|
From: Paul S. O. <ps...@us...> - 2001-12-24 14:43:56
|
Update of /cvsroot/phpbb/phpBB2/admin
In directory usw-pr-cvs1:/tmp/cvs-serv29030/admin
Modified Files:
admin_users.php
Log Message:
Fixed bug #496107 and changed avatar support to enable admin to use avatars irrespective of board settings
Index: admin_users.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/admin/admin_users.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** admin_users.php 2001/12/09 06:42:50 1.35
--- admin_users.php 2001/12/24 14:43:53 1.36
***************
*** 196,199 ****
--- 196,221 ----
$user_rank = (!empty($HTTP_POST_VARS['user_rank'])) ? intval($HTTP_POST_VARS['user_rank']) : 0;
$user_allowavatar = (!empty($HTTP_POST_VARS['user_allowavatar'])) ? intval($HTTP_POST_VARS['user_allowavatar']) : 0;
+
+ if( isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar']) )
+ {
+ $username = stripslashes($username);
+ $email = stripslashes($email);
+ $password = "";
+ $password_confirm = "";
+
+ $icq = stripslashes($icq);
+ $aim = stripslashes($aim);
+ $msn = stripslashes($msn);
+ $yim = stripslashes($yim);
+
+ $website = stripslashes($website);
+ $location = stripslashes($location);
+ $occupation = stripslashes($occupation);
+ $interests = stripslashes($interests);
+ $signature = stripslashes($signature);
+
+ $user_lang = stripslashes($user_lang);
+ $user_dateformat = stripslashes($user_dateformat);
+ }
}
***************
*** 215,219 ****
else
{
! $username_sql = "username = '$username', ";
}
}
--- 237,241 ----
else
{
! $username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
}
}
***************
*** 261,268 ****
if( $signature != "" )
{
! $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : "";
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
}
$avatar_sql = "";
if( isset($HTTP_POST_VARS['avatardel']) )
--- 283,313 ----
if( $signature != "" )
{
! $sig_length_check = preg_replace("/(\[.*?)(=.*?)\]/is", "\\1]", stripslashes($signature));
! if( $allowhtml )
! {
! $sig_length_check = preg_replace("/(\<.*?)(=.*?)( .*?=.*?)?([ \/]?\>)/is", "\\1\\3\\4", $sig_length_check);
! }
!
! // Only create a new bbcode_uid when there was no uid yet.
! if($signature_bbcode_uid == '')
! {
! $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : "";
! }
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
+
+ if( strlen($sig_length_check) > $board_config['max_sig_chars'] )
+ {
+ $error = TRUE;
+ if( isset($error_msg) )
+ {
+ $error_msg .= "<br />";
+ }
+ $error_msg .= $lang['Signature_too_long'];
+ }
}
+ //
+ // Avatar stuff
+ //
$avatar_sql = "";
if( isset($HTTP_POST_VARS['avatardel']) )
***************
*** 270,281 ****
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
{
! if( @file_exists("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
}
}
$avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}
! else if( !$error && ( $user_avatar_loc != "" || !empty($user_avatar_url) ) )
{
//
--- 315,326 ----
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
{
! if( @file_exists("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
}
}
$avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}
! else if( ( $user_avatar_loc != "" || !empty($user_avatar_url) ) && !$error )
{
//
***************
*** 293,297 ****
}
! if( $user_avatar_loc != "" )
{
if( file_exists($user_avatar_loc) && ereg(".jpg$|.gif$|.png$", $user_avatar_name) )
--- 338,342 ----
}
! if( $user_avatar_loc != "" )
{
if( file_exists($user_avatar_loc) && ereg(".jpg$|.gif$|.png$", $user_avatar_name) )
***************
*** 337,346 ****
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
{
! if( @file_exists("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./../" . $board_config['avatar_path'] . "/". $this_userdata['user_avatar']);
}
}
! @copy($user_avatar_loc, "./../" . $board_config['avatar_path'] . "/$avatar_filename");
$avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;
--- 382,391 ----
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
{
! if( @file_exists("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./" . $board_config['avatar_path'] . "/". $this_userdata['user_avatar']);
}
}
! @copy($user_avatar_loc, "./" . $board_config['avatar_path'] . "/$avatar_filename");
$avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;
***************
*** 428,432 ****
$avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size);
! $tmp_filename = tempnam ("/tmp", $userdata['user_id'] . "-");
$fptr = @fopen($tmp_filename, "wb");
$bytes_written = @fwrite($fptr, $avatar_data, $file_size);
--- 473,477 ----
$avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size);
! $tmp_filename = tempnam ("/tmp", $this_userdata['user_id'] . "-");
$fptr = @fopen($tmp_filename, "wb");
$bytes_written = @fwrite($fptr, $avatar_data, $file_size);
***************
*** 445,454 ****
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "")
{
! if( file_exists("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
}
}
! @copy($tmp_filename, "./../" . $board_config['avatar_path'] . "/$avatar_filename");
@unlink($tmp_filename);
--- 490,499 ----
if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "")
{
! if( file_exists("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']) )
{
! @unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
}
}
! @copy($tmp_filename, "./" . $board_config['avatar_path'] . "/$avatar_filename");
@unlink($tmp_filename);
***************
*** 512,518 ****
}
! if( preg_match("#^http:\/\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+\/.*?\.(gif|jpg|png)$#is", $user_avatar_remoteurl) )
{
! $avatar_sql = ", user_avatar = '$user_avatar_remoteurl', user_avatar_type = " . USER_AVATAR_REMOTE;
}
else
--- 557,563 ----
}
! if( preg_match("#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+\/.*?\.(gif|jpg|png)$)#is", $user_avatar_remoteurl) )
{
! $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_remoteurl) . "', user_avatar_type = " . USER_AVATAR_REMOTE;
}
else
***************
*** 522,530 ****
}
}
! else if( !$error && $user_avatar_local != "" && $avatar_sql == "" )
{
! $avatar_sql = ", user_avatar = '$user_avatar_local', user_avatar_type = " . USER_AVATAR_GALLERY;
}
if( !$error )
{
--- 567,578 ----
}
}
! else if( $user_avatar_local != "" && $avatar_sql == "" && !$error )
{
! $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
}
+ //
+ // Update entry in DB
+ //
if( !$error )
{
***************
*** 608,612 ****
{
$sql = "UPDATE " . USERS_TABLE . "
! SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '$user_lang', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
WHERE user_id = $user_id";
if( $result = $db->sql_query($sql) )
--- 656,660 ----
{
$sql = "UPDATE " . USERS_TABLE . "
! SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
WHERE user_id = $user_id";
if( $result = $db->sql_query($sql) )
***************
*** 742,746 ****
while( $file = @readdir($dir) )
{
! if( $file != "." && $file != ".." && !is_file($file) && !is_link($file) )
{
$sub_dir = @opendir("../" . $board_config['avatar_gallery_path'] . "/" . $file);
--- 790,794 ----
while( $file = @readdir($dir) )
{
! if( $file != "." && $file != ".." && !is_file("./../" . $board_config['avatar_gallery_path'] . "/" . $file) && !is_link("./../" . $board_config['avatar_gallery_path'] . "/" . $file) )
{
$sub_dir = @opendir("../" . $board_config['avatar_gallery_path'] . "/" . $file);
***************
*** 812,826 ****
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $user_id . '" />';
! $s_hidden_fields .= '<input type="hidden" name="username" value="' . addslashes($username) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="email" value="' . addslashes($email) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="icq" value="' . addslashes($icq) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="aim" value="' . addslashes($aim) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="msn" value="' . addslashes($msn) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="yim" value="' . addslashes($yim) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="website" value="' . addslashes($website) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="location" value="' . addslashes($location) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="occupation" value="' . addslashes($occupation) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="interests" value="' . addslashes($interests) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="signature" value="' . addslashes($signature) . '" />';
$s_hidden_fields .= '<input type="hidden" name="viewemail" value="' . $viewemail . '" />';
$s_hidden_fields .= '<input type="hidden" name="notifypm" value="' . $notifypm . '" />';
--- 860,874 ----
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $user_id . '" />';
! $s_hidden_fields .= '<input type="hidden" name="username" value="' . str_replace("\"", """, $username) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="email" value="' . str_replace("\"", """, $email) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="icq" value="' . str_replace("\"", """, $icq) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="aim" value="' . str_replace("\"", """, $aim) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="msn" value="' . str_replace("\"", """, $msn) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="yim" value="' . str_replace("\"", """, $yim) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="website" value="' . str_replace("\"", """, $website) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="location" value="' . str_replace("\"", """, $location) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="occupation" value="' . str_replace("\"", """, $occupation) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", """, $interests) . '" />';
! $s_hidden_fields .= '<input type="hidden" name="signature" value="' . str_replace("\"", """, $signature) . '" />';
$s_hidden_fields .= '<input type="hidden" name="viewemail" value="' . $viewemail . '" />';
$s_hidden_fields .= '<input type="hidden" name="notifypm" value="' . $notifypm . '" />';
***************
*** 835,839 ****
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />';
$s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />';
! $s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . addslashes($user_dateformat) . '" />';
$s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';
--- 883,887 ----
$s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />';
$s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />';
! $s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . str_replace("\"", """, $user_dateformat) . '" />';
$s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';
***************
*** 1029,1048 ****
);
! if( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] )
{
! $template->assign_block_vars("avatarblock", array() );
! if($board_config['allow_avatar_upload'])
! {
! $template->assign_block_vars("avatarblock.avatarupload", array() );
! }
! if($board_config['allow_avatar_remote'])
! {
! $template->assign_block_vars("avatarblock.avatarremote", array() );
! }
! if($board_config['allow_avatar_local'])
! {
! $template->assign_block_vars("avatarblock.avatargallery", array() );
! }
}
}
--- 1077,1088 ----
);
! if( file_exists("./../" . $board_config['avatar_path']) )
{
! $template->assign_block_vars("avatarupload", array() );
! }
! if( file_exists("./../" . $board_config['avatar_gallery_path']) )
! {
! $template->assign_block_vars("avatargallery", array() );
}
}
|