db_Delete("generic", "gen_type='sendmail' AND gen_datestamp < ".(time()-86400)); if (isset($_POST['save_email'])){ $qry = "0,'massmail', '".time()."', '".USERID."', '".$tp->toDB($_POST['email_subject'])."', '0', \"".$tp->toDB($_POST['email_body'])."\" "; $message = $sql -> db_Insert("generic", $qry) ? LAN_SAVED : LAN_ERROR; } if (isset($_POST['update_email'])){ $qry = "gen_user_id = '".USERID."', gen_datestamp = '".time()."', gen_ip = '".$tp->toDB($_POST['email_subject'])."', gen_chardata= \"".$tp->toDB($_POST['email_body'])."\" WHERE gen_id = '".$_POST['update_id']."' "; $message = $sql -> db_Update("generic", $qry) ? LAN_UPDATED : LAN_UPDATED_FAILED; } if (isset($_POST['delete'])){ $d_idt = array_keys($_POST['delete']); $message = ($sql -> db_Delete("generic", "gen_id='".$d_idt[0]."'")) ? LAN_DELETED : LAN_DELETED_FAILED; } if (isset($_POST['edit'])){ $e_idt = array_keys($_POST['edit']); if($sql -> db_Select("generic", "*", "gen_id='".$e_idt[0]."' ")){ $foo = $sql -> db_Fetch(); } } if (isset($_POST['submit'])) { if ($_POST['email_to'] == "all" || $_POST['email_to'] == "admin") { switch ($_POST['email_to']) { case "admin": $insert = "u.user_admin='1' "; break; case "all": $insert = "u.user_ban='0' "; break; } $qry = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id WHERE $insert "; } elseif($_POST['email_to'] == "unverified"){ $qry = "SELECT u.* FROM #user AS u WHERE u.user_ban='2'"; } elseif($_POST['email_to'] == "self"){ $qry = "SELECT u.* FROM #user AS u WHERE u.user_id='".USERID."'"; } else { $insert = "u.user_class REGEXP concat('(^|,)',{$_POST['email_to']},'(,|$)') AND u.user_ban='0' "; $qry = "SELECT u.*, ue.* FROM #user AS u LEFT JOIN #user_extended AS ue ON ue.user_extended_id = u.user_id WHERE $insert "; } $sql2 = new db; $c = 0; if($_POST['extended_1_name'] && $_POST['extended_1_value']){ $qry .= " AND ".$_POST['extended_1_name']." = '".$_POST['extended_1_value']."' "; } if($_POST['extended_2_name'] && $_POST['extended_2_value']){ $qry .= " AND ".$_POST['extended_2_name']." = '".$_POST['extended_2_value']."' "; } if($_POST['user_search_name'] && $_POST['user_search_value']){ $qry .= " AND u.".$_POST['user_search_name']." LIKE '%".$_POST['user_search_value']."%' "; } $qry .= " ORDER BY u.user_name"; $_POST['mail_id'] = time(); $sql->db_Select_gen($qry); if (ob_get_level() == 0) { ob_start(); } while ($row = $sql->db_Fetch()) { $qry = "0,'sendmail', '".$_POST['mail_id']."', '".$row['user_id']."', '', '0', \"".$tp->toDB($_POST['email_subject'])."\" "; if($sql2 -> db_Insert("generic", $qry)){ $c++; } ob_flush(); flush(); } ob_end_flush(); $text = "
"; foreach($_POST as $key=>$val){ $text .= "\n"; } $text .= "
"; $text .= "
$c ".MAILAN_24."
"; $text .= "

"; $text .= "


"; // --------------- Preview Email --------------------------> if(is_numeric($_POST['email_to'])) { $sql->db_Select("userclass_classes", "userclass_name", "userclass_id = '{$_POST['email_to']}'"); $row = $sql->db_Fetch(); $_to = MAILAN_23.$row['userclass_name']; } else { $_to = $_POST['email_to']; } $text .= "
"; $text .= ($_POST['email_cc']) ? " ": ""; $text .= ($_POST['email_bcc']) ? " ": ""; $text .= ($_POST['user_search_name'] && $_POST['user_search_value']) ? " ": ""; $text .= ($_POST['extended_1_name'] && $_POST['extended_1_value']) ? " ": ""; $text .= ($_POST['extended_2_name'] && $_POST['extended_2_value']) ? " ": ""; $text .="
".MAILAN_03." ".$_to." "; if($_POST['email_to'] == "self"){ $text .= "<".USEREMAIL.">"; } $text .="
".MAILAN_01." / ".MAILAN_02." ".$_POST['email_from_name']." <".$_POST['email_from_email'].">
".MAILAN_06." ".$_POST['email_subject']." 
".MAILAN_04." ".$_POST['email_cc']." 
".MAILAN_05." ".$_POST['email_bcc']." 
".$_POST['user_search_name']." ".$_POST['user_search_value']." 
".$_POST['extended_1_name']." ".$_POST['extended_1_value']." 
".$_POST['extended_2_name']." ".$_POST['extended_2_value']." 
".stripslashes($tp->toHTML($_POST['email_body'],TRUE))."
"; $ns->tablerender("Emailing ($c) ", $text); require_once(e_ADMIN."footer.php"); exit; } //. Update Preferences. if (isset($_POST['updateprefs'])) { $pref['mailer'] = $_POST['mailer']; $pref['sendmail'] = $_POST['sendmail']; $pref['smtp_server'] = $tp->toDB($_POST['smtp_server']); $pref['smtp_username'] = $tp->toDB($_POST['smtp_username']); $pref['smtp_password'] = $tp->toDB($_POST['smtp_password']); $pref['mail_pause'] = $_POST['mail_pause']; $pref['mail_pausetime'] = $_POST['mail_pausetime']; $pref['mail_bounce_email'] = $_POST['mail_bounce_email']; $pref['mail_bounce_pop3'] = $_POST['mail_bounce_pop3']; $pref['mail_bounce_user'] = $_POST['mail_bounce_user']; $pref['mail_bounce_pass'] = $_POST['mail_bounce_pass']; $pref['mail_bounce_delete'] = $_POST['mail_bounce_delete']; save_prefs(); $message = LAN_SETSAVED; } if (isset($message)) { $ns->tablerender("", "
".$message."
"); } // ----------------- Actions -----------------------------------------------> if(e_QUERY == "prefs"){ show_prefs(); } if((!e_QUERY && !$_POST['delete']) || $_POST['edit']){ show_mailform($foo); } if(e_QUERY == "list" || $_POST['delete'] ){ showList(); } require_once(e_ADMIN."footer.php"); // ------------------- Display Mailout Form.---------------------------------> function show_mailform($foo=""){ global $ns,$sql,$tp,$pref,$HANDLERS_DIRECTORY; $email_subject = $foo['gen_ip']; $email_body = $tp->toForm($foo['gen_chardata']); $email_id = $foo['gen_id']; $text = ""; if(strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip") && !is_readable(e_HANDLER."phpmailer/.htaccess")){ $warning = "You need to rename e107.htaccess to .htaccess in ".$HANDLERS_DIRECTORY."phpmailer/ before sending mail from this page."; $ns -> tablerender("Warning", $warning); } $text .= "
"; $text .=" "; // User Search Field. $u_array = array("user_name"=>"Username","user_login"=>"User Login","user_email"=>"User Email"); $text .= " "; // Extended Field #1. $text .= " "; // Extended Field #2. $text .= " "; $text .= " "; // Attachment. $text .= ""; $text .= " "; $text .=" "; $text .= "
".MAILAN_01.":
".MAILAN_02.":
".MAILAN_03.": ".userclasses("email_to", $_POST['email_to'])."
User-Match contains
User-Match equals
User-Match equals
".MAILAN_04.":
".MAILAN_05.":
".MAILAN_06.":
".MAILAN_07.": "; $text .= ""; $text .= "
".MAILAN_09.":
".display_help("helpb") .""; if($pref['wysiwyg']) { $text .=" "; } else { $text .=" "; } $text .="
"; if(isset($_POST['edit'])){ $text .= ""; $text .= ""; }else{ $text .= ""; } $text .=" 
"; $ns->tablerender(MAILAN_15, $text); } // ------------------ Preferences --------------------------------------------> function show_prefs(){ global $pref,$ns; $text = "
\n \n
".PRFLAN_63."
".PRFLAN_70."
".PRFLAN_71."

