mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
let us be more strict while testing for writeable directories.
git-svn-id: file:///svn/phpbb/trunk@6602 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e264a62b73
commit
a8eb642053
1 changed files with 20 additions and 6 deletions
|
@ -10,7 +10,6 @@
|
|||
|
||||
/**
|
||||
*/
|
||||
|
||||
if (!defined('IN_INSTALL'))
|
||||
{
|
||||
// Someone has tried to access the file direct. This is not a good idea, so exit
|
||||
|
@ -314,18 +313,33 @@ class install_install extends module
|
|||
$passed['files'] = true;
|
||||
foreach ($directories as $dir)
|
||||
{
|
||||
$write = $exists = true;
|
||||
$exists = $write = false;
|
||||
|
||||
// Try to create the directory if it does not exist
|
||||
if (!file_exists($phpbb_root_path . $dir))
|
||||
{
|
||||
@mkdir($phpbb_root_path . $dir, 0777);
|
||||
@chmod($phpbb_root_path . $dir, 0777);
|
||||
}
|
||||
|
||||
// Now really check
|
||||
if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))
|
||||
{
|
||||
if (!is_writeable($phpbb_root_path . $dir))
|
||||
{
|
||||
$write = (@chmod($phpbb_root_path . $dir, 0777)) ? true : false;
|
||||
@chmod($phpbb_root_path . $dir, 0777);
|
||||
}
|
||||
$exists = true;
|
||||
}
|
||||
else
|
||||
|
||||
// Now check if it is writeable by storing a simple file
|
||||
$fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb');
|
||||
if ($fp !== false)
|
||||
{
|
||||
$write = $exists = (@mkdir($phpbb_root_path . $dir, 0777)) ? true : false;
|
||||
@unlink($phpbb_root_path . $dir . 'test_lock');
|
||||
$write = true;
|
||||
}
|
||||
@fclose($fp);
|
||||
|
||||
$passed['files'] = ($exists && $write && $passed['files']) ? true : false;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue