* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-06 3:41 Dean Stephens (desultory)
0 siblings, 0 replies; 9+ messages in thread
From: Dean Stephens (desultory) @ 2010-11-06 3:41 UTC (permalink / raw
To: gentoo-commits
desultory 10/11/06 03:41:52
Modified: admin_user_ban.php
Log:
Allow use of a simplified template for prespecified targets.
Revision Changes Path
1.11 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.11&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.11&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.10&r2=1.11
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- admin_user_ban.php 6 Feb 2007 18:42:11 -0000 1.10
+++ admin_user_ban.php 6 Nov 2010 03:41:52 -0000 1.11
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.10 2007/02/06 18:42:11 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.11 2010/11/06 03:41:52 desultory Exp $
*
*
***************************************************************************/
@@ -305,9 +305,22 @@
}
else
{
- $template->set_filenames(array(
- 'body' => 'admin/user_ban_body.tpl')
- );
+ $just_ban = ( isset($HTTP_GET_VARS['username']) || isset($HTTP_GET_VARS['ban_ip']) || isset($HTTP_GET_VARS['ban_email']) );
+
+ if ( $just_ban )
+ {
+ $template->set_filenames(array(
+ 'body' => 'admin/user_just_ban_body.tpl')
+ );
+ 1;
+ }
+ else
+ {
+ $template->set_filenames(array(
+ 'body' => 'admin/user_ban_body.tpl')
+ );
+ }
+
$hidden = $pane == '' ? '<input type="hidden" name="nopane" value="1">' : '';
@@ -333,109 +346,112 @@
'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'])
);
- $userban_count = 0;
- $ipban_count = 0;
- $emailban_count = 0;
-
- $sql = "SELECT b.ban_id, u.user_id, u.username
- FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
- WHERE u.user_id = b.ban_userid
- AND b.ban_userid <> 0
- AND u.user_id <> " . ANONYMOUS . "
- ORDER BY u.username ASC";
- // 2005-05-10 tomk - Order banned list by username
- if ( !($result = $db->sql_query($sql)) )
+ if ( !$just_ban )
{
- message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);
- }
+ $userban_count = 0;
+ $ipban_count = 0;
+ $emailban_count = 0;
- $user_list = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ $sql = "SELECT b.ban_id, u.user_id, u.username
+ FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
+ WHERE u.user_id = b.ban_userid
+ AND b.ban_userid <> 0
+ AND u.user_id <> " . ANONYMOUS . "
+ ORDER BY u.username ASC";
+ // 2005-05-10 tomk - Order banned list by username
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql);
+ }
- $select_userlist = '';
- for($i = 0; $i < count($user_list); $i++)
- {
- $select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
- $userban_count++;
- }
+ $user_list = $db->sql_fetchrowset($result);
+ $db->sql_freeresult($result);
- if( $select_userlist == '' )
- {
- $select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>';
- }
+ $select_userlist = '';
+ for($i = 0; $i < count($user_list); $i++)
+ {
+ $select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>';
+ $userban_count++;
+ }
- $select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
+ if( $select_userlist == '' )
+ {
+ $select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>';
+ }
- // 2005-10-13 tomk - sort IPs and email addresses
- $sql = "SELECT ban_id, ban_ip
- FROM " . BANLIST_TABLE . "
- WHERE ban_ip != ''
- ORDER BY ban_ip";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);
- }
+ $select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
- $banlist = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ // 2005-10-13 tomk - sort IPs and email addresses
+ $sql = "SELECT ban_id, ban_ip
+ FROM " . BANLIST_TABLE . "
+ WHERE ban_ip != ''
+ ORDER BY ban_ip";
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql);
+ }
- $select_iplist = '';
+ $banlist = $db->sql_fetchrowset($result);
+ $db->sql_freeresult($result);
- for($i = 0; $i < count($banlist); $i++)
- {
- $ban_id = $banlist[$i]['ban_id'];
+ $select_iplist = '';
- if ( !empty($banlist[$i]['ban_ip']) )
+ for($i = 0; $i < count($banlist); $i++)
{
- // 2006-01-25 tomk - use CIDR format for IP ranges
- $ban_ip = decode_ip($banlist[$i]['ban_ip']);
+ $ban_id = $banlist[$i]['ban_id'];
+
+ if ( !empty($banlist[$i]['ban_ip']) )
+ {
+ // 2006-01-25 tomk - use CIDR format for IP ranges
+ $ban_ip = decode_ip($banlist[$i]['ban_ip']);
- $select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
- $ipban_count++;
+ $select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>';
+ $ipban_count++;
+ }
}
- }
- if ( $select_iplist == '' )
- {
- $select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>';
- }
+ if ( $select_iplist == '' )
+ {
+ $select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>';
+ }
- $select_emaillist = '';
+ $select_emaillist = '';
- $sql = "SELECT ban_id, ban_email
- FROM " . BANLIST_TABLE . "
- WHERE ban_email IS NOT NULL
- ORDER BY ban_email";
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, 'Could not select current email ban list', '', __LINE__, __FILE__, $sql);
- }
+ $sql = "SELECT ban_id, ban_email
+ FROM " . BANLIST_TABLE . "
+ WHERE ban_email IS NOT NULL
+ ORDER BY ban_email";
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not select current email ban list', '', __LINE__, __FILE__, $sql);
+ }
- $banlist = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ $banlist = $db->sql_fetchrowset($result);
+ $db->sql_freeresult($result);
- $select_emaillist = '';
+ $select_emaillist = '';
- for($i = 0; $i < count($banlist); $i++)
- {
- $ban_id = $banlist[$i]['ban_id'];
+ for($i = 0; $i < count($banlist); $i++)
+ {
+ $ban_id = $banlist[$i]['ban_id'];
+
+ if ( !empty($banlist[$i]['ban_email']) )
+ {
+ $ban_email = $banlist[$i]['ban_email'];
+ $select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
+ $emailban_count++;
+ }
+ }
- if ( !empty($banlist[$i]['ban_email']) )
+ if ( $select_emaillist == '' )
{
- $ban_email = $banlist[$i]['ban_email'];
- $select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>';
- $emailban_count++;
+ $select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>';
}
- }
- if ( $select_emaillist == '' )
- {
- $select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>';
+ $select_iplist = '<select name="unban_ip[]" multiple="multiple" size="5">' . $select_iplist . '</select>';
+ $select_emaillist = '<select name="unban_email[]" multiple="multiple" size="5">' . $select_emaillist . '</select>';
}
- $select_iplist = '<select name="unban_ip[]" multiple="multiple" size="5">' . $select_iplist . '</select>';
- $select_emaillist = '<select name="unban_email[]" multiple="multiple" size="5">' . $select_emaillist . '</select>';
-
$template->assign_vars(array(
'L_UNBAN_USER' => $lang['Unban_username'],
'L_UNBAN_USER_EXPLAIN' => $lang['Unban_username_explain'],
@@ -448,11 +464,17 @@
'L_FIND_USERNAME' => $lang['Find_username'],
'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"),
- 'S_UNBAN_USERLIST_SELECT' => $select_userlist,
- 'S_UNBAN_IPLIST_SELECT' => $select_iplist,
- 'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist,
'S_BAN_ACTION' => append_sid("admin_user_ban.$phpEx"))
);
+
+ if ( !$just_ban )
+ {
+ $template->assign_vars(array(
+ 'S_UNBAN_USERLIST_SELECT' => $select_userlist,
+ 'S_UNBAN_IPLIST_SELECT' => $select_iplist,
+ 'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist)
+ );
+ }
}
$template->pparse('body');
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-17 21:33 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2010-11-17 21:33 UTC (permalink / raw
To: gentoo-commits
tomk 10/11/17 21:33:25
Modified: admin_user_ban.php
Log:
- Prevent ACP ban page hitting memory limit (tomk)
- Show bbcode snippet to add to ban report topic after banning user (tomk)
Revision Changes Path
1.12 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.12&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.12&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.11&r2=1.12
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- admin_user_ban.php 6 Nov 2010 03:41:52 -0000 1.11
+++ admin_user_ban.php 17 Nov 2010 21:33:25 -0000 1.12
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.11 2010/11/06 03:41:52 desultory Exp $
+ * $Id: admin_user_ban.php,v 1.12 2010/11/17 21:33:25 tomk Exp $
*
*
***************************************************************************/
@@ -52,6 +52,7 @@
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
+ $user_bbcode_snippet = '';
$user_list = array();
if ( !empty($HTTP_POST_VARS['username']) )
@@ -69,6 +70,9 @@
}
$user_list[] = $this_userdata['user_id'];
+
+ // 2010-11-17 tomk - Show bbcode snippet to add to ban report topic after banning user
+ $user_bbcode_snippet .= "\n[*][profile=" . $this_userdata['user_id'] . "]" . $this_userdata['username'] . "[/profile] -- ";
}
}
@@ -120,91 +124,57 @@
}
}
- $sql = "SELECT *
- FROM " . BANLIST_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
- }
-
- $current_banlist = $db->sql_fetchrowset($result);
- $db->sql_freeresult($result);
+ // 2010-11-17 tomk - Prevent ACP ban page hitting memory limit (by not coding like a braindead monkey)
$kill_session_sql = '';
for($i = 0; $i < count($user_list); $i++)
{
- $in_banlist = false;
- for($j = 0; $j < count($current_banlist); $j++)
- {
- if ( $user_list[$i] == $current_banlist[$j]['ban_userid'] )
- {
- $in_banlist = true;
- break;
- }
- }
+ $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
- if ( !$in_banlist )
+ $sql = "INSERT IGNORE INTO " . BANLIST_TABLE . " (ban_userid)
+ VALUES (" . $user_list[$i] . ")";
+ if ( !$db->sql_query($sql) )
{
- $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "session_user_id = " . $user_list[$i];
-
- $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_userid)
- VALUES (" . $user_list[$i] . ")";
- 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);
}
}
for($i = 0; $i < count($ip_list); $i++)
{
- $in_banlist = false;
- for($j = 0; $j < count($current_banlist); $j++)
+ // 2006-01-29 tomk - use CIDR format for IP ranges
+ if ( strpos($ip_list[$i], '/') !== FALSE )
{
- if ( $ip_list[$i] == $current_banlist[$j]['ban_ip'] )
+ $limit = $board_config['min_cidr_block_size'] % 4 == 0 ? $board_config['min_cidr_block_size'] / 4 : ( $board_config['min_cidr_block_size'] / 4 ) + 1;
+
+ $sql = "SELECT session_id, session_ip
+ FROM " . SESSIONS_TABLE . "
+ WHERE LEFT(session_ip, $limit) = '" . substr($user_ip, 0, $limit) . "'";
+
+ if ( !($result = $db->sql_query($sql)) )
{
- $in_banlist = true;
- break;
+ message_die(CRITICAL_ERROR, 'Could not obtain session ban information', '', __LINE__, __FILE__, $sql);
}
- }
- if ( !$in_banlist )
- {
- // 2006-01-29 tomk - use CIDR format for IP ranges
- if ( strpos($ip_list[$i], '/') !== FALSE )
+ while ( $row = $db->sql_fetchrow($result) )
{
- $limit = $board_config['min_cidr_block_size'] % 4 == 0 ? $board_config['min_cidr_block_size'] / 4 : ( $board_config['min_cidr_block_size'] / 4 ) + 1;
-
- $sql = "SELECT session_id, session_ip
- FROM " . SESSIONS_TABLE . "
- WHERE LEFT(session_ip, $limit) = '" . substr($user_ip, 0, $limit) . "'";
-
- if ( !($result = $db->sql_query($sql)) )
+ if ( do_ips_match($row['session_ip'], $user_ip))
{
- message_die(CRITICAL_ERROR, 'Could not obtain session ban information', '', __LINE__, __FILE__, $sql);
- }
-
- while ( $row = $db->sql_fetchrow($result) )
- {
- if ( do_ips_match($row['session_ip'], $user_ip))
- {
- $kill_ip_sql = "session_id = '" . $row['session_id'] . "'";
- $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
- }
+ $kill_ip_sql = "session_id = '" . $row['session_id'] . "'";
+ $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
}
}
- else
- {
- $kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
- $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
- }
+ }
+ else
+ {
+ $kill_ip_sql = "session_ip = '" . $ip_list[$i] . "'";
+ $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
+ }
- $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip)
- VALUES ('" . $ip_list[$i] . "')";
- if ( !$db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
- }
+ $sql = "INSERT IGNORE INTO " . BANLIST_TABLE . " (ban_ip)
+ VALUES ('" . $ip_list[$i] . "')";
+ if ( !$db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
}
}
@@ -225,24 +195,11 @@
for($i = 0; $i < count($email_list); $i++)
{
- $in_banlist = false;
- for($j = 0; $j < count($current_banlist); $j++)
- {
- if ( $email_list[$i] == $current_banlist[$j]['ban_email'] )
- {
- $in_banlist = true;
- break;
- }
- }
-
- if ( !$in_banlist )
+ $sql = "INSERT IGNORE INTO " . BANLIST_TABLE . " (ban_email)
+ VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";
+ if ( !$db->sql_query($sql) )
{
- $sql = "INSERT INTO " . BANLIST_TABLE . " (ban_email)
- VALUES ('" . str_replace("\'", "''", $email_list[$i]) . "')";
- 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);
}
}
@@ -300,6 +257,8 @@
// 2006-03-14 tomk - return to the admin index frame on success
$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") . '">', '</a>');
+ $message .= $user_bbcode_snippet;
+
message_die(GENERAL_MESSAGE, $message);
}
@@ -312,7 +271,6 @@
$template->set_filenames(array(
'body' => 'admin/user_just_ban_body.tpl')
);
- 1;
}
else
{
@@ -321,7 +279,6 @@
);
}
-
$hidden = $pane == '' ? '<input type="hidden" name="nopane" value="1">' : '';
$template->assign_vars(array(
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-17 21:37 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2010-11-17 21:37 UTC (permalink / raw
To: gentoo-commits
tomk 10/11/17 21:37:17
Modified: admin_user_ban.php
Log:
use HTML to display bbcode snippet
Revision Changes Path
1.13 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.13&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.13&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.12&r2=1.13
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- admin_user_ban.php 17 Nov 2010 21:33:25 -0000 1.12
+++ admin_user_ban.php 17 Nov 2010 21:37:17 -0000 1.13
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.12 2010/11/17 21:33:25 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.13 2010/11/17 21:37:17 tomk Exp $
*
*
***************************************************************************/
@@ -72,7 +72,7 @@
$user_list[] = $this_userdata['user_id'];
// 2010-11-17 tomk - Show bbcode snippet to add to ban report topic after banning user
- $user_bbcode_snippet .= "\n[*][profile=" . $this_userdata['user_id'] . "]" . $this_userdata['username'] . "[/profile] -- ";
+ $user_bbcode_snippet .= "<br /><tt>[*][profile=" . $this_userdata['user_id'] . "]" . $this_userdata['username'] . "[/profile] -- </tt>";
}
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-17 21:48 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2010-11-17 21:48 UTC (permalink / raw
To: gentoo-commits
tomk 10/11/17 21:48:35
Modified: admin_user_ban.php
Log:
html encode username
Revision Changes Path
1.14 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.13&r2=1.14
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- admin_user_ban.php 17 Nov 2010 21:37:17 -0000 1.13
+++ admin_user_ban.php 17 Nov 2010 21:48:35 -0000 1.14
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.13 2010/11/17 21:37:17 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.14 2010/11/17 21:48:35 tomk Exp $
*
*
***************************************************************************/
@@ -72,7 +72,7 @@
$user_list[] = $this_userdata['user_id'];
// 2010-11-17 tomk - Show bbcode snippet to add to ban report topic after banning user
- $user_bbcode_snippet .= "<br /><tt>[*][profile=" . $this_userdata['user_id'] . "]" . $this_userdata['username'] . "[/profile] -- </tt>";
+ $user_bbcode_snippet .= "<br /><tt>[*][profile=" . $this_userdata['user_id'] . "]" . htmlspecialchars($this_userdata['username']) . "[/profile] -- </tt>";
}
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-18 10:44 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2010-11-18 10:44 UTC (permalink / raw
To: gentoo-commits
tomk 10/11/18 10:44:09
Modified: admin_user_ban.php
Log:
extra line break
Revision Changes Path
1.15 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.15&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.15&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.14&r2=1.15
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- admin_user_ban.php 17 Nov 2010 21:48:35 -0000 1.14
+++ admin_user_ban.php 18 Nov 2010 10:44:09 -0000 1.15
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.14 2010/11/17 21:48:35 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.15 2010/11/18 10:44:09 tomk Exp $
*
*
***************************************************************************/
@@ -52,7 +52,7 @@
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';
- $user_bbcode_snippet = '';
+ $user_bbcode_snippet = '<br />';
$user_list = array();
if ( !empty($HTTP_POST_VARS['username']) )
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2010-11-20 22:53 Dean Stephens (desultory)
0 siblings, 0 replies; 9+ messages in thread
From: Dean Stephens (desultory) @ 2010-11-20 22:53 UTC (permalink / raw
To: gentoo-commits
desultory 10/11/20 22:53:49
Modified: admin_user_ban.php
Log:
Change user unban to use textfield
Revision Changes Path
1.16 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.15&r2=1.16
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- admin_user_ban.php 18 Nov 2010 10:44:09 -0000 1.15
+++ admin_user_ban.php 20 Nov 2010 22:53:49 -0000 1.16
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.15 2010/11/18 10:44:09 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.16 2010/11/20 22:53:49 desultory Exp $
*
*
***************************************************************************/
@@ -207,14 +207,28 @@
if ( isset($HTTP_POST_VARS['unban_user']) )
{
- $user_list = $HTTP_POST_VARS['unban_user'];
+ // 2010-11-19 desultory - switch to comma separated list from multiple selection, like ban logic above
+ $user_list = explode( ',', $HTTP_POST_VARS['unban_user']);
+ $unban_userids = '';
for($i = 0; $i < count($user_list); $i++)
{
- if ( $user_list[$i] != -1 )
+ $userdata = get_userdata($user_list[$i], true);
+
+ if ( !$userdata )
{
- $where_sql .= ( ( $where_sql != '' ) ? ', ' : '' ) . intval($user_list[$i]);
+ message_die(GENERAL_MESSAGE, sprintf($lang['This_user_not_exist'], trim($user_list[$i])) . '<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") . '">', '</a>') );
}
+
+ $unban_userids .= ( ( $unban_userids != '' ) ? ', ' : '' ) . $userdata['user_id'];
+ }
+
+ $sql = "DELETE FROM " . BANLIST_TABLE . "
+ WHERE ban_userid IN ($unban_userids);";
+
+ if ( !$db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't delete ban info from database", "", __LINE__, __FILE__, $sql);
}
}
@@ -264,7 +278,8 @@
}
else
{
- $just_ban = ( isset($HTTP_GET_VARS['username']) || isset($HTTP_GET_VARS['ban_ip']) || isset($HTTP_GET_VARS['ban_email']) );
+ // 2010-11-06 desultory - use a simplified template when banning a prespecified target
+ $just_ban = ( isset($HTTP_GET_VARS['username']) || isset($HTTP_GET_VARS['reg_ip']) || isset($HTTP_GET_VARS['email']) );
if ( $just_ban )
{
@@ -292,6 +307,7 @@
'S_BANLIST_ACTION' => append_sid("admin_user_ban.$phpEx"),
'S_USERNAME' => $HTTP_GET_VARS['username'],
'S_REG_IP' => $HTTP_GET_VARS['reg_ip'],
+ 'S_EMAIL' => $HTTP_GET_VARS['email'],
'S_HIDDEN' => $hidden,
'L_BAN_USER' => $lang['Ban_username'],
@@ -305,10 +321,12 @@
if ( !$just_ban )
{
- $userban_count = 0;
+ //$userban_count = 0;
$ipban_count = 0;
$emailban_count = 0;
+ // 2010-11-19 desultory - no need to populate a list we aren't going to use
+ /*
$sql = "SELECT b.ban_id, u.user_id, u.username
FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u
WHERE u.user_id = b.ban_userid
@@ -337,6 +355,7 @@
}
$select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>';
+ */
// 2005-10-13 tomk - sort IPs and email addresses
$sql = "SELECT ban_id, ban_ip
@@ -427,7 +446,7 @@
if ( !$just_ban )
{
$template->assign_vars(array(
- 'S_UNBAN_USERLIST_SELECT' => $select_userlist,
+ 'S_UNBAN_USER' => $HTTP_GET_VARS['unban_user'],
'S_UNBAN_IPLIST_SELECT' => $select_iplist,
'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist)
);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2011-01-18 12:02 Dean Stephens (desultory)
0 siblings, 0 replies; 9+ messages in thread
From: Dean Stephens (desultory) @ 2011-01-18 12:02 UTC (permalink / raw
To: gentoo-commits
desultory 11/01/18 12:02:12
Modified: admin_user_ban.php
Log:
IP ban session dropping bugfix
Revision Changes Path
1.17 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.17&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.17&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.16&r2=1.17
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- admin_user_ban.php 20 Nov 2010 22:53:49 -0000 1.16
+++ admin_user_ban.php 18 Jan 2011 12:02:12 -0000 1.17
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.16 2010/11/20 22:53:49 desultory Exp $
+ * $Id: admin_user_ban.php,v 1.17 2011/01/18 12:02:12 desultory Exp $
*
*
***************************************************************************/
@@ -142,25 +142,36 @@
for($i = 0; $i < count($ip_list); $i++)
{
// 2006-01-29 tomk - use CIDR format for IP ranges
- if ( strpos($ip_list[$i], '/') !== FALSE )
+ // 2011-01 desultory - same, but different, with bug fixing
+ if ( count( $tuple = explode( '/', $ip_list[$i]) ) > 1 )
{
- $limit = $board_config['min_cidr_block_size'] % 4 == 0 ? $board_config['min_cidr_block_size'] / 4 : ( $board_config['min_cidr_block_size'] / 4 ) + 1;
-
- $sql = "SELECT session_id, session_ip
- FROM " . SESSIONS_TABLE . "
- WHERE LEFT(session_ip, $limit) = '" . substr($user_ip, 0, $limit) . "'";
-
- if ( !($result = $db->sql_query($sql)) )
+ if ( count($tuple) > 2 )
+ {
+ message_die(GENERAL_ERROR, 'Invalid IP ban format in: "'.$ip_list[$i].'"', __LINE__, __FILE__);
+ }
+ if ( $tuple[1] < $board_config['min_cidr_block_size'] )
{
- message_die(CRITICAL_ERROR, 'Could not obtain session ban information', '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Too Inclusive a netmask in: "'.$ip_list[$i].'"', __LINE__, __FILE__, 'Most inclusive currently allowed mask: '.$board_config['min_cidr_block_size'] );
}
+ list($address) = sscanf( $tuple[0], '%x' );
+ list($mask) = sscanf( $tuple[1], '%d' );
+ $mask_nybbles = $mask / 4;
+ $head_nybbles = substr( $tuple[0], 0, $mask_nybbles );
+ $extra_bits = $mask % 4;
- while ( $row = $db->sql_fetchrow($result) )
+ if ( $extra_bits == 0 )
{
- if ( do_ips_match($row['session_ip'], $user_ip))
+ $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . "LEFT(session_ip, $mask_nybbles) = '$head_nybbles'";
+ }
+ else
+ {
+ $source_nybble = (($address >> $mask) << $extra_bits )& 0xf;
+ $match_bits = 1 << (4 - $extra_bits);
+
+ while ( $match_bits > 0 )
{
- $kill_ip_sql = "session_id = '" . $row['session_id'] . "'";
- $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . $kill_ip_sql;
+ $match_bits--;
+ $kill_session_sql .= ( ( $kill_session_sql != '' ) ? ' OR ' : '' ) . sprintf( "LEFT(session_ip, %d) = '%s%x'" , $mask_nybbles + 1, $head_nybbles, ($source_nybble | $match_bits ) );
}
}
}
@@ -205,7 +216,7 @@
$where_sql = '';
- if ( isset($HTTP_POST_VARS['unban_user']) )
+ if ( !empty($HTTP_POST_VARS['unban_user']) )
{
// 2010-11-19 desultory - switch to comma separated list from multiple selection, like ban logic above
$user_list = explode( ',', $HTTP_POST_VARS['unban_user']);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2011-02-21 10:32 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2011-02-21 10:32 UTC (permalink / raw
To: gentoo-commits
tomk 11/02/21 10:32:57
Modified: admin_user_ban.php
Log:
Added 'mark as spammer' to ban page to add spammer to stopforumspam.com
Revision Changes Path
1.18 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.18&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.18&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.17&r2=1.18
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- admin_user_ban.php 18 Jan 2011 12:02:12 -0000 1.17
+++ admin_user_ban.php 21 Feb 2011 10:32:57 -0000 1.18
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.17 2011/01/18 12:02:12 desultory Exp $
+ * $Id: admin_user_ban.php,v 1.18 2011/02/21 10:32:57 tomk Exp $
*
*
***************************************************************************/
@@ -53,6 +53,7 @@
$email_bansql = '';
$ip_bansql = '';
$user_bbcode_snippet = '<br />';
+ $is_spammer = false;
$user_list = array();
if ( !empty($HTTP_POST_VARS['username']) )
@@ -74,6 +75,9 @@
// 2010-11-17 tomk - Show bbcode snippet to add to ban report topic after banning user
$user_bbcode_snippet .= "<br /><tt>[*][profile=" . $this_userdata['user_id'] . "]" . htmlspecialchars($this_userdata['username']) . "[/profile] -- </tt>";
}
+
+ // 2011-02-21 tomk - is_spammer only makes sense for users
+ $is_spammer = isset($HTTP_POST_VARS['is_spammer']);
}
$ip_list = array();
@@ -137,6 +141,28 @@
{
message_die(GENERAL_ERROR, "Couldn't insert ban_userid info into database", "", __LINE__, __FILE__, $sql);
}
+
+ // 2011-02-21 tomk - Added 'mark as spammer' to ban page to add spammer to stopforumspam.com
+ if ($is_spammer)
+ {
+ include_once($phpbb_root_path . 'includes/stopforumspam.'.$phpEx);
+
+ // get required details
+ $sql = "SELECT username, user_email, user_reg_ip, user_website, user_sig
+ FROM " . USERS_TABLE . "
+ WHERE user_id = " . $user_list[$i];
+
+ if ( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not select spammer information', '', __LINE__, __FILE__, $sql);
+ }
+
+ $spammer = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // post to stopforumspam API
+ stopforumspam_add_spammer($spammer['username'], $spammer['user_email'], decode_ip($spammer['user_reg_ip']), $pammer['user_website'], $spammer['user_sig']);
+ }
}
for($i = 0; $i < count($ip_list); $i++)
@@ -305,6 +331,9 @@
);
}
+ // 2011-02-21 tomk - default spammer to true if the username is already set
+ $is_spammer_checked = isset($HTTP_GET_VARS['username']) ? 'checked="checked"' : '';
+
$hidden = $pane == '' ? '<input type="hidden" name="nopane" value="1">' : '';
$template->assign_vars(array(
@@ -320,6 +349,7 @@
'S_REG_IP' => $HTTP_GET_VARS['reg_ip'],
'S_EMAIL' => $HTTP_GET_VARS['email'],
'S_HIDDEN' => $hidden,
+ 'S_IS_SPAMMER' => $is_spammer_checked,
'L_BAN_USER' => $lang['Ban_username'],
'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'],
@@ -327,7 +357,9 @@
'L_BAN_IP' => $lang['Ban_IP'],
'L_BAN_IP_EXPLAIN' => sprintf($lang['Ban_IP_explain_cidr'], $board_config['min_cidr_block_size']),
'L_BAN_EMAIL' => $lang['Ban_email'],
- 'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'])
+ 'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'],
+ 'L_IS_SPAMMER' => $lang['Is_spammer'],
+ 'L_IS_SPAMMER_EXPLAIN' => $lang['Is_spammer_explain'])
);
if ( !$just_ban )
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php
@ 2011-03-01 17:00 Tom Knight (tomk)
0 siblings, 0 replies; 9+ messages in thread
From: Tom Knight (tomk) @ 2011-03-01 17:00 UTC (permalink / raw
To: gentoo-commits
tomk 11/03/01 17:00:44
Modified: admin_user_ban.php
Log:
typo + ignore unhelpful error message
Revision Changes Path
1.19 forums/htdocs/admin/admin_user_ban.php
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.19&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.19&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.18&r2=1.19
Index: admin_user_ban.php
===================================================================
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- admin_user_ban.php 21 Feb 2011 10:32:57 -0000 1.18
+++ admin_user_ban.php 1 Mar 2011 17:00:44 -0000 1.19
@@ -6,7 +6,7 @@
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
- * $Id: admin_user_ban.php,v 1.18 2011/02/21 10:32:57 tomk Exp $
+ * $Id: admin_user_ban.php,v 1.19 2011/03/01 17:00:44 tomk Exp $
*
*
***************************************************************************/
@@ -161,7 +161,7 @@
$db->sql_freeresult($result);
// post to stopforumspam API
- stopforumspam_add_spammer($spammer['username'], $spammer['user_email'], decode_ip($spammer['user_reg_ip']), $pammer['user_website'], $spammer['user_sig']);
+ stopforumspam_add_spammer($spammer['username'], $spammer['user_email'], decode_ip($spammer['user_reg_ip']), $spammer['user_website'], $spammer['user_sig']);
}
}
@@ -226,7 +226,8 @@
WHERE $kill_session_sql";
if ( !$db->sql_query($sql) )
{
- message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
+ // 2011-03-01 tomk - not sure why this doesn't work sometimes but we can ignore this message for now
+ //message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
}
}
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-03-01 17:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21 10:32 [gentoo-commits] gentoo-projects commit in forums/htdocs/admin: admin_user_ban.php Tom Knight (tomk)
-- strict thread matches above, loose matches on Subject: below --
2011-03-01 17:00 Tom Knight (tomk)
2011-01-18 12:02 Dean Stephens (desultory)
2010-11-20 22:53 Dean Stephens (desultory)
2010-11-18 10:44 Tom Knight (tomk)
2010-11-17 21:48 Tom Knight (tomk)
2010-11-17 21:37 Tom Knight (tomk)
2010-11-17 21:33 Tom Knight (tomk)
2010-11-06 3:41 Dean Stephens (desultory)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox