| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $ 14 | $Revision: 1.88 $ 15 | $Date: 2006/11/28 18:16:36 $ 16 | $Author: mcfly_e107 $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("../class2.php"); 20 21 if (!getperms("4")) { 22 header("location:".e_BASE."index.php"); 23 exit; 24 } 25 26 if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo') { 27 header('location:'.e_ADMIN."userinfo.php?".$tp -> toDB($_POST['userip'])); 28 exit; 29 } 30 31 if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings') { 32 header('location:'.e_BASE."usersettings.php?".$tp -> toDB($_POST['userid'])); 33 exit; 34 } 35 36 if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') { 37 header('location:'.e_ADMIN."userclass.php?".$tp -> toDB($_POST['userid'].".".e_QUERY)); 38 exit; 39 } 40 41 $e_sub_cat = 'users'; 42 $user = new users; 43 require_once ("auth.php"); 44 45 require_once(e_HANDLER."form_handler.php"); 46 require_once(e_HANDLER."userclass_class.php"); 47 48 $rs = new form; 49 50 if (e_QUERY) { 51 $tmp = explode(".", e_QUERY); 52 $action = $tmp[0]; 53 $sub_action = $tmp[1]; 54 $id = $tmp[2]; 55 $from = ($tmp[3] ? $tmp[3] : 0); 56 unset($tmp); 57 } 58 59 $from = (isset($from)) ? $from : 0; 60 $amount = 30; 61 62 63 // ------- Check for Bounces -------------- 64 if(isset($_POST['check_bounces'])){ 65 $user->check_bounces(); 66 require_once ("footer.php"); 67 exit; 68 } 69 70 71 // ------- Resend Email. -------------- 72 if (isset($_POST['resend_mail'])) { 73 74 $user->resend($_POST['resend_id'],$_POST['resend_key'],$_POST['resend_name'],$_POST['resend_email']); 75 76 } 77 // ------- Resend Email. -------------- 78 if(isset($_POST['resend_to_all'])){ 79 $user->resend_to_all(); 80 } 81 82 83 84 // ------- Test Email. -------------- 85 if (isset($_POST['test_mail'])) { 86 require_once(e_HANDLER."mail_validation_class.php"); 87 list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL); 88 $validator = new email_validation_class; 89 $validator->localuser= $adminuser; 90 $validator->localhost= $adminhost; 91 $validator->timeout=5; 92 $validator->debug=1; 93 $validator->html_debug=1; 94 $text = "<div style='".ADMIN_WIDTH."'>"; 95 ob_start(); 96 $email_status = $validator->ValidateEmailBox($_POST['test_email']); 97 $text .= ob_get_contents(); 98 ob_end_clean(); 99 $text .= "</div>"; 100 $caption = $_POST['test_email']." - "; 101 $caption .= ($email_status == 1)? "Valid": "Invalid"; 102 103 if($email_status == 1){ 104 $text .= "<form method='post' action='".e_SELF.$qry."'> 105 <div style='text-align:left'> 106 <input type='hidden' name='useraction' value='resend' />\n 107 <input type='hidden' name='userid' value='".$_POST['test_id']."' />\n 108 <input class='button' type='submit' name='resend_' value='".USRLAN_112."' />\n</div></form>\n"; 109 $text .= "<div>"; 110 } 111 112 113 $ns->tablerender($caption, $text); 114 unset($id, $action, $sub_cation); 115 } 116 // ------- Update Options. -------------- 117 if (isset($_POST['update_options'])) { 118 $pref['avatar_upload'] = (FILE_UPLOADS ? $_POST['avatar_upload'] : 0); 119 $pref['im_width'] = $_POST['im_width']; 120 $pref['im_height'] = $_POST['im_height']; 121 $pref['photo_upload'] = (FILE_UPLOADS ? $_POST['photo_upload'] : 0); 122 $pref['del_unv'] = $_POST['del_unv']; 123 $pref['profile_rate'] = $_POST['profile_rate']; 124 $pref['profile_comments'] = $_POST['profile_comments']; 125 $pref['track_online'] = $_POST['track_online']; 126 $pref['force_userupdate'] = $_POST['force_userupdate']; 127 $pref['memberlist_access'] = $_POST['memberlist_access']; 128 save_prefs(); 129 $user->show_message(USRLAN_1); 130 } 131 // ------- Prune Users. -------------- 132 if (isset($_POST['prune'])) { 133 $e107cache->clear("online_menu_totals"); 134 $text = USRLAN_56." "; 135 $bantype = $_POST['prune_type']; 136 if ($sql->db_Select("user", "user_id, user_name", "user_ban= {$bantype}")) 137 { 138 $uList = $sql->db_getList(); 139 foreach($uList as $u) 140 { 141 $text .= $u['user_name']." "; 142 $sql->db_Delete("user", "user_id='{$u['user_id']}' "); 143 $sql->db_Delete("user_extended", "user_extended_id='{$u['user_id']}' "); 144 } 145 } 146 $ns->tablerender(USRLAN_57, "<div style='text-align:center'><b>".$text."</b></div>"); 147 unset($text); 148 } 149 // ------- Quick Add User -------------- 150 if (isset($_POST['adduser'])) { 151 $e107cache->clear("online_menu_totals"); 152 if (!$_POST['ac'] == md5(ADMINPWCHANGE)) { 153 exit; 154 } 155 156 require_once(e_HANDLER."message_handler.php"); 157 if (strstr($_POST['name'], "#") || strstr($_POST['name'], "=")) { 158 message_handler("P_ALERT", USRLAN_92); 159 $error = TRUE; 160 } 161 $_POST['name'] = trim(str_replace(" ", "", $_POST['name'])); 162 if ($_POST['name'] == "Anonymous") { 163 message_handler("P_ALERT", USRLAN_65); 164 $error = TRUE; 165 } 166 if ($sql->db_Select("user", "*", "user_name='".$_POST['name']."' ")) { 167 message_handler("P_ALERT", USRLAN_66); 168 $error = TRUE; 169 } 170 if ($_POST['password1'] != $_POST['password2']) { 171 message_handler("P_ALERT", USRLAN_67); 172 $error = TRUE; 173 } 174 175 if ($_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] = "") { 176 message_handler("P_ALERT", USRLAN_68); 177 $error = TRUE; 178 } 179 if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', $_POST['email'])) { 180 message_handler("P_ALERT", USRLAN_69); 181 $error = TRUE; 182 } 183 if (!$error) { 184 if ($sql->db_Select("user", "*", "user_email='".$_POST['email']."' AND user_ban='1' ")) { 185 exit; 186 } 187 if ($sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'")) { 188 exit; 189 } 190 191 $username = strip_tags($_POST['name']); 192 $loginname = strip_tags($_POST['loginname']); 193 194 // extract($_POST); 195 // for($a = 0; $a <= (count($_POST['userclass'])-1); $a++) { 196 // $svar .= $userclass[$a]."."; 197 // } 198 $svar = implode(",", $_POST['userclass']); 199 admin_update($sql -> db_Insert("user", "0, '$username', '$loginname', '', '".md5($_POST['password1'])."', '$key', '".$_POST['email']."', '".$_POST['signature']."', '".$_POST['image']."', '".$_POST['timezone']."', '1', '".time()."', '".time()."', '".time()."', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '".$_POST['realname']."', '".$svar."', '', '', '".time()."', ''"), 'insert', USRLAN_70); 200 } 201 } 202 203 // ------- Ban User. -------------- 204 if (isset($_POST['useraction']) && $_POST['useraction'] == "ban") 205 { 206 // $sub_action = $_POST['userid']; 207 $sql->db_Select("user", "*", "user_id='".$_POST['userid']."'"); 208 $row = $sql->db_Fetch(); 209 // extract($row); 210 if ($row['user_perms'] == "0") 211 { 212 $user->show_message(USRLAN_7); 213 } 214 else 215 { 216 if($sql->db_Update("user", "user_ban='1' WHERE user_id='".$_POST['userid']."' ")) 217 { 218 $user->show_message(USRLAN_8); 219 } 220 if(trim($row['user_ip']) == "") 221 { 222 $user->show_message(USRLAN_135); 223 } 224 else 225 { 226 if($sql->db_Count("user", "(*)", "WHERE user_ip = '{$row['user_ip']}'") > 1) 227 { 228 $user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_136)); 229 } 230 else 231 { 232 $sql -> db_Insert("banlist", "'".$row['user_ip']."', '".USERID."', '".$row['user_name']."' "); 233 $user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_137)); 234 } 235 } 236 } 237 $action = "main"; 238 if(!$sub_action){$sub_action = "user_id"; } 239 } 240 // ------- Unban User -------------- 241 if (isset($_POST['useraction']) && $_POST['useraction'] == "unban") { 242 $sql->db_Select("user", "*", "user_id='".$_POST['userid']."'"); 243 $row = $sql->db_Fetch(); 244 extract($row); 245 $sql->db_Update("user", "user_ban='0' WHERE user_id='".$_POST['userid']."' "); 246 $sql -> db_Delete("banlist", " banlist_ip='$user_ip' "); 247 $user->show_message(USRLAN_9); 248 $action = "main"; 249 if(!$sub_action){$sub_action = "user_id"; } 250 } 251 252 // ------- Resend Email Confirmation. -------------- 253 if (isset($_POST['useraction']) && $_POST['useraction'] == 'resend') { 254 $qry = (e_QUERY) ? "?".e_QUERY : ""; 255 if ($sql->db_Select("user", "*", "user_id='".$_POST['userid']."' ")) { 256 $resend = $sql->db_Fetch(); 257 $text .= "<form method='post' action='".e_SELF.$qry."'><div style='text-align:center'>\n"; 258 $text .= USRLAN_116." <b>".$resend['user_name']."</b><br /><br /> 259 260 <input type='hidden' name='resend_id' value='".$_POST['userid']."' />\n 261 <input type='hidden' name='resend_name' value='".$resend['user_name']."' />\n 262 <input type='hidden' name='resend_key' value='".$resend['user_sess']."' />\n 263 <input type='hidden' name='resend_email' value='".$resend['user_email']."' />\n 264 <input class='button' type='submit' name='resend_mail' value='".USRLAN_112."' />\n</div></form>\n"; 265 $caption = USRLAN_112; 266 $ns->tablerender($caption, $text); 267 require_once ("footer.php"); 268 exit; 269 } 270 } 271 // ------- TEst Email confirmation. -------------- 272 if (isset($_POST['useraction']) && $_POST['useraction'] == 'test') { 273 $qry = (e_QUERY) ? "?".e_QUERY : ""; 274 if ($sql->db_Select("user", "*", "user_id='".$_POST['userid']."' ")) { 275 $test = $sql->db_Fetch(); 276 $text .= "<form method='post' action='".e_SELF.$qry."'><div style='text-align:center'>\n"; 277 $text .= USRLAN_117." <br /><b>".$test['user_email']."</b><br /><br /> 278 <input type='hidden' name='test_email' value='".$test['user_email']."' />\n 279 <input type='hidden' name='test_id' value='".$_POST['userid']."' />\n 280 <input class='button' type='submit' name='test_mail' value='".USRLAN_118."' />\n</div></form>\n"; 281 $caption = USRLAN_118; 282 $ns->tablerender($caption, $text); 283 require_once ("footer.php"); 284 exit; 285 } 286 } 287 // ------- Delete User -------------- 288 if (isset($_POST['useraction']) && $_POST['useraction'] == 'deluser') { 289 if ($_POST['confirm']) { 290 if ($sql->db_Delete("user", "user_id='".$_POST['userid']."' AND user_perms != '0'")) { 291 $sql->db_Delete("user_extended", "user_extended_id='".$_POST['userid']."' "); 292 $user->show_message(USRLAN_10); 293 } 294 if(!$sub_action){ $sub_action = "user_id"; } 295 if(!$id){ $id = "DESC"; } 296 297 } else { 298 if ($sql->db_Select("user", "*", "user_id='".$_POST['userid']."' ")) { 299 $row = $sql->db_Fetch(); 300 $qry = (e_QUERY) ? "?".e_QUERY : ""; 301 $text .= "<form method='post' action='".e_SELF.$qry."'><div style='text-align:center'>\n"; 302 $text .= "<div> 303 <input type='hidden' name='useraction' value='deluser' /> 304 <input type='hidden' name='userid' value='{$row['user_id']}' /></div>". USRLAN_13." 305 <br /><br /><span class='indent'>#{$row['user_id']} : {$row['user_name']}</span> 306 <br /><br /> 307 <input type='submit' class='button' name='confirm' value='".USRLAN_17."' /> 308 309 <input type='button' class='button' name='cancel' value='".LAN_CANCEL."' onclick=\"location.href='".e_SELF.$qry."' \"/> 310 </div> 311 </form> 312 "; 313 $ns->tablerender(USRLAN_16, $text); 314 require_once ("footer.php"); 315 exit; 316 } 317 } 318 } 319 // ------- Make Admin.. -------------- 320 if (isset($_POST['useraction']) && $_POST['useraction'] == "admin" && getperms('3')) { 321 $sql->db_Select("user", "*", "user_id='".$_POST['userid']."'"); 322 $row = $sql->db_Fetch(); 323 extract($row); 324 $sql->db_Update("user", "user_admin='1' WHERE user_id='".$_POST['userid']."' "); 325 $user->show_message($user_name." ".USRLAN_3." <a href='".e_ADMIN."administrator.php?edit.$user_id'>".USRLAN_4."</a>"); 326 $action = "main"; 327 if(!$sub_action){ $sub_action = "user_id"; } 328 if(!$id){ $id = "DESC"; } 329 } 330 331 // ------- Remove Admin -------------- 332 if (isset($_POST['useraction']) && $_POST['useraction'] == "unadmin" && getperms('3')) { 333 $sql->db_Select("user", "*", "user_id='".$_POST['userid']."'"); 334 $row = $sql->db_Fetch(); 335 extract($row); 336 if ($user_perms == "0") { 337 $user->show_message(USRLAN_5); 338 } else { 339 $sql->db_Update("user", "user_admin='0', user_perms='' WHERE user_id='".$_POST['userid']."'"); 340 $user->show_message($user_name." ".USRLAN_6); 341 $action = "main"; 342 if(!$sub_action){ $sub_action = "user_id"; } 343 if(!$id){ $id = "DESC"; } 344 } 345 } 346 347 // ------- Approve User. -------------- 348 if (isset($_POST['useraction']) && $_POST['useraction'] == "verify") 349 { 350 $uid = intval($_POST['userid']); 351 if ($sql->db_Update("user", "user_ban='0' WHERE user_id='{$uid}' ")) 352 { 353 $user->show_message(USRLAN_86); 354 if(!$action){ $action = "main"; } 355 if(!$sub_action){ $sub_action = "user_id"; } 356 if(!$id){ $id = "DESC"; } 357 358 if($pref['user_reg_veri'] == 2) 359 { 360 if($sql->db_Select("user", "user_email, user_name", "user_id = '{$uid}'")) 361 { 362 $row = $sql->db_Fetch(); 363 $message = USRLAN_114." ".$row['user_name'].",\n\n".USRLAN_122." ".SITENAME.".\n\n".USRLAN_123."\n\n"; 364 $message .= str_replace("{SITEURL}", SITEURL, USRLAN_139); 365 366 require_once(e_HANDLER."mail.php"); 367 if(sendemail($row['user_email'], USRLAN_113." ".SITENAME, $message)) 368 { 369 // echo str_replace("\n","<br>",$message); 370 $user->show_message("Email sent to: ".$row['user_name']); 371 } 372 else 373 { 374 $user->show_message("Failed to send to: ".$row['user_name']); 375 } 376 } 377 } 378 } 379 } 380 381 if (isset($action) && $action == "uset") { 382 $user->show_message(USRLAN_87); 383 $action = "main"; 384 } 385 386 if (isset($action) && $action == "cu") { 387 $user->show_message(USRLAN_88); 388 $action = "main"; 389 // $sub_action = "user_id"; 390 } 391 392 /* 393 echo "action= ".$action."<br />"; 394 echo "subaction= ".$sub_action."<br />"; 395 echo "id= ".$id."<br />"; 396 echo "from= ".$from."<br />"; 397 echo "amount= ".$amount."<br />"; 398 */ 399 400 401 $unverified = $sql -> db_Count("user", "(*)", "WHERE user_ban = 2"); 402 403 if (!e_QUERY || ($action == "main")) { 404 $user->show_existing_users($action, $sub_action, $id, $from, $amount); 405 } 406 407 if (isset($action) && $action == "unverified") { 408 $user->show_existing_users($action, $sub_action, $id, $from, $amount); 409 } 410 411 if (isset($action) && $action == "options") { 412 $user->show_prefs(); 413 } 414 415 if (isset($action) && $action == "prune") { 416 $user->show_prune(); 417 } 418 419 if (isset($action) && $action == "create") { 420 $user->add_user(); 421 } 422 423 require_once ("footer.php"); 424 425 class users{ 426 427 function show_existing_users($action, $sub_action, $id, $from, $amount) { 428 // ##### Display scrolling list of existing news items --------------------------------------------------------------------------------------------------------- 429 430 global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref,$unverified; 431 // save the display choices. 432 if(isset($_POST['searchdisp'])){ 433 $pref['admin_user_disp'] = implode("|",$_POST['searchdisp']); 434 save_prefs(); 435 } 436 437 if(!$pref['admin_user_disp']){ 438 $search_display = array("user_name","user_class"); 439 }else{ 440 $search_display = explode("|",$pref['admin_user_disp']); 441 } 442 443 if ($sql->db_Select("userclass_classes")) { 444 while ($row = $sql->db_Fetch()) 445 { 446 $class[$row['userclass_id']] = $tp->toHTML($row['userclass_name'],"","defs,emotes_off, no_make_clickable"); 447 } 448 } 449 450 $text = "<div style='text-align:center'>"; 451 452 if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") 453 { 454 $_POST['searchquery'] = trim($_POST['searchquery']); 455 $query = "WHERE ". 456 $query .= (strpos($_POST['searchquery'], "@") !== FALSE) ? "user_email REGEXP('".$_POST['searchquery']."') OR ": ""; 457 $query .= (strpos($_POST['searchquery'], ".") !== FALSE) ? "user_ip REGEXP('".$_POST['searchquery']."') OR ": ""; 458 foreach($search_display as $disp) 459 { 460 $query .= "$disp REGEXP('".$_POST['searchquery']."') OR "; 461 } 462 $query .= "user_login REGEXP('".$_POST['searchquery']."') OR "; 463 $query .= "user_name REGEXP('".$_POST['searchquery']."') "; 464 if($action == 'unverified') 465 { 466 $query .= " AND user_ban = 2 "; 467 } 468 $query .= " ORDER BY user_id"; 469 } else { 470 $query = ""; 471 if($action == 'unverified') 472 { 473 $query = "WHERE user_ban = 2 "; 474 } 475 $query .= "ORDER BY ".($sub_action ? $sub_action : "user_id")." ".($id ? $id : "DESC")." LIMIT $from, $amount"; 476 } 477 478 // $user_total = db_Count($table, $fields = '(*)', 479 $qry_insert = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id "; 480 481 if ($user_total = $sql->db_Select_gen($qry_insert. $query)) { 482 $text .= "<table class='fborder' style='".ADMIN_WIDTH."'> 483 <tr> 484 <td style='width:5%' class='fcaption'><a href='".e_SELF."?main.user_id.".($id == "desc" ? "asc" : "desc").".$from'>ID</a></td> 485 <td style='width:10%' class='fcaption'><a href='".e_SELF."?main.user_ban.".($id == "desc" ? "asc" : "desc").".$from'>".USRLAN_79."</a></td>"; 486 487 488 // Search Display Column header. 489 $display_lan = array('user_id' => DUSRLAN_1, 490 'user_id' => DUSRLAN_1, 491 'user_name' => DUSRLAN_2, 492 'user_loginname' => DUSRLAN_3, 493 'user_customtitle' => DUSRLAN_4, 494 'user_password' => DUSRLAN_5, 495 'user_sess' => DUSRLAN_6, 496 'user_email' => DUSRLAN_7, 497 'user_homepage' => DUSRLAN_8, 498 'user_icq' => DUSRLAN_9, 499 'user_aim' => DUSRLAN_10, 500 'user_msn' => DUSRLAN_11, 501 'user_location' => DUSRLAN_12, 502 'user_birthday' => DUSRLAN_13, 503 'user_signature' => DUSRLAN_14, 504 'user_image' => DUSRLAN_15, 505 'user_timezone' => DUSRLAN_16, 506 'user_hideemail' => DUSRLAN_17, 507 'user_join' => DUSRLAN_18, 508 'user_lastvisit' => DUSRLAN_19, 509 'user_currentvisit' => DUSRLAN_20, 510 'user_lastpost' => DUSRLAN_21, 511 'user_chats' => DUSRLAN_22, 512 'user_comments' => DUSRLAN_23, 513 'user_forums' => DUSRLAN_24, 514 'user_ip' => DUSRLAN_25, 515 'user_ban' => DUSRLAN_26, 516 'user_prefs' => DUSRLAN_27, 517 'user_new' => DUSRLAN_28, 518 'user_viewed' => DUSRLAN_29, 519 'user_visits' => DUSRLAN_30, 520 'user_admin' => DUSRLAN_31, 521 'user_login' => DUSRLAN_32, 522 'user_class' => DUSRLAN_33, 523 'user_perms' => DUSRLAN_34, 524 'user_realm' => DUSRLAN_35, 525 'user_pwchange' => DUSRLAN_36, 526 'user_xup' => DUSRLAN_37 527 ); 528 529 foreach($search_display as $disp){ 530 if (isset($display_lan[$disp])) { 531 $text .= "<td style='width:15%' class='fcaption'><a href='".e_SELF."?main.$disp.".($id == "desc" ? "asc" : "desc").".$from'>".$display_lan[$disp]."</a></td>"; 532 } else { 533 $text .= "<td style='width:15%' class='fcaption'><a href='".e_SELF."?main.$disp.".($id == "desc" ? "asc" : "desc").".$from'>".ucwords(str_replace("_"," ",$disp))."</a></td>"; 534 } 535 } 536 537 // ------------------------------ 538 539 $text .= " <td style='width:30%' class='fcaption'>".LAN_OPTIONS."</td> 540 </tr>"; 541 542 while ($row = $sql->db_Fetch()) { 543 extract($row); 544 $text .= "<tr> 545 <td style='width:5%; text-align:center' class='forumheader3'>$user_id</td> 546 <td style='width:10%' class='forumheader3'>"; 547 548 if ($user_perms == "0") { 549 $text .= "<div class='fcaption' style='padding-left:3px;padding-right:3px;text-align:center;white-space:nowrap'>".LAN_MAINADMIN."</div>"; 550 } 551 else if($user_admin) { 552 $text .= "<div class='fcaption' style='padding-left:3px;padding-right:3px;;text-align:center'><a href='".e_SELF."?main.user_admin.".($id == "desc" ? "asc" : "desc")."'>".LAN_ADMIN."</a></div>"; 553 } 554 else if($user_ban == 1) { 555 $text .= "<div class='fcaption' style='padding-left:3px;padding-right:3px;text-align:center;white-space:nowrap'><a href='".e_SELF."?main.user_ban.".($id == "desc" ? "asc" : "desc")."'>".LAN_BANNED."</a></div>"; 556 } 557 else if($user_ban == 2) { 558 $text .= "<div class='fcaption' style='padding-left:3px;padding-right:3px;text-align:center;white-space:nowrap' >".LAN_NOTVERIFIED."</div>"; 559 } 560 else if($user_ban == 3) { 561 $text .= "<div class='fcaption' style='padding-left:3px;padding-right:3px;text-align:center;white-space:nowrap' >".LAN_BOUNCED."</div>"; 562 } else { 563 $text .= " "; 564 } 565 566 $text .= "</td>"; 567 568 569 570 // Display Chosen options ------------------------------------- 571 572 $datefields = array("user_lastpost","user_lastvisit","user_join","user_currentvisit"); 573 $boleanfields = array("user_admin","user_hideemail","user_ban"); 574 575 foreach($search_display as $disp) 576 { 577 $text .= "<td style='white-space:nowrap' class='forumheader3'>"; 578 if($disp == "user_class") 579 { 580 if ($user_class) 581 { 582 $tmp = explode(",", $user_class); 583 while (list($key, $class_id) = each($tmp)) 584 { 585 $text .= ($class[$class_id] ? $class[$class_id]."<br />\n" : ""); 586 } 587 } 588 else 589 { 590 $text .= " "; 591 } 592 }elseif(in_array($disp,$boleanfields)) 593 { 594 $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : ""; 595 } 596 elseif(in_array($disp,$datefields)) 597 { 598 $text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])." " : " "; 599 } 600 elseif($disp == "user_name") 601 { 602 $text .= "<a href='".e_BASE."user.php?id.{$row['user_id']}'>{$row['user_name']}</a>"; 603 } 604 else 605 { 606 $text .= $row[$disp]." "; 607 } 608 if(!in_array($disp,$boleanfields) && isset($prev[$disp]) && $row[$disp] == $prev[$disp] && $prev[$disp] != "") 609 { // show matches 610 $text .= " <b>*</b>"; 611 } 612 613 $text .= "</td>"; 614 $prev[$disp] = $row[$disp]; 615 } 616 // ------------------------------------------------------------- 617 $qry = (e_QUERY) ? "?".e_QUERY : ""; 618 $text .= " 619 <td style='width:30%;text-align:center' class='forumheader3'> 620 <form method='post' action='".e_SELF.$qry."'> 621 <div> 622 623 <input type='hidden' name='userid' value='{$user_id}' /> 624 <input type='hidden' name='userip' value='{$user_ip}' /> 625 <select name='useraction' onchange='this.form.submit()' class='tbox' style='width:75%'> 626 <option selected='selected' value=''> </option>"; 627 628 if ($user_perms != "0") { 629 $text .= "<option value='userinfo'>".USRLAN_80."</option> 630 <option value='usersettings'>".LAN_EDIT."</option>"; 631 632 if ($user_ban == 1) { 633 $text .= "<option value='unban'>".USRLAN_33."</option>\n"; 634 } 635 else if($user_ban == 2) { 636 $text .= "<option value='ban'>".USRLAN_30."</option> 637 <option value='verify'>".USRLAN_32."</option> 638 <option value='resend'>".USRLAN_112."</option> 639 <option value='test'>".USRLAN_118."</option>"; 640 } else { 641 $text .= "<option value='ban'>".USRLAN_30."</option>\n"; 642 } 643 644 if (!$user_admin && !$user_ban && $user_ban != 2 && getperms('3')) { 645 $text .= "<option value='admin'>".USRLAN_35."</option>\n"; 646 } 647 else if ($user_admin && $user_perms != "0" && getperms('3')) { 648 $text .= "<option value='unadmin'>".USRLAN_34."</option>\n"; 649 } 650 651 } 652 if ($user_perms == "0" && !getperms("0")) { 653 $text .= ""; 654 } elseif($user_id != USERID || getperms("0") ) { 655 $text .= "<option value='userclass'>".USRLAN_36."</option>\n"; 656 } 657 658 if ($user_perms != "0") { 659 $text .= "<option value='deluser'>".LAN_DELETE."</option>\n"; 660 } 661 $text .= "</select></div>"; 662 $text .= "</form></td></tr>"; 663 } 664 $text .= "</table>"; 665 } 666 667 if($action == "unverified"){ 668 $text .= " 669 <div style='text-align:center'> 670 <br /> 671 <form method='post' action='".e_SELF.$qry."'>"; 672 if($pref['mail_bounce_pop3']!=''){ 673 $text .= "<input type='submit' class='button' name='check_bounces' value=\"".USRLAN_143."\" />\n"; 674 } 675 $text .= " <input type='submit' class='button' name='resend_to_all' value=\"".USRLAN_144."\" /> 676 </form> 677 </div>"; 678 679 } 680 681 682 $users = (e_QUERY != "unverified") ? $sql->db_Count("user"): $unverified; 683 684 if ($users > $amount && !$_POST['searchquery']) { 685 $parms = "{$users},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.user_id.desc.")."[FROM]"; 686 $text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}"); 687 } 688 689 // Search - display options etc. . 690 691 $text .= "<br /><form method='post' action='".e_SELF."?".e_QUERY."'>\n"; 692 $text .= "<p>\n<input class='tbox' type='text' name='searchquery' size='20' value='' maxlength='50' />\n 693 <input class='button' type='submit' name='searchsubmit' value='".USRLAN_90."' />\n 694 <br /><br /></p>\n"; 695 696 $text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">".LAN_DISPLAYOPT."</div>"; 697 $text .= "<div id='sdisp' style='padding-top:4px;display:none;text-align:center;margin-left:auto;margin-right:auto'> 698 <table class='forumheader3' style='width:95%'><tr>"; 699 $fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."user"); 700 $columns = mysql_num_fields($fields); 701 for ($i = 0; $i < $columns; $i++) { 702 $fname[] = mysql_field_name($fields, $i); 703 } 704 705 // include extended fields in the list. 706 $sql -> db_Select("user_extended_struct"); 707 while($row = $sql-> db_Fetch()){ 708 $fname[] = "user_".$row['user_extended_struct_name']; 709 } 710 $m = 0; 711 foreach($fname as $fcol){ 712 $checked = (in_array($fcol,$search_display)) ? "checked='checked'" : ""; 713 $text .= "<td style='text-align:left; padding:0px'>"; 714 $text .= "<input type='checkbox' name='searchdisp[]' value='".$fcol."' $checked />".str_replace("user_","",$fcol) . "</td>\n"; 715 $m++; 716 if($m == 5){ 717 $text .= "</tr><tr>"; 718 $m = 0; 719 } 720 } 721 722 $text .= "</table></div> 723 </form>\n 724 </div>"; 725 726 727 728 // ====================== 729 $total_cap = (isset($_POST['searchquery'])) ? $user_total : $users; 730 $caption = USRLAN_77 ." (total: $total_cap)"; 731 $ns->tablerender($caption, $text); 732 733 } 734 735 function show_options($action) { 736 737 global $unverified; 738 // ##### Display options --------------------------------------------------------------------------------------------------------- 739 if ($action == "") { 740 $action = "main"; 741 } 742 // ##### Display options --------------------------------------------------------------------------------------------------------- 743 $var['main']['text'] = USRLAN_71; 744 $var['main']['link'] = e_SELF; 745 746 $var['create']['text'] = USRLAN_72; 747 $var['create']['link'] = e_SELF."?create"; 748 749 $var['prune']['text'] = USRLAN_73; 750 $var['prune']['link'] = e_SELF."?prune"; 751 752 $var['options']['text'] = LAN_OPTIONS; 753 $var['options']['link'] = e_SELF."?options"; 754 755 if($unverified) 756 { 757 $var['unveri']['text'] = USRLAN_138." ($unverified)"; 758 $var['unveri']['link'] = e_SELF."?unverified"; 759 } 760 761 // $var['mailing']['text']= USRLAN_121; 762 // $var['mailing']['link']="mailout.php"; 763 show_admin_menu(USRLAN_76, $action, $var); 764 } 765 766 function show_prefs() { 767 global $ns, $pref; 768 $pref['memberlist_access'] = varset($pref['memberlist_access'], e_UC_MEMBER); 769 $text = "<div style='text-align:center'> 770 <form method='post' action='".e_SELF."?".e_QUERY."'> 771 <table style='".ADMIN_WIDTH."' class='fborder'> 772 773 <tr> 774 <td style='width:50%' class='forumheader3'>".USRLAN_44.":</td> 775 <td style='width:50%' class='forumheader3'>". ($pref['avatar_upload'] ? "<input name='avatar_upload' type='radio' value='1' checked='checked' />".LAN_YES." <input name='avatar_upload' type='radio' value='0' />".LAN_NO : "<input name='avatar_upload' type='radio' value='1' />".LAN_YES." <input name='avatar_upload' type='radio' value='0' checked='checked' />".LAN_NO). (!FILE_UPLOADS ? " <span class='smalltext'>(".USRLAN_58.")</span>" : "")." 776 </td> 777 </tr> 778 779 <tr> 780 <td style='width:50%' class='forumheader3'>".USRLAN_53.":</td> 781 <td style='width:50%' class='forumheader3'>". ($pref['photo_upload'] ? "<input name='photo_upload' type='radio' value='1' checked='checked' />".LAN_YES." <input name='photo_upload' type='radio' value='0' />".LAN_NO : "<input name='photo_upload' type='radio' value='1' />".LAN_YES." <input name='photo_upload' type='radio' value='0' checked='checked' />".LAN_NO). (!FILE_UPLOADS ? " <span class='smalltext'>(".USRLAN_58.")</span>" : "")." 782 </td> 783 </tr> 784 785 <tr> 786 <td style='width:50%' class='forumheader3'>".USRLAN_47.":</td> 787 <td style='width:50%' class='forumheader3'> 788 <input class='tbox' type='text' name='im_width' size='10' value='".$pref['im_width']."' maxlength='5' /> (".USRLAN_48.") 789 </td></tr> 790 791 <tr> 792 <td style='width:50%' class='forumheader3'>".USRLAN_49.":</td> 793 <td style='width:50%' class='forumheader3'> 794 <input class='tbox' type='text' name='im_height' size='10' value='".$pref['im_height']."' maxlength='5' /> (".USRLAN_50.") 795 </td></tr> 796 797 <tr> 798 <td style='width:50%' class='forumheader3'>".USRLAN_126.":</td> 799 <td style='width:50%;vertical-align:top' class='forumheader3'>". ($pref['profile_rate'] ? "<input name='profile_rate' type='radio' value='1' checked='checked' />".LAN_YES." <input name='profile_rate' type='radio' value='0' />".LAN_NO : "<input name='profile_rate' type='radio' value='1' />".LAN_YES." <input name='profile_rate' type='radio' value='0' checked='checked' />".LAN_NO)." 800 </td> 801 </tr> 802 803 <tr> 804 <td style='width:50%' class='forumheader3'>".USRLAN_127.":</td> 805 <td style='width:50%;vertical-align:top' class='forumheader3'>". ($pref['profile_comments'] ? "<input name='profile_comments' type='radio' value='1' checked='checked' />".LAN_YES." <input name='profile_comments' type='radio' value='0' />".LAN_NO : "<input name='profile_comments' type='radio' value='1' />".LAN_YES." <input name='profile_comments' type='radio' value='0' checked='checked' />".LAN_NO)." 806 </td> 807 </tr> 808 809 <tr> 810 <td style='width:50%;vertical-align:top' class='forumheader3'>".USRLAN_133.":<br /><span class='smalltext'>".USRLAN_134."</span></td> 811 <td style='width:50%;vertical-align:top' class='forumheader3'>". ($pref['force_userupdate'] ? "<input name='force_userupdate' type='radio' value='1' checked='checked' />".LAN_YES." <input name='force_userupdate' type='radio' value='0' />".LAN_NO : "<input name='force_userupdate' type='radio' value='1' />".LAN_YES." <input name='force_userupdate' type='radio' value='0' checked='checked' />".LAN_NO)." 812 </td> 813 </tr> 814 815 816 <tr> 817 <td style='width:50%;vertical-align:top' class='forumheader3'>".USRLAN_93."<br /><span class='smalltext'>".USRLAN_94."</span></td> 818 <td style='width:50%' class='forumheader3'> 819 <input class='tbox' type='text' name='del_unv' size='10' value='".$pref['del_unv']."' maxlength='5' /> ".USRLAN_95." 820 </td></tr> 821 822 <tr> 823 <td style='width:50%' class='forumheader3'>".USRLAN_130."<br /><span class='smalltext'>".USRLAN_131."</span></td> 824 <td style='width:50%' class='forumheader3'> 825 <input type='checkbox' name='track_online' value='1'".($pref['track_online'] ? " checked='checked'" : "")." /> ".USRLAN_132." 826 </td> 827 </tr> 828 829 830 <tr> 831 <td style='width:50%' class='forumheader3'>".USRLAN_146.":</td> 832 <td style='width:50%' class='forumheader3'>".r_userclass("memberlist_access",$pref['memberlist_access'], "off", "public,member,guest,admin,main,classes,nobody")." 833 </td> 834 </tr> 835 836 <tr> 837 <td colspan='2' style='text-align:center' class='forumheader'> 838 <input class='button' type='submit' name='update_options' value='".USRLAN_51."' /> 839 </td></tr> 840 841 </table></form></div>"; 842 $ns->tablerender(USRLAN_52, $text); 843 } 844 845 function show_message($message) { 846 global $ns; 847 $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); 848 } 849 850 function show_prune() { 851 global $ns, $sql; 852 853 $unactive = $sql->db_Select("user", "*", "user_ban=2"); 854 $bounced = $sql->db_Select("user", "*", "user_ban=3"); 855 $text = "<div style='text-align:center'><br /><br /> 856 <form method='post' action='".e_SELF."'> 857 <table style='".ADMIN_WIDTH."' class='fborder'> 858 <tr> 859 <td class='forumheader3' style='text-align:center'><br />".LAN_DELETE.": 860 <select class='tbox' name='prune_type'>"; 861 $prune_type = array(2=>USRLAN_138." [".$unactive."]",3=>USRLAN_145." [".$bounced."]"); 862 foreach($prune_type as $key=>$val){ 863 $text .= "<option value='$key'>{$val}</option>\n"; 864 } 865 866 $text .= "</select><br /><br /></td> 867 </tr> 868 <tr> 869 <td class='forumheader' style='text-align:center'> 870 <input class='button' type='submit' name='prune' value=\"".USRLAN_55."\" /> 871 </td> 872 </tr> 873 </table> 874 </form> 875 </div>"; 876 $ns->tablerender(USRLAN_55, $text); 877 } 878 879 function add_user() { 880 global $rs, $ns; 881 $text = "<div style='text-align:center'>". $rs->form_open("post", e_SELF, "adduserform")." 882 <table style='".ADMIN_WIDTH."' class='fborder'> 883 <tr> 884 <td style='width:30%' class='forumheader3'>".USRLAN_61."</td> 885 <td style='width:70%' class='forumheader3'> 886 ".$rs->form_text("name", 40, "", 30)." 887 </td> 888 </tr> 889 890 <tr> 891 <td style='width:30%' class='forumheader3'>".USRLAN_128."</td> 892 <td style='width:70%' class='forumheader3'> 893 ".$rs->form_text("loginname", 40, "", 30)." 894 </td> 895 </tr> 896 897 <tr> 898 <td style='width:30%' class='forumheader3'>".USRLAN_62."</td> 899 <td style='width:70%' class='forumheader3'> 900 ".$rs->form_password("password1", 40, "", 20)." 901 </td> 902 </tr> 903 <tr> 904 <td style='width:30%' class='forumheader3'>".USRLAN_63."</td> 905 <td style='width:70%' class='forumheader3'> 906 ".$rs->form_password("password2", 40, "", 20)." 907 </td> 908 </tr> 909 <tr> 910 <td style='width:30%' class='forumheader3'>".USRLAN_64."</td> 911 <td style='width:70%' class='forumheader3'> 912 ".$rs->form_text("email", 60, "", 100)." 913 </td> 914 </tr>"; 915 916 917 if (!is_object($sql)) $sql = new db; 918 if ($sql->db_Select("userclass_classes")) { 919 $text .= "<tr style='vertical-align:top'> 920 <td colspan='2' style='text-align:center' class='forumheader'> 921 ".USRLAN_120." 922 </td> 923 </tr>"; 924 $c = 0; 925 while ($row = $sql->db_Fetch()) { 926 $class[$c][0] = $row['userclass_id']; 927 $class[$c][1] = $row['userclass_name']; 928 $class[$c][2] = $row['userclass_description']; 929 $c++; 930 } 931 for($a = 0; $a <= (count($class)-1); $a++) { 932 $text .= "<tr><td style='width:30%' class='forumheader'> 933 <input type='checkbox' name='userclass[]' value='".$class[$a][0]."' />".$class[$a][1]." 934 </td><td style='width:70%' class='forumheader3'> ".$class[$a][2]."</td></tr>"; 935 } 936 } 937 $text .= " 938 <tr style='vertical-align:top'> 939 <td colspan='2' style='text-align:center' class='forumheader'> 940 <input class='button' type='submit' name='adduser' value='".USRLAN_60."' /> 941 <input type='hidden' name='ac' value='".md5(ADMINPWCHANGE)."' /> 942 </td> 943 </tr> 944 </table> 945 </form> 946 </div> 947 "; 948 949 $ns->tablerender(USRLAN_59, $text); 950 } 951 952 953 function resend($id,$key,$name,$email,$lfile=''){ 954 global $sql,$mailheader_e107id; 955 956 957 // Check for a Language field, and if present, send the email in the user's language. 958 if($lfile == ""){ 959 if($sql -> db_Select("user_extended", "user_language", "user_extended_id = '$id'")){ 960 $row = $sql -> db_Fetch(); 961 $lfile = e_LANGUAGEDIR.$row['user_language']."/lan_signup.php"; 962 } 963 } 964 if(is_readable($lfile)){ 965 require_once($lfile); 966 }else{ 967 $row['user_language'] = e_LANGUAGE; 968 require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php"); 969 } 970 971 972 define("RETURNADDRESS", (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$id.".".$key : SITEURL."/signup.php?activate.".$id.".".$key)); 973 974 $message = LAN_EMAIL_01." ".$name."\n\n".LAN_SIGNUP_24." ".SITENAME.".\n".LAN_SIGNUP_21."...\n\n"; 975 $message .= RETURNADDRESS . "\n\n".SITENAME."\n".SITEURL; 976 977 $mailheader_e107id = $id; 978 979 require_once(e_HANDLER."mail.php"); 980 if(sendemail($email, LAN_404." ".SITENAME, $message)){ 981 // echo str_replace("\n","<br>",$message); 982 $this->show_message(USRLAN_140.": <a href='mailto:".$email."?body=".RETURNADDRESS."' title=\"".DUSRLAN_7."\" >".$name."</a> (".$row['user_language'].") "); 983 }else{ 984 $this->show_message(USRLAN_141.": ".$name); 985 } 986 987 } 988 989 990 function resend_to_all(){ 991 global $sql,$pref,$sql3; 992 $pause_count = 1; 993 $pause_amount = ($pref['mail_pause']) ? $pref['mail_pause'] : 10; 994 $pause_time = ($pref['mail_pausetime']) ? $pref['mail_pausetime'] : 1; 995 996 if($sql -> db_Select_gen("SELECT user_language FROM #user_extended LIMIT 1")){ 997 $query = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 ORDER BY u.user_id DESC"; 998 }else{ 999 $query = "SELECT * FROM #user WHERE user_ban='2'"; 1000 } 1001 1002 if(!is_object($sql3)){ 1003 $sql3 = new db; 1004 } 1005 1006 $sql3 -> db_Select_gen($query); 1007 while($row = $sql3-> db_Fetch()){ 1008 echo $row['user_id']." ".$row['user_sess']." ".$row['user_name']." ".$row['user_email']."<br />"; 1009 $this->resend($row['user_id'],$row['user_sess'],$row['user_name'],$row['user_email'],$row['user_language']); 1010 if($pause_count > $pause_amount){ 1011 sleep($pause_time); 1012 $pause_count = 1; 1013 } 1014 sleep(1); 1015 $pause_count++; 1016 } 1017 } 1018 1019 // --------------------------------------------------------------------- 1020 1021 function check_bounces(){ 1022 global $sql,$pref; 1023 include(e_HANDLER."pop3_class.php"); 1024 1025 $obj= new receiveMail($pref['mail_bounce_user'],$pref['mail_bounce_pass'],$pref['mail_bounce_email'],$pref['mail_bounce_pop3'],'pop3','110'); 1026 $obj->connect(); 1027 $tot=$obj->getTotalMails(); 1028 $found = FALSE; 1029 $DEL = ($pref['mail_bounce_delete']) ? TRUE : FALSE; 1030 $text = "<br /><div><table class='fborder' style='".ADMIN_WIDTH."'> 1031 <tr><td class='fcaption' style='width:5%'>#</td><td class='fcaption'>e107-id</td><td class='fcaption'>email</td><td class='fcaption'>Subject</td><td class='fcaption'>Bounce</td></tr>\n"; 1032 for($i=1;$i<=$tot;$i++) { 1033 $head=$obj->getHeaders($i); 1034 1035 if($head['bounce']){ 1036 if (ereg('.*X-e107-id:(.*)MIME', $obj->getBody($i), $result)){ 1037 if($result[1]){ 1038 $id[$i] = intval($result[1]); 1039 $found = TRUE; 1040 } 1041 1042 }elseif(preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)){ 1043 if($result[0] && $result[0] != $pref['mail_bounce_email']){ 1044 $emails[$i] = "'".$result[0]."'"; 1045 $found = TRUE; 1046 }elseif($result[1] && $result[1] != $pref['mail_bounce_email']){ 1047 $emails[$i] = "'".$result[1]."'"; 1048 $found = TRUE; 1049 } 1050 1051 } 1052 if($DEL && $found){ $obj->deleteMails($i); } 1053 1054 } 1055 1056 $text .= "<tr><td class='forumheader3'>".$i."</td><td class='forumheader3'>".$id[$i]."</td><td class='forumheader3'>".$emails[$i]."</td><td class='forumheader3'>".$head['subject']."</td><td class='forumheader3'>".($head['bounce'] ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."</td></tr>"; 1057 1058 } 1059 $text .= "</table></div>"; 1060 1061 array_unique($id); 1062 array_unique($emails); 1063 1064 $all_ids = implode(",",$id); 1065 $all_emails = implode(",",$emails); 1066 1067 $obj->close_mailbox(); 1068 $found = count($id) + count($emails); 1069 if($ed = $sql -> db_Update("user", "user_ban=3 WHERE (user_id IN (".$all_ids.") OR user_email IN (".$all_emails.")) AND user_sess !='' ")){ 1070 $this->show_message(LAN_UPDATED."<br >Found $tot, updated $ed / $found".$text); 1071 }else{ 1072 $this->show_message(LAN_UPDATED_FAILED."<br >Found $tot, not updated $ed / $found".$text); 1073 } 1074 1075 } 1076 1077 } 1078 function users_adminmenu() { 1079 global $user; 1080 global $action; 1081 $user->show_options($action); 1082 } 1083 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |