Changed way subject is sent to email ... handled by templates where necessary

git-svn-id: file:///svn/phpbb/trunk@2247 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-03-02 18:12:19 +00:00
parent dcdb379679
commit 6172b1c51e
4 changed files with 184 additions and 207 deletions

View file

@ -197,7 +197,7 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
$emailer->use_template("group_request", $moderator['user_lang']); $emailer->use_template("group_request", $moderator['user_lang']);
$emailer->email_address($moderator['user_email']); $emailer->email_address($moderator['user_email']);
$emailer->set_subject($lang['Group_request']); $emailer->set_subject();//$lang['Group_request']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
@ -403,7 +403,7 @@ else if( $group_id )
$emailer->use_template("group_added", $row['user_lang']); $emailer->use_template("group_added", $row['user_lang']);
$emailer->email_address($row['user_email']); $emailer->email_address($row['user_email']);
$emailer->set_subject($lang['Group_added']); $emailer->set_subject();//$lang['Group_added']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
@ -509,7 +509,7 @@ else if( $group_id )
$emailer->use_template("group_approved"); $emailer->use_template("group_approved");
$emailer->email_address($email_addresses); $emailer->email_address($email_addresses);
$emailer->set_subject($lang['Group_approved']); $emailer->set_subject();//$lang['Group_approved']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(

View file

