mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
some changes
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5092 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -77,13 +77,39 @@ function get_db_stat($mode)
|
||||
// added at phpBB 2.0.11 to properly format the username
|
||||
function phpbb_clean_username($username)
|
||||
{
|
||||
$username = htmlspecialchars(rtrim(trim($username), "\\"));
|
||||
$username = substr(str_replace("\\'", "'", $username), 0, 25);
|
||||
$username = str_replace("'", "\\'", $username);
|
||||
$username = substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25);
|
||||
$username = phpbb_rtrim($username, "\\");
|
||||
$username = str_replace("'", "\'", $username);
|
||||
|
||||
return $username;
|
||||
}
|
||||
|
||||
// added at phpBB 2.0.12 to fix a bug in PHP 4.3.10 (only supporting charlist in php >= 4.1.0)
|
||||
function phpbb_rtrim($str, $charlist = false)
|
||||
{
|
||||
if ($charlist === false)
|
||||
{
|
||||
return rtrim($str);
|
||||
}
|
||||
|
||||
$php_version = explode('.', PHP_VERSION);
|
||||
|
||||
// php version < 4.1.0
|
||||
if ((int) $php_version[0] < 4 || ((int) $php_version[0] == 4 && (int) $php_version[1] < 1))
|
||||
{
|
||||
while ($str{strlen($str)-1} == $charlist)
|
||||
{
|
||||
$str = substr($str, 0, strlen($str)-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = rtrim($str, $charlist);
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Userdata, $user can be username or user_id. If force_str is true, the username will be forced.
|
||||
//
|
||||
@@ -579,7 +605,7 @@ function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '',
|
||||
|
||||
if ( $err_line != '' && $err_file != '' )
|
||||
{
|
||||
$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . $err_file;
|
||||
$debug_text .= '</br /><br />Line : ' . $err_line . '<br />File : ' . basename($err_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -230,7 +230,7 @@ class Template {
|
||||
// Check if it's an absolute or relative path.
|
||||
if (substr($filename, 0, 1) != '/')
|
||||
{
|
||||
$filename = phpbb_realpath($this->root . '/' . $filename);
|
||||
$filename = ($rp_filename = phpbb_realpath($this->root . '/' . $filename)) ? $rp_filename : $filename;
|
||||
}
|
||||
|
||||
if (!file_exists($filename))
|
||||
|
@@ -51,6 +51,7 @@ function user_avatar_delete($avatar_type, $avatar_file)
|
||||
{
|
||||
global $board_config, $userdata;
|
||||
|
||||
$avatar_file = basename($avatar_file);
|
||||
if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
|
||||
{
|
||||
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
|
||||
@@ -65,6 +66,13 @@ function user_avatar_delete($avatar_type, $avatar_file)
|
||||
function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
|
||||
{
|
||||
global $board_config;
|
||||
|
||||
$avatar_filename = str_replace(array('../', '..\\', './', '.\\'), '', $avatar_filename);
|
||||
if ($avatar_filename{0} == '/' || $avatar_filename{0} == "\\")
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -224,6 +232,10 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
|
||||
$move_file = 'copy';
|
||||
}
|
||||
|
||||
if (!is_uploaded_file($avatar_filename))
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
|
||||
}
|
||||
$move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
|
||||
}
|
||||
|
||||
|
@@ -459,7 +459,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
|
||||
{
|
||||
if ( !empty($user_avatar_upload) )
|
||||
{
|
||||
$avatar_mode = ( !empty($user_avatar_name) ) ? 'local' : 'remote';
|
||||
$avatar_mode = (empty($user_avatar_name)) ? 'remote' : 'local';
|
||||
$avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
|
||||
}
|
||||
else if ( !empty($user_avatar_name) )
|
||||
|
Reference in New Issue
Block a user