Yep, more updates and fixes

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@2570 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-05-12 15:57:47 +00:00
parent a37f7ae66d
commit 801891caea
19 changed files with 229 additions and 313 deletions

View file

@ -178,6 +178,7 @@ else
$template->assign_vars(array( $template->assign_vars(array(
'FORUM_NAME' => $forum_name, 'FORUM_NAME' => $forum_name,
'L_FORUM' => $lang['Forum'],
'L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_FORUM_PRUNE' => $lang['Forum_Prune'],
'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'], 'L_FORUM_PRUNE_EXPLAIN' => $lang['Forum_Prune_explain'],
'L_DO_PRUNE' => $lang['Do_Prune'], 'L_DO_PRUNE' => $lang['Do_Prune'],

View file

@ -34,7 +34,7 @@ if( !empty($setmodules) )
// Load default header // Load default header
// //
$no_page_header = TRUE; $no_page_header = TRUE;
$phpbb_root_path = "./../"; $phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc'); require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx); require('./pagestart.' . $phpEx);
@ -52,23 +52,23 @@ $simple_auth_ary = array(
6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
); );
$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . " [" . $lang['Hidden'] . "]", $lang['Private'], $lang['Private'] . " [" . $lang['Hidden'] . "]", $lang['Moderators'], $lang['Moderators'] . " [" . $lang['Hidden'] . "]"); $simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . ' [' . $lang['Hidden'] . ']', $lang['Private'], $lang['Private'] . ' [' . $lang['Hidden'] . ']', $lang['Moderators'], $lang['Moderators'] . ' [' . $lang['Hidden'] . ']');
$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce", "auth_vote", "auth_pollcreate"); $forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate');
$field_names = array( $field_names = array(
"auth_view" => $lang['View'], 'auth_view' => $lang['View'],
"auth_read" => $lang['Read'], 'auth_read' => $lang['Read'],
"auth_post" => $lang['Post'], 'auth_post' => $lang['Post'],
"auth_reply" => $lang['Reply'], 'auth_reply' => $lang['Reply'],
"auth_edit" => $lang['Edit'], 'auth_edit' => $lang['Edit'],
"auth_delete" => $lang['Delete'], 'auth_delete' => $lang['Delete'],
"auth_sticky" => $lang['Sticky'], 'auth_sticky' => $lang['Sticky'],
"auth_announce" => $lang['Announce'], 'auth_announce' => $lang['Announce'],
"auth_vote" => $lang['Vote'], 'auth_vote' => $lang['Vote'],
"auth_pollcreate" => $lang['Pollcreate']); 'auth_pollcreate' => $lang['Pollcreate']);
$forum_auth_levels = array("ALL", "REG", "PRIVATE", "MOD", "ADMIN"); $forum_auth_levels = array('ALL', 'REG', 'PRIVATE', 'MOD', 'ADMIN');
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN); $forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);
if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL])) if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]))
@ -79,7 +79,7 @@ if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL
else else
{ {
unset($forum_id); unset($forum_id);
$forum_sql = ""; $forum_sql = '';
} }
if( isset($HTTP_GET_VARS['adv']) ) if( isset($HTTP_GET_VARS['adv']) )
@ -96,7 +96,7 @@ else
// //
if( isset($HTTP_POST_VARS['submit']) ) if( isset($HTTP_POST_VARS['submit']) )
{ {
$sql = ""; $sql = '';
if(!empty($forum_id)) if(!empty($forum_id))
{ {
@ -108,11 +108,7 @@ if( isset($HTTP_POST_VARS['submit']) )
for($i = 0; $i < count($simple_ary); $i++) for($i = 0; $i < count($simple_ary); $i++)
{ {
$sql .= $forum_auth_fields[$i] . " = " . $simple_ary[$i]; $sql .= ( ( $i < count($simple_ary) - 1 ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
if($i < count($simple_ary) - 1)
{
$sql .= ", ";
}
} }
$sql .= " WHERE forum_id = $forum_id"; $sql .= " WHERE forum_id = $forum_id";
@ -123,28 +119,24 @@ if( isset($HTTP_POST_VARS['submit']) )
{ {
$value = $HTTP_POST_VARS[$forum_auth_fields[$i]]; $value = $HTTP_POST_VARS[$forum_auth_fields[$i]];
if($forum_auth_fields[$i] == 'auth_vote') if ( $forum_auth_fields[$i] == 'auth_vote' )
{ {
if( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL ) if ( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL )
{ {
$value = AUTH_REG; $value = AUTH_REG;
} }
} }
$sql .= $forum_auth_fields[$i] . " = " . $value; $sql .= ( ( $i < count($forum_auth_fields) - 1 ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
if($i < count($forum_auth_fields) - 1)
{
$sql .= ", ";
}
} }
$sql .= " WHERE forum_id = $forum_id"; $sql .= " WHERE forum_id = $forum_id";
} }
if($sql != "") if ( $sql != '' )
{ {
if(!$db->sql_query($sql)) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql);
} }
@ -155,7 +147,7 @@ if( isset($HTTP_POST_VARS['submit']) )
} }
$template->assign_vars(array( $template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
); );
$message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>"); $message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>");
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
@ -187,7 +179,7 @@ if( empty($forum_id) )
// specified // specified
// //
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/auth_select_body.tpl") 'body' => 'admin/auth_select_body.tpl')
); );
$select_list = '<select name="' . POST_FORUM_URL . '">'; $select_list = '<select name="' . POST_FORUM_URL . '">';
@ -198,13 +190,13 @@ if( empty($forum_id) )
$select_list .= '</select>'; $select_list .= '</select>';
$template->assign_vars(array( $template->assign_vars(array(
"L_AUTH_TITLE" => $lang['Auth_Control_Forum'], 'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], 'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
"L_AUTH_SELECT" => $lang['Select_a_Forum'], 'L_AUTH_SELECT' => $lang['Select_a_Forum'],
"L_LOOK_UP" => $lang['Look_up_Forum'], 'L_LOOK_UP' => $lang['Look_up_Forum'],
"S_AUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), 'S_AUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
"S_AUTH_SELECT" => $select_list) 'S_AUTH_SELECT' => $select_list)
); );
} }
@ -215,7 +207,7 @@ else
// specified // specified
// //
$template->set_filenames(array( $template->set_filenames(array(
"body" => "admin/auth_forum_body.tpl") 'body' => 'admin/auth_forum_body.tpl')
); );
$forum_name = $forum_rows[0]['forum_name']; $forum_name = $forum_rows[0]['forum_name'];
@ -244,38 +236,30 @@ else
// If we didn't get a match above then we // If we didn't get a match above then we
// automatically switch into 'advanced' mode // automatically switch into 'advanced' mode
// //
if(!isset($adv) && !$matched) if ( !isset($adv) && !$matched )
{ {
$adv = 1; $adv = 1;
} }
$s_column_span == 0; $s_column_span == 0;
if( empty($adv) ) if ( empty($adv) )
{ {
$simple_auth = "<select name=\"simpleauth\">"; $simple_auth = '<select name="simpleauth">';
for($j = 0; $j < count($simple_auth_types); $j++) for($j = 0; $j < count($simple_auth_types); $j++)
{ {
if($matched_type == $j) $selected = ( $matched_type == $j ) ? ' selected="selected"' : '';
{ $simple_auth .= '<option value="' . $j . '"' . $selected . '>' . $simple_auth_types[$j] . '</option>';
$simple_auth .= "<option value=\"$j\" selected>";
$simple_auth .= $simple_auth_types[$j];
$simple_auth .= "</option>";
}
else
{
$simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>";
}
} }
$simple_auth .= "</select>"; $simple_auth .= '</select>';
$template->assign_block_vars("forum_auth_titles", array( $template->assign_block_vars('forum_auth_titles', array(
"CELL_TITLE" => $lang['Simple_mode']) 'CELL_TITLE' => $lang['Simple_mode'])
); );
$template->assign_block_vars("forum_auth_data", array( $template->assign_block_vars('forum_auth_data', array(
"S_AUTH_LEVELS_SELECT" => $simple_auth) 'S_AUTH_LEVELS_SELECT' => $simple_auth)
); );
$s_column_span++; $s_column_span++;
@ -288,37 +272,29 @@ else
// //
for($j = 0; $j < count($forum_auth_fields); $j++) for($j = 0; $j < count($forum_auth_fields); $j++)
{ {
$custom_auth[$j] = "&nbsp;<select name=\"" . $forum_auth_fields[$j] . "\">"; $custom_auth[$j] = '&nbsp;<select name="' . $forum_auth_fields[$j] . '">';
for($k = 0; $k < count($forum_auth_levels); $k++) for($k = 0; $k < count($forum_auth_levels); $k++)
{ {
if ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) $selected = ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] ) ? ' selected="selected"' : '';
{ $custom_auth[$j] .= '<option value="' . $forum_auth_const[$k] . '"' . $selected . '>' . $lang['Forum_' . $forum_auth_levels[$k]] . '</option>';
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\" selected>";
$custom_auth[$j] .= $lang['Forum_' . $forum_auth_levels[$k]];
$custom_auth[$j] .= "</option>";
}
else
{
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $lang['Forum_' . $forum_auth_levels[$k]] . "</option>";
}
} }
$custom_auth[$j] .= "</select>&nbsp;"; $custom_auth[$j] .= '</select>&nbsp;';
$cell_title = $field_names[$forum_auth_fields[$j]]; $cell_title = $field_names[$forum_auth_fields[$j]];
$template->assign_block_vars("forum_auth_titles", array( $template->assign_block_vars('forum_auth_titles', array(
"CELL_TITLE" => $cell_title) 'CELL_TITLE' => $cell_title)
); );
$template->assign_block_vars("forum_auth_data", array( $template->assign_block_vars('forum_auth_data', array(
"S_AUTH_LEVELS_SELECT" => $custom_auth[$j]) 'S_AUTH_LEVELS_SELECT' => $custom_auth[$j])
); );
$s_column_span++; $s_column_span++;
} }
} }
$adv_mode = (empty($adv)) ? "1" : "0"; $adv_mode = ( empty($adv) ) ? '1' : '0';
$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode); $switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
$switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode']; $switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>'; $u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';
@ -326,25 +302,26 @@ else
$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">'; $s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';
$template->assign_vars(array( $template->assign_vars(array(
"FORUM_NAME" => $forum_name, 'FORUM_NAME' => $forum_name,
"L_AUTH_TITLE" => $lang['Auth_Control_Forum'], 'L_FORUM' => $lang['Forum'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'], 'L_AUTH_TITLE' => $lang['Auth_Control_Forum'],
"L_SUBMIT" => $lang['Submit'], 'L_AUTH_EXPLAIN' => $lang['Forum_auth_explain'],
"L_RESET" => $lang['Reset'], 'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'],
"U_SWITCH_MODE" => $u_switch_mode, 'U_SWITCH_MODE' => $u_switch_mode,
"S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"), 'S_FORUMAUTH_ACTION' => append_sid("admin_forumauth.$phpEx"),
"S_COLUMN_SPAN" => $s_column_span, 'S_COLUMN_SPAN' => $s_column_span,
"S_HIDDEN_FIELDS" => $s_hidden_fields) 'S_HIDDEN_FIELDS' => $s_hidden_fields)
); );
} }
include('./page_header_admin.'.$phpEx); include('./page_header_admin.'.$phpEx);
$template->pparse("body"); $template->pparse('body');
include('./page_footer_admin.'.$phpEx); include('./page_footer_admin.'.$phpEx);

View file

@ -308,7 +308,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['Group_mode_not_selected']); message_die(GENERAL_MESSAGE, $lang['No_group_action']);
} }
} }
} }

View file

@ -255,7 +255,7 @@ if( $mode != "" )
$template->assign_vars(array( $template->assign_vars(array(
"L_RANKS_TITLE" => $lang['Ranks_title'], "L_RANKS_TITLE" => $lang['Ranks_title'],
"L_RANKS_TEXT" => $lang['Ranks_explain'], "L_RANKS_TEXT" => $lang['Ranks_explain'],
"L_RANK" => $lang['Rank'], "L_RANK" => $lang['Rank_title'],
"L_RANK_MINIMUM" => $lang['Rank_minimum'], "L_RANK_MINIMUM" => $lang['Rank_minimum'],
"L_SPECIAL_RANK" => $lang['Special_rank'], "L_SPECIAL_RANK" => $lang['Special_rank'],
"L_EDIT" => $lang['Edit'], "L_EDIT" => $lang['Edit'],

View file

@ -286,7 +286,7 @@ else if( isset($HTTP_POST_VARS['add']) )
$template->assign_vars(array( $template->assign_vars(array(
"L_SMILEY_TITLE" => $lang['smiley_title'], "L_SMILEY_TITLE" => $lang['smiley_title'],
"L_SMILEY_CONFIG" => $lang['smiley_config'], "L_SMILEY_CONFIG" => $lang['smiley_config'],
"L_SMILEY_EXPLAIN" => $lang['smiley_instr'], "L_SMILEY_EXPLAIN" => $lang['smile_desc'],
"L_SMILEY_CODE" => $lang['smiley_code'], "L_SMILEY_CODE" => $lang['smiley_code'],
"L_SMILEY_URL" => $lang['smiley_url'], "L_SMILEY_URL" => $lang['smiley_url'],
"L_SMILEY_EMOTION" => $lang['smiley_emot'], "L_SMILEY_EMOTION" => $lang['smiley_emot'],
@ -340,7 +340,7 @@ else if ( $mode != "" )
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if( !$result ) if( !$result )
{ {
message_die(GENERAL_ERROR, $lang['smile_edit_err'], "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not obtain emoticon information', "", __LINE__, __FILE__, $sql);
} }
$smile_data = $db->sql_fetchrow($result); $smile_data = $db->sql_fetchrow($result);

View file

@ -858,14 +858,14 @@ else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id
$template->assign_vars(array( $template->assign_vars(array(
'L_USER_OR_GROUPNAME' => ( $mode == 'user' ) ? $lang['Username'] : $lang['Group_name'], 'L_USER_OR_GROUPNAME' => ( $mode == 'user' ) ? $lang['Username'] : $lang['Group_name'],
'L_USER_OR_GROUP' => ( $mode == 'user' ) ? $lang['User'] : $lang['Group'],
'L_AUTH_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'], 'L_AUTH_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'],
'L_AUTH_EXPLAIN' => ( $mode == 'user' ) ? $lang['User_auth_explain'] : $lang['Group_auth_explain'], 'L_AUTH_EXPLAIN' => ( $mode == 'user' ) ? $lang['User_auth_explain'] : $lang['Group_auth_explain'],
'L_MODERATOR_STATUS' => $lang['Moderator_status'], 'L_MODERATOR_STATUS' => $lang['Moderator_status'],
'L_PERMISSIONS' => $lang['Permissions'], 'L_PERMISSIONS' => $lang['Permissions'],
'L_SUBMIT' => $lang['Submit'], 'L_SUBMIT' => $lang['Submit'],
'L_RESET' => $lang['Reset'], 'L_RESET' => $lang['Reset'],
'L_FORUM' => $lang['Forum'],
'U_USER_OR_GROUP' => append_sid("admin_ug_auth.$phpEx"), 'U_USER_OR_GROUP' => append_sid("admin_ug_auth.$phpEx"),
'U_SWITCH_MODE' => $u_switch_mode, 'U_SWITCH_MODE' => $u_switch_mode,
@ -922,7 +922,7 @@ else
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />'; $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$l_type = ( $mode == 'user' ) ? "USER" : "AUTH"; $l_type = ( $mode == 'user' ) ? 'USER' : 'AUTH';
$template->assign_vars(array( $template->assign_vars(array(
'L_' . $l_type . '_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'], 'L_' . $l_type . '_TITLE' => ( $mode == 'user' ) ? $lang['Auth_Control_User'] : $lang['Auth_Control_Group'],

View file

@ -22,7 +22,7 @@
define('IN_PHPBB', 1); define('IN_PHPBB', 1);
if( !empty($setmodules) ) if ( !empty($setmodules) )
{ {
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['Users']['Ban_Management'] = $filename; $module['Users']['Ban_Management'] = $filename;
@ -33,38 +33,39 @@ if( !empty($setmodules) )
// //
// Load default header // Load default header
// //
$phpbb_root_path = "./../"; $phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc'); require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx); require('./pagestart.' . $phpEx);
// //
// Start program // Start program
// //
if( isset($HTTP_POST_VARS['submit']) ) if ( isset($HTTP_POST_VARS['submit']) )
{ {
$user_bansql = ""; $user_bansql = '';
$email_bansql = ""; $email_bansql = '';
$ip_bansql = ""; $ip_bansql = '';
$user_list = array(); $user_list = array();
if( isset($HTTP_POST_VARS['ban_user']) ) if ( !empty($HTTP_POST_VARS['username']) )
{ {
$user_list_temp = $HTTP_POST_VARS['ban_user']; $this_userdata = get_userdata($HTTP_POST_VARS['username']);
if( !$this_userdata )
for($i = 0; $i < count($user_list_temp); $i++)
{ {
$user_list[] = trim($user_list_temp[$i]); message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
} }
$user_list[] = $this_userdata['user_id'];
} }
$ip_list = array(); $ip_list = array();
if( isset($HTTP_POST_VARS['ban_ip']) ) if ( isset($HTTP_POST_VARS['ban_ip']) )
{ {
$ip_list_temp = explode(",", $HTTP_POST_VARS['ban_ip']); $ip_list_temp = explode(',', $HTTP_POST_VARS['ban_ip']);
for($i = 0; $i < count($ip_list_temp); $i++) for($i = 0; $i < count($ip_list_temp); $i++)
{ {
if( preg_match("/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", trim($ip_list_temp[$i]), $ip_range_explode) ) if ( preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode) )
{ {
// //
// Don't ask about all this, just don't ask ... ! // Don't ask about all this, just don't ask ... !
@ -72,12 +73,12 @@ if( isset($HTTP_POST_VARS['submit']) )
$ip_1_counter = $ip_range_explode[1]; $ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5]; $ip_1_end = $ip_range_explode[5];
while($ip_1_counter <= $ip_1_end) while ( $ip_1_counter <= $ip_1_end )
{ {
$ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; $ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
$ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; $ip_2_end = ( $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[6];
if($ip_2_counter == 0 && $ip_2_end == 254) if ( $ip_2_counter == 0 && $ip_2_end == 254 )
{ {
$ip_2_counter = 255; $ip_2_counter = 255;
$ip_2_fragment = 255; $ip_2_fragment = 255;
@ -85,12 +86,12 @@ if( isset($HTTP_POST_VARS['submit']) )
$ip_list[] = encode_ip("$ip_1_counter.255.255.255"); $ip_list[] = encode_ip("$ip_1_counter.255.255.255");
} }
while($ip_2_counter <= $ip_2_end) while ( $ip_2_counter <= $ip_2_end )
{ {
$ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; $ip_3_counter = ( $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
$ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; $ip_3_end = ( $ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end ) ? 254 : $ip_range_explode[7];
if($ip_3_counter == 0 && $ip_3_end == 254 ) if ( $ip_3_counter == 0 && $ip_3_end == 254 )
{ {
$ip_3_counter = 255; $ip_3_counter = 255;
$ip_3_fragment = 255; $ip_3_fragment = 255;
@ -98,12 +99,12 @@ if( isset($HTTP_POST_VARS['submit']) )
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.255.255"); $ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.255.255");
} }
while($ip_3_counter <= $ip_3_end) while ( $ip_3_counter <= $ip_3_end )
{ {
$ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; $ip_4_counter = ( $ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
$ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; $ip_4_end = ( $ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end ) ? 254 : $ip_range_explode[8];
if($ip_4_counter == 0 && $ip_4_end == 254) if ( $ip_4_counter == 0 && $ip_4_end == 254 )
{ {
$ip_4_counter = 255; $ip_4_counter = 255;
$ip_4_fragment = 255; $ip_4_fragment = 255;
@ -111,7 +112,7 @@ if( isset($HTTP_POST_VARS['submit']) )
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255"); $ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255");
} }
while($ip_4_counter <= $ip_4_end) while ( $ip_4_counter <= $ip_4_end )
{ {
$ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter"); $ip_list[] = encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter");
$ip_4_counter++; $ip_4_counter++;
@ -123,29 +124,29 @@ if( isset($HTTP_POST_VARS['submit']) )
$ip_1_counter++; $ip_1_counter++;
} }
} }
else if( preg_match("/^([\w\-_]\.?){2,}$/is", trim($ip_list_temp[$i])) ) else if ( preg_match('/^([\w\-_]\.?){2,}$/is', trim($ip_list_temp[$i])) )
{ {
$ip = gethostbynamel(trim($ip_list_temp[$i])); $ip = gethostbynamel(trim($ip_list_temp[$i]));
for($j = 0; $j < count($ip); $j++) for($j = 0; $j < count($ip); $j++)
{ {
if( !empty($ip[$j]) ) if ( !empty($ip[$j]) )
{ {
$ip_list[] = encode_ip($ip[$j]); $ip_list[] = encode_ip($ip[$j]);
} }
} }
} }
else if( preg_match("/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/", trim($ip_list_temp[$i])) ) else if ( preg_match('/^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$/', trim($ip_list_temp[$i])) )
{ {
$ip_list[] = encode_ip(str_replace("*", "255", trim($ip_list_temp[$i]))); $ip_list[] = encode_ip(str_replace('*', '255', trim($ip_list_temp[$i])));
} }
} }
} }
$email_list = array(); $email_list = array();
if(isset($HTTP_POST_VARS['ban_email'])) if ( isset($HTTP_POST_VARS['ban_email']) )
{ {
$email_list_temp = explode(",", $HTTP_POST_VARS['ban_email']); $email_list_temp = explode(',', $HTTP_POST_VARS['ban_email']);
for($i = 0; $i < count($email_list_temp); $i++) for($i = 0; $i < count($email_list_temp); $i++)
{ {
@ -154,7 +155,7 @@ if( isset($HTTP_POST_VARS['submit']) )
// contained in the annotated php manual at php.com (ereg // contained in the annotated php manual at php.com (ereg
// section) // section)
// //
if( eregi("^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$", trim($email_list_temp[$i])) ) if ( eregi('^(([[:alnum:]\*]+([-_.][[:alnum:]\*]+)*\.?)|(\*))@([[:alnum:]]+([-_]?[[:alnum:]]+)*\.){1,3}([[:alnum:]]{2,6})$', trim($email_list_temp[$i])) )
{ {
$email_list[] = trim($email_list_temp[$i]); $email_list[] = trim($email_list_temp[$i]);
} }
@ -163,32 +164,33 @@ if( isset($HTTP_POST_VARS['submit']) )
$sql = "SELECT * $sql = "SELECT *
FROM " . BANLIST_TABLE; FROM " . BANLIST_TABLE;
if( !$result = $db->sql_query($sql) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
} }
$current_banlist = $db->sql_fetchrowset($result); $current_banlist = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$kill_session_sql = ""; $kill_session_sql = '';
for($i = 0; $i < count($user_list); $i++) for($i = 0; $i < count($user_list); $i++)
{ {
$in_banlist = false; $in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++) for($j = 0; $j < count($current_banlist); $j++)
{ {
if($user_list[$i] == $current_banlist[$j]['ban_userid']) if ( $user_list[$i] == $current_banlist[$j]['ban_userid'] )
{ {
$in_banlist = true; $in_banlist = true;
} }
} }
if(!$in_banlist) if ( !$in_banlist )
{ {
$kill_session_sql .= ( ($kill_session_sql != "") ? " OR " : "" ) . "session_user_id = $user_list[$i]"; $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid) $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid)
VALUES (" . $user_list[$i] . ")"; VALUES (" . $user_list[$i] . ")";
if( !$result = $db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
} }
@ -200,28 +202,28 @@ if( isset($HTTP_POST_VARS['submit']) )
$in_banlist = false; $in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++) for($j = 0; $j < count($current_banlist); $j++)
{ {
if($ip_list[$i] == $current_banlist[$j]['ban_ip']) if ( $ip_list[$i] == $current_banlist[$j]['ban_ip'] )
{ {
$in_banlist = true; $in_banlist = true;
} }
} }
if(!$in_banlist) if ( !$in_banlist )
{ {
if( preg_match("/(ff\.)|(\.ff)/is", chunk_split($ip_list[$i], 2, ".")) ) if ( preg_match('/(ff\.)|(\.ff)/is', chunk_split($ip_list[$i], 2, '.')) )
{ {
$kill_ip_sql = "session_ip LIKE '" . str_replace(".", "", preg_replace("/(ff\.)|(\.ff)/is", "%", chunk_split($ip_list[$i], 2, "."))) . "'"; $kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff\.)|(\.ff)/is', '%', chunk_split($ip_list[$i], 2, "."))) . "'";
} }
else else
{ {
$kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'"; $kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
} }
$kill_session_sql .= ( ($kill_session_sql != "") ? " OR " : "" ) . $kill_ip_sql; $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip) $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip)
VALUES ('" . $ip_list[$i] . "')"; VALUES ('" . $ip_list[$i] . "')";
if( !$result = $db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
} }
@ -229,18 +231,15 @@ if( isset($HTTP_POST_VARS['submit']) )
} }
// //
// Now we'll delete all entries from the // Now we'll delete all entries from the session table with any of the banned
// session table with any of the banned // user or IP info just entered into the ban table ... this will force a session
// user or IP info just entered into the // initialisation resulting in an instant ban
// ban table ... this will force a session
// initialisation resulting in an instant
// ban
// //
if( $kill_session_sql != "" ) if ( $kill_session_sql != '' )
{ {
$sql = "DELETE FROM " . SESSIONS_TABLE . " $sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE $kill_session_sql"; WHERE $kill_session_sql";
if( !$result = $db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
} }
@ -251,87 +250,75 @@ if( isset($HTTP_POST_VARS['submit']) )
$in_banlist = false; $in_banlist = false;
for($j = 0; $j < count($current_banlist); $j++) for($j = 0; $j < count($current_banlist); $j++)
{ {
if( $email_list[$i] == $current_banlist[$j]['ban_email'] ) if ( $email_list[$i] == $current_banlist[$j]['ban_email'] )
{ {
$in_banlist = true; $in_banlist = true;
} }
} }
if( !$in_banlist ) if ( !$in_banlist )
{ {
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email) $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email)
VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')"; VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";
if( !$result = $db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't insert ban_email info into database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't insert ban_email info into database", "", __LINE__, __FILE__, $sql);
} }
} }
} }
$where_sql = ""; $where_sql = '';
if(isset($HTTP_POST_VARS['unban_user'])) if ( isset($HTTP_POST_VARS['unban_user']) )
{ {
$user_list = $HTTP_POST_VARS['unban_user']; $user_list = $HTTP_POST_VARS['unban_user'];
for($i = 0; $i < count($user_list); $i++) for($i = 0; $i < count($user_list); $i++)
{ {
if($user_list[$i] != -1) if ( $user_list[$i] != -1 )
{ {
if($where_sql != "") $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $user_list[$i];
{
$where_sql .= ", ";
}
$where_sql .= $user_list[$i];
} }
} }
} }
if( isset($HTTP_POST_VARS['unban_ip']) ) if ( isset($HTTP_POST_VARS['unban_ip']) )
{ {
$ip_list = $HTTP_POST_VARS['unban_ip']; $ip_list = $HTTP_POST_VARS['unban_ip'];
for($i = 0; $i < count($ip_list); $i++) for($i = 0; $i < count($ip_list); $i++)
{ {
if($ip_list[$i] != -1) if ( $ip_list[$i] != -1 )
{ {
if($where_sql != "") $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $ip_list[$i];
{
$where_sql .= ", ";
}
$where_sql .= $ip_list[$i];
} }
} }
} }
if( isset($HTTP_POST_VARS['unban_email']) ) if ( isset($HTTP_POST_VARS['unban_email']) )
{ {
$email_list = $HTTP_POST_VARS['unban_email']; $email_list = $HTTP_POST_VARS['unban_email'];
for($i = 0; $i < count($email_list); $i++) for($i = 0; $i < count($email_list); $i++)
{ {
if($email_list[$i] != -1) if ( $email_list[$i] != -1 )
{ {
if($where_sql != "") $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . $email_list[$i];
{
$where_sql .= ", ";
}
$where_sql .= $email_list[$i];
} }
} }
} }
if( $where_sql != "" ) if ( $where_sql != '' )
{ {
$sql = "DELETE FROM " . BANLIST_TABLE . " $sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_id IN ($where_sql)"; WHERE ban_id IN ($where_sql)";
if( !$result = $db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't delete ban info from database", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete ban info from database", "", __LINE__, __FILE__, $sql);
} }
} }
$message = $lang['Ban_update_sucessful'] . "<br /><br />" . sprintf($lang['Click_return_banadmin'], "<a href=\"" . append_sid("admin_user_ban.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); $message = $lang['Ban_update_sucessful'] . '<br /><br />' . sprintf($lang['Click_return_banadmin'], '<a href="' . append_sid("admin_user_ban.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
@ -354,37 +341,13 @@ else
'S_BANLIST_ACTION' => append_sid("admin_user_ban.$phpEx")) 'S_BANLIST_ACTION' => append_sid("admin_user_ban.$phpEx"))
); );
$userban_count = 0;
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY username ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);
}
$user_list = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$select_userlist = '';
for($i = 0; $i < count($user_list); $i++)
{
$select_userlist .= '<option value="' . $user_list[$i]['user_id'] . '">' . $user_list[$i]['username'] . '</option>';
$userban_count++;
}
$select_userlist = '<select name="ban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
$template->assign_vars(array( $template->assign_vars(array(
'L_BAN_USER' => $lang['Ban_username'], 'L_BAN_USER' => $lang['Ban_username'],
'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'], 'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'],
'L_BAN_IP' => $lang['Ban_IP'], 'L_BAN_IP' => $lang['Ban_IP'],
'L_BAN_IP_EXPLAIN' => $lang['Ban_IP_explain'], 'L_BAN_IP_EXPLAIN' => $lang['Ban_IP_explain'],
'L_BAN_EMAIL' => $lang['Ban_email'], 'L_BAN_EMAIL' => $lang['Ban_email'],
'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'], 'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'])
'S_BAN_USERLIST_SELECT' => $select_userlist)
); );
$userban_count = 0; $userban_count = 0;
@ -469,8 +432,12 @@ else
'L_UNBAN_IP' => $lang['Unban_IP'], 'L_UNBAN_IP' => $lang['Unban_IP'],
'L_UNBAN_IP_EXPLAIN' => $lang['Unban_IP_explain'], 'L_UNBAN_IP_EXPLAIN' => $lang['Unban_IP_explain'],
'L_UNBAN_EMAIL' => $lang['Unban_email'], 'L_UNBAN_EMAIL' => $lang['Unban_email'],
'L_UNBAN_EMAIL_EXPLAIN' => $lang['Unban_email_explain'], 'L_UNBAN_EMAIL_EXPLAIN' => $lang['Unban_email_explain'],
'L_USERNAME' => $lang['Username'],
'L_LOOK_UP' => $lang['Look_up_User'],
'L_FIND_USERNAME' => $lang['Find_username'],
'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"),
'S_UNBAN_USERLIST_SELECT' => $select_userlist, 'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT' => $select_iplist, 'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist, 'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,

View file

@ -159,10 +159,12 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
if( stripslashes($username) != $this_userdata['username'] ) if( stripslashes($username) != $this_userdata['username'] )
{ {
unset($rename_user); unset($rename_user);
if( !validate_username($username) )
$result = validate_username($username);
if ( $result['error'] )
{ {
$error = TRUE; $error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Invalid_username']; $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
} }
else else
{ {
@ -971,7 +973,7 @@ if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) |
'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'], 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
'L_SPECIAL' => $lang['User_special'], 'L_SPECIAL' => $lang['User_special'],
'L_SPECIAL_EXPLAIN' => $lang['User_specail_explain'], 'L_SPECIAL_EXPLAIN' => $lang['User_special_explain'],
'L_USER_ACTIVE' => $lang['User_status'], 'L_USER_ACTIVE' => $lang['User_status'],
'L_ALLOW_PM' => $lang['User_allowpm'], 'L_ALLOW_PM' => $lang['User_allowpm'],
'L_ALLOW_AVATAR' => $lang['User_allowavatar'], 'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
@ -1035,19 +1037,6 @@ else
// //
// Default user selection box // Default user selection box
// //
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS ."
ORDER BY username";
$result = $db->sql_query($sql);
$select_list = '<select name="' . POST_USERS_URL . '">';
while( $row = $db->sql_fetchrow($result) )
{
$select_list .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
}
$select_list .= '</select>';
$template->set_filenames(array( $template->set_filenames(array(
'body' => 'admin/user_select_body.tpl') 'body' => 'admin/user_select_body.tpl')
); );
@ -1059,7 +1048,7 @@ else
'L_LOOK_UP' => $lang['Look_up_user'], 'L_LOOK_UP' => $lang['Look_up_user'],
'L_FIND_USERNAME' => $lang['Find_username'], 'L_FIND_USERNAME' => $lang['Find_username'],
'U_SEARCH_USER' => append_sid("../search.$phpEx?mode=searchuser"), 'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"),
'S_USER_ACTION' => append_sid("admin_users.$phpEx"), 'S_USER_ACTION' => append_sid("admin_users.$phpEx"),
'S_USER_SELECT' => $select_list) 'S_USER_SELECT' => $select_list)
@ -1070,4 +1059,4 @@ else
include('./page_footer_admin.'.$phpEx); include('./page_footer_admin.'.$phpEx);
?> ?>

View file

@ -172,7 +172,7 @@ if( $mode != "" )
} }
else else
{ {
message_die(GENERAL_MESSAGE, $lang['Must_specify_word']); message_die(GENERAL_MESSAGE, $lang['No_word_selected']);
} }
} }
} }

View file

@ -62,7 +62,7 @@ if( $do_gzip_compress )
$gzip_contents = gzcompress($gzip_contents, 9); $gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo '\x1f\x8b\x08\x00\x00\x00\x00\x00'; echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents; echo $gzip_contents;
echo pack('V', $gzip_crc); echo pack('V', $gzip_crc);
echo pack('V', $gzip_size); echo pack('V', $gzip_size);

View file

@ -31,22 +31,22 @@ define('HEADER_INC', true);
// gzip_compression // gzip_compression
// //
$do_gzip_compress = FALSE; $do_gzip_compress = FALSE;
if($board_config['gzip_compress']) if ( $board_config['gzip_compress'] )
{ {
$phpver = phpversion(); $phpver = phpversion();
if($phpver >= '4.0.4pl1') if ( $phpver >= '4.0.4pl1' && strstr($HTTP_USER_AGENT,'compatible') )
{ {
if(extension_loaded('zlib')) if ( extension_loaded('zlib') )
{ {
ob_start('ob_gzhandler'); ob_start('ob_gzhandler');
} }
} }
else if($phpver > '4.0') else if ( $phpver > '4.0' )
{ {
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
{ {
if(extension_loaded('zlib')) if ( extension_loaded('zlib') )
{ {
$do_gzip_compress = TRUE; $do_gzip_compress = TRUE;
ob_start(); ob_start();
@ -72,30 +72,8 @@ $template->assign_vars(array(
'PAGE_TITLE' => $page_title, 'PAGE_TITLE' => $page_title,
'L_ADMIN' => $lang['Admin'], 'L_ADMIN' => $lang['Admin'],
'L_USERNAME' => $lang['Username'],
'L_PASSWORD' => $lang['Password'],
'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']), 'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
'L_REGISTER' => $lang['Register'],
'L_PROFILE' => $lang['Profile'],
'L_SEARCH' => $lang['Search'],
'L_PRIVATEMSGS' => $lang['Private_msgs'],
'L_MEMBERLIST' => $lang['Memberlist'],
'L_FAQ' => $lang['FAQ'], 'L_FAQ' => $lang['FAQ'],
'L_USERGROUPS' => $lang['Usergroups'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'],
'L_LASTPOST' => $lang['Last_Post'],
'L_MODERATOR' => $lang['Moderator'],
'L_NONEWPOSTS' => $lang['No_new_posts'],
'L_NEWPOSTS' => $lang['New_posts'],
'L_POSTED' => $lang['Posted'],
'L_JOINED' => $lang['Joined'],
'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'],
'L_BY' => $lang['by'],
'U_INDEX' => append_sid('../index.'.$phpEx), 'U_INDEX' => append_sid('../index.'.$phpEx),

View file

@ -198,14 +198,14 @@ function add_search_words($post_id, $post_text, $post_title = '')
{ {
case 'mysql': case 'mysql':
case 'mysql4': case 'mysql4':
$value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\')'; $value_sql .= ( ( $value_sql != '' ) ? ', ' : '' ) . '(\'' . $word[$i] . '\', 0)';
break; break;
case 'mssql': case 'mssql':
$value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "'"; $value_sql .= ( ( $value_sql != '' ) ? ' UNION ALL ' : '' ) . "SELECT '" . $word[$i] . "', 0";
break; break;
default: default:
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common)
VALUES ('" . $word[$i] . "')"; VALUES ('" . $word[$i] . "', 0)";
if( !$db->sql_query($sql) ) if( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not insert new word', '', __LINE__, __FILE__, $sql);
@ -221,11 +221,11 @@ function add_search_words($post_id, $post_text, $post_title = '')
{ {
case 'mysql': case 'mysql':
case 'mysql4': case 'mysql4':
$sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT IGNORE INTO " . SEARCH_WORD_TABLE . " (word_text, word_common)
VALUES $value_sql"; VALUES $value_sql";
break; break;
case 'mssql': case 'mssql':
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text, word_common)
$value_sql"; $value_sql";
break; break;
} }

View file

@ -162,7 +162,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
{ {
if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 ) if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
{ {
preg_match("'image\/[x\-]*([a-z]+)'", $avatar_filetype, $avatar_filetype); preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
$avatar_filetype = $avatar_filetype[1]; $avatar_filetype = $avatar_filetype[1];
} }
else else
@ -184,7 +184,7 @@ function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_typ
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'] )
{ {
$new_filename = ( ( $current_avatar != '' && $current_type == USER_AVATAR_UPLOAD ) && $mode != 'register' ) ? $current_avatar : uniqid($user_ip) . $imgtype; $new_filename = uniqid($user_ip) . $imgtype;
if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' ) if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
{ {

View file

@ -899,27 +899,30 @@ else
// of the templates to 'fake' an IF...ELSE...ENDIF solution // of the templates to 'fake' an IF...ELSE...ENDIF solution
// it works well :) // it works well :)
// //
if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) ) if ( $mode != 'register' )
{ {
$template->assign_block_vars('switch_avatar_block', array() ); if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
if ( $board_config['allow_avatar_upload'] && file_exists('./' . $board_config['avatar_path']) )
{ {
if ( $form_enctype != '' ) $template->assign_block_vars('switch_avatar_block', array() );
if ( $board_config['allow_avatar_upload'] && file_exists('./' . $board_config['avatar_path']) )
{ {
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() ); if ( $form_enctype != '' )
{
$template->assign_block_vars('switch_avatar_block.switch_avatar_local_upload', array() );
}
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
} }
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_upload', array() );
}
if ( $board_config['allow_avatar_remote'] ) if ( $board_config['allow_avatar_remote'] )
{ {
$template->assign_block_vars('switch_avatar_block.switch_avatar_remote_link', array() ); $template->assign_block_vars('switch_avatar_block.switch_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('switch_avatar_block.switch_avatar_local_gallery', array() ); $template->assign_block_vars('switch_avatar_block.switch_avatar_local_gallery', array() );
}
} }
} }
} }

View file

@ -68,29 +68,6 @@ else
$confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0; $confirm = ( $HTTP_POST_VARS['confirm'] ) ? TRUE : 0;
//
// Check if user did or did not confirm
// If they did not, forward them to the last page they were on
//
if ( isset($HTTP_POST_VARS['cancel']) )
{
if ( $topic_id )
{
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
}
else if ( $forum_id )
{
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
}
else
{
$redirect = "index.$phpEx";
}
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid($redirect, true));
}
// //
// Continue var definitions // Continue var definitions
// //
@ -176,6 +153,29 @@ init_userprefs($userdata);
// End session management // End session management
// //
//
// Check if user did or did not confirm
// If they did not, forward them to the last page they were on
//
if ( isset($HTTP_POST_VARS['cancel']) )
{
if ( $topic_id )
{
$redirect = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
}
else if ( $forum_id )
{
$redirect = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
}
else
{
$redirect = "index.$phpEx";
}
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid($redirect, true));
}
// //
// Start auth check // Start auth check
// //

View file

@ -68,6 +68,15 @@ else if ( $mode == 'smilies' )
exit; exit;
} }
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
// //
// Was cancel pressed? If so then redirect to the appropriate // Was cancel pressed? If so then redirect to the appropriate
// page, no point in continuing with any further checks // page, no point in continuing with any further checks
@ -96,19 +105,10 @@ if ( isset($HTTP_POST_VARS['cancel']) )
} }
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid($redirect) . $post_append, true); header($header_location . append_sid($redirect, true) . $post_append);
exit; exit;
} }
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
// //
// What auth type do we need to check? // What auth type do we need to check?
// //

View file

@ -407,7 +407,7 @@ else if ( $mode == 'read' )
$s_hidden_fields = '<input type="hidden" name="mark[]" value="' . $privmsgs_id . '" />'; $s_hidden_fields = '<input type="hidden" name="mark[]" value="' . $privmsgs_id . '" />';
$page_title = $lang['Read_private_message']; $page_title = $lang['Read_pm'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
@ -440,6 +440,7 @@ else if ( $mode == 'read' )
'BOX_NAME' => $l_box_name, 'BOX_NAME' => $l_box_name,
'L_MESSAGE' => $lang['Message'],
'L_INBOX' => $lang['Inbox'], 'L_INBOX' => $lang['Inbox'],
'L_OUTBOX' => $lang['Outbox'], 'L_OUTBOX' => $lang['Outbox'],
'L_SENTBOX' => $lang['Sent'], 'L_SENTBOX' => $lang['Sent'],
@ -1180,21 +1181,21 @@ else if ( $submit || $refresh || $mode != '' )
// //
if ( $mode == 'post' ) if ( $mode == 'post' )
{ {
$page_title = $lang['Send_new_privmsg']; $page_title = $lang['Post_new_pm'];
$user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : ''; $user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : '';
} }
else if ( $mode == 'reply' ) else if ( $mode == 'reply' )
{ {
$page_title = $lang['Reply_privmsg']; $page_title = $lang['Post_reply_pm'];
$user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : ''; $user_sig = ( $userdata['user_sig'] != '' && $board_config['allow_sig'] ) ? $userdata['user_sig'] : '';
} }
else if ( $mode == 'edit' ) else if ( $mode == 'edit' )
{ {
$page_title = $lang['Edit_privmsg']; $page_title = $lang['Edit_pm'];
$sql = "SELECT u.user_id, u.user_sig $sql = "SELECT u.user_id, u.user_sig
FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u FROM " . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u
@ -1209,7 +1210,7 @@ else if ( $submit || $refresh || $mode != '' )
{ {
if ( $userdata['user_id'] != $postrow['user_id'] ) if ( $userdata['user_id'] != $postrow['user_id'] )
{ {
message_die(GENERAL_MESSAGE, $lang['Sorry_edit_own_posts']); message_die(GENERAL_MESSAGE, $lang['Edit_own_posts']);
} }
$user_sig = ( $postrow['user_sig'] != '' && $board_config['allow_sig'] ) ? $postrow['user_sig'] : ''; $user_sig = ( $postrow['user_sig'] != '' && $board_config['allow_sig'] ) ? $postrow['user_sig'] : '';
@ -1808,7 +1809,7 @@ switch ( $folder )
$l_box_name = $lang['Outbox']; $l_box_name = $lang['Outbox'];
break; break;
case 'savebox': case 'savebox':
$l_box_name = $lang['Savedbox']; $l_box_name = $lang['Savebox'];
break; break;
case 'sentbox': case 'sentbox':
$l_box_name = $lang['Sentbox']; $l_box_name = $lang['Sentbox'];

View file

@ -3,13 +3,13 @@
<p>{L_BAN_EXPLAIN}</p> <p>{L_BAN_EXPLAIN}</p>
<form method="post" action="{S_BANLIST_ACTION}"><table width="80%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline"> <form method="post" name="post" action="{S_BANLIST_ACTION}"><table width="80%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
<tr> <tr>
<th class="thHead" colspan="2">{L_BAN_USER}</th> <th class="thHead" colspan="2">{L_BAN_USER}</th>
</tr> </tr>
<tr> <tr>
<td class="row1">{L_USERNAME}: <br /><span class="gensmall">{L_BAN_USER_EXPLAIN}</span></td> <td class="row1">{L_USERNAME}:</td>
<td class="row2">{S_BAN_USERLIST_SELECT}</td> <td class="row2"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS} <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
</tr> </tr>
<tr> <tr>
<th class="thHead" colspan="2">{L_UNBAN_USER}</th> <th class="thHead" colspan="2">{L_UNBAN_USER}</th>

View file

@ -208,10 +208,10 @@
<input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14" class="post" /> <input type="text" name="dateformat" value="{DATE_FORMAT}" maxlength="14" class="post" />
</td> </td>
</tr> </tr>
<!-- BEGIN switch_avatar_block -->
<tr> <tr>
<td class="catSides" colspan="2" height="28">&nbsp;</td> <td class="catSides" colspan="2" height="28">&nbsp;</td>
</tr> </tr>
<!-- BEGIN switch_avatar_block -->
<tr> <tr>
<th class="thSides" colspan="2" height="12" valign="middle">{L_AVATAR_PANEL}</th> <th class="thSides" colspan="2" height="12" valign="middle">{L_AVATAR_PANEL}</th>
</tr> </tr>