From bf8ac19eaa8d74f9dfd6d597190f5664e7339382 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 4 Oct 2009 18:13:59 +0000 Subject: Move trunk/phpBB to old_trunk/phpBB git-svn-id: file:///svn/phpbb/trunk@10210 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/core/system.php | 213 ----------------------------------------- 1 file changed, 213 deletions(-) delete mode 100644 phpBB/includes/core/system.php (limited to 'phpBB/includes/core/system.php') diff --git a/phpBB/includes/core/system.php b/phpBB/includes/core/system.php deleted file mode 100644 index 5bb42e9ed4..0000000000 --- a/phpBB/includes/core/system.php +++ /dev/null @@ -1,213 +0,0 @@ -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']) - { - $file_uid = fileowner($filename); - $file_gid = filegroup($filename); - - // 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; - } - -} - -?> \ No newline at end of file -- cgit v1.2.1