mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
"Fix" for realpath and Lycos?
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3222 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6f9d59a4a6
commit
5d8b228bb0
11 changed files with 33 additions and 37 deletions
|
@ -903,7 +903,7 @@ if( isset($HTTP_GET_VARS['perform']) || isset($HTTP_POST_VARS['perform']) )
|
|||
// a hackers attempt at getting us to process a local system
|
||||
// file.
|
||||
//
|
||||
if( file_exists(realpath($backup_file_tmpname)) )
|
||||
if( file_exists(phpbb_realpath($backup_file_tmpname)) )
|
||||
{
|
||||
if( preg_match("/^(text\/[a-zA-Z]+)|(application\/(x\-)?gzip(\-compressed)?)|(application\/octet-stream)$/is", $backup_file_type) )
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ $dir = @opendir($phpbb_root_path . $board_config['smilies_path']);
|
|||
|
||||
while($file = @readdir($dir))
|
||||
{
|
||||
if( !@is_dir(realpath($phpbb_root_path . $board_config['smilies_path'] . '/' . $file)) )
|
||||
if( !@is_dir(phpbb_realpath($phpbb_root_path . $board_config['smilies_path'] . '/' . $file)) )
|
||||
{
|
||||
$img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file);
|
||||
|
||||
|
|
|
@ -132,9 +132,9 @@ switch( $mode )
|
|||
{
|
||||
while( $sub_dir = @readdir($dir) )
|
||||
{
|
||||
if( !is_file(realpath($phpbb_root_path . 'templates/' .$sub_dir)) && !is_link(realpath($phpbb_root_path . 'templates/' .$sub_dir)) && $sub_dir != "." && $sub_dir != ".." && $sub_dir != "CVS" )
|
||||
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' .$sub_dir)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' .$sub_dir)) && $sub_dir != "." && $sub_dir != ".." && $sub_dir != "CVS" )
|
||||
{
|
||||
if( @file_exists(@realpath($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg")) )
|
||||
if( @file_exists(@phpbb_realpath($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg")) )
|
||||
{
|
||||
include($phpbb_root_path. "templates/" . $sub_dir . "/theme_info.cfg");
|
||||
|
||||
|
@ -549,7 +549,7 @@ switch( $mode )
|
|||
$s_template_select = '<select name="template_name">';
|
||||
while( $file = @readdir($dir) )
|
||||
{
|
||||
if( !is_file(realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(realpath($phpbb_root_path . 'templates/' . $file)) && $file != "." && $file != ".." && $file != "CVS" )
|
||||
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && $file != "." && $file != ".." && $file != "CVS" )
|
||||
{
|
||||
if($file == $selected['template_name'])
|
||||
{
|
||||
|
@ -790,7 +790,7 @@ switch( $mode )
|
|||
$s_template_select = '<select name="export_template">';
|
||||
while( $file = @readdir($dir) )
|
||||
{
|
||||
if( !is_file(realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(realpath($phpbb_root_path . 'templates/' .$file)) && $file != "." && $file != ".." && $file != "CVS" )
|
||||
if( !is_file(phpbb_realpath($phpbb_root_path . 'templates/' . $file)) && !is_link(phpbb_realpath($phpbb_root_path . 'templates/' .$file)) && $file != "." && $file != ".." && $file != "CVS" )
|
||||
{
|
||||
$s_template_select .= '<option value="' . $file . '">' . $file . "</option>\n";
|
||||
}
|
||||
|
|
|
@ -379,7 +379,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
{
|
||||
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
|
||||
{
|
||||
if( @file_exists(@realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
if( @file_exists(@phpbb_realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
{
|
||||
@unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
|
||||
if( $user_avatar_loc != "" )
|
||||
{
|
||||
if( file_exists(@realpath($user_avatar_loc)) && ereg(".jpg$|.gif$|.png$", $user_avatar_name) )
|
||||
if( file_exists(@phpbb_realpath($user_avatar_loc)) && ereg(".jpg$|.gif$|.png$", $user_avatar_name) )
|
||||
{
|
||||
if( $user_avatar_size <= $board_config['avatar_filesize'] && $user_avatar_size > 0)
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
|
||||
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
|
||||
{
|
||||
if( @file_exists(@realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
if( @file_exists(@phpbb_realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
{
|
||||
@unlink("./../" . $board_config['avatar_path'] . "/". $this_userdata['user_avatar']);
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
|
||||
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "")
|
||||
{
|
||||
if( file_exists(@realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
if( file_exists(@phpbb_realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
|
||||
{
|
||||
@unlink("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
|
||||
}
|
||||
|
@ -788,7 +788,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
$avatar_images = array();
|
||||
while( $file = @readdir($dir) )
|
||||
{
|
||||
if( $file != "." && $file != ".." && !is_file(realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) && !is_link(realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) )
|
||||
if( $file != "." && $file != ".." && !is_file(phpbb_realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) && !is_link(phpbb_realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) )
|
||||
{
|
||||
$sub_dir = @opendir("../" . $board_config['avatar_gallery_path'] . "/" . $file);
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
'S_PROFILE_ACTION' => append_sid("admin_users.$phpEx"))
|
||||
);
|
||||
|
||||
if( file_exists(@realpath('./../' . $board_config['avatar_path'])) && ($board_config['allow_avatar_upload'] == TRUE) )
|
||||
if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'])) && ($board_config['allow_avatar_upload'] == TRUE) )
|
||||
{
|
||||
if ( $form_enctype != '' )
|
||||
{
|
||||
|
@ -1087,7 +1087,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
|
|||
$template->assign_block_vars('avatar_remote_upload', array() );
|
||||
}
|
||||
|
||||
if( file_exists(@realpath('./../' . $board_config['avatar_gallery_path'])) && ($board_config['allow_avatar_local'] == TRUE) )
|
||||
if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_gallery_path'])) && ($board_config['allow_avatar_local'] == TRUE) )
|
||||
{
|
||||
$template->assign_block_vars('avatar_local_gallery', array() );
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ if ( !defined('IN_PHPBB') )
|
|||
|
||||
// Debug Level
|
||||
//define('DEBUG', 1); // Debugging on
|
||||
define('DEBUG', 0); // Debugging off
|
||||
define('DEBUG', 1); // Debugging off
|
||||
|
||||
|
||||
// User Levels <- Do not change the values of USER or ADMIN
|
||||
|
|
|
@ -88,9 +88,9 @@ class emailer
|
|||
$template_lang = $board_config['default_lang'];
|
||||
}
|
||||
|
||||
$this->tpl_file = @realpath($phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl');
|
||||
$this->tpl_file = @phpbb_realpath($phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl');
|
||||
|
||||
if ( !file_exists(realpath($this->tpl_file)) )
|
||||
if ( !file_exists(phpbb_realpath($this->tpl_file)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not find email template file ' . $template_file, '', __LINE__, __FILE__);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ class emailer
|
|||
//
|
||||
function encode_file($sourcefile)
|
||||
{
|
||||
if (is_readable(realpath($sourcefile)))
|
||||
if (is_readable(phpbb_realpath($sourcefile)))
|
||||
{
|
||||
$fd = fopen($sourcefile, "r");
|
||||
$contents = fread($fd, filesize($sourcefile));
|
||||
|
|
|
@ -220,7 +220,7 @@ function init_userprefs($userdata)
|
|||
}
|
||||
}
|
||||
|
||||
if ( !file_exists(@realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) )
|
||||
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) )
|
||||
{
|
||||
$board_config['default_lang'] = 'english';
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ function init_userprefs($userdata)
|
|||
|
||||
if ( defined('IN_ADMIN') )
|
||||
{
|
||||
if( !file_exists(@realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx)) )
|
||||
if( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx)) )
|
||||
{
|
||||
$board_config['default_lang'] = 'english';
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ function setup_style($style)
|
|||
message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
$img_lang = ( file_exists(@realpath($phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang'])) ) ? $board_config['default_lang'] : 'english';
|
||||
$img_lang = ( file_exists(@phpbb_realpath($phpbb_root_path . $current_template_path . '/images/lang_' . $board_config['default_lang'])) ) ? $board_config['default_lang'] : 'english';
|
||||
|
||||
while( list($key, $value) = @each($images) )
|
||||
{
|
||||
|
@ -681,14 +681,10 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
|
|||
// function. In later versions of PHP, it needs to be called
|
||||
// to do checks with some functions. Older versions of PHP don't
|
||||
// seem to need this, so we'll just return the original value.
|
||||
//
|
||||
// dougk_ff7 <October 5, 2002>
|
||||
if ( !function_exists(realpath) )
|
||||
function phpbb_realpath($path)
|
||||
{
|
||||
function realpath($path)
|
||||
{
|
||||
return $path;
|
||||
}
|
||||
return (!@function_exists('realpath') || !@realpath($phpbb_root_path . 'includes/functions.'.$phpEx)) ? $path : realpath($path);
|
||||
}
|
||||
|
||||
function redirect($url)
|
||||
|
|
|
@ -230,7 +230,7 @@ class Template {
|
|||
// Check if it's an absolute or relative path.
|
||||
if (substr($filename, 0, 1) != '/')
|
||||
{
|
||||
$filename = realpath($this->root . '/' . $filename);
|
||||
$filename = phpbb_realpath($this->root . '/' . $filename);
|
||||
}
|
||||
|
||||
if (!file_exists($filename))
|
||||
|
|
|
@ -53,7 +53,7 @@ function user_avatar_delete($avatar_type, $avatar_file)
|
|||
|
||||
if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
|
||||
{
|
||||
if ( @file_exists(@realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
|
||||
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
|
||||
{
|
||||
@unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ function user_avatar_delete($avatar_type, $avatar_file)
|
|||
function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
|
||||
{
|
||||
global $board_config;
|
||||
if ( file_exists(@realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
|
||||
if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
|
||||
{
|
||||
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
|
|||
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
|
||||
}
|
||||
}
|
||||
else if ( ( file_exists(@realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
|
||||
else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
|
||||
{
|
||||
if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
|
|||
|
||||
if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
|
||||
{
|
||||
if ( file_exists(@realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
|
||||
if ( file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
|
||||
{
|
||||
@unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
|
|||
}
|
||||
else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] )
|
||||
{
|
||||
if ( @file_exists(@realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
|
||||
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
|
||||
{
|
||||
@unlink('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']);
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
|
|||
}
|
||||
else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] )
|
||||
{
|
||||
if ( @file_exists(@realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
|
||||
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) )
|
||||
{
|
||||
@unlink('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']);
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ else
|
|||
{
|
||||
$template->assign_block_vars('switch_avatar_block', array() );
|
||||
|
||||
if ( $board_config['allow_avatar_upload'] && file_exists(@realpath('./' . $board_config['avatar_path'])) )
|
||||
if ( $board_config['allow_avatar_upload'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_path'])) )
|
||||
{
|
||||
if ( $form_enctype != '' )
|
||||
{
|
||||
|
@ -951,7 +951,7 @@ else
|
|||
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() );
|
||||
}
|
||||
|
||||
if ( $board_config['allow_avatar_local'] && file_exists(@realpath('./' . $board_config['avatar_gallery_path'])) )
|
||||
if ( $board_config['allow_avatar_local'] && file_exists(@phpbb_realpath('./' . $board_config['avatar_gallery_path'])) )
|
||||
{
|
||||
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ function guess_lang()
|
|||
{
|
||||
if (preg_match('#' . $match . '#i', trim($accept_lang_ary[$i])))
|
||||
{
|
||||
if (file_exists(@realpath($phpbb_root_path . 'language/lang_' . $lang)))
|
||||
if (file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $lang)))
|
||||
{
|
||||
return $lang;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ else
|
|||
}
|
||||
|
||||
// Open config.php ... if it exists
|
||||
if (@file_exists(@realpath('config.'.$phpEx)))
|
||||
if (@file_exists(@phpbb_realpath('config.'.$phpEx)))
|
||||
{
|
||||
include($phpbb_root_path.'config.'.$phpEx);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue