aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_transfer.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-05-29 12:25:56 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-05-29 12:25:56 +0000
commit2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch)
tree3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/includes/functions_transfer.php
parent91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff)
downloadforums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz
forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip
ok... i hope i haven't messed too much with the code and everything is still working.
Changes: - Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed. - A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added. git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_transfer.php')
-rw-r--r--phpBB/includes/functions_transfer.php36
1 files changed, 10 insertions, 26 deletions
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index 9eb32a7b45..63f8d72e9f 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -38,13 +38,11 @@ class transfer
*/
function __construct()
{
- global $phpbb_root_path;
-
$this->file_perms = 0644;
$this->dir_perms = 0777;
// We use the store directory as temporary path to circumvent open basedir restrictions
- $this->tmp_path = $phpbb_root_path . 'store/';
+ $this->tmp_path = PHPBB_ROOT_PATH . 'store/';
}
/**
@@ -52,9 +50,7 @@ class transfer
*/
public function write_file($destination_file = '', $contents = '')
{
- global $phpbb_root_path;
-
- $destination_file = $this->root_path . str_replace($phpbb_root_path, '', $destination_file);
+ $destination_file = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $destination_file);
// need to create a temp file and then move that temp file.
// ftp functions can only move files around and can't create.
@@ -104,9 +100,7 @@ class transfer
*/
public function make_dir($dir)
{
- global $phpbb_root_path;
-
- $dir = str_replace($phpbb_root_path, '', $dir);
+ $dir = str_replace(PHPBB_ROOT_PATH, '', $dir);
$dir = explode('/', $dir);
$dirs = '';
@@ -120,7 +114,7 @@ class transfer
}
$cur_dir = $dir[$i] . '/';
- if (!file_exists($phpbb_root_path . $dirs . $cur_dir))
+ if (!file_exists(PHPBB_ROOT_PATH . $dirs . $cur_dir))
{
// create the directory
$result = $this->_mkdir($dir[$i]);
@@ -144,10 +138,8 @@ class transfer
*/
public function copy_file($from_loc, $to_loc)
{
- global $phpbb_root_path;
-
- $from_loc = ((strpos($from_loc, $phpbb_root_path) !== 0) ? $phpbb_root_path : '') . $from_loc;
- $to_loc = $this->root_path . str_replace($phpbb_root_path, '', $to_loc);
+ $from_loc = ((strpos($from_loc, PHPBB_ROOT_PATH) !== 0) ? PHPBB_ROOT_PATH : '') . $from_loc;
+ $to_loc = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $to_loc);
if (!file_exists($from_loc))
{
@@ -164,9 +156,7 @@ class transfer
*/
public function delete_file($file)
{
- global $phpbb_root_path;
-
- $file = $this->root_path . str_replace($phpbb_root_path, '', $file);
+ $file = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $file);
return $this->_delete($file);
}
@@ -177,9 +167,7 @@ class transfer
*/
public function remove_dir($dir)
{
- global $phpbb_root_path;
-
- $dir = $this->root_path . str_replace($phpbb_root_path, '', $dir);
+ $dir = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $dir);
return $this->_rmdir($dir);
}
@@ -189,9 +177,7 @@ class transfer
*/
public function rename($old_handle, $new_handle)
{
- global $phpbb_root_path;
-
- $old_handle = $this->root_path . str_replace($phpbb_root_path, '', $old_handle);
+ $old_handle = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $old_handle);
return $this->_rename($old_handle, $new_handle);
}
@@ -201,9 +187,7 @@ class transfer
*/
public function file_exists($directory, $filename)
{
- global $phpbb_root_path;
-
- $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory);
+ $directory = $this->root_path . str_replace(PHPBB_ROOT_PATH, '', $directory);
$this->_chdir($directory);
$result = $this->_ls('');