1 |
desultory 10/11/06 03:41:52 |
2 |
|
3 |
Modified: admin_user_ban.php |
4 |
Log: |
5 |
Allow use of a simplified template for prespecified targets. |
6 |
|
7 |
Revision Changes Path |
8 |
1.11 forums/htdocs/admin/admin_user_ban.php |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.11&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?rev=1.11&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/htdocs/admin/admin_user_ban.php?r1=1.10&r2=1.11 |
13 |
|
14 |
Index: admin_user_ban.php |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/forums/htdocs/admin/admin_user_ban.php,v |
17 |
retrieving revision 1.10 |
18 |
retrieving revision 1.11 |
19 |
diff -u -r1.10 -r1.11 |
20 |
--- admin_user_ban.php 6 Feb 2007 18:42:11 -0000 1.10 |
21 |
+++ admin_user_ban.php 6 Nov 2010 03:41:52 -0000 1.11 |
22 |
@@ -6,7 +6,7 @@ |
23 |
* copyright : (C) 2001 The phpBB Group |
24 |
* email : support@×××××.com |
25 |
* |
26 |
- * $Id: admin_user_ban.php,v 1.10 2007/02/06 18:42:11 tomk Exp $ |
27 |
+ * $Id: admin_user_ban.php,v 1.11 2010/11/06 03:41:52 desultory Exp $ |
28 |
* |
29 |
* |
30 |
***************************************************************************/ |
31 |
@@ -305,9 +305,22 @@ |
32 |
} |
33 |
else |
34 |
{ |
35 |
- $template->set_filenames(array( |
36 |
- 'body' => 'admin/user_ban_body.tpl') |
37 |
- ); |
38 |
+ $just_ban = ( isset($HTTP_GET_VARS['username']) || isset($HTTP_GET_VARS['ban_ip']) || isset($HTTP_GET_VARS['ban_email']) ); |
39 |
+ |
40 |
+ if ( $just_ban ) |
41 |
+ { |
42 |
+ $template->set_filenames(array( |
43 |
+ 'body' => 'admin/user_just_ban_body.tpl') |
44 |
+ ); |
45 |
+ 1; |
46 |
+ } |
47 |
+ else |
48 |
+ { |
49 |
+ $template->set_filenames(array( |
50 |
+ 'body' => 'admin/user_ban_body.tpl') |
51 |
+ ); |
52 |
+ } |
53 |
+ |
54 |
|
55 |
$hidden = $pane == '' ? '<input type="hidden" name="nopane" value="1">' : ''; |
56 |
|
57 |
@@ -333,109 +346,112 @@ |
58 |
'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain']) |
59 |
); |
60 |
|
61 |
- $userban_count = 0; |
62 |
- $ipban_count = 0; |
63 |
- $emailban_count = 0; |
64 |
- |
65 |
- $sql = "SELECT b.ban_id, u.user_id, u.username |
66 |
- FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u |
67 |
- WHERE u.user_id = b.ban_userid |
68 |
- AND b.ban_userid <> 0 |
69 |
- AND u.user_id <> " . ANONYMOUS . " |
70 |
- ORDER BY u.username ASC"; |
71 |
- // 2005-05-10 tomk - Order banned list by username |
72 |
- if ( !($result = $db->sql_query($sql)) ) |
73 |
+ if ( !$just_ban ) |
74 |
{ |
75 |
- message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql); |
76 |
- } |
77 |
+ $userban_count = 0; |
78 |
+ $ipban_count = 0; |
79 |
+ $emailban_count = 0; |
80 |
|
81 |
- $user_list = $db->sql_fetchrowset($result); |
82 |
- $db->sql_freeresult($result); |
83 |
+ $sql = "SELECT b.ban_id, u.user_id, u.username |
84 |
+ FROM " . BANLIST_TABLE . " b, " . USERS_TABLE . " u |
85 |
+ WHERE u.user_id = b.ban_userid |
86 |
+ AND b.ban_userid <> 0 |
87 |
+ AND u.user_id <> " . ANONYMOUS . " |
88 |
+ ORDER BY u.username ASC"; |
89 |
+ // 2005-05-10 tomk - Order banned list by username |
90 |
+ if ( !($result = $db->sql_query($sql)) ) |
91 |
+ { |
92 |
+ message_die(GENERAL_ERROR, 'Could not select current user_id ban list', '', __LINE__, __FILE__, $sql); |
93 |
+ } |
94 |
|
95 |
- $select_userlist = ''; |
96 |
- for($i = 0; $i < count($user_list); $i++) |
97 |
- { |
98 |
- $select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>'; |
99 |
- $userban_count++; |
100 |
- } |
101 |
+ $user_list = $db->sql_fetchrowset($result); |
102 |
+ $db->sql_freeresult($result); |
103 |
|
104 |
- if( $select_userlist == '' ) |
105 |
- { |
106 |
- $select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>'; |
107 |
- } |
108 |
+ $select_userlist = ''; |
109 |
+ for($i = 0; $i < count($user_list); $i++) |
110 |
+ { |
111 |
+ $select_userlist .= '<option value="' . $user_list[$i]['ban_id'] . '">' . $user_list[$i]['username'] . '</option>'; |
112 |
+ $userban_count++; |
113 |
+ } |
114 |
|
115 |
- $select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>'; |
116 |
+ if( $select_userlist == '' ) |
117 |
+ { |
118 |
+ $select_userlist = '<option value="-1">' . $lang['No_banned_users'] . '</option>'; |
119 |
+ } |
120 |
|
121 |
- // 2005-10-13 tomk - sort IPs and email addresses |
122 |
- $sql = "SELECT ban_id, ban_ip |
123 |
- FROM " . BANLIST_TABLE . " |
124 |
- WHERE ban_ip != '' |
125 |
- ORDER BY ban_ip"; |
126 |
- if ( !($result = $db->sql_query($sql)) ) |
127 |
- { |
128 |
- message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql); |
129 |
- } |
130 |
+ $select_userlist = '<select name="unban_user[]" multiple="multiple" size="5">' . $select_userlist . '</select>'; |
131 |
|
132 |
- $banlist = $db->sql_fetchrowset($result); |
133 |
- $db->sql_freeresult($result); |
134 |
+ // 2005-10-13 tomk - sort IPs and email addresses |
135 |
+ $sql = "SELECT ban_id, ban_ip |
136 |
+ FROM " . BANLIST_TABLE . " |
137 |
+ WHERE ban_ip != '' |
138 |
+ ORDER BY ban_ip"; |
139 |
+ if ( !($result = $db->sql_query($sql)) ) |
140 |
+ { |
141 |
+ message_die(GENERAL_ERROR, 'Could not select current ip ban list', '', __LINE__, __FILE__, $sql); |
142 |
+ } |
143 |
|
144 |
- $select_iplist = ''; |
145 |
+ $banlist = $db->sql_fetchrowset($result); |
146 |
+ $db->sql_freeresult($result); |
147 |
|
148 |
- for($i = 0; $i < count($banlist); $i++) |
149 |
- { |
150 |
- $ban_id = $banlist[$i]['ban_id']; |
151 |
+ $select_iplist = ''; |
152 |
|
153 |
- if ( !empty($banlist[$i]['ban_ip']) ) |
154 |
+ for($i = 0; $i < count($banlist); $i++) |
155 |
{ |
156 |
- // 2006-01-25 tomk - use CIDR format for IP ranges |
157 |
- $ban_ip = decode_ip($banlist[$i]['ban_ip']); |
158 |
+ $ban_id = $banlist[$i]['ban_id']; |
159 |
+ |
160 |
+ if ( !empty($banlist[$i]['ban_ip']) ) |
161 |
+ { |
162 |
+ // 2006-01-25 tomk - use CIDR format for IP ranges |
163 |
+ $ban_ip = decode_ip($banlist[$i]['ban_ip']); |
164 |
|
165 |
- $select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>'; |
166 |
- $ipban_count++; |
167 |
+ $select_iplist .= '<option value="' . $ban_id . '">' . $ban_ip . '</option>'; |
168 |
+ $ipban_count++; |
169 |
+ } |
170 |
} |
171 |
- } |
172 |
|
173 |
- if ( $select_iplist == '' ) |
174 |
- { |
175 |
- $select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>'; |
176 |
- } |
177 |
+ if ( $select_iplist == '' ) |
178 |
+ { |
179 |
+ $select_iplist = '<option value="-1">' . $lang['No_banned_ip'] . '</option>'; |
180 |
+ } |
181 |
|
182 |
- $select_emaillist = ''; |
183 |
+ $select_emaillist = ''; |
184 |
|
185 |
- $sql = "SELECT ban_id, ban_email |
186 |
- FROM " . BANLIST_TABLE . " |
187 |
- WHERE ban_email IS NOT NULL |
188 |
- ORDER BY ban_email"; |
189 |
- if ( !($result = $db->sql_query($sql)) ) |
190 |
- { |
191 |
- message_die(GENERAL_ERROR, 'Could not select current email ban list', '', __LINE__, __FILE__, $sql); |
192 |
- } |
193 |
+ $sql = "SELECT ban_id, ban_email |
194 |
+ FROM " . BANLIST_TABLE . " |
195 |
+ WHERE ban_email IS NOT NULL |
196 |
+ ORDER BY ban_email"; |
197 |
+ if ( !($result = $db->sql_query($sql)) ) |
198 |
+ { |
199 |
+ message_die(GENERAL_ERROR, 'Could not select current email ban list', '', __LINE__, __FILE__, $sql); |
200 |
+ } |
201 |
|
202 |
- $banlist = $db->sql_fetchrowset($result); |
203 |
- $db->sql_freeresult($result); |
204 |
+ $banlist = $db->sql_fetchrowset($result); |
205 |
+ $db->sql_freeresult($result); |
206 |
|
207 |
- $select_emaillist = ''; |
208 |
+ $select_emaillist = ''; |
209 |
|
210 |
- for($i = 0; $i < count($banlist); $i++) |
211 |
- { |
212 |
- $ban_id = $banlist[$i]['ban_id']; |
213 |
+ for($i = 0; $i < count($banlist); $i++) |
214 |
+ { |
215 |
+ $ban_id = $banlist[$i]['ban_id']; |
216 |
+ |
217 |
+ if ( !empty($banlist[$i]['ban_email']) ) |
218 |
+ { |
219 |
+ $ban_email = $banlist[$i]['ban_email']; |
220 |
+ $select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>'; |
221 |
+ $emailban_count++; |
222 |
+ } |
223 |
+ } |
224 |
|
225 |
- if ( !empty($banlist[$i]['ban_email']) ) |
226 |
+ if ( $select_emaillist == '' ) |
227 |
{ |
228 |
- $ban_email = $banlist[$i]['ban_email']; |
229 |
- $select_emaillist .= '<option value="' . $ban_id . '">' . $ban_email . '</option>'; |
230 |
- $emailban_count++; |
231 |
+ $select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>'; |
232 |
} |
233 |
- } |
234 |
|
235 |
- if ( $select_emaillist == '' ) |
236 |
- { |
237 |
- $select_emaillist = '<option value="-1">' . $lang['No_banned_email'] . '</option>'; |
238 |
+ $select_iplist = '<select name="unban_ip[]" multiple="multiple" size="5">' . $select_iplist . '</select>'; |
239 |
+ $select_emaillist = '<select name="unban_email[]" multiple="multiple" size="5">' . $select_emaillist . '</select>'; |
240 |
} |
241 |
|
242 |
- $select_iplist = '<select name="unban_ip[]" multiple="multiple" size="5">' . $select_iplist . '</select>'; |
243 |
- $select_emaillist = '<select name="unban_email[]" multiple="multiple" size="5">' . $select_emaillist . '</select>'; |
244 |
- |
245 |
$template->assign_vars(array( |
246 |
'L_UNBAN_USER' => $lang['Unban_username'], |
247 |
'L_UNBAN_USER_EXPLAIN' => $lang['Unban_username_explain'], |
248 |
@@ -448,11 +464,17 @@ |
249 |
'L_FIND_USERNAME' => $lang['Find_username'], |
250 |
|
251 |
'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"), |
252 |
- 'S_UNBAN_USERLIST_SELECT' => $select_userlist, |
253 |
- 'S_UNBAN_IPLIST_SELECT' => $select_iplist, |
254 |
- 'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist, |
255 |
'S_BAN_ACTION' => append_sid("admin_user_ban.$phpEx")) |
256 |
); |
257 |
+ |
258 |
+ if ( !$just_ban ) |
259 |
+ { |
260 |
+ $template->assign_vars(array( |
261 |
+ 'S_UNBAN_USERLIST_SELECT' => $select_userlist, |
262 |
+ 'S_UNBAN_IPLIST_SELECT' => $select_iplist, |
263 |
+ 'S_UNBAN_EMAILLIST_SELECT' => $select_emaillist) |
264 |
+ ); |
265 |
+ } |
266 |
} |
267 |
|
268 |
$template->pparse('body'); |