"; // SMTP. --------------> $smtpdisp = ($pref['mailer'] != "smtp") ? "display:none;" : ""; $text .= "
"; $text .= "
".PRFLAN_72.":  
".PRFLAN_73.": (".LAN_OPTIONAL.")  
".PRFLAN_74.": (".LAN_OPTIONAL.")  
"; // Sendmail. --------------> $senddisp = ($pref['mailer'] != "sendmail") ? "display:none;" : ""; $text .= "
"; $text .= "
".MAILAN_20.":  
"; $text .="
".MAILAN_25." ".MAILAN_26." ".MAILAN_27.".
".MAILAN_28." ".MAILAN_29.".
".MAILAN_30."
".MAILAN_31." ".MAILAN_32.":
".MAILAN_33." (POP3):
".MAILAN_34.":
".MAILAN_35.":
"; $check = ($pref['mail_bounce_delete']==1) ? "checked='checked'" : ""; $text .= MAILAN_36.":
"; $text .= ""; $caption = LAN_PREFS; $ns->tablerender($caption, $text); } function showList() { global $sql,$ns,$tp; $gen = new convert; $qry ="SELECT g.*,u.* FROM #generic AS g LEFT JOIN #user AS u ON g.gen_user_id = u.user_id WHERE g.gen_type = 'massmail' ORDER BY g.gen_datestamp DESC"; // $count = $sql -> db_Select("generic", "*", "gen_type ='massmail' ORDER BY gen_datestamp DESC"); $count = $sql -> db_Select_gen($qry); $text = "
"; if (!$count) { $text = "
".MAILAN_22."
"; $ns -> tablerender("
".MAILAN_21."
", $text); require_once(e_ADMIN."footer.php"); exit; } else { $text .= "
"; $glArray = $sql -> db_getList(); foreach($glArray as $row2) { $datestamp = $gen->convert_date($row2['gen_datestamp'], "short"); $text .= " "; } } $text .= "
Id Author Subject Lastmod ".LAN_OPTIONS."
".$row2['gen_id'] ." ".$row2['user_name']." ".$row2['gen_ip']." ".$datestamp."
toJS(LAN_CONFIRMDEL." [".$row2['gen_ip']."]")."') \" src='".e_IMAGE."admin_images/delete_16.png' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
\n



"; $ns -> tablerender("
".MAILAN_21."
", $text); } function userclasses($name) { global $sql; $text .= ""; return $text; } function mailout_adminmenu() { $action = (e_QUERY) ? e_QUERY : "post"; if($action == "edit"){ $action = "post"; } $var['post']['text'] = "Send Mail"; $var['post']['link'] = e_SELF; $var['post']['perm'] = "W"; $var['list']['text'] = LAN_SAVED; $var['list']['link'] = e_SELF."?list"; $var['list']['perm'] = "W"; if(getperms("0")){ $var['prefs']['text'] = LAN_OPTIONS; $var['prefs']['link'] = e_SELF."?prefs"; $var['prefs']['perm'] = "0"; } show_admin_menu(MAILAN_15, $action, $var); } function headerjs() { $text = " "; return $text; } ?>