1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 15:16:16 +02:00

Various updates related to email creation ... should fix various bugs and errors, in theory

git-svn-id: file:///svn/phpbb/trunk@1974 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-01-27 22:13:17 +00:00
parent 20d33a47fd
commit 6497f166ef
5 changed files with 403 additions and 368 deletions

View File

@ -57,6 +57,52 @@ $cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0;
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
//
// Set default email variables
//
if( isset($HTTP_SERVER_VARS['PHP_SELF']) || isset($HTTP_ENV_VARS['PHP_SELF']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
}
else if( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) || isset($HTTP_ENV_VARS['SCRIPT_NAME']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) ) ? $HTTP_SERVER_VARS['SCRIPT_NAME'] : $HTTP_ENV_VARS['SCRIPT_NAME'];
}
else if( isset($HTTP_SERVER_VARS['PATH_INFO']) || isset($HTTP_ENV_VARS['PATH_INFO']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PATH_INFO']) ) ? $HTTP_SERVER_VARS['PATH_INFO'] : $HTTP_ENV_VARS['PATH_INFO'];
}
else
{
$script_name = "groupcp.$phpEx";
}
if( isset($HTTP_SERVER_VARS['SERVER_NAME']) || isset($HTTP_ENV_VARS['SERVER_NAME']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['SERVER_NAME']) ) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME'];
}
else if( isset($HTTP_SERVER_VARS['HTTP_HOST']) || isset($HTTP_ENV_VARS['HTTP_HOST']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST'];
}
else
{
$server_name = "";
}
if ( !empty($HTTP_SERVER_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else if ( !empty($HTTP_ENV_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_ENV_VARS['HTTPS']) ) ? ( ( $HTTP_ENV_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else
{
$protocol = "http://";
}
$is_moderator = FALSE; $is_moderator = FALSE;
if( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) if( isset($HTTP_POST_VARS['groupstatus']) && $group_id )
@ -69,7 +115,6 @@ if( isset($HTTP_POST_VARS['groupstatus']) && $group_id )
$sql = "SELECT group_moderator $sql = "SELECT group_moderator
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if( !$result = $db->sql_query($sql) ) if( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain user and group information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain user and group information", "", __LINE__, __FILE__, $sql);
@ -128,13 +173,13 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
message_die(GENERAL_ERROR, "Couldn't obtain user and group information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain user and group information", "", __LINE__, __FILE__, $sql);
} }
$rowset = $db->sql_fetchrowset($result); if( $row = $db->sql_fetchrow($result) )
if( $rowset[0]['group_type'] == GROUP_OPEN )
{ {
for($i = 0; $i < count($rowset); $i++ ) if( $row['group_type'] == GROUP_OPEN )
{ {
if( $userdata['user_id'] == $rowset[$i]['user_id'] ) do
{
if( $userdata['user_id'] == $row['user_id'] )
{ {
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') "META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">')
@ -144,7 +189,7 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
} } while ( $row = $db->sql_fetchrow($result) );
} }
else else
{ {
@ -156,6 +201,11 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; VALUES ($group_id, " . $userdata['user_id'] . ", 1)";
@ -180,21 +230,6 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
$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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
$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']);
@ -205,7 +240,7 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id )
"GROUP_MODERATOR" => $moderator['username'], "GROUP_MODERATOR" => $moderator['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']),
"U_GROUPCP" => $protocol . $server_name . $path . "/groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id&validate=true") "U_GROUPCP" => $protocol . $server_name . $script_name . "?" . POST_GROUPS_URL . "=$group_id&validate=true")
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
@ -401,21 +436,6 @@ else if( $group_id )
$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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
$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']);
@ -426,7 +446,7 @@ else if( $group_id )
"GROUP_NAME" => $group_name, "GROUP_NAME" => $group_name,
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"U_GROUPCP" => $protocol . $server_name . $path . "/groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") "U_GROUPCP" => $protocol . $server_name . $script_name . "?" . POST_GROUPS_URL . "=$group_id")
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
@ -470,7 +490,7 @@ else if( $group_id )
FROM ". USERS_TABLE . " FROM ". USERS_TABLE . "
WHERE user_id IN ($sql_in)"; WHERE user_id IN ($sql_in)";
} }
else if( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) ) else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) )
{ {
$sql = "DELETE FROM $sql = "DELETE FROM
" . USER_GROUP_TABLE . " " . USER_GROUP_TABLE . "
@ -478,7 +498,7 @@ else if( $group_id )
AND group_id = $group_id"; AND group_id = $group_id";
} }
if( !$result = $db->sql_query($sql) ) if ( !$result = $db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Could not update user group table.", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not update user group table.", "Error", __LINE__, __FILE__, $sql);
} }
@ -486,15 +506,22 @@ else if( $group_id )
// //
// Email users when they are approved // Email users when they are approved
// //
if( isset($HTTP_POST_VARS['approve']) ) if ( isset($HTTP_POST_VARS['approve']) )
{ {
if( !$result = $db->sql_query($sql_select) ) if ( !$result = $db->sql_query($sql_select) )
{ {
message_die(GENERAL_ERROR, "Could not get user email information", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get user email information", "Error", __LINE__, __FILE__, $sql);
} }
$email_rowset = $db->sql_fetchrowset($result);
$members_count = $db->sql_numrows($result); $email_addresses = "";
while( $row = $db->sql_fetchrow($result) )
{
if( $i > 0 )
{
$email_addresses .= ", ";
}
$email_addresses .= $row['user_email'];
}
// //
// Get the group name // Get the group name
@ -502,44 +529,19 @@ else if( $group_id )
$group_sql = "SELECT group_name $group_sql = "SELECT group_name
FROM " . GROUPS_TABLE . " FROM " . GROUPS_TABLE . "
WHERE group_id = $group_id"; WHERE group_id = $group_id";
if(!$result = $db->sql_query($group_sql)) if ( !($result = $db->sql_query($group_sql)) )
{ {
message_die(GENERAL_ERROR, "Could not get group information", "Error", __LINE__, __FILE__, $group_sql); message_die(GENERAL_ERROR, "Could not get group information", "Error", __LINE__, __FILE__, $group_sql);
} }
$group_name_row = $db->sql_fetchrow($result); $group_name_row = $db->sql_fetchrow($result);
$group_name = $group_name_row['group_name']; $group_name = $group_name_row['group_name'];
$email_addresses = "";
for($i = 0; $i < $members_count; $i++)
{
if($i > 0)
{
$email_addresses .= ", ";
}
$email_addresses .= $email_rowset[$i]['user_email'];
}
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']);
$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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
$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']);
@ -550,7 +552,7 @@ else if( $group_id )
"GROUP_NAME" => $group_name, "GROUP_NAME" => $group_name,
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"U_GROUPCP" => $protocol . $server_name . $path . "/groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") "U_GROUPCP" => $protocol . $server_name . $script_name . "?" . POST_GROUPS_URL . "=$group_id")
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
@ -615,15 +617,14 @@ else if( $group_id )
AND ug.user_pending = 0 AND ug.user_pending = 0
AND ug.user_id <> " . $group_moderator['user_id'] . " AND ug.user_id <> " . $group_moderator['user_id'] . "
ORDER BY u.username"; ORDER BY u.username";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Error getting user list for group", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Error getting user list for group", "", __LINE__, __FILE__, $sql);
} }
if( $members_count = $db->sql_numrows($result) )
{
$group_members = $db->sql_fetchrowset($result); $group_members = $db->sql_fetchrowset($result);
} $modgroup_pending_count = count($group_members);
$db->sql_freeresult($result);
$sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
@ -632,22 +633,21 @@ else if( $group_id )
AND ug.user_pending = 1 AND ug.user_pending = 1
AND u.user_id = ug.user_id AND u.user_id = ug.user_id
ORDER BY u.username"; ORDER BY u.username";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Error getting user pending information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Error getting user pending information", "", __LINE__, __FILE__, $sql);
} }
if( $modgroup_pending_count = $db->sql_numrows($result) )
{
$modgroup_pending_list = $db->sql_fetchrowset($result); $modgroup_pending_list = $db->sql_fetchrowset($result);
} $modgroup_pending_count = count($modgroup_pending_list);
$db->sql_freeresult($result);
$is_group_member = 0; $is_group_member = 0;
if( $members_count ) if ( $members_count )
{ {
for($i = 0; $i < $members_count; $i++) for($i = 0; $i < $members_count; $i++)
{ {
if( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] )
{ {
$is_group_member = TRUE; $is_group_member = TRUE;
} }
@ -655,23 +655,23 @@ else if( $group_id )
} }
$is_group_pending_member = 0; $is_group_pending_member = 0;
if( $modgroup_pending_count ) if ( $modgroup_pending_count )
{ {
for($i = 0; $i < $modgroup_pending_count; $i++) for($i = 0; $i < $modgroup_pending_count; $i++)
{ {
if( $modgroup_pending_list[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) if ( $modgroup_pending_list[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] )
{ {
$is_group_pending_member = TRUE; $is_group_pending_member = TRUE;
} }
} }
} }
if( $userdata['user_level'] == ADMIN ) if ( $userdata['user_level'] == ADMIN )
{ {
$is_moderator = TRUE; $is_moderator = TRUE;
} }
if( $userdata['user_id'] == $group_info['group_moderator'] ) if ( $userdata['user_id'] == $group_info['group_moderator'] )
{ {
$is_moderator = TRUE; $is_moderator = TRUE;
@ -679,7 +679,7 @@ else if( $group_id )
$s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />";
} }
else if( $is_group_member || $is_group_pending_member ) else if ( $is_group_member || $is_group_pending_member )
{ {
$template->assign_block_vars("switch_unsubscribe_group_input", array()); $template->assign_block_vars("switch_unsubscribe_group_input", array());
@ -687,26 +687,26 @@ else if( $group_id )
$s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />";
} }
else if( $userdata['user_id'] == ANONYMOUS ) else if ( $userdata['user_id'] == ANONYMOUS )
{ {
$group_details = $lang['Login_to_join']; $group_details = $lang['Login_to_join'];
$s_hidden_fields = ""; $s_hidden_fields = "";
} }
else else
{ {
if( $group_info['group_type'] == GROUP_OPEN ) if ( $group_info['group_type'] == GROUP_OPEN )
{ {
$template->assign_block_vars("switch_subscribe_group_input", array()); $template->assign_block_vars("switch_subscribe_group_input", array());
$group_details = $lang['This_open_group']; $group_details = $lang['This_open_group'];
$s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />"; $s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />";
} }
else if( $group_info['group_type'] == GROUP_CLOSED ) else if ( $group_info['group_type'] == GROUP_CLOSED )
{ {
$group_details = $lang['This_closed_group']; $group_details = $lang['This_closed_group'];
$s_hidden_fields = ""; $s_hidden_fields = "";
} }
else if( $group_info['group_type'] == GROUP_HIDDEN ) else if ( $group_info['group_type'] == GROUP_HIDDEN )
{ {
$group_details = $lang['This_hidden_group']; $group_details = $lang['This_hidden_group'];
$s_hidden_fields = ""; $s_hidden_fields = "";
@ -751,7 +751,7 @@ else if( $group_id )
$pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>"; $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>";
if( !empty($group_moderator['user_viewemail']) ) if ( !empty($group_moderator['user_viewemail']) )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $group_moderator['user_id']) : "mailto:" . $group_moderator['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $group_moderator['user_id']) : "mailto:" . $group_moderator['user_email'];
@ -764,7 +764,7 @@ else if( $group_id )
$www_img = ( $group_moderator['user_website'] ) ? "<a href=\"" . $group_moderator['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "&nbsp;"; $www_img = ( $group_moderator['user_website'] ) ? "<a href=\"" . $group_moderator['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "&nbsp;";
if( !empty($group_moderator['user_icq']) ) if ( !empty($group_moderator['user_icq']) )
{ {
$icq_status_img = "<a href=\"http://wwp.icq.com/" . $group_moderator['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $group_moderator['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>"; $icq_status_img = "<a href=\"http://wwp.icq.com/" . $group_moderator['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $group_moderator['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>";
$icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $group_moderator['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>"; $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $group_moderator['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>";
@ -877,7 +877,7 @@ else if( $group_id )
$pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>"; $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>";
if( !empty($group_members[$i]['user_viewemail']) ) if ( !empty($group_members[$i]['user_viewemail']) )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $group_members[$i]['user_id']) : "mailto:" . $group_members[$i]['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $group_members[$i]['user_id']) : "mailto:" . $group_members[$i]['user_email'];
@ -890,7 +890,7 @@ else if( $group_id )
$www_img = ( $group_members[$i]['user_website'] ) ? "<a href=\"" . $group_members[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "&nbsp;"; $www_img = ( $group_members[$i]['user_website'] ) ? "<a href=\"" . $group_members[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "&nbsp;";
if( !empty($group_members[$i]['user_icq']) ) if ( !empty($group_members[$i]['user_icq']) )
{ {
$icq_status_img = "<a href=\"http://wwp.icq.com/" . $group_members[$i]['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $group_members[$i]['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>"; $icq_status_img = "<a href=\"http://wwp.icq.com/" . $group_members[$i]['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $group_members[$i]['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>";
$icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $group_members[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>"; $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $group_members[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>";
@ -909,7 +909,7 @@ else if( $group_id )
$search_img = "<a href=\"" . append_sid("search.$phpEx?search_author=" . urlencode($group_members[$i]['username']) . "&amp;showresults=topics") . "\"><img src=\"" . $images['icon_search'] . "\" border=\"0\" alt=\"" . $lang['Search_user_posts'] . "\" /></a>"; $search_img = "<a href=\"" . append_sid("search.$phpEx?search_author=" . urlencode($group_members[$i]['username']) . "&amp;showresults=topics") . "\"><img src=\"" . $images['icon_search'] . "\" border=\"0\" alt=\"" . $lang['Search_user_posts'] . "\" /></a>";
if( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator ) if ( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator )
{ {
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
@ -937,14 +937,14 @@ else if( $group_id )
"U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $user_id)) "U_VIEWPROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $user_id))
); );
if( $is_moderator ) if ( $is_moderator )
{ {
$template->assign_block_vars("member_row.switch_mod_option", array()); $template->assign_block_vars("member_row.switch_mod_option", array());
} }
} }
} }
if( !$members_count ) if ( !$members_count )
{ {
// //
// No group members // No group members
@ -963,7 +963,7 @@ else if( $group_id )
"L_GOTO_PAGE" => $lang['Goto_page']) "L_GOTO_PAGE" => $lang['Goto_page'])
); );
if( $group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator ) if ( $group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator )
{ {
// //
// No group members // No group members
@ -979,12 +979,12 @@ else if( $group_id )
// We've displayed the members who belong to the group, now we // We've displayed the members who belong to the group, now we
// do that pending memebers... // do that pending memebers...
// //
if( $is_moderator ) if ( $is_moderator )
{ {
// //
// Users pending in ONLY THIS GROUP (which is moderated by this user) // Users pending in ONLY THIS GROUP (which is moderated by this user)
// //
if( $modgroup_pending_count ) if ( $modgroup_pending_count )
{ {
for($i = 0; $i < $modgroup_pending_count; $i++) for($i = 0; $i < $modgroup_pending_count; $i++)
{ {
@ -1001,7 +1001,7 @@ else if( $group_id )
$pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>"; $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&amp;" . POST_USERS_URL . "=$user_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Private_messaging'] . "\" border=\"0\" /></a>";
if( !empty($modgroup_pending_list[$i]['user_viewemail']) ) if ( !empty($modgroup_pending_list[$i]['user_viewemail']) )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $modgroup_pending_list[$i]['user_id']) : "mailto:" . $modgroup_pending_list[$i]['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $modgroup_pending_list[$i]['user_id']) : "mailto:" . $modgroup_pending_list[$i]['user_email'];
@ -1014,7 +1014,7 @@ else if( $group_id )
$www_img = ( $modgroup_pending_list[$i]['user_website'] ) ? "<a href=\"" . $modgroup_pending_list[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : ""; $www_img = ( $modgroup_pending_list[$i]['user_website'] ) ? "<a href=\"" . $modgroup_pending_list[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "";
if( !empty($modgroup_pending_list[$i]['user_icq']) ) if ( !empty($modgroup_pending_list[$i]['user_icq']) )
{ {
$icq_status_img = "<a href=\"http://wwp.icq.com/" . $modgroup_pending_list[$i]['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $modgroup_pending_list[$i]['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>"; $icq_status_img = "<a href=\"http://wwp.icq.com/" . $modgroup_pending_list[$i]['user_icq'] . "#pager\"><img src=\"http://web.icq.com/whitepages/online?icq=" . $modgroup_pending_list[$i]['user_icq'] . "&amp;img=5\" width=\"18\" height=\"18\" border=\"0\" /></a>";
$icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $modgroup_pending_list[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>"; $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $modgroup_pending_list[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>";
@ -1075,7 +1075,7 @@ else if( $group_id )
} }
} }
if( $is_moderator ) if ( $is_moderator )
{ {
$template->assign_block_vars("switch_mod_option", array()); $template->assign_block_vars("switch_mod_option", array());
$template->assign_block_vars("switch_add_member", array()); $template->assign_block_vars("switch_add_member", array());
@ -1089,68 +1089,50 @@ else if( $group_id )
} }
else else
{ {
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
ORDER BY group_name";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql);
}
if( !$db->sql_numrows($result) )
{
message_die(GENERAL_MESSAGE, $lang['No_groups_exist']);
}
$group_list = $db->sql_fetchrowset($result);
$sql = "SELECT g.group_id, g.group_name, ug.user_pending $sql = "SELECT g.group_id, g.group_name, ug.user_pending
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . " WHERE ug.user_id = " . $userdata['user_id'] . "
AND g.group_id = ug.group_id AND ug.group_id = g.group_id
AND g.group_single_user <> " . TRUE . " AND g.group_single_user <> " . TRUE . "
ORDER BY g.group_name"; ORDER BY g.group_name, ug.user_id";
if(!$result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql);
} }
if($db->sql_numrows($result))
{
$membergroup_list = $db->sql_fetchrowset($result);
}
$s_member_groups = '<select name="' . POST_GROUPS_URL . '">';
$s_member_groups_opt = ""; $s_member_groups_opt = "";
$s_pending_groups = '<select name="' . POST_GROUPS_URL . '">';
$s_pending_groups_opt = ""; $s_pending_groups_opt = "";
while( $row = $db->sql_fetchrow($result) )
for($i = 0; $i < count($membergroup_list); $i++)
{ {
if( $membergroup_list[$i]['user_pending'] ) if ( $row['user_pending'] )
{ {
$s_pending_groups_opt .= '<option value="' . $membergroup_list[$i]['group_id'] . '">' . $membergroup_list[$i]['group_name'] . '</option>'; $s_pending_groups_opt .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
} }
else else
{ {
$s_member_groups_opt .= '<option value="' . $membergroup_list[$i]['group_id'] . '">' . $membergroup_list[$i]['group_name'] . '</option>'; $s_member_groups_opt .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
} }
} }
$s_pending_groups .= $s_pending_groups_opt . "</select>"; $s_pending_groups = '<select name="' . POST_GROUPS_URL . '">' . $s_pending_groups_opt . "</select>";
$s_member_groups .= $s_member_groups_opt . "</select>"; $s_member_groups = '<select name="' . POST_GROUPS_URL . '">' . $s_member_groups_opt . "</select>";
// $sql = "SELECT DISTINCT g.group_id, g.group_name
// Remaining groups FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
// WHERE ug.user_id <> " . $userdata['user_id'] . "
$s_group_list = '<select name="' . POST_GROUPS_URL . '">'; AND ug.group_id = g.group_id
for($i = 0; $i < count($group_list); $i++) AND g.group_single_user <> " . TRUE . "
ORDER BY g.group_name";
if ( !($result = $db->sql_query($sql)) )
{ {
if( !strstr($s_pending_groups, $group_list[$i]['group_name']) && !strstr($s_member_groups, $group_list[$i]['group_name']) ) message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql);
}
$s_group_list_opt = "";
while( $row = $db->sql_fetchrow($result) )
{ {
$s_group_list_opt .= '<option value="' . $group_list[$i]['group_id'] . '">' . $group_list[$i]['group_name'] . '</option>'; $s_group_list_opt .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
} }
} $s_group_list = '<select name="' . POST_GROUPS_URL . '">' . $s_group_list_opt . "</select>";
$s_group_list .= $s_group_list_opt . "</select>";
// //
// Load and process templates // Load and process templates
@ -1173,22 +1155,22 @@ else
); );
$template->assign_var_from_handle("JUMPBOX", "jumpbox"); $template->assign_var_from_handle("JUMPBOX", "jumpbox");
if($s_pending_groups_opt != "" || $s_member_groups_opt != "") if ( $s_pending_groups_opt != "" || $s_member_groups_opt != "" )
{ {
$template->assign_block_vars("groups_joined", array() ); $template->assign_block_vars("groups_joined", array() );
} }
if( $s_member_groups_opt != "" ) if ( $s_member_groups_opt != "" )
{ {
$template->assign_block_vars("groups_joined.groups_member", array() ); $template->assign_block_vars("groups_joined.groups_member", array() );
} }
if( $s_pending_groups_opt != "" ) if ( $s_pending_groups_opt != "" )
{ {
$template->assign_block_vars("groups_joined.groups_pending", array() ); $template->assign_block_vars("groups_joined.groups_pending", array() );
} }
if( $s_group_list_opt != "") if ( $s_group_list_opt != "")
{ {
$template->assign_block_vars("groups_remaining", array() ); $template->assign_block_vars("groups_remaining", array() );
} }

View File

@ -79,27 +79,6 @@ function topic_review($topic_id, $is_inline_review)
} }
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
ORDER BY p.post_time DESC
LIMIT " . $board_config['posts_per_page'];
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain post/user information.", "", __LINE__, __FILE__, $sql);
}
if(!$total_posts = $db->sql_numrows($result))
{
message_die(GENERAL_ERROR, "There don't appear to be any posts for this topic.", "", __LINE__, __FILE__, $sql);
}
$postrow = $db->sql_fetchrowset($result);
// //
// Define censored word matches // Define censored word matches
// //
@ -110,6 +89,7 @@ function topic_review($topic_id, $is_inline_review)
obtain_word_list($orig_word, $replacement_word); obtain_word_list($orig_word, $replacement_word);
} }
// //
// Dump out the page header and load viewtopic body template // Dump out the page header and load viewtopic body template
// //
@ -125,32 +105,49 @@ function topic_review($topic_id, $is_inline_review)
); );
} }
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id = pt.post_id
ORDER BY p.post_time DESC
LIMIT " . $board_config['posts_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain post/user information.", "", __LINE__, __FILE__, $sql);
}
// //
// Okay, let's do the loop, yeah come on baby let's do the loop // Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ... // and it goes like this ...
// //
for($i = 0; $i < $total_posts; $i++) if ( $row = $db->sql_fetchrow($result) )
{ {
$poster_id = $postrow[$i]['user_id']; do
$poster = $postrow[$i]['username']; {
$poster_id = $row['user_id'];
$poster = $row['username'];
$post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); $post_date = create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']);
$mini_post_img = '<img src="' . $images['icon_minipost'] . '" alt="' . $lang['Post'] . '" />'; $mini_post_img = '<img src="' . $images['icon_minipost'] . '" alt="' . $lang['Post'] . '" />';
// //
// Handle anon users posting with usernames // Handle anon users posting with usernames
// //
if( $poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '' ) if( $poster_id == ANONYMOUS && $row['post_username'] != '' )
{ {
$poster = $postrow[$i]['post_username']; $poster = $row['post_username'];
$poster_rank = $lang['Guest']; $poster_rank = $lang['Guest'];
} }
$post_subject = ( $postrow[$i]['post_subject'] != "" ) ? $postrow[$i]['post_subject'] : ""; $post_subject = ( $row['post_subject'] != "" ) ? $row['post_subject'] : "";
$message = $postrow[$i]['post_text']; $message = $row['post_text'];
$bbcode_uid = $postrow[$i]['bbcode_uid']; $bbcode_uid = $row['bbcode_uid'];
// //
// If the board has HTML off but the post has HTML // If the board has HTML off but the post has HTML
@ -158,7 +155,7 @@ function topic_review($topic_id, $is_inline_review)
// //
if( !$board_config['allow_html'] ) if( !$board_config['allow_html'] )
{ {
if( $postrow[$i]['enable_html'] ) if( $row['enable_html'] )
{ {
$message = preg_replace("#(<)([\/]?.*?)(>)#is", "&lt;\\2&gt;", $message); $message = preg_replace("#(<)([\/]?.*?)(>)#is", "&lt;\\2&gt;", $message);
} }
@ -177,7 +174,7 @@ function topic_review($topic_id, $is_inline_review)
$message = preg_replace($orig_word, $replacement_word, $message); $message = preg_replace($orig_word, $replacement_word, $message);
} }
if( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] ) if( $board_config['allow_smilies'] && $row['enable_smilies'] )
{ {
$message = smilies_pass($message); $message = smilies_pass($message);
} }
@ -202,6 +199,12 @@ function topic_review($topic_id, $is_inline_review)
"MESSAGE" => $message) "MESSAGE" => $message)
); );
} }
while( $row = $db->sql_fetchrow($result) );
}
else
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', "", __LINE__, __FILE__, $sql);
}
$template->assign_vars(array( $template->assign_vars(array(
"L_POSTED" => $lang['Posted'], "L_POSTED" => $lang['Posted'],
@ -456,30 +459,24 @@ if( $mode != "newtopic" )
if( $is_first_post_topic && $post_has_poll ) if( $is_first_post_topic && $post_has_poll )
{ {
$sql = "SELECT vd.vote_id, vr.vote_result $sql = "SELECT vd.vote_id, SUM(vr.vote_result) AS vote_sum
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
WHERE vd.topic_id = $topic_id WHERE vd.topic_id = $topic_id
AND vr.vote_id = vd.vote_id"; AND vr.vote_id = vd.vote_id
if( !$result = $db->sql_query($sql) ) GROUP BY vd.vote_id";
if( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
} }
if( $vote_rows = $db->sql_numrows($result) )
{
$rowset = $db->sql_fetchrowset($result);
$vote_id = $rowset[0]['vote_id'];
$vote_results_sum = 0; $vote_results_sum = 0;
for($i = 0; $i < $vote_rows; $i++ ) if( $row = $db->sql_fetchrow($result) )
{ {
$vote_results_sum += $rowset[$i]['vote_result']; $vote_id = $row['vote_id'];
$vote_results_sum = $row['vote_sum'];
} }
$can_edit_poll = ( !$vote_results_sum ) ? TRUE : 0; $can_edit_poll = ( !$vote_results_sum ) ? TRUE : 0;
} }
}
else else
{ {
$can_edit_poll = 0; $can_edit_poll = 0;
@ -979,53 +976,81 @@ if( ( $submit || $confirm || $mode == "delete" ) && !$error )
AND u.user_id = tw.user_id"; AND u.user_id = tw.user_id";
if( $result = $db->sql_query($sql) ) if( $result = $db->sql_query($sql) )
{ {
$email_set = $db->sql_fetchrowset($result);
$update_watched_sql = "";
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']);
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n"; if( isset($HTTP_SERVER_VARS['PHP_SELF']) || isset($HTTP_ENV_VARS['PHP_SELF']) )
if( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{ {
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']); $script_name = ( isset($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
} }
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/') else if( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) || isset($HTTP_ENV_VARS['SCRIPT_NAME']) )
{ {
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']); $script_name = ( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) ) ? $HTTP_SERVER_VARS['SCRIPT_NAME'] : $HTTP_ENV_VARS['SCRIPT_NAME'];
}
else if( isset($HTTP_SERVER_VARS['PATH_INFO']) || isset($HTTP_ENV_VARS['PATH_INFO']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PATH_INFO']) ) ? $HTTP_SERVER_VARS['PATH_INFO'] : $HTTP_ENV_VARS['PATH_INFO'];
} }
else else
{ {
$path = ''; $script_name = "viewtopic.$phpEx";
}
if( isset($HTTP_SERVER_VARS['SERVER_NAME']) || isset($HTTP_ENV_VARS['SERVER_NAME']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['SERVER_NAME']) ) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME'];
}
else if( isset($HTTP_SERVER_VARS['HTTP_HOST']) || isset($HTTP_ENV_VARS['HTTP_HOST']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST'];
}
else
{
$server_name = "";
}
if ( !empty($HTTP_SERVER_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else if ( !empty($HTTP_ENV_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_ENV_VARS['HTTPS']) ) ? ( ( $HTTP_ENV_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else
{
$protocol = "http://";
} }
$orig_word = array(); $orig_word = array();
$replacement_word = array(); $replacement_word = array();
obtain_word_list($orig_word, $replacement_word); obtain_word_list($orig_word, $replacement_word);
$topic_title = preg_replace($orig_word, $replacement_word, $email_set[0]['topic_title']); $email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME']; $update_watched_sql = "";
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://"; while( $row = $db->sql_fetchrow($result) )
{
if( empty($topic_title) )
{
$topic_title = preg_replace($orig_word, $replacement_word, $row['topic_title']);
}
for($i = 0; $i < count($email_set); $i++) if( $row['user_email'] != "")
{ {
if( $email_set[$i]['user_email'] != "") $emailer->use_template("topic_notify", $row['user_lang']);
{ $emailer->email_address($row['user_email']);
$emailer->use_template("topic_notify", $email_set[$i]['user_lang']);
$emailer->email_address($email_set[$i]['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(
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"USERNAME" => $email_set[$i]['username'], "USERNAME" => $row['username'],
"SITENAME" => $board_config['sitename'], "SITENAME" => $board_config['sitename'],
"TOPIC_TITLE" => $topic_title, "TOPIC_TITLE" => $topic_title,
"U_TOPIC" => $protocol . $server_name . $path . "/viewtopic.$phpEx?" . POST_POST_URL . "=$new_post_id#$new_post_id", "U_TOPIC" => $protocol . $server_name . $script_name . "?" . POST_POST_URL . "=$new_post_id#$new_post_id",
"U_STOP_WATCHING_TOPIC" => $protocol . $server_name . $path . "/viewtopic.$phpEx?" . POST_TOPIC_URL . "=$new_topic_id&unwatch=topic") "U_STOP_WATCHING_TOPIC" => $protocol . $server_name . $script_name . "?" . POST_TOPIC_URL . "=$new_topic_id&unwatch=topic")
); );
$emailer->send(); $emailer->send();
@ -1035,7 +1060,7 @@ if( ( $submit || $confirm || $mode == "delete" ) && !$error )
{ {
$update_watched_sql .= ", "; $update_watched_sql .= ", ";
} }
$update_watched_sql .= $email_set[$i]['user_id']; $update_watched_sql .= $row['user_id'];
} }
} }

View File

@ -1063,20 +1063,48 @@ else if( $submit || $refresh || $mode != "" )
if( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) ) if( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) )
{ {
if( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/') if( isset($HTTP_SERVER_VARS['PHP_SELF']) || isset($HTTP_ENV_VARS['PHP_SELF']) )
{ {
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']); $script_name = ( isset($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
} }
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/') else if( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) || isset($HTTP_ENV_VARS['SCRIPT_NAME']) )
{ {
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']); $script_name = ( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) ) ? $HTTP_SERVER_VARS['SCRIPT_NAME'] : $HTTP_ENV_VARS['SCRIPT_NAME'];
}
else if( isset($HTTP_SERVER_VARS['PATH_INFO']) || isset($HTTP_ENV_VARS['PATH_INFO']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PATH_INFO']) ) ? $HTTP_SERVER_VARS['PATH_INFO'] : $HTTP_ENV_VARS['PATH_INFO'];
} }
else else
{ {
$path = ''; $script_name = "privmsg.$phpEx";
} }
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
if( isset($HTTP_SERVER_VARS['SERVER_NAME']) || isset($HTTP_ENV_VARS['SERVER_NAME']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['SERVER_NAME']) ) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME'];
}
else if( isset($HTTP_SERVER_VARS['HTTP_HOST']) || isset($HTTP_ENV_VARS['HTTP_HOST']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST'];
}
else
{
$server_name = "";
}
if ( !empty($HTTP_SERVER_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://"; $protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else if ( !empty($HTTP_ENV_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_ENV_VARS['HTTPS']) ) ? ( ( $HTTP_ENV_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else
{
$protocol = "http://";
}
$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";
@ -1087,7 +1115,6 @@ else if( $submit || $refresh || $mode != "" )
// Attempt to use language setting for recipient // Attempt to use language setting for recipient
// //
$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']);
@ -1097,7 +1124,7 @@ else if( $submit || $refresh || $mode != "" )
"SITENAME" => $board_config['sitename'], "SITENAME" => $board_config['sitename'],
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"U_INBOX" => $protocol . $server_name . $path . "/privmsg.$phpEx?folder=inbox") "U_INBOX" => $protocol . $server_name . $script_name . "?folder=inbox")
); );
$emailer->send(); $emailer->send();
@ -1584,9 +1611,9 @@ else if( $submit || $refresh || $mode != "" )
"L_POST_A" => $post_a, "L_POST_A" => $post_a,
"L_FIND_USERNAME" => $lang['Find_username'], "L_FIND_USERNAME" => $lang['Find_username'],
"L_FIND" => $lang['Find'], "L_FIND" => $lang['Find'],
"L_DISABLE_HTML" => $lang['Disable_HTML_post'], "L_DISABLE_HTML" => $lang['Disable_HTML_pm'],
"L_DISABLE_BBCODE" => $lang['Disable_BBCode_post'], "L_DISABLE_BBCODE" => $lang['Disable_BBCode_pm'],
"L_DISABLE_SMILIES" => $lang['Disable_Smilies_post'], "L_DISABLE_SMILIES" => $lang['Disable_Smilies_pm'],
"L_ATTACH_SIGNATURE" => $lang['Attach_signature'], "L_ATTACH_SIGNATURE" => $lang['Attach_signature'],
"L_BBCODE_B_HELP" => $lang['bbcode_b_help'], "L_BBCODE_B_HELP" => $lang['bbcode_b_help'],

View File

@ -35,6 +35,51 @@ init_userprefs($userdata);
// End session management // End session management
// //
//
// Set default email variables
//
if( isset($HTTP_SERVER_VARS['PHP_SELF']) || isset($HTTP_ENV_VARS['PHP_SELF']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PHP_SELF']) ) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_ENV_VARS['PHP_SELF'];
}
else if( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) || isset($HTTP_ENV_VARS['SCRIPT_NAME']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['SCRIPT_NAME']) ) ? $HTTP_SERVER_VARS['SCRIPT_NAME'] : $HTTP_ENV_VARS['SCRIPT_NAME'];
}
else if( isset($HTTP_SERVER_VARS['PATH_INFO']) || isset($HTTP_ENV_VARS['PATH_INFO']) )
{
$script_name = ( isset($HTTP_SERVER_VARS['PATH_INFO']) ) ? $HTTP_SERVER_VARS['PATH_INFO'] : $HTTP_ENV_VARS['PATH_INFO'];
}
else
{
$script_name = "profile.$phpEx";
}
if( isset($HTTP_SERVER_VARS['SERVER_NAME']) || isset($HTTP_ENV_VARS['SERVER_NAME']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['SERVER_NAME']) ) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME'];
}
else if( isset($HTTP_SERVER_VARS['HTTP_HOST']) || isset($HTTP_ENV_VARS['HTTP_HOST']) )
{
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST'];
}
else
{
$server_name = "";
}
if ( !empty($HTTP_SERVER_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else if ( !empty($HTTP_ENV_VARS['HTTPS']) )
{
$protocol = ( !empty($HTTP_ENV_VARS['HTTPS']) ) ? ( ( $HTTP_ENV_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
}
else
{
$protocol = "http://";
}
// ----------------------- // -----------------------
// Page specific functions // Page specific functions
@ -187,10 +232,10 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// //
// Begin page proper // Begin page proper
// //
if( $mode == "viewprofile" ) if ( $mode == "viewprofile" )
{ {
if( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS ) if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
{ {
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']); message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
} }
@ -199,11 +244,13 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$sql = "SELECT * $sql = "SELECT *
FROM " . RANKS_TABLE . " FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min"; ORDER BY rank_special, rank_min";
if(!$ranks_result = $db->sql_query($sql)) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain ranks information.", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain ranks information.", "", __LINE__, __FILE__, $sql);
} }
$ranksrow = $db->sql_fetchrowset($ranksresult);
$ranksrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
// //
// Output page header and // Output page header and
@ -238,7 +285,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$posts_per_day = $profiledata['user_posts'] / $memberdays; $posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts // Get the users percentage of total posts
if( $profiledata['user_posts'] != 0 ) if ( $profiledata['user_posts'] != 0 )
{ {
$total_posts = get_db_stat("postcount"); $total_posts = get_db_stat("postcount");
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0; $percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
@ -248,7 +295,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$percentage = 0; $percentage = 0;
} }
if( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN ) if ( !empty($profiledata['user_viewemail']) || $userdata['user_level'] == ADMIN )
{ {
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $profiledata['user_id']) : "mailto:" . $profiledata['user_email']; $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&amp;" . POST_USERS_URL ."=" . $profiledata['user_id']) : "mailto:" . $profiledata['user_email'];
@ -262,7 +309,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
$avatar_img = ""; $avatar_img = "";
if( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] ) if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{ {
switch( $profiledata['user_avatar_type'] ) switch( $profiledata['user_avatar_type'] )
{ {
@ -280,11 +327,11 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$poster_rank = ""; $poster_rank = "";
$rank_image = ""; $rank_image = "";
if( $profiledata['user_rank'] ) if ( $profiledata['user_rank'] )
{ {
for($i = 0; $i < count($ranksrow); $i++) for($i = 0; $i < count($ranksrow); $i++)
{ {
if( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] ) if ( $profiledata['user_rank'] == $ranksrow[$i]['rank_id'] && $ranksrow[$i]['rank_special'] )
{ {
$poster_rank = $ranksrow[$i]['rank_title']; $poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ""; $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : "";
@ -295,7 +342,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{ {
for($i = 0; $i < count($ranksrow); $i++) for($i = 0; $i < count($ranksrow); $i++)
{ {
if( $profiledata['user_posts'] > $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] ) if ( $profiledata['user_posts'] > $ranksrow[$i]['rank_min'] && !$ranksrow[$i]['rank_special'] )
{ {
$poster_rank = $ranksrow[$i]['rank_title']; $poster_rank = $ranksrow[$i]['rank_title'];
$rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ""; $rank_image = ( $ranksrow[$i]['rank_image'] ) ? '<img src="' . $ranksrow[$i]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : "";
@ -303,7 +350,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
} }
} }
if( !empty($profiledata['user_icq']) ) if ( !empty($profiledata['user_icq']) )
{ {
$icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&amp;img=5" width="18" height="18" border="0" /></a>'; $icq_status_img = '<a href="http://wwp.icq.com/' . $profiledata['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $profiledata['user_icq'] . '&amp;img=5" width="18" height="18" border="0" /></a>';
$icq_add_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" border="0" /></a>'; $icq_add_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $profiledata['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" border="0" /></a>';
@ -391,10 +438,10 @@ 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 == "editprofile" || $mode == "register" ) else if ( $mode == "editprofile" || $mode == "register" )
{ {
if( !$userdata['session_logged_in'] && $mode == "editprofile" ) if ( !$userdata['session_logged_in'] && $mode == "editprofile" )
{ {
header("Location: " . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true)); header("Location: " . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
} }
@ -404,7 +451,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
// //
// Start processing for output // Start processing for output
// //
if( $mode == "register" && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) ) if ( $mode == "register" && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
{ {
if( !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) ) if( !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
{ {
@ -1047,21 +1094,6 @@ 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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
if( $board_config['require_activation'] == USER_ACTIVATION_SELF ) if( $board_config['require_activation'] == USER_ACTIVATION_SELF )
{ {
$emailer->use_template("user_activate", stripslashes($user_lang)); $emailer->use_template("user_activate", stripslashes($user_lang));
@ -1080,7 +1112,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
"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']),
"U_ACTIVATE" => $protocol . $server_name . $path . "/profile.$phpEx?mode=activate&act_key=$user_actkey") "U_ACTIVATE" => $protocol . $server_name . $script_name . "?mode=activate&act_key=$user_actkey")
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
@ -1165,21 +1197,6 @@ 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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
$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']));
@ -1193,7 +1210,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
"PASSWORD" => $password_confirm, "PASSWORD" => $password_confirm,
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"U_ACTIVATE" => $protocol . $server_name . $path . "/profile.$phpEx?mode=activate&act_key=$user_actkey", "U_ACTIVATE" => $protocol . $server_name . $script_name . "?mode=activate&act_key=$user_actkey",
"FAX_INFO" => $board_config['coppa_fax'], "FAX_INFO" => $board_config['coppa_fax'],
"MAIL_INFO" => $board_config['coppa_mail'], "MAIL_INFO" => $board_config['coppa_mail'],
"EMAIL_ADDRESS" => $email, "EMAIL_ADDRESS" => $email,
@ -1737,21 +1754,6 @@ 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( isset($HTTP_SERVER_VARS['PATH_INFO']) && dirname($HTTP_SERVER_VARS['PATH_INFO']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['PATH_INFO']);
}
else if( dirname($HTTP_SERVER_VARS['SCRIPT_NAME']) != '/')
{
$path = dirname($HTTP_SERVER_VARS['SCRIPT_NAME']);
}
else
{
$path = '';
}
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
$protocol = ( !empty($HTTP_SERVER_VARS['HTTPS']) ) ? ( ( $HTTP_SERVER_VARS['HTTPS'] == "on" ) ? "https://" : "http://" ) : "http://";
$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']);
@ -1763,7 +1765,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
"PASSWORD" => $user_password, "PASSWORD" => $user_password,
"EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']), "EMAIL_SIG" => str_replace("<br />", "\n", "-- \n" . $board_config['board_email_sig']),
"U_ACTIVATE" => $protocol . $server_name . $path . "/profile.$phpEx?mode=activate&act_key=$user_actkey") "U_ACTIVATE" => $protocol . $server_name . $script_name . "?mode=activate&act_key=$user_actkey")
); );
$emailer->send(); $emailer->send();
$emailer->reset(); $emailer->reset();
@ -1957,8 +1959,6 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if( $result = $db->sql_query($sql) ) if( $result = $db->sql_query($sql) )
{ {
$server_name = ( isset($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_SERVER_VARS['SERVER_NAME'];
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']);
@ -1971,7 +1971,7 @@ if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
$email_headers .= "X-AntiAbuse: Board servername - " . $server_name . "\n"; $email_headers .= "X-AntiAbuse: Board servername - " . $server_name . "\n";
$email_headers .= "X-AntiAbuse: User_id - " . $userdata['user_id'] . "\n"; $email_headers .= "X-AntiAbuse: User_id - " . $userdata['user_id'] . "\n";
$email_headers .= "X-AntiAbuse: Username - " . $userdata['username'] . "\n"; $email_headers .= "X-AntiAbuse: Username - " . $userdata['username'] . "\n";
$email_headers .= "X-AntiAbuse: User IP - " . decode_ip($user_ip) . "\r\n"; $email_headers .= "X-AntiAbuse: User IP - " . decode_ip($user_ip) . "\n";
$emailer->use_template("profile_send_email", $user_lang); $emailer->use_template("profile_send_email", $user_lang);
$emailer->email_address($user_email); $emailer->email_address($user_email);

View File

@ -412,6 +412,7 @@ if(!$total_posts = $db->sql_numrows($result))
message_die(GENERAL_MESSAGE, $lang['No_posts_topic']); message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
} }
$postrow = $db->sql_fetchrowset($result); $postrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$sql = "SELECT * $sql = "SELECT *
FROM " . RANKS_TABLE . " FROM " . RANKS_TABLE . "