diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
commit | 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch) | |
tree | 3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/includes/functions_compress.php | |
parent | 91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff) | |
download | forums-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_compress.php')
-rw-r--r-- | phpBB/includes/functions_compress.php | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index c439ed8390..f4efc6b5c9 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -29,8 +29,6 @@ class compress */ public function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '') { - global $phpbb_root_path; - $skip_files = explode(',', $skip_files); // Remove rm prefix from src path @@ -40,22 +38,22 @@ class compress // Remove initial "/" if present $src_path = (substr($src_path, 0, 1) == '/') ? substr($src_path, 1) : $src_path; - if (is_file($phpbb_root_path . $src)) + if (is_file(PHPBB_ROOT_PATH . $src)) { - $this->data($src_path, file_get_contents("$phpbb_root_path$src"), false, stat("$phpbb_root_path$src")); + $this->data($src_path, file_get_contents(PHPBB_ROOT_PATH . $src), false, stat(PHPBB_ROOT_PATH . $src)); } - else if (is_dir($phpbb_root_path . $src)) + else if (is_dir(PHPBB_ROOT_PATH . $src)) { // Clean up path, add closing / if not present $src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path; $filelist = array(); - $filelist = filelist("$phpbb_root_path$src", '', '*'); + $filelist = filelist(PHPBB_ROOT_PATH . $src, '', '*'); krsort($filelist); if ($src_path) { - $this->data($src_path, '', true, stat("$phpbb_root_path$src")); + $this->data($src_path, '', true, stat(PHPBB_ROOT_PATH . $src)); } foreach ($filelist as $path => $file_ary) @@ -66,7 +64,7 @@ class compress $path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path; $path = ($path && substr($path, -1) != '/') ? $path . '/' : $path; - $this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path")); + $this->data("$src_path$path", '', true, stat(PHPBB_ROOT_PATH . $src . $path)); } foreach ($file_ary as $file) @@ -76,7 +74,7 @@ class compress continue; } - $this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), false, stat("$phpbb_root_path$src$path$file")); + $this->data("$src_path$path$file", file_get_contents(PHPBB_ROOT_PATH . $src . $path . $file), false, stat(PHPBB_ROOT_PATH . $src . $path . $file)); } } } @@ -429,8 +427,6 @@ class compress_zip extends compress */ public function download($filename, $download_name = false) { - global $phpbb_root_path; - if ($download_name === false) { $download_name = $filename; @@ -442,7 +438,7 @@ class compress_zip extends compress header("Content-Type: $mimetype; name=\"$download_name.zip\""); header("Content-disposition: attachment; filename=$download_name.zip"); - $fp = @fopen("{$phpbb_root_path}store/$filename.zip", 'rb'); + $fp = @fopen(PHPBB_ROOT_PATH . "store/$filename.zip", 'rb'); if ($fp) { while ($buffer = fread($fp, 1024)) @@ -649,8 +645,6 @@ class compress_tar extends compress */ public function download($filename, $download_name = false) { - global $phpbb_root_path; - if ($download_name === false) { $download_name = $filename; @@ -679,7 +673,7 @@ class compress_tar extends compress header("Content-Type: $mimetype; name=\"$download_name$this->type\""); header("Content-disposition: attachment; filename=$download_name$this->type"); - $fp = @fopen("{$phpbb_root_path}store/$filename$this->type", 'rb'); + $fp = @fopen(PHPBB_ROOT_PATH . "store/$filename$this->type", 'rb'); if ($fp) { while ($buffer = fread($fp, 1024)) |