@ -630,7 +630,7 @@ function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id
{ {
$emailer->use_template("topic_notify", $row['user_lang']); $emailer->use_template("topic_notify", $row['user_lang']);
$emailer->email_address($row['user_email']); $emailer->email_address($row['user_email']);
$emailer->set_subject($lang['Topic_reply_notification']); $emailer->set_subject();//$lang['Topic_reply_notification']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(

View file

@ -1125,7 +1125,7 @@ else if( $submit || $refresh || $mode != "" )
$emailer->use_template("privmsg_notify", $to_userdata['user_lang']); $emailer->use_template("privmsg_notify", $to_userdata['user_lang']);
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->email_address($to_userdata['user_email']); $emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['Notification_subject']); $emailer->set_subject(); //$lang['Notification_subject']
$emailer->assign_vars(array( $emailer->assign_vars(array(
"USERNAME" => $to_username, "USERNAME" => $to_username,
@ -1207,16 +1207,6 @@ else if( $submit || $refresh || $mode != "" )
message_die(GENERAL_ERROR, "Couldn't obtain post and post text", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain post and post text", "", __LINE__, __FILE__, $sql);
} }
} }
//
// Process the username list operations
//
if( $submit_search )
{
if( !empty($HTTP_POST_VARS['username_search']) )
{
}
}
} }
else else
{ {

View file

@ -59,7 +59,7 @@ function validate_email($email)
if ( $email != "" ) if ( $email != "" )
{ {
if ( preg_match("/^[a-z0-9\.\-_]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is", $email) ) if ( preg_match('/^[a-z0-9\.\-_]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email) )
{ {
$sql = "SELECT ban_email $sql = "SELECT ban_email
FROM " . BANLIST_TABLE; FROM " . BANLIST_TABLE;
@ -107,28 +107,28 @@ function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$loca
{ {
if ( strlen($$check_var_length[$i]) < 2 ) if ( strlen($$check_var_length[$i]) < 2 )
{ {
$$check_var_length[$i] = ""; $$check_var_length[$i] = '';
} }
} }
// ICQ number has to be only numbers. // ICQ number has to be only numbers.
if ( !preg_match("/^[0-9]+$/", $icq) ) if ( !preg_match('/^[0-9]+$/', $icq) )
{ {
$icq = ""; $icq = '';
} }
// website has to start with http://, followed by something with length at least 3 that // website has to start with http://, followed by something with length at least 3 that
// contains at least one dot. // contains at least one dot.
if ( $website != "" ) if ( $website != "" )
{ {
if ( !preg_match("#^http:\/\/#i", $website) ) if ( !preg_match('#^http:\/\/#i', $website) )
{ {
$website = "http://" . $website; $website = "http://" . $website;
} }
if ( !preg_match("#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i", $website) ) if ( !preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $website) )
{ {
$website = ""; $website = '';
} }
} }
@ -633,9 +633,9 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
$username_sql = ""; $username_sql = "";
if( $board_config['allow_namechange'] || $mode == "register" ) if ( $board_config['allow_namechange'] || $mode == 'register' )
{ {
if( $username != $userdata['username'] || $mode == "register" ) if ( $username != $userdata['username'] || $mode == 'register' )
{ {
$result = validate_username($username); $result = validate_username($username);
if ( $result['error'] ) if ( $result['error'] )
@ -643,7 +643,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$error = TRUE; $error = TRUE;
if(isset($error_msg)) if(isset($error_msg))
{ {
$error_msg .= "<br />"; $error_msg .= '<br />';
} }
$error_msg .= $result['error_msg']; $error_msg .= $result['error_msg'];
} }
@ -654,7 +654,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
} }
if( $signature != "" ) if ( $signature != '' )
{ {
$sig_length_check = preg_replace("/(\[.*?)(=.*?)\]/is", "\\1]", stripslashes($signature)); $sig_length_check = preg_replace("/(\[.*?)(=.*?)\]/is", "\\1]", stripslashes($signature));
if( $allowhtml ) if( $allowhtml )
@ -665,7 +665,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// Only create a new bbcode_uid when there was no uid yet. // Only create a new bbcode_uid when there was no uid yet.
if($signature_bbcode_uid == '') if($signature_bbcode_uid == '')
{ {
$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : ""; $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
} }
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid); $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
@ -674,13 +674,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$error = TRUE; $error = TRUE;
if( isset($error_msg) ) if( isset($error_msg) )
{ {
$error_msg .= "<br />"; $error_msg .= '<br />';
} }
$error_msg .= $lang['Signature_too_long']; $error_msg .= $lang['Signature_too_long'];
} }
} }
if( $mode == "register" ) if ( $mode == 'register' )
{ {
// //
// The AUTO_INCREMENT field in MySQL v3.23 doesn't work // The AUTO_INCREMENT field in MySQL v3.23 doesn't work
@ -718,14 +718,14 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
} }
$avatar_sql = ""; $avatar_sql = '';
if( isset($HTTP_POST_VARS['avatardel']) && $mode == "editprofile" ) if ( isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile' )
{ {
if ( $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "" ) if ( $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "" )
{ {
if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if ( @file_exists('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']) )
{ {
@unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']); @unlink('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']);
} }
} }
$avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE; $avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
@ -741,14 +741,14 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$error = TRUE; $error = TRUE;
if( isset($error_msg) ) if( isset($error_msg) )
{ {
$error_msg .= "<br />"; $error_msg .= '<br />';
} }
$error_msg .= $lang['Only_one_avatar']; $error_msg .= $lang['Only_one_avatar'];
} }
if( $user_avatar_loc != "" ) if ( $user_avatar_loc != '' )
{ {
if( file_exists($user_avatar_loc) && ereg(".jpg$|.jpeg$|.gif$|.png$", $user_avatar_name) ) if ( file_exists($user_avatar_loc) && ereg('.jpg$|.jpeg$|.gif$|.png$', $user_avatar_name) )
{ {
if ( $user_avatar_size <= $board_config['avatar_filesize'] && $avatar_size > 0 ) if ( $user_avatar_size <= $board_config['avatar_filesize'] && $avatar_size > 0 )
{ {
@ -762,14 +762,15 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
switch( $user_avatar_filetype ) switch( $user_avatar_filetype )
{ {
case "jpeg": case 'jpeg':
case "pjpeg": case 'pjpeg':
case 'jpg':
$imgtype = '.jpg'; $imgtype = '.jpg';
break; break;
case "gif": case 'gif':
$imgtype = '.gif'; $imgtype = '.gif';
break; break;
case "png": case 'png':
$imgtype = '.png'; $imgtype = '.png';
break; break;
default: default:
@ -784,18 +785,18 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] ) if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
{ {
$user_id = ($mode == "register") ? $new_user_id : $userdata['user_id']; $user_id = ( $mode == 'register' ) ? $new_user_id : $userdata['user_id'];
$avatar_filename = $user_id . $imgtype; $avatar_filename = $user_id . $imgtype;
if( $mode == "editprofile" && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "" ) if( $mode == 'editprofile' && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != '' )
{ {
if( @file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if( @file_exists('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar']) )
{ {
@unlink("./" . $board_config['avatar_path'] . "/". $userdata['user_avatar']); @unlink('./' . $board_config['avatar_path'] . '/'. $userdata['user_avatar']);
} }
} }
@copy($user_avatar_loc, "./" . $board_config['avatar_path'] . "/$avatar_filename"); @copy($user_avatar_loc, './' . $board_config['avatar_path'] . "/$avatar_filename");
$avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD; $avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;
} }
@ -804,7 +805,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']); $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
} }
} }
} }
@ -813,13 +814,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024)); $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
} }
} }
else else
{ {
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Avatar_filetype'] : $lang['Avatar_filetype']; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
} }
} }
else if ( !empty($user_avatar_url) ) else if ( !empty($user_avatar_url) )
@ -829,7 +830,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// to, look for a :[xxxx]/ or, if that doesn't // to, look for a :[xxxx]/ or, if that doesn't
// exist assume port 80 (http) // exist assume port 80 (http)
// //
preg_match("/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/", $user_avatar_url, $url_ary); preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $user_avatar_url, $url_ary);
if ( !empty($url_ary[4]) ) if ( !empty($url_ary[4]) )
{ {
@ -838,7 +839,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$fsock = @fsockopen($url_ary[2], $port, $errno, $errstr); $fsock = @fsockopen($url_ary[2], $port, $errno, $errstr);
if ( $fsock ) if ( $fsock )
{ {
$base_get = "/" . $url_ary[4]; $base_get = '/' . $url_ary[4];
// //
// Uses HTTP 1.1, could use HTTP 1.0 ... // Uses HTTP 1.1, could use HTTP 1.0 ...
@ -854,22 +855,22 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
@fclose($fsock); @fclose($fsock);
if( preg_match("/Content-Length\: ([0-9]+)[^\/ ][\s]+/i", $avatar_data, $file_data1) && preg_match("/Content-Type\: image\/[x\-]*([a-z]+)[\s]+/i", $avatar_data, $file_data2) ) if ( preg_match('/Content-Length\: ([0-9]+)[^\/ ][\s]+/i', $avatar_data, $file_data1) && preg_match('/Content-Type\: image\/[x\-]*([a-z]+)[\s]+/i', $avatar_data, $file_data2) )
{ {
$file_size = $file_data1[1]; $file_size = $file_data1[1];
$file_type = $file_data2[1]; $file_type = $file_data2[1];
switch( $file_type ) switch( $file_type )
{ {
case "jpeg": case 'jpeg':
case "pjpeg": case 'pjpeg':
case "jpg": case 'jpg':
$imgtype = '.jpg'; $imgtype = '.jpg';
break; break;
case "gif": case 'gif':
$imgtype = '.gif'; $imgtype = '.gif';
break; break;
case "png": case 'png':
$imgtype = '.png'; $imgtype = '.png';
break; break;
default: default:
@ -882,8 +883,8 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
$avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size); $avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size);
$tmp_filename = tempnam ("/tmp", $userdata['user_id'] . "-"); $tmp_filename = tempnam ('/tmp', $userdata['user_id'] . '-');
$fptr = @fopen($tmp_filename, "wb"); $fptr = @fopen($tmp_filename, 'wb');
$bytes_written = @fwrite($fptr, $avatar_data, $file_size); $bytes_written = @fwrite($fptr, $avatar_data, $file_size);
@fclose($fptr); @fclose($fptr);
@ -897,11 +898,11 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$avatar_filename = $user_id . $imgtype; $avatar_filename = $user_id . $imgtype;
if( $mode == "editprofile" && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != "") if ( $mode == 'editprofile' && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $userdata['user_avatar'] != '')
{ {
if( file_exists("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']) ) if ( file_exists("./" . $board_config['avatar_path'] . '/' . $userdata['user_avatar']) )
{ {
@unlink("./" . $board_config['avatar_path'] . "/" . $userdata['user_avatar']); @unlink("./" . $board_config['avatar_path'] . '/' . $userdata['user_avatar']);
} }
} }
@copy($tmp_filename, "./" . $board_config['avatar_path'] . "/$avatar_filename"); @copy($tmp_filename, "./" . $board_config['avatar_path'] . "/$avatar_filename");
@ -923,7 +924,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// Error writing file // Error writing file
// //
@unlink($tmp_filename); @unlink($tmp_filename);
message_die(GENERAL_ERROR, "Could not write avatar file to local storage. Please contact the board administrator with this message", "", __LINE__, __FILE__); message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
} }
} }
} }
@ -933,7 +934,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// No data // No data
// //
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['File_no_data'] : $lang['File_no_data']; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
} }
} }
else else
@ -942,13 +943,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// No connection // No connection
// //
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['No_connection_URL'] : $lang['No_connection_URL']; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
} }
} }
else else
{ {
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Incomplete_URL'] : $lang['Incomplete_URL']; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
} }
} }
else if ( !empty($user_avatar_name) ) else if ( !empty($user_avatar_name) )
@ -956,34 +957,34 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024)); $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
} }
} }
else if( $user_avatar_remoteurl != "" && $board_config['allow_avatar_remote'] && $avatar_sql == "" && !$error ) else if ( $user_avatar_remoteurl != '' && $board_config['allow_avatar_remote'] && $avatar_sql == '' && !$error )
{ {
if( !preg_match("#^http:\/\/#i", $user_avatar_remoteurl) ) if ( !preg_match('#^http:\/\/#i', $user_avatar_remoteurl) )
{ {
$user_avatar_remoteurl = "http://" . $user_avatar_remoteurl; $user_avatar_remoteurl = 'http://' . $user_avatar_remoteurl;
} }
if( preg_match("#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is", $user_avatar_remoteurl) ) if ( preg_match('#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is', $user_avatar_remoteurl) )
{ {
$avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_remoteurl) . "', user_avatar_type = " . USER_AVATAR_REMOTE; $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_remoteurl) . "', user_avatar_type = " . USER_AVATAR_REMOTE;
} }
else else
{ {
$error = true; $error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format']; $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
} }
} }
else if( $user_avatar_local != "" && $board_config['allow_avatar_local'] && $avatar_sql == "" && !$error ) else if ( $user_avatar_local != '' && $board_config['allow_avatar_local'] && $avatar_sql == '' && !$error )
{ {
$avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY; $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
} }
if ( !$error ) if ( !$error )
{ {
if( $mode == "editprofile" ) if ( $mode == 'editprofile' )
{ {
if ( $email != $current_email && ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN ) && $userdata['user_level'] != ADMIN ) if ( $email != $current_email && ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN ) && $userdata['user_level'] != ADMIN )
{ {
@ -993,15 +994,15 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// //
// The user is inactive, remove their session forcing them to login again before they can post. // The user is inactive, remove their session forcing them to login again before they can post.
// //
$sql = "DELETE FROM " . SESSIONS_TABLE . " if( $userdata['session_logged_in'] )
WHERE session_user_id = " . $userdata['user_id']; {
$db->sql_query($sql); session_end($userdata['session_id'], $userdata['user_id']);
}
} }
else else
{ {
$user_active = 1; $user_active = 1;
$user_actkey = ""; $user_actkey = '';
} }
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
@ -1019,17 +1020,9 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n"; $email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
if( $board_config['require_activation'] == USER_ACTIVATION_SELF ) $emailer->use_template('user_activate', stripslashes($user_lang));
{
$emailer->use_template("user_activate", stripslashes($user_lang));
$emailer->email_address($email); $emailer->email_address($email);
} $emailer->set_subject();//$lang['Reactivate']
else
{
$emailer->use_template("admin_activate", stripslashes($user_lang));
$emailer->email_address($board_config['board_email']);
}
$emailer->set_subject($lang['Reactivate']);
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
@ -1042,19 +1035,11 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
$message = $lang['Profile_updated_inactive'] . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>"); $message = $lang['Profile_updated_inactive'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
// Log the user out as their account is no longer active
if( $userdata['session_logged_in'] )
{
session_end($userdata['session_id'], $userdata['user_id']);
}
} }
else else
{ {
$message = $lang['Profile_updated'] . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>"); $message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
} }
$template->assign_vars(array( $template->assign_vars(array(
@ -1124,12 +1109,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$emailer->use_template($email_template, stripslashes($user_lang)); $emailer->use_template($email_template, stripslashes($user_lang));
$emailer->email_address($email); $emailer->email_address($email);
$emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename'])); $emailer->set_subject();//sprintf($lang['Welcome_subject'], $board_config['sitename'])
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
if( $coppa ) if( $coppa )
{ {
$emailer->assign_vars(array( $emailer->assign_vars(array(
"SITENAME" => $board_config['sitename'],
"WELCOME_MSG" => sprintf($lang['Welcome_subject'], $board_config['sitename']), "WELCOME_MSG" => sprintf($lang['Welcome_subject'], $board_config['sitename']),
"USERNAME" => $username, "USERNAME" => $username,
"PASSWORD" => $password_confirm, "PASSWORD" => $password_confirm,
@ -1153,6 +1139,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
else else
{ {
$emailer->assign_vars(array( $emailer->assign_vars(array(
"SITENAME" => $board_config['sitename'],
"WELCOME_MSG" => sprintf($lang['Welcome_subject'], $board_config['sitename']), "WELCOME_MSG" => sprintf($lang['Welcome_subject'], $board_config['sitename']),
"USERNAME" => $username, "USERNAME" => $username,
"PASSWORD" => $password_confirm, "PASSWORD" => $password_confirm,
@ -1169,11 +1156,10 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
$emailer->use_template("admin_activate", stripslashes($user_lang)); $emailer->use_template("admin_activate", stripslashes($user_lang));
$emailer->email_address($board_config['board_email']); $emailer->email_address($board_config['board_email']);
$emailer->set_subject($lang['New_account_subject']); $emailer->set_subject(); //$lang['New_account_subject']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
"WELCOME_MSG" => sprintf($lang['Welcome_subject'], $board_config['sitename']),
"USERNAME" => $username, "USERNAME" => $username,
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
@ -1628,25 +1614,25 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// //
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) ) if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
{ {
$template->assign_block_vars("avatarblock", array() ); $template->assign_block_vars("avatar_block", array() );
if ( $board_config['allow_avatar_upload'] && file_exists("./" . $board_config['avatar_path']) ) if ( $board_config['allow_avatar_upload'] && file_exists("./" . $board_config['avatar_path']) )
{ {
$template->assign_block_vars("avatarblock.avatarupload", array() );
if ( $form_enctype != '' ) if ( $form_enctype != '' )
{ {
$template->assign_block_vars("avatarblock.avatarupload.avatarfileupload", array() ); $template->assign_block_vars("avatar_block.avatar_local_upload", array() );
} }
$template->assign_block_vars("avatar_block.avatar_remote_upload", array() );
} }
if ( $board_config['allow_avatar_remote'] ) if ( $board_config['allow_avatar_remote'] )
{ {
$template->assign_block_vars("avatarblock.avatarremote", array() ); $template->assign_block_vars("avatar_block.avatar_remote_link", array() );
} }
if ( $board_config['allow_avatar_local'] && file_exists("./" . $board_config['avatar_gallery_path']) ) if ( $board_config['allow_avatar_local'] && file_exists("./" . $board_config['avatar_gallery_path']) )
{ {
$template->assign_block_vars("avatarblock.avatargallery", array() ); $template->assign_block_vars("avatar_block.avatar_local_gallery", array() );
} }
} }
} }
@ -1668,13 +1654,8 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
AND username = '" . str_replace("\'", "''", $username) . "'"; AND username = '" . str_replace("\'", "''", $username) . "'";
if ( $result = $db->sql_query($sql) ) if ( $result = $db->sql_query($sql) )
{ {
if( !$db->sql_numrows($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
message_die(GENERAL_MESSAGE, $lang['No_email_match']);
}
$row = $db->sql_fetchrow($result);
if ( $row['user_active'] == 0 ) if ( $row['user_active'] == 0 )
{ {
message_die(GENERAL_MESSAGE, $lang['No_send_account_inactive']); message_die(GENERAL_MESSAGE, $lang['No_send_account_inactive']);
@ -1700,7 +1681,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$emailer->use_template("user_activate_passwd", $row['user_lang']); $emailer->use_template("user_activate_passwd", $row['user_lang']);
$emailer->email_address($row['user_email']); $emailer->email_address($row['user_email']);
$emailer->set_subject($lang['New_password_activation']); $emailer->set_subject();//$lang['New_password_activation']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
@ -1723,6 +1704,11 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else else
{
message_die(GENERAL_MESSAGE, $lang['No_email_match']);
}
}
else
{ {
message_die(GENERAL_ERROR, "Couldn't obtain user information for sendpassword", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain user information for sendpassword", "", __LINE__, __FILE__, $sql);
} }
@ -1769,7 +1755,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if( $mode == "activate" ) else if ( $mode == 'activate' )
{ {
$sql = "SELECT user_id, user_email, user_newpasswd, user_lang $sql = "SELECT user_id, user_email, user_newpasswd, user_lang
FROM " . USERS_TABLE . " FROM " . USERS_TABLE . "
@ -1785,7 +1771,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
WHERE user_id = " . $row['user_id']; WHERE user_id = " . $row['user_id'];
if ( $result = $db->sql_query($sql) ) if ( $result = $db->sql_query($sql) )
{ {
if( $board_config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == "" ) if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == '' )
{ {
include($phpbb_root_path . 'includes/emailer.'.$phpEx); include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$emailer = new emailer($board_config['smtp_delivery']); $emailer = new emailer($board_config['smtp_delivery']);
@ -1794,7 +1780,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$emailer->use_template("admin_welcome_activated", $row['user_lang']); $emailer->use_template("admin_welcome_activated", $row['user_lang']);
$emailer->email_address($row['user_email']); $emailer->email_address($row['user_email']);
$emailer->set_subject($lang['Account_activated_subject']); $emailer->set_subject();//$lang['Account_activated_subject']
$emailer->extra_headers($email_headers); $emailer->extra_headers($email_headers);
$emailer->assign_vars(array( $emailer->assign_vars(array(
@ -1852,6 +1838,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
if ( !$userdata['session_logged_in'] ) if ( !$userdata['session_logged_in'] )
{ {
header("Location: " . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true)); header("Location: " . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true));
exit;
} }
$sql = "SELECT username, user_email, user_viewemail, user_lang $sql = "SELECT username, user_email, user_viewemail, user_lang