diff --git a/e107_admin/users.php b/e107_admin/users.php index e651b93ea..b2ae40f63 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -11,33 +11,41 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/users.php,v $ -| $Revision: 1.4 $ -| $Date: 2007-05-01 19:50:55 $ -| $Author: lisa_ $ +| $Revision: 1.5 $ +| $Date: 2007-08-06 19:35:11 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ require_once("../class2.php"); -if (!getperms("4")) { - header("location:".e_BASE."index.php"); - exit; +if (!getperms("4")) +{ + header("location:".e_BASE."index.php"); + exit; } -if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo') { + +if (isset($_POST['useraction']) && $_POST['useraction'] == 'userinfo') +{ header('location:'.e_ADMIN."userinfo.php?".$tp -> toDB($_POST['userip'])); exit; } -if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings') { + +if (isset($_POST['useraction']) && $_POST['useraction'] == 'usersettings') +{ header('location:'.e_BASE."usersettings.php?".$tp -> toDB($_POST['userid'])); exit; } -if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') { + +if (isset($_POST['useraction']) && $_POST['useraction'] == 'userclass') +{ header('location:'.e_ADMIN."userclass.php?".$tp -> toDB($_POST['userid'].".".e_QUERY)); exit; } + $e_sub_cat = 'users'; $user = new users; require_once("auth.php"); @@ -61,28 +69,38 @@ $amount = 30; // ------- Check for Bounces -------------- -if(isset($_POST['check_bounces'])){ - $user->check_bounces(); +$bounce_act = ''; +if (isset($_POST['check_bounces'])) $bounce_act = 'first_check'; +if (isset($_POST['delnonbouncesubmit'])) $bounce_act = 'delnonbounce'; +if (isset($_POST['delcheckedsubmit'])) $bounce_act = 'delchecked'; +if (isset($_POST['delallsubmit'])) $bounce_act = 'delall'; +if ($bounce_act) +{ + $user->check_bounces($bounce_act, implode(',',$_POST['delete_email'])); require_once("footer.php"); exit; } -// ------- Resend Email. -------------- -if (isset($_POST['resend_mail'])) { + +// ------- Resend Email. -------------- +if (isset($_POST['resend_mail'])) +{ $user->resend($_POST['resend_id'],$_POST['resend_key'],$_POST['resend_name'],$_POST['resend_email']); - } + // ------- Resend Email. -------------- -if(isset($_POST['resend_to_all'])){ +if(isset($_POST['resend_to_all'])) +{ $user->resend_to_all(); } // ------- Test Email. -------------- -if (isset($_POST['test_mail'])) { +if (isset($_POST['test_mail'])) +{ require_once(e_HANDLER."mail_validation_class.php"); list($adminuser,$adminhost) = split ("@", SITEADMINEMAIL); $validator = new email_validation_class; @@ -113,8 +131,11 @@ if (isset($_POST['test_mail'])) { $ns->tablerender($caption, $text); unset($id, $action, $sub_cation); } + + // ------- Update Options. -------------- -if (isset($_POST['update_options'])) { +if (isset($_POST['update_options'])) +{ $pref['avatar_upload'] = (FILE_UPLOADS ? $_POST['avatar_upload'] : 0); $pref['im_width'] = $_POST['im_width']; $pref['im_height'] = $_POST['im_height']; @@ -128,6 +149,8 @@ if (isset($_POST['update_options'])) { save_prefs(); $user->show_message(USRLAN_1); } + + // ------- Prune Users. -------------- if (isset($_POST['prune'])) { $e107cache->clear("online_menu_member_total"); @@ -147,6 +170,8 @@ if (isset($_POST['prune'])) { $ns->tablerender(USRLAN_57, "
".$text."
"); unset($text); } + + // ------- Quick Add User -------------- if (isset($_POST['adduser'])) { $e107cache->clear("online_menu_member_total"); @@ -201,6 +226,21 @@ if (isset($_POST['adduser'])) { } } + +// ------- Bounce --> Unverified -------------- +if (isset($_POST['useraction']) && $_POST['useraction'] == "reqverify") +{ + $sql->db_Select("user", "*", "user_id='".$_POST['userid']."'"); + $row = $sql->db_Fetch(); + extract($row); + $sql->db_Update("user", "user_ban='2' WHERE user_id='".$_POST['userid']."' "); + $user->show_message("User now has to verify"); + $action = "main"; + if(!$sub_action) {$sub_action = "user_id"; } +} + + + // ------- Ban User. -------------- if (isset($_POST['useraction']) && $_POST['useraction'] == "ban") { @@ -237,6 +277,8 @@ if (isset($_POST['useraction']) && $_POST['useraction'] == "ban") $action = "main"; if(!$sub_action){$sub_action = "user_id"; } } + + // ------- Unban User -------------- if (isset($_POST['useraction']) && $_POST['useraction'] == "unban") { $sql->db_Select("user", "user_ip", "user_id='".$_POST['userid']."'"); @@ -623,37 +665,53 @@ class users{ "; @@ -1014,47 +1072,119 @@ class users{ } } -// --------------------------------------------------------------------- - function check_bounces(){ + +// --------------------------------------------------------------------- +// Bounce handling +// --------------------------------------------------------------------- +// $bounce_act has the task to perform: +// 'first_check' - initial read of list of bounces +// 'delnonbounce' - delete any emails that aren't bounces +// 'delchecked' - delete the emails whose comma-separated IDs are in $bounce_arr +// 'delall' - delete all bounced emails + + function check_bounces($bounce_act='first_check', $bounce_arr = '') + { global $sql,$pref; include(e_HANDLER."pop3_class.php"); + if (!$bounce_act) $bounce_act='first_check'; + +// echo "Check bounces. Action: {$bounce_act}; Entries: {$bounce_arr}
"; + $obj= new receiveMail($pref['mail_bounce_user'],$pref['mail_bounce_pass'],$pref['mail_bounce_email'],$pref['mail_bounce_pop3'],'pop3','110'); + if ($bounce_act !='first_check') + { // Must do some deleting + $obj->connect(); + $tot=$obj->getTotalMails(); + $del_array = explode(',',$bounce_arr); + for($i=1;$i<=$tot;$i++) + { + $dodel = FALSE; + switch ($bounce_act) + { + case 'delnonbounce' : + $head=$obj->getHeaders($i); + $dodel = (!$head['bounce']); + break; + case 'delall' : + $dodel = TRUE; + break; + case 'delchecked' : + $dodel = in_array($i, $del_array); + break; + } + if ($dodel) + { +// echo "Delete email ID {$i}
"; + $obj->deleteMails($i); + } + } + $obj->close_mailbox(); // This actually deletes the emails + } + $obj->connect(); $tot=$obj->getTotalMails(); $found = FALSE; $DEL = ($pref['mail_bounce_delete']) ? TRUE : FALSE; - $text = "
+ $text = "
\n"; - for($i=1;$i<=$tot;$i++) { - $head=$obj->getHeaders($i); - - if($head['bounce']){ - if (ereg('.*X-e107-id:(.*)MIME', $obj->getBody($i), $result)){ - if($result[1]){ + for($i=1;$i<=$tot;$i++) + { + $head=$obj->getHeaders($i); + if($head['bounce']) + { + if (ereg('.*X-e107-id:(.*)MIME', $obj->getBody($i), $result)) + { + if($result[1]) + { $id[$i] = intval($result[1]); +// Try and pull out an email address from body - should be the one that failed + if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) + { + $emails[$i] = "'".$result[0]."'"; + } $found = TRUE; } - }elseif(preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)){ - if($result[0] && $result[0] != $pref['mail_bounce_email']){ + } + elseif (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) + { + if($result[0] && $result[0] != $pref['mail_bounce_email']) + { $emails[$i] = "'".$result[0]."'"; $found = TRUE; - }elseif($result[1] && $result[1] != $pref['mail_bounce_email']){ + } + elseif($result[1] && $result[1] != $pref['mail_bounce_email']) + { $emails[$i] = "'".$result[1]."'"; $found = TRUE; } - } if($DEL && $found){ $obj->deleteMails($i); } - } - - $text .= ""; - + else + { // Its a warning message or similar +// $id[$i] = ''; // Don't worry about an ID for now +// Try and pull out an email address from body - should be the one that failed + if (preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $obj->getBody($i), $result)) + { + $wmails[$i] = "'".$result[0]."'"; + } + } + $text .= "\n"; } - $text .= "
#e107-idemailSubjectBounce
".$i."".$id[$i]."".$emails[$i]."".$head['subject']."".($head['bounce'] ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."
".$i."".$id[$i]."".(isset($emails[$i]) ? $emails[$i] : $wmails[$i])."".$head['subject']."".($head['bounce'] ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON); + $text .= "
"; + + if ($tot) + { // Option to delete emails + $text .= " + \n + \n + \n + "; + } + $text .= "
"; array_unique($id); array_unique($emails); @@ -1063,17 +1193,26 @@ class users{ $all_emails = implode(",",$emails); $obj->close_mailbox(); - $found = count($id) + count($emails); - if($ed = $sql -> db_Update("user", "user_ban=3 WHERE (user_id IN (".$all_ids.") OR user_email IN (".$all_emails.")) AND user_sess !='' ")){ - $this->show_message(LAN_UPDATED."
Found $tot, updated $ed / $found".$text); - }else{ - $this->show_message(LAN_UPDATED_FAILED."
Found $tot, not updated $ed / $found".$text); +// $found = count($id) + count($emails); + $found = count($emails); // Number of bounce emails found + // Update bounce status for users + if($ed = $sql -> db_Update("user", "user_ban=3 WHERE (`user_id` IN (".$all_ids.") OR `user_email` IN (".$all_emails.")) AND user_sess !='' ")) + { + $this->show_message(LAN_UPDATED."
Found {$tot}, updated {$ed} / {$found}".$text); + } + else + { + $this->show_message(LAN_UPDATED_FAILED."
Found {$tot}, not updated {$ed} / {$found}".$text); } } -} -function users_adminmenu() { +} // End class users + + + +function users_adminmenu() +{ global $user; global $action; $user->show_options($action); diff --git a/e107_languages/English/admin/lan_users.php b/e107_languages/English/admin/lan_users.php index 506cd216c..3ea794def 100644 --- a/e107_languages/English/admin/lan_users.php +++ b/e107_languages/English/admin/lan_users.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_users.php,v $ -| $Revision: 1.4 $ -| $Date: 2007-04-15 22:50:31 $ -| $Author: e107coders $ +| $Revision: 1.5 $ +| $Date: 2007-08-06 19:35:17 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ define("USRLAN_1", "Options Saved."); @@ -133,10 +133,34 @@ define("USRLAN_135", "No IP address found in user's info; IP not banned"); define("USRLAN_136", "Multiple users found with IP address of {IP}; IP not banned."); define("USRLAN_137", "Users IP address of {IP} banned."); + +define("USRLAN_138", "Unverified users"); +define("USRLAN_139", "Your account has been activated.\n\nYou can visit {SITEURL} and log into the site using the login information you provided."); + +define("USRLAN_140", "Email Re-sent to"); +define("USRLAN_141", "Failed to Re-send email to"); +define("USRLAN_142", "with the following activation link"); + +define("USRLAN_143", "Check For Bounces"); +define("USRLAN_144", "Resend Confirmation Email to All"); +define("USRLAN_145", "Bounced users"); +define("USRLAN_146", "Member information is available to"); + +define("USRLAN_147", "Email address is already used by a banned user"); +define("USRLAN_148", "Email address is banned"); + +define("USRLAN_149", "Delete checked emails"); +define("USRLAN_150", "Delete all emails"); +define("USRLAN_151", "Clear bounce, require Activation"); +define("USRLAN_152", "Clear bounce and Activate"); +define("USRLAN_153", "Delete non-bounce emails"); + + define("LAN_MAINADMIN","Main Admin"); define("LAN_ADMIN","Admin"); define("LAN_NOTVERIFIED","Not Verified"); define("LAN_BANNED","Banned"); +define("LAN_BOUNCED","Bounced"); define("DUSRLAN_1", "ID"); define("DUSRLAN_2", "Display Name"); @@ -176,20 +200,4 @@ define("DUSRLAN_35", "Picture"); define("DUSRLAN_36", "Password Change"); define("DUSRLAN_37", "XUP"); -define("USRLAN_138", "Unverified users"); -define("USRLAN_139", "Your account has been activated.\n\nYou can visit {SITEURL} and log into the site using the login information you provided."); - -define("USRLAN_140", "Email Re-sent to"); -define("USRLAN_141", "Failed to Re-send email to"); -define("USRLAN_142", "with the following activation link"); - -define("LAN_BOUNCED","Bounced"); -define("USRLAN_143", "Check For Bounces"); -define("USRLAN_144", "Resend Confirmation Email to All"); -define("USRLAN_145", "Bounced users"); -define("USRLAN_146", "Member information is available to"); - -define("USRLAN_147", "Email address is already used by a banned user"); -define("USRLAN_148", "Email address is banned"); - ?> \ No newline at end of file