Changeset 3 for branches/rsr.v5.1.dev/web/punbb/admin_users.php
- Timestamp:
- Nov 14, 2011, 11:17:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/admin_users.php
r1 r3 1 1 <?php 2 /*********************************************************************** 3 4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) 5 6 This file is part of PunBB. 7 8 PunBB is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 PunBB is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 MA 02111-1307 USA 22 23 ************************************************************************/ 24 2 3 /** 4 * Copyright (C) 2008-2011 FluxBB 5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB 6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 7 */ 25 8 26 9 // Tell header.php to use the admin template 27 10 define('PUN_ADMIN_CONSOLE', 1); 28 11 29 define('PUN_ROOT', './');12 define('PUN_ROOT', dirname(__FILE__).'/'); 30 13 require PUN_ROOT.'include/common.php'; 31 14 require PUN_ROOT.'include/common_admin.php'; 32 15 33 16 34 if ( $pun_user['g_id'] > PUN_MOD)17 if (!$pun_user['is_admmod']) 35 18 message($lang_common['No permission']); 36 19 20 // Load the admin_users.php language file 21 require PUN_ROOT.'lang/'.$admin_language.'/admin_users.php'; 37 22 38 23 // Show IP statistics for a certain user ID … … 43 28 message($lang_common['Bad request']); 44 29 45 46 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Utilisateurs'; 30 // Fetch ip count 31 $result = $db->query('SELECT poster_ip, MAX(posted) AS last_used FROM '.$db->prefix.'posts WHERE poster_id='.$ip_stats.' GROUP BY poster_ip') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 32 $num_ips = $db->num_rows($result); 33 34 // Determine the ip offset (based on $_GET['p']) 35 $num_pages = ceil($num_ips / 50); 36 37 $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']); 38 $start_from = 50 * ($p - 1); 39 40 // Generate paging links 41 $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?ip_stats='.$ip_stats ); 42 43 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); 44 define('PUN_ACTIVE_PAGE', 'admin'); 47 45 require PUN_ROOT.'header.php'; 48 46 49 47 ?> 50 48 <div class="linkst"> 51 <div class="inbox"> 52 <div><a href="javascript:history.go(-1)">Retour</a></div> 49 <div class="inbox crumbsplus"> 50 <ul class="crumbs"> 51 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 52 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 53 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 54 </ul> 55 <div class="pagepost"> 56 <p class="pagelink"><?php echo $paging_links ?></p> 57 </div> 58 <div class="clearer"></div> 53 59 </div> 54 60 </div> 55 61 56 62 <div id="users1" class="blocktable"> 57 <h2><span> Utilisateurs</span></h2>63 <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> 58 64 <div class="box"> 59 65 <div class="inbox"> … … 61 67 <thead> 62 68 <tr> 63 <th class="tcl" scope="col"> Adresse <acronym title="Internet Protocol" lang="en">IP</acronym></th>64 <th class="tc2" scope="col"> DerniÚre visite</th>65 <th class="tc3" scope="col"> Occurences</th>66 <th class="tcr" scope="col"> Action</th>69 <th class="tcl" scope="col"><?php echo $lang_admin_users['Results IP address head'] ?></th> 70 <th class="tc2" scope="col"><?php echo $lang_admin_users['Results last used head'] ?></th> 71 <th class="tc3" scope="col"><?php echo $lang_admin_users['Results times found head'] ?></th> 72 <th class="tcr" scope="col"><?php echo $lang_admin_users['Results action head'] ?></th> 67 73 </tr> 68 74 </thead> … … 70 76 <?php 71 77 72 $result = $db->query('SELECT poster_ip, MAX(posted) AS last_used, COUNT(id) AS used_times FROM '.$db->prefix.'posts WHERE poster_id='.$ip_stats.' GROUP BY poster_ip ORDER BY last_used DESC ') or error('Impossible de retrouver les informations des messages', __FILE__, __LINE__, $db->error());78 $result = $db->query('SELECT poster_ip, MAX(posted) AS last_used, COUNT(id) AS used_times FROM '.$db->prefix.'posts WHERE poster_id='.$ip_stats.' GROUP BY poster_ip ORDER BY last_used DESC LIMIT '.$start_from.', 50') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 73 79 if ($db->num_rows($result)) 74 80 { … … 81 87 <td class="tc2"><?php echo format_time($cur_ip['last_used']) ?></td> 82 88 <td class="tc3"><?php echo $cur_ip['used_times'] ?></td> 83 <td class="tcr"><a href="admin_users.php?show_users=<?php echo $cur_ip['poster_ip'] ?>"> Trouver plus d'utilisateur pour cette <acronym title="Internet Protocol" lang="en">IP</acronym></a></td>89 <td class="tcr"><a href="admin_users.php?show_users=<?php echo $cur_ip['poster_ip'] ?>"><?php echo $lang_admin_users['Results find more link'] ?></a></td> 84 90 </tr> 85 91 <?php … … 88 94 } 89 95 else 90 echo "\t\t\t\t".'<tr><td class="tcl" colspan="4"> Il n\'y a actuellement aucun message de cet utilisateur dans les forums.</td></tr>'."\n";96 echo "\t\t\t\t".'<tr><td class="tcl" colspan="4">'.$lang_admin_users['Results no posts found'].'</td></tr>'."\n"; 91 97 92 98 ?> … … 98 104 99 105 <div class="linksb"> 100 <div class="inbox"> 101 <div><a href="javascript:history.go(-1)">Retour</a></div> 106 <div class="inbox crumbsplus"> 107 <div class="pagepost"> 108 <p class="pagelink"><?php echo $paging_links ?></p> 109 </div> 110 <ul class="crumbs"> 111 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 112 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 113 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 114 </ul> 115 <div class="clearer"></div> 102 116 </div> 103 117 </div> … … 110 124 if (isset($_GET['show_users'])) 111 125 { 112 $ip = $_GET['show_users']; 113 114 if (!preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $ip)) 115 message('L\'adresse IP soumise n\'est pas correctement formée.'); 116 117 118 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Utilisateurs'; 126 $ip = trim($_GET['show_users']); 127 128 if (!@preg_match('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$%', $ip) && !@preg_match('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$%', $ip)) 129 message($lang_admin_users['Bad IP message']); 130 131 // Fetch user count 132 $result = $db->query('SELECT DISTINCT poster_id, poster FROM '.$db->prefix.'posts WHERE poster_ip=\''.$db->escape($ip).'\'') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 133 $num_users = $db->num_rows($result); 134 135 // Determine the user offset (based on $_GET['p']) 136 $num_pages = ceil($num_users / 50); 137 138 $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']); 139 $start_from = 50 * ($p - 1); 140 141 // Generate paging links 142 $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?show_users='.$ip); 143 144 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); 145 define('PUN_ACTIVE_PAGE', 'admin'); 119 146 require PUN_ROOT.'header.php'; 120 147 121 148 ?> 122 149 <div class="linkst"> 123 <div class="inbox"> 124 <div><a href="javascript:history.go(-1)">Retour</a></div> 150 <div class="inbox crumbsplus"> 151 <ul class="crumbs"> 152 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 153 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 154 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 155 </ul> 156 <div class="pagepost"> 157 <p class="pagelink"><?php echo $paging_links ?></p> 158 </div> 159 <div class="clearer"></div> 125 160 </div> 126 161 </div> 127 162 128 163 <div id="users2" class="blocktable"> 129 <h2><span> Utilisateurs</span></h2>164 <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> 130 165 <div class="box"> 131 166 <div class="inbox"> … … 133 168 <thead> 134 169 <tr> 135 <th class="tcl" scope="col"> Nom d'utilisateur</th>136 <th class="tc2" scope="col"> E-mail</th>137 <th class="tc3" scope="col"> Titre/Statut</th>138 <th class="tc4" scope="col"> Messages</th>139 <th class="tc5" scope="col"> Note admin</th>140 <th class="tcr" scope="col"> Actions</th>170 <th class="tcl" scope="col"><?php echo $lang_admin_users['Results username head'] ?></th> 171 <th class="tc2" scope="col"><?php echo $lang_admin_users['Results e-mail head'] ?></th> 172 <th class="tc3" scope="col"><?php echo $lang_admin_users['Results title head'] ?></th> 173 <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> 174 <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> 175 <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> 141 176 </tr> 142 177 </thead> … … 144 179 <?php 145 180 146 $result = $db->query('SELECT DISTINCT poster_id, poster FROM '.$db->prefix.'posts WHERE poster_ip=\''.$db->escape($ip).'\' ORDER BY poster DESC') or error(' Impossible de retrouver les informations des messages', __FILE__, __LINE__, $db->error());181 $result = $db->query('SELECT DISTINCT poster_id, poster FROM '.$db->prefix.'posts WHERE poster_ip=\''.$db->escape($ip).'\' ORDER BY poster DESC') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 147 182 $num_posts = $db->num_rows($result); 148 183 … … 154 189 list($poster_id, $poster) = $db->fetch_row($result); 155 190 156 $result2 = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND u.id='.$poster_id) or error(' Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error());191 $result2 = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND u.id='.$poster_id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 157 192 158 193 if (($user_data = $db->fetch_assoc($result2))) … … 160 195 $user_title = get_title($user_data); 161 196 162 $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'"> Voir stats IP</a> - <a href="search.php?action=show_user&user_id='.$user_data['id'].'">Afficher messages</a>';197 $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> | <a href="search.php?action=show_user_posts&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; 163 198 164 199 ?> … … 167 202 <td class="tc2"><a href="mailto:<?php echo $user_data['email'] ?>"><?php echo $user_data['email'] ?></a></td> 168 203 <td class="tc3"><?php echo $user_title ?></td> 169 <td class="tc4"><?php echo $user_data['num_posts']?></td>170 <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? $user_data['admin_note']: ' ' ?></td>204 <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> 205 <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> 171 206 <td class="tcr"><?php echo $actions ?></td> 172 207 </tr> … … 181 216 <td class="tcl"><?php echo pun_htmlspecialchars($poster) ?></td> 182 217 <td class="tc2"> </td> 183 <td class="tc3"> Invité</td>218 <td class="tc3"><?php echo $lang_admin_users['Results guest'] ?></td> 184 219 <td class="tc4"> </td> 185 220 <td class="tc5"> </td> … … 192 227 } 193 228 else 194 echo "\t\t\t\t".'<tr><td class="tcl" colspan="6"> L\'adresse IP soumise est introuvable dans la base de données.</td></tr>'."\n";229 echo "\t\t\t\t".'<tr><td class="tcl" colspan="6">'.$lang_admin_users['Results no IP found'].'</td></tr>'."\n"; 195 230 196 231 ?> … … 202 237 203 238 <div class="linksb"> 204 <div class="inbox"> 205 <div><a href="javascript:history.go(-1)">Retour</a></div> 239 <div class="inbox crumbsplus"> 240 <div class="pagepost"> 241 <p class="pagelink"><?php echo $paging_links ?></p> 242 </div> 243 <ul class="crumbs"> 244 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 245 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 246 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 247 </ul> 248 <div class="clearer"></div> 206 249 </div> 207 250 </div> … … 211 254 212 255 213 else if (isset($_POST['find_user'])) 256 // Move multiple users to other user groups 257 else if (isset($_POST['move_users']) || isset($_POST['move_users_comply'])) 214 258 { 215 $form = $_POST['form']; 216 $form['username'] = $_POST['username']; 259 if ($pun_user['g_id'] > PUN_ADMIN) 260 message($lang_common['No permission']); 261 262 confirm_referrer('admin_users.php'); 263 264 if (isset($_POST['users'])) 265 { 266 $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); 267 $user_ids = array_map('intval', $user_ids); 268 269 // Delete invalid IDs 270 $user_ids = array_diff($user_ids, array(0, 1)); 271 } 272 else 273 $user_ids = array(); 274 275 if (empty($user_ids)) 276 message($lang_admin_users['No users selected']); 277 278 // Are we trying to batch move any admins? 279 $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 280 if ($db->result($result) > 0) 281 message($lang_admin_users['No move admins message']); 282 283 // Fetch all user groups 284 $all_groups = array(); 285 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id NOT IN ('.PUN_GUEST.','.PUN_ADMIN.') ORDER BY g_title ASC') or error('Unable to fetch groups', __FILE__, __LINE__, $db->error()); 286 while ($row = $db->fetch_row($result)) 287 $all_groups[$row[0]] = $row[1]; 288 289 if (isset($_POST['move_users_comply'])) 290 { 291 $new_group = isset($_POST['new_group']) && isset($all_groups[$_POST['new_group']]) ? $_POST['new_group'] : message($lang_admin_users['Invalid group message']); 292 293 // Is the new group a moderator group? 294 $result = $db->query('SELECT g_moderator FROM '.$db->prefix.'groups WHERE g_id='.$new_group) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); 295 $new_group_mod = $db->result($result); 296 297 // Fetch user groups 298 $user_groups = array(); 299 $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); 300 while ($cur_user = $db->fetch_assoc($result)) 301 { 302 if (!isset($user_groups[$cur_user['group_id']])) 303 $user_groups[$cur_user['group_id']] = array(); 304 305 $user_groups[$cur_user['group_id']][] = $cur_user['id']; 306 } 307 308 // Are any users moderators? 309 $group_ids = array_keys($user_groups); 310 $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); 311 while ($cur_group = $db->fetch_assoc($result)) 312 { 313 if ($cur_group['g_moderator'] == '0') 314 unset($user_groups[$cur_group['g_id']]); 315 } 316 317 if (!empty($user_groups) && $new_group != PUN_ADMIN && $new_group_mod != '1') 318 { 319 // Fetch forum list and clean up their moderator list 320 $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); 321 while ($cur_forum = $db->fetch_assoc($result)) 322 { 323 $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); 324 325 foreach ($user_groups as $group_users) 326 $cur_moderators = array_diff($cur_moderators, $group_users); 327 328 $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; 329 $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); 330 } 331 } 332 333 // Change user group 334 $db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group.' WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to change user group', __FILE__, __LINE__, $db->error()); 335 336 redirect('admin_users.php', $lang_admin_users['Users move redirect']); 337 } 338 339 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Move users']); 340 define('PUN_ACTIVE_PAGE', 'admin'); 341 require PUN_ROOT.'header.php'; 342 343 generate_admin_menu('users'); 344 345 ?> 346 <div class="blockform"> 347 <h2><span><?php echo $lang_admin_users['Move users'] ?></span></h2> 348 <div class="box"> 349 <form name="confirm_move_users" method="post" action="admin_users.php"> 350 <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> 351 <div class="inform"> 352 <fieldset> 353 <legend><?php echo $lang_admin_users['Move users subhead'] ?></legend> 354 <div class="infldset"> 355 <table class="aligntop" cellspacing="0"> 356 <tr> 357 <th scope="row"><?php echo $lang_admin_users['New group label'] ?></th> 358 <td> 359 <select name="new_group" tabindex="1"> 360 <?php foreach ($all_groups as $gid => $group) : ?> <option value="<?php echo $gid ?>"><?php echo pun_htmlspecialchars($group) ?></option> 361 <?php endforeach; ?> 362 </select> 363 <span><?php echo $lang_admin_users['New group help'] ?></span> 364 </td> 365 </tr> 366 </table> 367 </div> 368 </fieldset> 369 </div> 370 <p class="submitend"><input type="submit" name="move_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="2" /></p> 371 </form> 372 </div> 373 </div> 374 <div class="clearer"></div> 375 </div> 376 <?php 377 378 require PUN_ROOT.'footer.php'; 379 } 380 381 382 // Delete multiple users 383 else if (isset($_POST['delete_users']) || isset($_POST['delete_users_comply'])) 384 { 385 if ($pun_user['g_id'] > PUN_ADMIN) 386 message($lang_common['No permission']); 387 388 confirm_referrer('admin_users.php'); 389 390 if (isset($_POST['users'])) 391 { 392 $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); 393 $user_ids = array_map('intval', $user_ids); 394 395 // Delete invalid IDs 396 $user_ids = array_diff($user_ids, array(0, 1)); 397 } 398 else 399 $user_ids = array(); 400 401 if (empty($user_ids)) 402 message($lang_admin_users['No users selected']); 403 404 // Are we trying to delete any admins? 405 $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 406 if ($db->result($result) > 0) 407 message($lang_admin_users['No delete admins message']); 408 409 if (isset($_POST['delete_users_comply'])) 410 { 411 // Fetch user groups 412 $user_groups = array(); 413 $result = $db->query('SELECT id, group_id FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user groups', __FILE__, __LINE__, $db->error()); 414 while ($cur_user = $db->fetch_assoc($result)) 415 { 416 if (!isset($user_groups[$cur_user['group_id']])) 417 $user_groups[$cur_user['group_id']] = array(); 418 419 $user_groups[$cur_user['group_id']][] = $cur_user['id']; 420 } 421 422 // Are any users moderators? 423 $group_ids = array_keys($user_groups); 424 $result = $db->query('SELECT g_id, g_moderator FROM '.$db->prefix.'groups WHERE g_id IN ('.implode(',', $group_ids).')') or error('Unable to fetch group moderators', __FILE__, __LINE__, $db->error()); 425 while ($cur_group = $db->fetch_assoc($result)) 426 { 427 if ($cur_group['g_moderator'] == '0') 428 unset($user_groups[$cur_group['g_id']]); 429 } 430 431 // Fetch forum list and clean up their moderator list 432 $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error()); 433 while ($cur_forum = $db->fetch_assoc($result)) 434 { 435 $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); 436 437 foreach ($user_groups as $group_users) 438 $cur_moderators = array_diff($cur_moderators, $group_users); 439 440 $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; 441 $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error()); 442 } 443 444 // Delete any subscriptions 445 $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete topic subscriptions', __FILE__, __LINE__, $db->error()); 446 $db->query('DELETE FROM '.$db->prefix.'forum_subscriptions WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to delete forum subscriptions', __FILE__, __LINE__, $db->error()); 447 448 // Remove them from the online list (if they happen to be logged in) 449 $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id IN ('.implode(',', $user_ids).')') or error('Unable to remove users from online list', __FILE__, __LINE__, $db->error()); 450 451 // Should we delete all posts made by these users? 452 if (isset($_POST['delete_posts'])) 453 { 454 require PUN_ROOT.'include/search_idx.php'; 455 @set_time_limit(0); 456 457 // Find all posts made by this user 458 $result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.poster_id IN ('.implode(',', $user_ids).')') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error()); 459 if ($db->num_rows($result)) 460 { 461 while ($cur_post = $db->fetch_assoc($result)) 462 { 463 // Determine whether this post is the "topic post" or not 464 $result2 = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 465 466 if ($db->result($result2) == $cur_post['id']) 467 delete_topic($cur_post['topic_id']); 468 else 469 delete_post($cur_post['id'], $cur_post['topic_id']); 470 471 update_forum($cur_post['forum_id']); 472 } 473 } 474 } 475 else 476 // Set all their posts to guest 477 $db->query('UPDATE '.$db->prefix.'posts SET poster_id=1 WHERE poster_id IN ('.implode(',', $user_ids).')') or error('Unable to update posts', __FILE__, __LINE__, $db->error()); 478 479 // Delete the users 480 $db->query('DELETE FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to delete users', __FILE__, __LINE__, $db->error()); 481 482 // Delete user avatars 483 foreach ($user_ids as $user_id) 484 delete_avatar($user_id); 485 486 // Regenerate the users info cache 487 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 488 require PUN_ROOT.'include/cache.php'; 489 490 generate_users_info_cache(); 491 492 redirect('admin_users.php', $lang_admin_users['Users delete redirect']); 493 } 494 495 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Delete users']); 496 define('PUN_ACTIVE_PAGE', 'admin'); 497 require PUN_ROOT.'header.php'; 498 499 generate_admin_menu('users'); 500 501 ?> 502 <div class="blockform"> 503 <h2><span><?php echo $lang_admin_users['Delete users'] ?></span></h2> 504 <div class="box"> 505 <form name="confirm_del_users" method="post" action="admin_users.php"> 506 <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> 507 <div class="inform"> 508 <fieldset> 509 <legend><?php echo $lang_admin_users['Confirm delete legend'] ?></legend> 510 <div class="infldset"> 511 <p><?php echo $lang_admin_users['Confirm delete info'] ?></p> 512 <div class="rbox"> 513 <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_admin_users['Delete posts'] ?><br /></label> 514 </div> 515 <p class="warntext"><strong><?php echo $lang_admin_users['Delete warning'] ?></strong></p> 516 </div> 517 </fieldset> 518 </div> 519 <p class="buttons"><input type="submit" name="delete_users_comply" value="<?php echo $lang_admin_users['Delete'] ?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_admin_common['Go back'] ?></a></p> 520 </form> 521 </div> 522 </div> 523 <div class="clearer"></div> 524 </div> 525 <?php 526 527 require PUN_ROOT.'footer.php'; 528 } 529 530 531 // Ban multiple users 532 else if (isset($_POST['ban_users']) || isset($_POST['ban_users_comply'])) 533 { 534 if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) 535 message($lang_common['No permission']); 536 537 confirm_referrer('admin_users.php'); 538 539 if (isset($_POST['users'])) 540 { 541 $user_ids = is_array($_POST['users']) ? array_keys($_POST['users']) : explode(',', $_POST['users']); 542 $user_ids = array_map('intval', $user_ids); 543 544 // Delete invalid IDs 545 $user_ids = array_diff($user_ids, array(0, 1)); 546 } 547 else 548 $user_ids = array(); 549 550 if (empty($user_ids)) 551 message($lang_admin_users['No users selected']); 552 553 // Are we trying to ban any admins? 554 $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).') AND group_id='.PUN_ADMIN) or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); 555 if ($db->result($result) > 0) 556 message($lang_admin_users['No ban admins message']); 557 558 // Also, we cannot ban moderators 559 $result = $db->query('SELECT COUNT(*) FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE g.g_moderator=1 AND u.id IN ('.implode(',', $user_ids).')') or error('Unable to fetch moderator group info', __FILE__, __LINE__, $db->error()); 560 if ($db->result($result) > 0) 561 message($lang_admin_users['No ban mods message']); 562 563 if (isset($_POST['ban_users_comply'])) 564 { 565 $ban_message = pun_trim($_POST['ban_message']); 566 $ban_expire = pun_trim($_POST['ban_expire']); 567 $ban_the_ip = isset($_POST['ban_the_ip']) ? intval($_POST['ban_the_ip']) : 0; 568 569 if ($ban_expire != '' && $ban_expire != 'Never') 570 { 571 $ban_expire = strtotime($ban_expire.' GMT'); 572 573 if ($ban_expire == -1 || !$ban_expire) 574 message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); 575 576 $diff = ($pun_user['timezone'] + $pun_user['dst']) * 3600; 577 $ban_expire -= $diff; 578 579 if ($ban_expire <= time()) 580 message($lang_admin_users['Invalid date message'].' '.$lang_admin_users['Invalid date reasons']); 581 } 582 else 583 $ban_expire = 'NULL'; 584 585 $ban_message = ($ban_message != '') ? '\''.$db->escape($ban_message).'\'' : 'NULL'; 586 587 // Fetch user information 588 $user_info = array(); 589 $result = $db->query('SELECT id, username, email, registration_ip FROM '.$db->prefix.'users WHERE id IN ('.implode(',', $user_ids).')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 590 while ($cur_user = $db->fetch_assoc($result)) 591 $user_info[$cur_user['id']] = array('username' => $cur_user['username'], 'email' => $cur_user['email'], 'ip' => $cur_user['registration_ip']); 592 593 // Overwrite the registration IP with one from the last post (if it exists) 594 if ($ban_the_ip != 0) 595 { 596 $result = $db->query('SELECT p.poster_id, p.poster_ip FROM '.$db->prefix.'posts AS p INNER JOIN (SELECT MAX(id) AS id FROM '.$db->prefix.'posts WHERE poster_id IN ('.implode(',', $user_ids).') GROUP BY poster_id) AS i ON p.id=i.id') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); 597 while ($cur_address = $db->fetch_assoc($result)) 598 $user_info[$cur_address['poster_id']]['ip'] = $cur_address['poster_ip']; 599 } 600 601 // And insert the bans! 602 foreach ($user_ids as $user_id) 603 { 604 $ban_username = '\''.$db->escape($user_info[$user_id]['username']).'\''; 605 $ban_email = '\''.$db->escape($user_info[$user_id]['email']).'\''; 606 $ban_ip = ($ban_the_ip != 0) ? '\''.$db->escape($user_info[$user_id]['ip']).'\'' : 'NULL'; 607 608 $db->query('INSERT INTO '.$db->prefix.'bans (username, ip, email, message, expire, ban_creator) VALUES('.$ban_username.', '.$ban_ip.', '.$ban_email.', '.$ban_message.', '.$ban_expire.', '.$pun_user['id'].')') or error('Unable to add ban', __FILE__, __LINE__, $db->error()); 609 } 610 611 // Regenerate the bans cache 612 if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) 613 require PUN_ROOT.'include/cache.php'; 614 615 generate_bans_cache(); 616 617 redirect('admin_users.php', $lang_admin_users['Users banned redirect']); 618 } 619 620 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Bans']); 621 $focus_element = array('bans2', 'ban_message'); 622 define('PUN_ACTIVE_PAGE', 'admin'); 623 require PUN_ROOT.'header.php'; 624 625 generate_admin_menu('users'); 626 627 ?> 628 <div class="blockform"> 629 <h2><span><?php echo $lang_admin_users['Ban users'] ?></span></h2> 630 <div class="box"> 631 <form id="bans2" name="confirm_ban_users" method="post" action="admin_users.php"> 632 <input type="hidden" name="users" value="<?php echo implode(',', $user_ids) ?>" /> 633 <div class="inform"> 634 <fieldset> 635 <legend><?php echo $lang_admin_users['Message expiry subhead'] ?></legend> 636 <div class="infldset"> 637 <table class="aligntop" cellspacing="0"> 638 <tr> 639 <th scope="row"><?php echo $lang_admin_users['Ban message label'] ?></th> 640 <td> 641 <input type="text" name="ban_message" size="50" maxlength="255" tabindex="1" /> 642 <span><?php echo $lang_admin_users['Ban message help'] ?></span> 643 </td> 644 </tr> 645 <tr> 646 <th scope="row"><?php echo $lang_admin_users['Expire date label'] ?></th> 647 <td> 648 <input type="text" name="ban_expire" size="17" maxlength="10" tabindex="2" /> 649 <span><?php echo $lang_admin_users['Expire date help'] ?></span> 650 </td> 651 </tr> 652 <tr> 653 <th scope="row"><?php echo $lang_admin_users['Ban IP label'] ?></th> 654 <td> 655 <input type="radio" name="ban_the_ip" tabindex="3" value="1" checked="checked" /> <strong><?php echo $lang_admin_common['Yes'] ?></strong>   <input type="radio" name="ban_the_ip" tabindex="4" value="0" checked="checked" /> <strong><?php echo $lang_admin_common['No'] ?></strong> 656 <span><?php echo $lang_admin_users['Ban IP help'] ?></span> 657 </td> 658 </tr> 659 </table> 660 </div> 661 </fieldset> 662 </div> 663 <p class="submitend"><input type="submit" name="ban_users_comply" value="<?php echo $lang_admin_common['Save'] ?>" tabindex="3" /></p> 664 </form> 665 </div> 666 </div> 667 <div class="clearer"></div> 668 </div> 669 <?php 670 671 require PUN_ROOT.'footer.php'; 672 } 673 674 675 else if (isset($_GET['find_user'])) 676 { 677 $form = isset($_GET['form']) ? $_GET['form'] : array(); 217 678 218 679 // trim() all elements in $form 219 $form = array_map('trim', $form); 220 $conditions = array(); 221 222 $posts_greater = trim($_POST['posts_greater']); 223 $posts_less = trim($_POST['posts_less']); 224 $last_post_after = trim($_POST['last_post_after']); 225 $last_post_before = trim($_POST['last_post_before']); 226 $registered_after = trim($_POST['registered_after']); 227 $registered_before = trim($_POST['registered_before']); 228 $order_by = $_POST['order_by']; 229 $direction = $_POST['direction']; 230 $user_group = $_POST['user_group']; 231 232 if (preg_match('/[^0-9]/', $posts_greater.$posts_less)) 233 message('Vous avez saisi une donnée non-numérique dans un champ qui en requiÚre une.'); 680 $form = array_map('pun_trim', $form); 681 $conditions = $query_str = array(); 682 683 $posts_greater = isset($_GET['posts_greater']) ? trim($_GET['posts_greater']) : ''; 684 $posts_less = isset($_GET['posts_less']) ? trim($_GET['posts_less']) : ''; 685 $last_post_after = isset($_GET['last_post_after']) ? trim($_GET['last_post_after']) : ''; 686 $last_post_before = isset($_GET['last_post_before']) ? trim($_GET['last_post_before']) : ''; 687 $last_visit_after = isset($_GET['last_visit_after']) ? trim($_GET['last_visit_after']) : ''; 688 $last_visit_before = isset($_GET['last_visit_before']) ? trim($_GET['last_visit_before']) : ''; 689 $registered_after = isset($_GET['registered_after']) ? trim($_GET['registered_after']) : ''; 690 $registered_before = isset($_GET['registered_before']) ? trim($_GET['registered_before']) : ''; 691 $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'last_visit', 'registered')) ? $_GET['order_by'] : 'username'; 692 $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC'; 693 $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1; 694 695 $query_str[] = 'order_by='.$order_by; 696 $query_str[] = 'direction='.$direction; 697 $query_str[] = 'user_group='.$user_group; 698 699 if (preg_match('%[^0-9]%', $posts_greater.$posts_less)) 700 message($lang_admin_users['Non numeric message']); 234 701 235 702 // Try to convert date/time to timestamps 236 703 if ($last_post_after != '') 704 { 705 $query_str[] = 'last_post_after='.$last_post_after; 706 237 707 $last_post_after = strtotime($last_post_after); 708 if ($last_post_after === false || $last_post_after == -1) 709 message($lang_admin_users['Invalid date time message']); 710 711 $conditions[] = 'u.last_post>'.$last_post_after; 712 } 238 713 if ($last_post_before != '') 714 { 715 $query_str[] = 'last_post_before='.$last_post_before; 716 239 717 $last_post_before = strtotime($last_post_before); 718 if ($last_post_before === false || $last_post_before == -1) 719 message($lang_admin_users['Invalid date time message']); 720 721 $conditions[] = 'u.last_post<'.$last_post_before; 722 } 723 if ($last_visit_after != '') 724 { 725 $query_str[] = 'last_visit_after='.$last_visit_after; 726 727 $last_visit_after = strtotime($last_visit_after); 728 if ($last_visit_after === false || $last_visit_after == -1) 729 message($lang_admin_users['Invalid date time message']); 730 731 $conditions[] = 'u.last_visit>'.$last_visit_after; 732 } 733 if ($last_visit_before != '') 734 { 735 $query_str[] = 'last_visit_before='.$last_visit_before; 736 737 $last_visit_before = strtotime($last_visit_before); 738 if ($last_visit_before === false || $last_visit_before == -1) 739 message($lang_admin_users['Invalid date time message']); 740 741 $conditions[] = 'u.last_visit<'.$last_visit_before; 742 } 240 743 if ($registered_after != '') 744 { 745 $query_str[] = 'registered_after='.$registered_after; 746 241 747 $registered_after = strtotime($registered_after); 748 if ($registered_after === false || $registered_after == -1) 749 message($lang_admin_users['Invalid date time message']); 750 751 $conditions[] = 'u.registered>'.$registered_after; 752 } 242 753 if ($registered_before != '') 754 { 755 $query_str[] = 'registered_before='.$registered_before; 756 243 757 $registered_before = strtotime($registered_before); 244 245 if ($last_post_after == -1 || $last_post_before == -1 || $registered_after == -1 || $registered_before == -1) 246 message('Vous avez saisi une date/heure invalide.'); 247 248 if ($last_post_after != '') 249 $conditions[] = 'u.last_post>'.$last_post_after; 250 if ($last_post_before != '') 251 $conditions[] = 'u.last_post<'.$last_post_before; 252 if ($registered_after != '') 253 $conditions[] = 'u.registered>'.$registered_after; 254 if ($registered_before != '') 758 if ($registered_before === false || $registered_before == -1) 759 message($lang_admin_users['Invalid date time message']); 760 255 761 $conditions[] = 'u.registered<'.$registered_before; 762 } 256 763 257 764 $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE'; 258 while (list($key, $input) = @each($form)) 259 { 260 if ($input != '') 765 foreach ($form as $key => $input) 766 { 767 if ($input != '' && in_array($key, array('username', 'email', 'title', 'realname', 'url', 'jabber', 'icq', 'msn', 'aim', 'yahoo', 'location', 'signature', 'admin_note'))) 768 { 261 769 $conditions[] = 'u.'.$db->escape($key).' '.$like_command.' \''.$db->escape(str_replace('*', '%', $input)).'\''; 770 $query_str[] = 'form%5B'.$key.'%5D='.urlencode($input); 771 } 262 772 } 263 773 264 774 if ($posts_greater != '') 775 { 776 $query_str[] = 'posts_greater='.$posts_greater; 265 777 $conditions[] = 'u.num_posts>'.$posts_greater; 778 } 266 779 if ($posts_less != '') 780 { 781 $query_str[] = 'posts_less='.$posts_less; 267 782 $conditions[] = 'u.num_posts<'.$posts_less; 268 269 if ($user_group != 'all') 270 $conditions[] = 'u.group_id='.$db->escape($user_group); 271 272 if (empty($conditions)) 273 message('Vous n\'avez saisi aucun critÚres de recherche.'); 274 275 276 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Utilisateurs'; 783 } 784 785 if ($user_group > -1) 786 $conditions[] = 'u.group_id='.$user_group; 787 788 // Fetch user count 789 $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '')) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 790 $num_users = $db->result($result); 791 792 // Determine the user offset (based on $_GET['p']) 793 $num_pages = ceil($num_users / 50); 794 795 $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']); 796 $start_from = 50 * ($p - 1); 797 798 // Generate paging links 799 $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'admin_users.php?find_user=&'.implode('&', $query_str)); 800 801 // Some helper variables for permissions 802 $can_delete = $can_move = $pun_user['g_id'] == PUN_ADMIN; 803 $can_ban = $pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_ban_users'] == '1'); 804 $can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0; 805 806 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users'], $lang_admin_users['Results head']); 807 $page_head = array('js' => '<script type="text/javascript" src="common.js"></script>'); 808 define('PUN_ACTIVE_PAGE', 'admin'); 277 809 require PUN_ROOT.'header.php'; 278 810 279 811 ?> 280 812 <div class="linkst"> 281 <div class="inbox"> 282 <div><a href="javascript:history.go(-1)">Retour</a></div> 283 </div> 284 </div> 285 813 <div class="inbox crumbsplus"> 814 <ul class="crumbs"> 815 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 816 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 817 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 818 </ul> 819 <div class="pagepost"> 820 <p class="pagelink"><?php echo $paging_links ?></p> 821 </div> 822 <div class="clearer"></div> 823 </div> 824 </div> 825 826 827 <form id="search-users-form" action="admin_users.php" method="post"> 286 828 <div id="users2" class="blocktable"> 287 <h2><span> Utilisateurs</span></h2>829 <h2><span><?php echo $lang_admin_users['Results head'] ?></span></h2> 288 830 <div class="box"> 289 831 <div class="inbox"> … … 291 833 <thead> 292 834 <tr> 293 <th class="tcl" scope="col">Nom d'utilisateur</th> 294 <th class="tc2" scope="col">E-mail</th> 295 <th class="tc3" scope="col">Titre/Status</th> 296 <th class="tc4" scope="col">Messages</th> 297 <th class="tc5" scope="col">Note admin</th> 298 <th class="tcr" scope="col">Actions</th> 835 <th class="tcl" scope="col"><?php echo $lang_admin_users['Results username head'] ?></th> 836 <th class="tc2" scope="col"><?php echo $lang_admin_users['Results e-mail head'] ?></th> 837 <th class="tc3" scope="col"><?php echo $lang_admin_users['Results title head'] ?></th> 838 <th class="tc4" scope="col"><?php echo $lang_admin_users['Results posts head'] ?></th> 839 <th class="tc5" scope="col"><?php echo $lang_admin_users['Results admin note head'] ?></th> 840 <th class="tcr" scope="col"><?php echo $lang_admin_users['Results actions head'] ?></th> 841 <?php if ($can_action): ?> <th class="tcmod" scope="col"><?php echo $lang_admin_users['Select'] ?></th> 842 <?php endif; ?> 299 843 </tr> 300 844 </thead> … … 302 846 <?php 303 847 304 $result = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1 AND '.implode(' AND ', $conditions).' ORDER BY '.$db->escape($order_by).' '.$db->escape($direction)) or error('Impossible de retrouver les informations utilisateurs', __FILE__, __LINE__, $db->error());848 $result = $db->query('SELECT u.id, u.username, u.email, u.title, u.num_posts, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($conditions) ? ' AND '.implode(' AND ', $conditions) : '').' ORDER BY '.$db->escape($order_by).' '.$db->escape($direction).' LIMIT '.$start_from.', 50') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); 305 849 if ($db->num_rows($result)) 306 850 { … … 311 855 // This script is a special case in that we want to display "Not verified" for non-verified users 312 856 if (($user_data['g_id'] == '' || $user_data['g_id'] == PUN_UNVERIFIED) && $user_title != $lang_common['Banned']) 313 $user_title = '<span class="warntext"> Not verified</span>';314 315 $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'"> Voir stats IP</a> - <a href="search.php?action=show_user&user_id='.$user_data['id'].'">Afficher messages</a>';857 $user_title = '<span class="warntext">'.$lang_admin_users['Not verified'].'</span>'; 858 859 $actions = '<a href="admin_users.php?ip_stats='.$user_data['id'].'">'.$lang_admin_users['Results view IP link'].'</a> | <a href="search.php?action=show_user_posts&user_id='.$user_data['id'].'">'.$lang_admin_users['Results show posts link'].'</a>'; 316 860 317 861 ?> … … 320 864 <td class="tc2"><a href="mailto:<?php echo $user_data['email'] ?>"><?php echo $user_data['email'] ?></a></td> 321 865 <td class="tc3"><?php echo $user_title ?></td> 322 <td class="tc4"><?php echo $user_data['num_posts']?></td>323 <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? $user_data['admin_note']: ' ' ?></td>866 <td class="tc4"><?php echo forum_number_format($user_data['num_posts']) ?></td> 867 <td class="tc5"><?php echo ($user_data['admin_note'] != '') ? pun_htmlspecialchars($user_data['admin_note']) : ' ' ?></td> 324 868 <td class="tcr"><?php echo $actions ?></td> 869 <?php if ($can_action): ?> <td class="tcmod"><input type="checkbox" name="users[<?php echo $user_data['id'] ?>]" value="1" /></td> 870 <?php endif; ?> 325 871 </tr> 326 872 <?php … … 329 875 } 330 876 else 331 echo "\t\t\t\t".'<tr><td class="tcl" colspan="6"> Aucun résultat.</td></tr>'."\n";877 echo "\t\t\t\t".'<tr><td class="tcl" colspan="6">'.$lang_admin_users['No match'].'</td></tr>'."\n"; 332 878 333 879 ?> … … 339 885 340 886 <div class="linksb"> 341 <div class="inbox"> 342 <div><a href="javascript:history.go(-1)">Retour</a></div> 343 </div> 344 </div> 887 <div class="inbox crumbsplus"> 888 <div class="pagepost"> 889 <p class="pagelink"><?php echo $paging_links ?></p> 890 <?php if ($can_action): ?> <p class="conr modbuttons"><a href="#" onclick="return select_checkboxes('search-users-form', this, '<?php echo $lang_admin_users['Unselect all'] ?>')"><?php echo $lang_admin_users['Select all'] ?></a> <?php if ($can_ban) : ?><input type="submit" name="ban_users" value="<?php echo $lang_admin_users['Ban'] ?>" /><?php endif; if ($can_delete) : ?><input type="submit" name="delete_users" value="<?php echo $lang_admin_users['Delete'] ?>" /><?php endif; if ($can_move) : ?><input type="submit" name="move_users" value="<?php echo $lang_admin_users['Change group'] ?>" /><?php endif; ?></p> 891 <?php endif; ?> 892 </div> 893 <ul class="crumbs"> 894 <li><a href="admin_index.php"><?php echo $lang_admin_common['Admin'].' '.$lang_admin_common['Index'] ?></a></li> 895 <li><span>» </span><a href="admin_users.php"><?php echo $lang_admin_common['Users'] ?></a></li> 896 <li><span>» </span><strong><?php echo $lang_admin_users['Results head'] ?></strong></li> 897 </ul> 898 <div class="clearer"></div> 899 </div> 900 </div> 901 </form> 345 902 <?php 346 903 … … 351 908 else 352 909 { 353 $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / Utilisateurs'; 354 $focus_element = array('find_user', 'username'); 910 $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Users']); 911 $focus_element = array('find_user', 'form[username]'); 912 define('PUN_ACTIVE_PAGE', 'admin'); 355 913 require PUN_ROOT.'header.php'; 356 914 … … 359 917 ?> 360 918 <div class="blockform"> 361 <h2><span> Recherche d'utilisateur</span></h2>919 <h2><span><?php echo $lang_admin_users['User search head'] ?></span></h2> 362 920 <div class="box"> 363 <form id="find_user" method=" post" action="admin_users.php?action=find_user">364 <p class="submittop"><input type="submit" name="find_user" value=" Rechercher" tabindex="1" /></p>921 <form id="find_user" method="get" action="admin_users.php"> 922 <p class="submittop"><input type="submit" name="find_user" value="<?php echo $lang_admin_users['Submit search'] ?>" tabindex="1" /></p> 365 923 <div class="inform"> 366 924 <fieldset> 367 <legend> Saisissez vos critÚres de recherche</legend>925 <legend><?php echo $lang_admin_users['User search subhead'] ?></legend> 368 926 <div class="infldset"> 369 <p> Recherche d'utilisateur dans la base de données. Vous pouvez saisir un ou plusieurs termes à rechercher. Utilisez le caractÚre astérisque (*) comme joker.</p>370 <table 371 <tr> 372 <th scope="row"> Nom d'utilisateur</th>373 <td><input type="text" name=" username" size="25" maxlength="25" tabindex="2" /></td>374 </tr> 375 <tr> 376 <th scope="row"> Adresse e-mail</th>377 <td><input type="text" name="form[email]" size="30" maxlength=" 50" tabindex="3" /></td>378 </tr> 379 <tr> 380 <th scope="row"> Titre</th>927 <p><?php echo $lang_admin_users['User search info'] ?></p> 928 <table class="aligntop" cellspacing="0"> 929 <tr> 930 <th scope="row"><?php echo $lang_admin_users['Username label'] ?></th> 931 <td><input type="text" name="form[username]" size="25" maxlength="25" tabindex="2" /></td> 932 </tr> 933 <tr> 934 <th scope="row"><?php echo $lang_admin_users['E-mail address label'] ?></th> 935 <td><input type="text" name="form[email]" size="30" maxlength="80" tabindex="3" /></td> 936 </tr> 937 <tr> 938 <th scope="row"><?php echo $lang_admin_users['Title label'] ?></th> 381 939 <td><input type="text" name="form[title]" size="30" maxlength="50" tabindex="4" /></td> 382 940 </tr> 383 941 <tr> 384 <th scope="row"> Nom réel</th>942 <th scope="row"><?php echo $lang_admin_users['Real name label'] ?></th> 385 943 <td><input type="text" name="form[realname]" size="30" maxlength="40" tabindex="5" /></td> 386 944 </tr> 387 945 <tr> 388 <th scope="row"> Site web</th>946 <th scope="row"><?php echo $lang_admin_users['Website label'] ?></th> 389 947 <td><input type="text" name="form[url]" size="35" maxlength="100" tabindex="6" /></td> 390 948 </tr> 391 949 <tr> 392 <th scope="row">ICQ</th> 393 <td><input type="text" name="form[icq]" size="12" maxlength="12" tabindex="7" /></td> 394 </tr> 395 <tr> 396 <th scope="row">MSN Messenger</th> 397 <td><input type="text" name="form[msn]" size="30" maxlength="50" tabindex="8" /></td> 398 </tr> 399 <tr> 400 <th scope="row">AOL IM</th> 401 <td><input type="text" name="form[aim]" size="20" maxlength="20" tabindex="9" /></td> 402 </tr> 403 <tr> 404 <th scope="row">Yahoo! Messenger</th> 405 <td><input type="text" name="form[yahoo]" size="20" maxlength="20" tabindex="10" /></td> 406 </tr> 407 <tr> 408 <th scope="row">Lieu</th> 409 <td><input type="text" name="form[location]" size="30" maxlength="30" tabindex="11" /></td> 410 </tr> 411 <tr> 412 <th scope="row">Signature</th> 413 <td><input type="text" name="form[signature]" size="35" maxlength="512" tabindex="12" /></td> 414 </tr> 415 <tr> 416 <th scope="row">Note admin</th> 417 <td><input type="text" name="form[admin_note]" size="30" maxlength="30" tabindex="13" /></td> 418 </tr> 419 <tr> 420 <th scope="row">Nombre de messages supérieur à </th> 421 <td><input type="text" name="posts_greater" size="5" maxlength="8" tabindex="14" /></td> 422 </tr> 423 <tr> 424 <th scope="row">Nombre de messages inférieur à </th> 425 <td><input type="text" name="posts_less" size="5" maxlength="8" tabindex="15" /></td> 426 </tr> 427 <tr> 428 <th scope="row">Le dernier message est aprÚs le</th> 429 <td><input type="text" name="last_post_after" size="24" maxlength="19" tabindex="16" /> 430 <span>(yyyy-mm-dd hh:mm:ss)</span></td> 431 </tr> 432 <tr> 433 <th scope="row">Le dernier message est avant le</th> 434 <td><input type="text" name="last_post_before" size="24" maxlength="19" tabindex="17" /> 435 <span>(yyyy-mm-dd hh:mm:ss)</span></td> 436 </tr> 437 <tr> 438 <th scope="row">Inscrit aprÚs le</th> 439 <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="18" /> 440 <span>(yyyy-mm-dd hh:mm:ss)</span></td> 441 </tr> 442 <tr> 443 <th scope="row">Inscrit avant le</th> 444 <td><input type="text" name="registered_before" size="24" maxlength="19" tabindex="19" /> 445 <span>(yyyy-mm-dd hh:mm:ss)</span></td> 446 </tr> 447 <tr> 448 <th scope="row">Trier par</th> 950 <th scope="row"><?php echo $lang_admin_users['Jabber label'] ?></th> 951 <td><input type="text" name="form[jabber]" size="30" maxlength="75" tabindex="7" /></td> 952 </tr> 953 <tr> 954 <th scope="row"><?php echo $lang_admin_users['ICQ label'] ?></th> 955 <td><input type="text" name="form[icq]" size="12" maxlength="12" tabindex="8" /></td> 956 </tr> 957 <tr> 958 <th scope="row"><?php echo $lang_admin_users['MSN label'] ?></th> 959 <td><input type="text" name="form[msn]" size="30" maxlength="50" tabindex="9" /></td> 960 </tr> 961 <tr> 962 <th scope="row"><?php echo $lang_admin_users['AOL label'] ?></th> 963 <td><input type="text" name="form[aim]" size="20" maxlength="20" tabindex="10" /></td> 964 </tr> 965 <tr> 966 <th scope="row"><?php echo $lang_admin_users['Yahoo label'] ?></th> 967 <td><input type="text" name="form[yahoo]" size="20" maxlength="20" tabindex="11" /></td> 968 </tr> 969 <tr> 970 <th scope="row"><?php echo $lang_admin_users['Location label'] ?></th> 971 <td><input type="text" name="form[location]" size="30" maxlength="30" tabindex="12" /></td> 972 </tr> 973 <tr> 974 <th scope="row"><?php echo $lang_admin_users['Signature label'] ?></th> 975 <td><input type="text" name="form[signature]" size="35" maxlength="512" tabindex="13" /></td> 976 </tr> 977 <tr> 978 <th scope="row"><?php echo $lang_admin_users['Admin note label'] ?></th> 979 <td><input type="text" name="form[admin_note]" size="30" maxlength="30" tabindex="14" /></td> 980 </tr> 981 <tr> 982 <th scope="row"><?php echo $lang_admin_users['Posts more than label'] ?></th> 983 <td><input type="text" name="posts_greater" size="5" maxlength="8" tabindex="15" /></td> 984 </tr> 985 <tr> 986 <th scope="row"><?php echo $lang_admin_users['Posts less than label'] ?></th> 987 <td><input type="text" name="posts_less" size="5" maxlength="8" tabindex="16" /></td> 988 </tr> 989 <tr> 990 <th scope="row"><?php echo $lang_admin_users['Last post after label'] ?></th> 991 <td><input type="text" name="last_post_after" size="24" maxlength="19" tabindex="17" /> 992 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 993 </tr> 994 <tr> 995 <th scope="row"><?php echo $lang_admin_users['Last post before label'] ?></th> 996 <td><input type="text" name="last_post_before" size="24" maxlength="19" tabindex="18" /> 997 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 998 </tr> 999 <tr> 1000 <th scope="row"><?php echo $lang_admin_users['Last visit after label'] ?></th> 1001 <td><input type="text" name="last_visit_after" size="24" maxlength="19" tabindex="17" /> 1002 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 1003 </tr> 1004 <tr> 1005 <th scope="row"><?php echo $lang_admin_users['Last visit before label'] ?></th> 1006 <td><input type="text" name="last_visit_before" size="24" maxlength="19" tabindex="18" /> 1007 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 1008 </tr> 1009 <tr> 1010 <th scope="row"><?php echo $lang_admin_users['Registered after label'] ?></th> 1011 <td><input type="text" name="registered_after" size="24" maxlength="19" tabindex="19" /> 1012 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 1013 </tr> 1014 <tr> 1015 <th scope="row"><?php echo $lang_admin_users['Registered before label'] ?></th> 1016 <td><input type="text" name="registered_before" size="24" maxlength="19" tabindex="20" /> 1017 <span><?php echo $lang_admin_users['Date help'] ?></span></td> 1018 </tr> 1019 <tr> 1020 <th scope="row"><?php echo $lang_admin_users['Order by label'] ?></th> 449 1021 <td> 450 <select name="order_by" tabindex="20"> 451 <option value="username" selected="selected">Nom d'utilisateur</option> 452 <option value="email">e-mail</option> 453 <option value="num_posts">messages</option> 454 <option value="last_post">dernier message</option> 455 <option value="registered">inscriptions</option> 456 </select>   <select name="direction" tabindex="21"> 457 <option value="ASC" selected="selected">croissant</option> 458 <option value="DESC">décroissant</option> 1022 <select name="order_by" tabindex="21"> 1023 <option value="username" selected="selected"><?php echo $lang_admin_users['Order by username'] ?></option> 1024 <option value="email"><?php echo $lang_admin_users['Order by e-mail'] ?></option> 1025 <option value="num_posts"><?php echo $lang_admin_users['Order by posts'] ?></option> 1026 <option value="last_post"><?php echo $lang_admin_users['Order by last post'] ?></option> 1027 <option value="last_visit"><?php echo $lang_admin_users['Order by last visit'] ?></option> 1028 <option value="registered"><?php echo $lang_admin_users['Order by registered'] ?></option> 1029 </select>   <select name="direction" tabindex="22"> 1030 <option value="ASC" selected="selected"><?php echo $lang_admin_users['Ascending'] ?></option> 1031 <option value="DESC"><?php echo $lang_admin_users['Descending'] ?></option> 459 1032 </select> 460 1033 </td> 461 1034 </tr> 462 1035 <tr> 463 <th scope="row"> Groupe utilisateurs</th>1036 <th scope="row"><?php echo $lang_admin_users['User group label'] ?></th> 464 1037 <td> 465 <select name="user_group" tabindex="22"> 466 <option value="all" selected="selected">Tous les groupes</option> 467 <?php 468 469 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Impossible de retrouver la liste des groupes', __FILE__, __LINE__, $db->error()); 1038 <select name="user_group" tabindex="23"> 1039 <option value="-1" selected="selected"><?php echo $lang_admin_users['All groups'] ?></option> 1040 <option value="0"><?php echo $lang_admin_users['Unverified users'] ?></option> 1041 <?php 1042 1043 $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error()); 470 1044 471 1045 while ($cur_group = $db->fetch_assoc($result)) … … 480 1054 </fieldset> 481 1055 </div> 482 <p class="submitend"><input type="submit" name="find_user" value=" Rechercher " tabindex="23" /></p>1056 <p class="submitend"><input type="submit" name="find_user" value="<?php echo $lang_admin_users['Submit search'] ?>" tabindex="25" /></p> 483 1057 </form> 484 1058 </div> 485 1059 486 <h2 class="block2"><span> Recherche <acronym title="Internet Protocol" lang="en">IP</acronym></span></h2>1060 <h2 class="block2"><span><?php echo $lang_admin_users['IP search head'] ?></span></h2> 487 1061 <div class="box"> 488 1062 <form method="get" action="admin_users.php"> 489 1063 <div class="inform"> 490 1064 <fieldset> 491 <legend> Saisissez une adresse <acronym title="Internet Protocol" lang="en">IP</acronym> à rechercher</legend>1065 <legend><?php echo $lang_admin_users['IP search subhead'] ?></legend> 492 1066 <div class="infldset"> 493 1067 <table class="aligntop" cellspacing="0"> 494 1068 <tr> 495 <th scope="row"> Adresse <acronym title="Internet Protocol" lang="en">IP</acronym><div><input type="submit" value=" Trouver " tabindex="25" /></div></th>1069 <th scope="row"><?php echo $lang_admin_users['IP address label'] ?><div><input type="submit" value="<?php echo $lang_admin_users['Find IP address'] ?>" tabindex="26" /></div></th> 496 1070 <td><input type="text" name="show_users" size="18" maxlength="15" tabindex="24" /> 497 <span> L'adresse <acronym title="Internet Protocol" lang="en">IP</acronym> à rechercher dans la base de données.</span></td>1071 <span><?php echo $lang_admin_users['IP address help'] ?></span></td> 498 1072 </tr> 499 1073 </table>
Note: See TracChangeset
for help on using the changeset viewer.