mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-03 16:48:52 +00:00
add some properties
change phpbb_chmod to phpbb::$system->chmod() also changed chmod behaviour to the most failsafe method. If we are not able to tell the exact outcome, we simply do not mess with it. git-svn-id: file:///svn/phpbb/trunk@9296 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6d380be53d
commit
950842de5c
17 changed files with 609 additions and 587 deletions
|
@ -93,12 +93,7 @@ class phpbb_acm_file extends phpbb_acm_abstract
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
if (!function_exists('phpbb_chmod'))
|
phpbb::$system->chmod($filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -172,12 +167,7 @@ class phpbb_acm_file extends phpbb_acm_abstract
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
if (!function_exists('phpbb_chmod'))
|
phpbb::$system->chmod($filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -844,7 +844,7 @@ class phpbb_template_compile
|
||||||
@flock($destination_handle, LOCK_UN);
|
@flock($destination_handle, LOCK_UN);
|
||||||
@fclose($destination_handle);
|
@fclose($destination_handle);
|
||||||
|
|
||||||
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: bootstrap.php 9216 2008-12-23 18:40:33Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: core.php 9216 2008-12-23 18:40:33Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: request.php 9212 2008-12-21 19:15:55Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: core.php 9200 2008-12-15 18:06:53Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: core.php 9200 2008-12-15 18:06:53Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
@ -23,11 +23,188 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
class phpbb_system extends phpbb_plugin_support
|
class phpbb_system extends phpbb_plugin_support
|
||||||
{
|
{
|
||||||
private $data = array();
|
/**
|
||||||
|
* @var array required phpBB objects
|
||||||
|
*/
|
||||||
public $phpbb_required = array();
|
public $phpbb_required = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Optional phpBB objects
|
||||||
|
*/
|
||||||
public $phpbb_optional = array();
|
public $phpbb_optional = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Holding some information for chmod()
|
||||||
|
*/
|
||||||
|
private $chmod_info = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for chmodding directories and files for internal use.
|
||||||
|
*
|
||||||
|
* This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
|
||||||
|
* The function determines owner and group from common.php file and sets the same to the provided file.
|
||||||
|
* The function uses bit fields to build the permissions.
|
||||||
|
* The function sets the appropiate execute bit on directories.
|
||||||
|
*
|
||||||
|
* Supported constants representing bit fields are:
|
||||||
|
*
|
||||||
|
* phpbb::CHMOD_ALL - all permissions (7)
|
||||||
|
* phpbb::CHMOD_READ - read permission (4)
|
||||||
|
* phpbb::CHMOD_WRITE - write permission (2)
|
||||||
|
* phpbb::CHMOD_EXECUTE - execute permission (1)
|
||||||
|
*
|
||||||
|
* NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions.
|
||||||
|
*
|
||||||
|
* @param string $filename The file/directory to be chmodded
|
||||||
|
* @param int $perms Permissions to set
|
||||||
|
*
|
||||||
|
* @return bool true on success, otherwise false
|
||||||
|
* @author faw, phpBB Group
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function chmod($filename, $perms = phpbb::CHMOD_READ)
|
||||||
|
{
|
||||||
|
// Return if the file no longer exists.
|
||||||
|
if (!file_exists($filename))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine some common vars
|
||||||
|
if (empty($this->chmod_info))
|
||||||
|
{
|
||||||
|
if (!function_exists('fileowner') || !function_exists('filegroup'))
|
||||||
|
{
|
||||||
|
// No need to further determine owner/group - it is unknown
|
||||||
|
$this->chmod_info['process'] = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Determine owner/group of common.php file and the filename we want to change here
|
||||||
|
$common_php_owner = fileowner(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
|
||||||
|
$common_php_group = filegroup(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
|
||||||
|
|
||||||
|
// And the owner and the groups PHP is running under.
|
||||||
|
$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;
|
||||||
|
$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;
|
||||||
|
|
||||||
|
if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group)
|
||||||
|
{
|
||||||
|
$this->chmod_info['process'] = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->chmod_info = array(
|
||||||
|
'process' => true,
|
||||||
|
'common_owner' => $common_php_owner,
|
||||||
|
'common_group' => $common_php_group,
|
||||||
|
'php_uid' => $php_uid,
|
||||||
|
'php_gids' => $php_gids,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->chmod_info['process'])
|
||||||
|
{
|
||||||
|
// Change owner
|
||||||
|
if (@chown($filename, $this->chmod_info['common_owner']))
|
||||||
|
{
|
||||||
|
clearstatcache();
|
||||||
|
$file_uid = fileowner($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change group
|
||||||
|
if (@chgrp($filename, $this->chmod_info['common_group']))
|
||||||
|
{
|
||||||
|
clearstatcache();
|
||||||
|
$file_gid = filegroup($filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the file_uid/gid now match the one from common.php we can process further, else we are not able to change something
|
||||||
|
if ($file_uid != $this->chmod_info['common_owner'] || $file_gid != $this->chmod_info['common_group'])
|
||||||
|
{
|
||||||
|
$this->chmod_info['process'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Still able to process?
|
||||||
|
if ($this->chmod_info['process'])
|
||||||
|
{
|
||||||
|
if ($file_uid == $this->chmod_info['php_uid'])
|
||||||
|
{
|
||||||
|
$php = 'owner';
|
||||||
|
}
|
||||||
|
else if (in_array($file_gid, $this->chmod_info['php_gids']))
|
||||||
|
{
|
||||||
|
$php = 'group';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Since we are setting the everyone bit anyway, no need to do expensive operations
|
||||||
|
$this->chmod_info['process'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are not able to determine or change something
|
||||||
|
if (!$this->chmod_info['process'])
|
||||||
|
{
|
||||||
|
$php = 'other';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Owner always has read/write permission
|
||||||
|
$owner = phpbb::CHMOD_READ | phpbb::CHMOD_WRITE;
|
||||||
|
if (is_dir($filename))
|
||||||
|
{
|
||||||
|
$owner |= phpbb::CHMOD_EXECUTE;
|
||||||
|
|
||||||
|
// Only add execute bit to the permission if the dir needs to be readable
|
||||||
|
if ($perms & phpbb::CHMOD_READ)
|
||||||
|
{
|
||||||
|
$perms |= phpbb::CHMOD_EXECUTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($php)
|
||||||
|
{
|
||||||
|
case 'owner':
|
||||||
|
$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
if (!is_null($php) || (is_readable($filename) && is_writable($filename)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'group':
|
||||||
|
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
if (!is_null($php) || ((!($perms & phpbb::CHMOD_READ) || is_readable($filename)) && (!($perms & phpbb::CHMOD_WRITE) || is_writable($filename))))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'other':
|
||||||
|
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0));
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
if (!is_null($php) || ((!($perms & phpbb::CHMOD_READ) || is_readable($filename)) && (!($perms & phpbb::CHMOD_WRITE) || is_writable($filename))))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: core.php 9200 2008-12-15 18:06:53Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package core
|
* @package core
|
||||||
* @version $Id: url.php 9219 2008-12-24 12:43:15Z acydburn $
|
* @version $Id$
|
||||||
* @copyright (c) 2008 phpBB Group
|
* @copyright (c) 2008 phpBB Group
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
|
|
|
@ -126,150 +126,6 @@ function still_on_time($extra_time = 15)
|
||||||
return (ceil($current_time - $start_time) < $max_execution_time) ? true : false;
|
return (ceil($current_time - $start_time) < $max_execution_time) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Global function for chmodding directories and files for internal use
|
|
||||||
* This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
|
|
||||||
* The function determines owner and group from common.php file and sets the same to the provided file. Permissions are mapped to the group, user always has rw(x) permission.
|
|
||||||
* The function uses bit fields to build the permissions.
|
|
||||||
* The function sets the appropiate execute bit on directories.
|
|
||||||
*
|
|
||||||
* Supported constants representing bit fields are:
|
|
||||||
*
|
|
||||||
* phpbb::CHMOD_ALL - all permissions (7)
|
|
||||||
* phpbb::CHMOD_READ - read permission (4)
|
|
||||||
* phpbb::CHMOD_WRITE - write permission (2)
|
|
||||||
* phpbb::CHMOD_EXECUTE - execute permission (1)
|
|
||||||
*
|
|
||||||
* NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions.
|
|
||||||
*
|
|
||||||
* @param $filename The file/directory to be chmodded
|
|
||||||
* @param $perms Permissions to set
|
|
||||||
* @return true on success, otherwise false
|
|
||||||
*
|
|
||||||
* @author faw, phpBB Group
|
|
||||||
*/
|
|
||||||
function phpbb_chmod($filename, $perms = phpbb::CHMOD_READ)
|
|
||||||
{
|
|
||||||
// Return if the file no longer exists.
|
|
||||||
if (!file_exists($filename))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('fileowner') || !function_exists('filegroup'))
|
|
||||||
{
|
|
||||||
$file_uid = $file_gid = false;
|
|
||||||
$common_php_owner = $common_php_group = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Determine owner/group of common.php file and the filename we want to change here
|
|
||||||
$common_php_owner = fileowner(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
|
|
||||||
$common_php_group = filegroup(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
|
|
||||||
|
|
||||||
$file_uid = fileowner($filename);
|
|
||||||
$file_gid = filegroup($filename);
|
|
||||||
|
|
||||||
// Try to set the owner to the same common.php has
|
|
||||||
if ($common_php_owner !== $file_uid && $common_php_owner !== false && $file_uid !== false)
|
|
||||||
{
|
|
||||||
// Will most likely not work
|
|
||||||
if (@chown($filename, $common_php_owner));
|
|
||||||
{
|
|
||||||
clearstatcache();
|
|
||||||
$file_uid = fileowner($filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to set the group to the same common.php has
|
|
||||||
if ($common_php_group !== $file_gid && $common_php_group !== false && $file_gid !== false)
|
|
||||||
{
|
|
||||||
if (@chgrp($filename, $common_php_group));
|
|
||||||
{
|
|
||||||
clearstatcache();
|
|
||||||
$file_gid = filegroup($filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// And the owner and the groups PHP is running under.
|
|
||||||
$php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false;
|
|
||||||
$php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false;
|
|
||||||
|
|
||||||
// Who is PHP?
|
|
||||||
if ($file_uid === false || $file_gid === false || $php_uid === false || $php_gids === false)
|
|
||||||
{
|
|
||||||
$php = NULL;
|
|
||||||
}
|
|
||||||
else if ($file_uid == $php_uid /* && $common_php_owner !== false && $common_php_owner === $file_uid*/)
|
|
||||||
{
|
|
||||||
$php = 'owner';
|
|
||||||
}
|
|
||||||
else if (in_array($file_gid, $php_gids))
|
|
||||||
{
|
|
||||||
$php = 'group';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$php = 'other';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Owner always has read/write permission
|
|
||||||
$owner = phpbb::CHMOD_READ | phpbb::CHMOD_WRITE;
|
|
||||||
if (is_dir($filename))
|
|
||||||
{
|
|
||||||
$owner |= phpbb::CHMOD_EXECUTE;
|
|
||||||
|
|
||||||
// Only add execute bit to the permission if the dir needs to be readable
|
|
||||||
if ($perms & phpbb::CHMOD_READ)
|
|
||||||
{
|
|
||||||
$perms |= phpbb::CHMOD_EXECUTE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($php)
|
|
||||||
{
|
|
||||||
case null:
|
|
||||||
case 'owner':
|
|
||||||
/* ATTENTION: if php is owner or NULL we set it to group here. This is the most failsafe combination for the vast majority of server setups.
|
|
||||||
|
|
||||||
$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));
|
|
||||||
|
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
if (!is_null($php) || (is_readable($filename) && is_writable($filename)))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
case 'group':
|
|
||||||
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));
|
|
||||||
|
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
if (!is_null($php) || ((!($perms & phpbb::CHMOD_READ) || is_readable($filename)) && (!($perms & phpbb::CHMOD_WRITE) || is_writable($filename))))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'other':
|
|
||||||
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0));
|
|
||||||
|
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
if (!is_null($php) || ((!($perms & phpbb::CHMOD_READ) || is_readable($filename)) && (!($perms & phpbb::CHMOD_WRITE) || is_writable($filename))))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a secret hash for use in links/GET requests
|
* Add a secret hash for use in links/GET requests
|
||||||
|
|
|
@ -226,7 +226,7 @@ class compress_zip extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ class compress_zip extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,7 +567,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $folder");
|
trigger_error("Could not create directory $folder");
|
||||||
}
|
}
|
||||||
phpbb_chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($str, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ class compress_tar extends compress
|
||||||
{
|
{
|
||||||
trigger_error("Couldn't create file $filename");
|
trigger_error("Couldn't create file $filename");
|
||||||
}
|
}
|
||||||
phpbb_chmod($target_filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($target_filename, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
// Grab the file contents
|
// Grab the file contents
|
||||||
fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);
|
fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize);
|
||||||
|
|
|
@ -561,7 +561,7 @@ class queue
|
||||||
|
|
||||||
$fp = @fopen($this->cache_file . '.lock', 'wb');
|
$fp = @fopen($this->cache_file . '.lock', 'wb');
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@chmod($this->cache_file . '.lock', 0666);
|
phpbb::$system->chmod($this->cache_file . '.lock', phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
include($this->cache_file);
|
include($this->cache_file);
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ class queue
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
phpbb_chmod($this->cache_file, phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($this->cache_file, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ class queue
|
||||||
@flock($fp, LOCK_UN);
|
@flock($fp, LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
phpbb_chmod($this->cache_file, phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($this->cache_file, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,7 +727,7 @@ function create_thumbnail($source, $destination, $mimetype)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($destination, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod($destination, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class filespec
|
||||||
*
|
*
|
||||||
* @param string $destination_path Destination path, for example phpbb::$config['avatar_path']
|
* @param string $destination_path Destination path, for example phpbb::$config['avatar_path']
|
||||||
* @param bool $overwrite If set to true, an already existing file will be overwritten
|
* @param bool $overwrite If set to true, an already existing file will be overwritten
|
||||||
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}
|
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here is the octal permission mask.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -348,7 +348,7 @@ class filespec
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($this->destination_file, $chmod);
|
phpbb::$system->chmod($this->destination_file, $chmod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to get real filesize from destination folder
|
// Try to get real filesize from destination folder
|
||||||
|
|
|
@ -506,13 +506,13 @@ class install_install extends module
|
||||||
if (!file_exists(PHPBB_ROOT_PATH . $dir))
|
if (!file_exists(PHPBB_ROOT_PATH . $dir))
|
||||||
{
|
{
|
||||||
@mkdir(PHPBB_ROOT_PATH . $dir, 0777);
|
@mkdir(PHPBB_ROOT_PATH . $dir, 0777);
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now really check
|
// Now really check
|
||||||
if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir))
|
if (file_exists(PHPBB_ROOT_PATH . $dir) && is_dir(PHPBB_ROOT_PATH . $dir))
|
||||||
{
|
{
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod(PHPBB_ROOT_PATH . $dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
$exists = true;
|
$exists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ class install_install extends module
|
||||||
}
|
}
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
|
|
||||||
@chmod(PHPBB_ROOT_PATH . 'cache/install_lock', 0666);
|
phpbb::$system->chmod(PHPBB_ROOT_PATH . 'cache/install_lock', phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
|
|
||||||
$load_extensions = implode(',', $load_extensions);
|
$load_extensions = implode(',', $load_extensions);
|
||||||
|
|
||||||
|
@ -880,8 +880,7 @@ class install_install extends module
|
||||||
|
|
||||||
if ($written)
|
if ($written)
|
||||||
{
|
{
|
||||||
// We may revert back to chmod() if we see problems with users not able to change their config.php file directly
|
@chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, 0644);
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . 'config.' . PHP_EXT, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1201,7 +1201,7 @@ class acp_attachments
|
||||||
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
|
if (!file_exists(PHPBB_ROOT_PATH . $upload_dir))
|
||||||
{
|
{
|
||||||
@mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777);
|
@mkdir(PHPBB_ROOT_PATH . $upload_dir, 0777);
|
||||||
phpbb_chmod(PHPBB_ROOT_PATH . $upload_dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
phpbb::$system->chmod(PHPBB_ROOT_PATH . $upload_dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ class acp_language
|
||||||
{
|
{
|
||||||
trigger_error("Could not create directory $dir", E_USER_ERROR);
|
trigger_error("Could not create directory $dir", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
@chmod($dir, 0777);
|
phpbb::$system->chmod($dir, phpbb::CHMOD_READ | phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue