1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

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
This commit is contained in:
Meik Sievertsen
2008-05-29 12:25:56 +00:00
parent 91b4fe1868
commit 2f4a618900
154 changed files with 2044 additions and 3484 deletions

View File

@@ -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('');