diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 57bd802a8..8590cfdfb 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -74,6 +74,1018 @@ if (!getperms('W')) header('location:'.e_BASE.'index.php'); exit; } +include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_users.php'); +include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_mailout.php'); + +require_once(e_HANDLER.'ren_help.php'); + +require_once(e_HANDLER.'userclass_class.php'); +require_once(e_HANDLER.'mailout_class.php'); // Class handler for core mailout functions +require_once(e_HANDLER.'mailout_admin_class.php'); // Admin tasks handler +require_once(e_HANDLER.'mail_manager_class.php'); // Mail DB API + + + + +class mailout_admin extends e_admin_dispatcher +{ + + protected $modes = array( + 'main' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'saved' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'pending' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'held' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'sent' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'prefs' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'maint' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'recipients' => array( + 'controller' => 'mailout_recipients_ui', + 'path' => null, + 'ui' => 'mailout_recipients_form_ui', + 'uipath' => null + ) + + ); + + protected $adminMenu = array( + // 'makemail/makemail' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W', 'url'=>e_SELF), + 'main/list' => array('caption'=> LAN_MANAGE, 'perm'=> 'W'), + 'main/create' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W'), + 'recipients/list' => array('caption'=> "Recipients", 'perm' => 'W'), + 'other' => array('divider'=> true), + 'saved/list' => array('caption'=> LAN_MAILOUT_191, 'perm' => 'W'), + 'pending/list' => array('caption'=> LAN_MAILOUT_193, 'perm' => 'W'), + 'held/list' => array('caption'=> LAN_MAILOUT_194, 'perm' => 'W'), + 'sent/list' => array('caption'=> LAN_MAILOUT_192, 'perm' => 'W'), + 'other2' => array('divider'=> true), + 'prefs/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'), + 'maint/maint' => array('caption'=> ADLAN_40, 'perm' => '0'), + + ); + + + + protected $adminMenuAliases = array( + // 'main/edit' => 'main/list', + ); + + protected $menuTitle = LAN_MAILOUT_15; +} + +class mailout_main_ui extends e_admin_ui +{ + + //TODO Move to Class above. + protected $pluginTitle = LAN_MAILOUT_15; + protected $pluginName = LAN_MAILOUT_15; + protected $table = "mail_content"; + + // protected $listQry = "SELECT * FROM #mail_content WHERE mail_content_status = 20 "; + + + // protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}"; + + protected $pid = "mail_source_id"; + protected $perPage = 10; + protected $listOrder = "mail_source_id desc"; + + protected $batchDelete = true; + protected $batchCopy = true; + + protected $tabs = array('Basic','Advanced'); //TODO Add LAN_BASIC and LAN_ADVANCED to lan_admin.php + + protected $fields = array( + 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), + 'mail_source_id' => array('title' => LAN_MAILOUT_137, 'width' =>'5%', 'thclass' => 'center', 'class'=>'center', 'forced' => TRUE), + + 'mail_selectors' => array('title' => LAN_MAILOUT_03, 'type'=>'method', 'data'=>false, 'nolist' => true, 'writeParms'=>'nolabel=0'), + 'mail_title' => array('title' => LAN_MAILOUT_135, 'type'=>'text', 'forced' => TRUE, 'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1', 'help'=>'whatever'), + 'mail_sender_name' => array('title' => LAN_MAILOUT_150, 'type'=>'method', 'data'=>false), + 'mail_sender_email' => array('title' => LAN_MAILOUT_149,'type'=>'method','data'=>false), + 'mail_copy_to' => array('title' => LAN_MAILOUT_151,'tab'=>1, 'type'=>'method','data'=>false), + 'mail_bcopy_to' => array('title' => LAN_MAILOUT_152,'tab'=>1, 'type'=>'method','data'=>false), + 'mail_subject' => array('title' => LAN_MAILOUT_06, 'type'=>'text', 'forced' => TRUE,'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1'), + 'mail_content_status' => array('title' => LAN_MAILOUT_136, 'tab'=>1, 'type'=> 'dropdown', 'data'=>'int', 'filter'=>false, 'inline'=>true, 'thclass' => 'left', 'class'=>'left'), + 'mail_togo_count' => array('title' => LAN_MAILOUT_83, 'noedit'=>true, 'type'=>'number'), + 'mail_sent_count' => array('title' => LAN_MAILOUT_82, 'noedit'=>true, 'type'=>'number'), + 'mail_fail_count' => array('title' => LAN_MAILOUT_128, 'noedit'=>true, 'type'=>'number'), + 'mail_bounce_count' => array('title' => LAN_MAILOUT_144, 'noedit'=>true, 'type'=>'number'), + 'mail_start_send' => array('title' => LAN_MAILOUT_131,'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'), + 'mail_end_send' => array('title' => LAN_MAILOUT_132, 'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'), + 'mail_create_date' => array('title' => LAN_MAILOUT_130, 'noedit'=>true, 'type'=>'datestamp', 'proc' => 'sdatetime'), + 'mail_creator' => array('title' => LAN_MAILOUT_85, 'noedit'=>true, 'type'=>'user', 'proc' => 'username'), + 'mail_create_app' => array('title' => LAN_MAILOUT_133, 'noedit'=>true), + 'mail_e107_priority' => array('title' => LAN_MAILOUT_134, 'noedit'=>true), + 'mail_notify_complete' => array('title' => LAN_MAILOUT_243, 'noedit'=>true, 'nolist' => true), + 'mail_last_date' => array('title' => LAN_MAILOUT_129, 'noedit'=>true, 'type'=>'int', 'proc' => 'sdatetime'), + 'mail_attach' => array('title' => LAN_MAILOUT_153, 'tab'=>1, 'type'=>'method','data'=>false), + 'mail_include_images' => array('title' => LAN_MAILOUT_224, 'tab'=>1, 'type'=>'boolean','data'=>false, 'proc' => 'yesno'), + 'mail_send_style' => array('title' => LAN_MAILOUT_154,'type'=>'method','data'=>false), + 'mail_body' => array('title' => LAN_MAILOUT_100, 'type'=>'bbarea', 'proc' => 'trunc200'), + 'mail_body_templated' => array('title' => LAN_MAILOUT_257, 'noedit'=>true, 'proc' => 'chars'), + 'mail_other' => array('title' => LAN_MAILOUT_84, 'type'=>null, 'noedit'=>true, 'data'=>'array', 'nolist'=>true), + + 'options' => array('title' => LAN_OPTIONS, 'type'=>'method', 'width'=>'10%', 'forced' => TRUE) + + ); + + + + + protected $fieldpref = array('checkboxes', 'mail_source_id', 'mail_title', 'mail_subject', 'mail_content_status', 'options'); + + + // optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName); + protected $prefs = array( + // 'after_submit' => array('title'=> 'Custom After Submit Text:', 'type'=>'bbarea') + // 'submit_question' => array('title'=> 'Allow submitting of Questions by:', 'type'=>'userclass'), + // 'classic_look' => array('title'=> 'Use Classic Layout', 'type'=>'boolean') + ); + + + + + public $mailAdmin = null; + + private $selectFields = array('email_to', + 'extended_1_name','extended_1_value', + 'extended_2_name', 'extended_2_value', + 'user_search_name', 'user_search_value', + 'last_visit_match', 'last_visit_date' + ); + + + private $mailOtherFields = array( + 'mail_sender_email', + 'mail_sender_name', + 'mail_copy_to', + 'mail_bcopy_to', + 'mail_attach', + 'mail_send_style', // HTML, text, template name etc + 'mail_selectors', // Only used internally + 'mail_include_images', // Used to determine whether to embed images, or link to them + 'mail_body_alt' , // If non-empty, use for alternate email text (generally the 'plain text' alternative) + 'mail_overrides' + ); + + + function init() + { + $action = varset($_GET['mode'], 'main'); + $this->mailAdmin = new mailoutAdminClass($action); + + if ($this->mailAdmin->loadMailHandlers() == 0) + { + e107::getMessage()->addDebug('No mail handlers loaded!!'); + + } + + /* + define('MAIL_STATUS_SENT', 0); // Mail sent. Email handler happy, but may have bounced (or may be yet to bounce) + define('MAIL_STATUS_BOUNCED', 1); + define('MAIL_STATUS_CANCELLED', 2); + define('MAIL_STATUS_PARTIAL', 3); // A run which was abandoned - errors, out of time etc + define('MAIL_STATUS_FAILED', 5); // Failure on initial send - rejected by selected email handler + // This must be the numerically highest 'processing complete' code + define('MAIL_STATUS_PENDING', 10); // Mail which is in the sending list (even if outside valid sending window) + // This must be the numerically lowest 'not sent' code + // E107_EMAIL_MAX_TRIES values used in here for retry counting + define('MAIL_STATUS_MAX_ACTIVE', 19); // Highest allowable 'not sent or processed' code + define('MAIL_STATUS_SAVED', 20); // Identifies an email which is just saved (or in process of update) + define('MAIL_STATUS_HELD',21); // Held pending release + define('MAIL_STATUS_TEMP', 22); // Tags entries which aren't yet in any list + */ + + $types = array(10=>'Pending',20=>"Saved", 21=>"Held", 0=>'Sent', 1=>'Bounced', 2=>'Cancelled', 3=> 'Partial', 5=>'Failed', 19 => "Max Active", 22=>"Temp"); + + + $qr = array('saved'=>20,'pending'=>10,'held'=>21,'sent'=>0); + + if($action !== 'main' ) + { + $this->listQry = "SELECT * FROM #mail_content WHERE mail_content_status = ".varset($qr[$action],20); + } + else + { + $this->fields['options']['type'] = ''; + } + + $this->fields['mail_content_status']['writeParms'] = $types; + + + if (getperms('0')) + { + if (isset($_POST['testemail'])) + { // Send test email - uses standard 'single email' handler + if(trim($_POST['testaddress']) == '') + { + $mes->addError(LAN_MAILOUT_19); + $subAction = 'error'; + } + else + { + $mailheader_e107id = USERID; + require_once(e_HANDLER.'mail.php'); + $add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).")" : ' (PHP)'; + $sendto = trim($_POST['testaddress']); + if (!sendemail($sendto, LAN_MAILOUT_113." ".SITENAME.$add, str_replace("[br]", "\n", LAN_MAILOUT_114),LAN_MAILOUT_189)) + { + $mes->addError(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106); + } + else + { + $mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')'); + $admin_log->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,''); + } + } + } + elseif (isset($_POST['updateprefs'])) + { + $this->saveMailPrefs($mes); // TODO check if functional, $emessage -> $mes + } + } + + + + } + + + public function beforeCreate($new_data, $old_data) + { + $ret = $this->processData($new_data); + + $ret['mail_create_date'] = time(); + $ret['mail_creator'] = USERID; + $ret['mail_content_status'] = 20; // Default status is 'Saved'; + + return $ret; + + } + + + public function beforeUpdate($new_data, $old_data, $id) + { + return $this->processData($new_data); + } + + + /** + * Process Posted Data + */ + private function processData($new_data) + { + $other = array(); + + $ret = $new_data; + + foreach($new_data as $k=>$v) + { + if(in_array($k, $this->mailOtherFields)) + { + $other[$k] = $v; + unset($ret[$k]); + } + } + + $other['mail_selectors'] = $this->mailAdmin->getAllSelectors(); + + + $ret['mail_attach'] = trim($new_data['mail_attach']); + $ret['mail_send_style'] = varset($new_data['mail_send_style'],'textonly'); + $ret['mail_include_images'] = (isset($new_data['mail_include_images']) ? 1 : 0); + $ret['mail_other'] = $other; // type is set to 'array' in $fields. + + // e107::getMessage()->addInfo(print_a($ret,true)); + return $ret; + } + + + /* + function createPage() + { + if (!isset($mailData) || !is_array($mailData)) + { + $mailData = array(); // Empty array just in case + } + + if($id = $this->getId()) + { + $mailData = e107::getDB()->retrieve('mail_content','*','mail_source_id='.$id); + } + + return $this->mailAdmin->show_mailform($mailData); + + } + */ + + + + function maintPage() + { + if (!getperms('0')) + { + return; + } + + $mes = e107::getMessage(); + $ns = e107::getRender(); + $frm = e107::getForm(); + + $text = " +
"; + + return $text; + + // return $ns->tablerender(ADLAN_136.SEP.ADLAN_40, $text, 'maint',true); + + } + + function prefsPage() + { + if (!getperms('0')) + { + return; + } + $pref = e107::getPref(); + $e107 = e107::getInstance(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + $ns = e107::getRender(); + + + e107::getCache()->CachePageMD5 = '_'; + $lastload = e107::getCache()->retrieve('emailLastBounce',FALSE,TRUE,TRUE); + $lastBounce = round((time() - $lastload) / 60); + + $lastBounceText = ($lastBounce > 1256474) ? "Never" : "".$lastBounce . " minutes ago."; + + $text = " + "; + + return $text; +// $caption = ADLAN_136.SEP.LAN_PREFS; +// $ns->tablerender($caption, $mes->render(). $text); + + } + + + + + + + + + // Update Preferences. (security handled elsewhere) + function saveMailPrefs(&$mes) // $emessage to $mes, working? + { + if(!getperms('0')) + { + return; + } + + //$pref = e107::getPref(); + $e107 = e107::getInstance(); + $tp = e107::getParser(); + $mes = e107::getMessage(); + + $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); + unset($temp); + if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) $_POST['mailer'] = 'php'; + $temp['mailer'] = $_POST['mailer']; + // Allow qmail as an option as well - works much as sendmail + if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) + { + $temp['sendmail'] = $tp->toDB($_POST['sendmail']); + } + else + { + $temp['sendmail'] = ''; + } + $temp['smtp_server'] = $tp->toDB($_POST['smtp_server']); + $temp['smtp_username'] = $tp->toDB($_POST['smtp_username']); + $temp['smtp_password'] = $tp->toDB($_POST['smtp_password']); + + $smtp_opts = array(); + switch (trim($_POST['smtp_options'])) + { + case 'smtp_ssl' : + $smtp_opts[] = 'secure=SSL'; + break; + case 'smtp_tls' : + $smtp_opts[] = 'secure=TLS'; + break; + case 'smtp_pop3auth' : + $smtp_opts[] = 'pop3auth'; + break; + } + if (varsettrue($_POST['smtp_keepalive'])) $smtp_opts[] = 'keepalive'; + if (varsettrue($_POST['smtp_useVERP'])) $smtp_opts[] = 'useVERP'; + + $temp['smtp_options'] = implode(',',$smtp_opts); + + $temp['mail_sendstyle'] = $tp->toDB($_POST['mail_sendstyle']); + $temp['mail_pause'] = intval($_POST['mail_pause']); + $temp['mail_pausetime'] = intval($_POST['mail_pausetime']); + $temp['mail_workpertick'] = intval($_POST['mail_workpertick']); + $temp['mail_workpertick'] = min($temp['mail_workpertick'],1000); + $temp['mail_bounce'] = isset($bounceOpts[$_POST['mail_bounce']]) ? $_POST['mail_bounce'] : 'none'; + $temp['mail_bounce_auto'] = 0; // Make sure this is always defined + switch ($temp['mail_bounce']) + { + case 'none' : + $temp['mail_bounce_email'] = ''; + break; + case 'auto' : + $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email2']); + break; + case 'mail' : + $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']); + $temp['mail_bounce_auto'] = intval($_POST['mail_bounce_auto']); + break; + } + $temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']); + $temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']); + $temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']); + $temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']); + $temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0)); + + $temp['mailout_enabled'] = implode(',',varset($_POST['mail_mailer_enabled'], '')); + $temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']); + + foreach ($temp as &$t) + { + if ($t === NULL) $t = ''; + } + $pref = e107::pref('core'); // Core Prefs Array. + if (e107::getAdminLog()->logArrayDiffs($temp, $pref, 'MAIL_03')) + { + e107::getConfig()->updatePref($temp); + e107::getConfig()->save(false); // Only save if changes - generates its own message + } + else + { + $mes->addInfo(LAN_NO_CHANGE); + } + } + + + +} + +class mailout_admin_form_ui extends e_admin_form_ui +{ + + public function mail_selectors($curval, $mode) + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + switch($mode) + { + case 'read': + return varset($data['mail_send_style'], ''); + break; + + case 'write': + return $this->getController()->mailAdmin->emailSelector('all', varset($data['mail_selectors'], FALSE)); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + + } + + + + + public function mail_send_style($curVal, $mode) + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + switch($mode) + { + case 'read': + return varset($data['mail_send_style'], ''); + break; + + case 'write': + return $this->getController()->mailAdmin->sendStyleSelect(varset($data['mail_send_style'], ''),'mail_send_style'); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + + + } + + + private function mailDetails($field, $mode) + { + + switch($mode) + { + case 'read': + $val = stripslashes($this->getController()->getListModel()->get('mail_other')); + $data = e107::unserialize($val); + return $data[$field]; + break; + + case 'write': + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + if($field == 'mail_sender_name' && !vartrue($data['mail_sender_name'])) + { + $data['mail_sender_name'] = USERNAME; + } + + if($field == 'mail_sender_email' && !vartrue($data['mail_sender_email'])) + { + $data['mail_sender_email'] = USEREMAIL; + } + + + return $this->text($field, $data[$field],70, 'size=xxlarge'); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + } + + + public function mail_sender_name($curVal,$mode) + { + return $this->mailDetails('mail_sender_name', $mode); + } + + public function mail_sender_email($curVal,$mode) + { + return $this->mailDetails('mail_sender_email', $mode); + } + + public function mail_copy_to($curVal,$mode) + { + return $this->mailDetails('mail_copy_to', $mode); + } + + public function mail_bcopy_to($curVal,$mode) + { + return $this->mailDetails('mail_bcopy_to', $mode); + } + + public function mail_attach($curVal,$mode) + { + if($mode == 'read') + { + $val = stripslashes($this->getController()->getListModel()->get('mail_other')); + $data = e107::unserialize($val); + return basename($data['mail_attach']); + } + + if($mode == 'write') + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + return $this->filepicker('mail_attach',$data['mail_attach'], $mode); + } + + } + + + function options() + { + $controller = $this->getController(); + + $mode = $controller->getMode(); + $mailData = $controller->getListModel()->getData(); + + return $controller->mailAdmin->makeMailOptions($mode,$mailData); + + } + +} + + + + + +class mailout_recipients_ui extends e_admin_ui +{ + + //TODO Move to Class above. + protected $pluginTitle = LAN_MAILOUT_15; + protected $pluginName = LAN_MAILOUT_15; + protected $table = "mail_recipients"; + + // protected $listQry = "SELECT * FROM #mail_content WHERE mail_content_status = 20 "; + + + // protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}"; + + protected $pid = "mail_target_id"; + protected $perPage = 10; + protected $listOrder = "mail_target_id desc"; + + protected $batchDelete = true; + + // protected $tabs = array('General','Details', 'Questionnaire', 'Correspondence'); + + protected $fields = array( + 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), + 'mail_target_id' => array('title' => LAN_MAILOUT_143, 'thclass' => 'center', 'forced' => TRUE), + 'mail_recipient_id' => array('title' => LAN_MAILOUT_142, 'thclass' => 'center'), + 'mail_recipient_name' => array('title' => LAN_MAILOUT_141, 'forced' => TRUE), + 'mail_recipient_email' => array('title' => LAN_MAILOUT_140, 'thclass' => 'left', 'forced' => TRUE), + 'mail_status' => array('title' => LAN_MAILOUT_138, 'thclass' => 'center', 'proc' => 'contentstatus'), + 'mail_detail_id' => array('title' => LAN_MAILOUT_137, 'type'=>'dropdown', 'filter'=>true), + 'mail_send_date' => array('title' => LAN_MAILOUT_139, 'proc' => 'sdatetime'), + 'mail_target_info' => array('title' => LAN_MAILOUT_148, 'proc' => 'array'), + 'options' => array('title' => LAN_OPTIONS, 'width'=>'10%', 'forced' => TRUE) + ); + + + protected $fieldpref = array('checkboxes', 'mail_target_id', 'mail_recipient_name', 'mail_recipient_email', 'mail_detail_id', 'mail_status', 'options'); + + + function init() + { + $sql = e107::getDb(); + $sql->gen("SELECT r.mail_detail_id,c.mail_title FROM #mail_recipients AS r LEFT JOIN #mail_content as c ON r.mail_detail_id = c.mail_source_id GROUP BY r.mail_detail_id"); + + while($row = $sql->fetch()) + { + $array[] = $row['mail_title']; + } + $this->fields['mail_detail_id']['writeParms'] = $array; + + + if(strpos($_GET['filter_options'],'mail_detail_id__')===false) + { + $ns = e107::getRender(); + e107::getMessage()->addInfo("Please select a mailing list from the filter menu below to view recipients."); + $this->listQry = "SELECT * FROM #mail_recipients WHERE mail_target_id = 0"; // simulated empty result. + return false; + } + + + + + } + + +} + + + +class mailout_recipients_form_ui extends e_admin_form_ui +{ + + + +} + + +new mailout_admin(); + + + + + + + + + + + + + + $e_sub_cat = 'mail'; @@ -84,15 +1096,7 @@ if(vartrue($_GET['mode']) == "progress") exit; } -require_once(e_HANDLER.'ren_help.php'); -include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_users.php'); -include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_mailout.php'); -require_once(e_HANDLER.'userclass_class.php'); -require_once(e_HANDLER.'mailout_class.php'); // Class handler for core mailout functions -require_once(e_HANDLER.'mailout_admin_class.php'); // Admin tasks handler -require_once(e_HANDLER.'mail_manager_class.php'); // Mail DB API -require_once (e_HANDLER.'message_handler.php'); $mes = e107::getMessage(); $tp = e107::getParser(); @@ -131,6 +1135,9 @@ if ($mailAdmin->loadMailHandlers() == 0) require_once(e_ADMIN.'auth.php'); +e107::getAdminUI()->runPage(); + +require_once(e_ADMIN.'footer.php'); @@ -174,6 +1181,8 @@ if (isset($_POST['targetaction'])) } } + +// e107::getMessage()->addDebug("Action=".$action); //echo "Action: {$action} MailId: {$mailId} Target: {$targetId}