diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 0f28b4c24..54db1ba3f 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -9,8 +9,8 @@ * Administration - Site Maintenance * * $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $ - * $Revision: 1.33 $ - * $Date: 2010-01-10 03:56:26 $ + * $Revision: 1.34 $ + * $Date: 2010-01-10 06:20:31 $ * $Author: e107coders $ * */ @@ -219,6 +219,7 @@ switch ($action) case 'makemail' : $newMail = TRUE; + if (isset($_POST['save_email'])) { $subAction = 'new'; diff --git a/e107_handlers/mailout_admin_class.php b/e107_handlers/mailout_admin_class.php index c83e01b7c..d64fd7d0b 100644 --- a/e107_handlers/mailout_admin_class.php +++ b/e107_handlers/mailout_admin_class.php @@ -9,8 +9,8 @@ * Administration - Site Maintenance * * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $ - * $Revision: 1.11 $ - * $Date: 2010-01-10 03:56:28 $ + * $Revision: 1.12 $ + * $Date: 2010-01-10 06:20:41 $ * $Author: e107coders $ * */ @@ -19,7 +19,7 @@ * * @package e107 * @subpackage e107_handlers - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ * @author $Author: e107coders $ * Various admin-related mailout functions, mostly to do with creating and handling forms. @@ -476,12 +476,14 @@ class mailoutAdminClass extends e107MailManager $ret .= "
\n"; - foreach ($this->mailHandlers as $key=>$m) + foreach ($this->mailHandlers as $m) { + $key = $m->mailerSource; + if ($m->mailerEnabled) { - $tab .= "
  • ".$m->mailerName."
  • "; - $tabc .= "
    "; + $tab .= "
  • ".$m->mailerName."
  • "; + $tabc .= "
    "; $content = $m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE)); @@ -549,7 +551,9 @@ class mailoutAdminClass extends e107MailManager $ret = ''; $this->checkDB(2); // Make sure DB object created - $ret .= " + \n"; + foreach ($fixedClasses as $k => $v) { $sel = ($k == $curSel) ? " selected='selected'" : ''; @@ -612,17 +616,22 @@ class mailoutAdminClass extends e107MailManager */ public function parseEmailPost($newMail = TRUE) { - $ret = array( 'mail_title' => $this->e107->tp->toDB($_POST['email_title']), - 'mail_subject' => $this->e107->tp->toDB($_POST['email_subject']), - 'mail_body' => $this->e107->tp->toDB($_POST['email_body']), - 'mail_sender_email' => $this->e107->tp->toDB($_POST['email_from_email']), - 'mail_sender_name' => $this->e107->tp->toDB($_POST['email_from_name']), - 'mail_copy_to' => $this->e107->tp->toDB($_POST['email_cc']), - 'mail_bcopy_to' => $this->e107->tp->toDB($_POST['email_bcc']), - 'mail_attach' => $this->e107->tp->toDB(trim($_POST['email_attachment'])), - 'mail_send_style' => $this->e107->tp->toDB(varset($_POST['send_style'],'textonly')), + $tp = e107::getParser(); + + $ret = array( 'mail_title' => $_POST['email_title'], + 'mail_subject' => $_POST['email_subject'], + 'mail_body' => $_POST['email_body'], + 'mail_sender_email' => $_POST['email_from_email'], + 'mail_sender_name' => $_POST['email_from_name'], + 'mail_copy_to' => $_POST['email_cc'], + 'mail_bcopy_to' => $_POST['email_bcc'], + 'mail_attach' => trim($_POST['email_attachment']), + 'mail_send_style' => varset($_POST['send_style'],'textonly'), 'mail_include_images' => (isset($_POST['mail_include_images']) ? 1 : 0) ); + + $ret = $tp->toDB($ret); // recursive + if (isset($_POST['mail_source_id'])) { $ret['mail_source_id'] = intval($_POST['mail_source_id']); @@ -684,6 +693,9 @@ class mailoutAdminClass extends e107MailManager */ public function showMailDetail(&$mailSource, $options='basic') { + $tp = e107::getParser(); + + if (!isset($this->mailDetailDisplay[$options])) { return "Programming bungle - invalid option value: {$options}"; @@ -693,7 +705,7 @@ class mailoutAdminClass extends e107MailManager foreach ($this->mailDetailDisplay[$options] as $k => $v) { $res .= ''.$this->fields['mail_content'][$k]['title'].''; - $res .= ($v > 1) ? $this->e107->tp->text_truncate($mailSource[$k], $v, '...') : $mailSource[$k]; + $res .= ($v > 1) ? $tp->text_truncate($mailSource[$k], $v, '...') : $mailSource[$k]; $res .= ''."\n"; } return $res; @@ -768,6 +780,8 @@ class mailoutAdminClass extends e107MailManager $debug = (e_MENU == "debug") ? "?[debug]" : ""; + + $text .= "
    ".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))." @@ -1150,6 +1164,10 @@ class mailoutAdminClass extends e107MailManager */ public function sendEmailCircular($mailData, $fromHold = FALSE) { + $sql = e107::getDb(); + $mes = e107::getMessage(); + + if ($fromHold) { // Email data already generated $mailMainID = $mailData['mail_source_id']; @@ -1228,9 +1246,16 @@ class mailoutAdminClass extends e107MailManager // Add in core and any plugin selectors here foreach ($this->mailHandlers as $m) { - if ($m->mailerEnabled) + + if ($m->mailerEnabled && ($contentArray = $m->showSelect(FALSE,$mailData['mail_selectors'][$m->mailerSource]))) { - $text .= ''.LAN_MAILOUT_180.'
    '.$m->mailerName.''.$m->showSelect(FALSE).''; + $text .= ''.LAN_MAILOUT_180.'
    '.$m->mailerName.''; + $text .= '
      '; + foreach($contentArray as $val) + { + $text .= "
    • ".$val['caption']." : ".$val['html']."
    • "; + } + $text .= '
    '; } } @@ -1251,8 +1276,8 @@ class mailoutAdminClass extends e107MailManager $text .= "
    "; - - $this->e107->ns->tablerender("
    ".ADLAN_136." :: ".LAN_MAILOUT_179."
    ", $text); + + e107::getRender()->tablerender("
    ".ADLAN_136." :: ".LAN_MAILOUT_179."
    ",$mes->render(). $text); } // End of previewed email diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php index e7c7f5d7e..3a3f94886 100644 --- a/e107_handlers/mailout_class.php +++ b/e107_handlers/mailout_class.php @@ -9,8 +9,8 @@ * Administration - Site Maintenance * * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $ - * $Revision: 1.7 $ - * $Date: 2010-01-10 03:56:28 $ + * $Revision: 1.8 $ + * $Date: 2010-01-10 06:20:43 $ * $Author: e107coders $ * */ @@ -80,12 +80,15 @@ class core_mailout */ public function returnSelectors() { + $tp = e107::getParser(); + + $res = array(); foreach ($this->selectFields as $k) { if (varsettrue($_POST[$k])) { - $res[$k] = $this->e107->tp->toDB($_POST[$k]); + $res[$k] = $tp->toDB($_POST[$k]); } } return $res; @@ -103,6 +106,9 @@ class core_mailout */ public function selectInit($selectVals = FALSE) { + $sql = e107::getDb(); + + $where = array(); $incExtended = array(); if ($selectVals === FALSE) @@ -195,7 +201,7 @@ class core_mailout $qry .= ' WHERE '.implode(' AND ',$where).' ORDER BY u.user_name'; // echo "Selector query: ".$qry.'
    '; - if (!( $this->mail_count = $this->e107->sql->db_Select_gen($qry))) return FALSE; + if (!( $this->mail_count = $sql->db_Select_gen($qry))) return FALSE; $this->mail_read = 0; return $this->mail_count; } @@ -214,7 +220,9 @@ class core_mailout */ public function selectAdd() { - if (!($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC))) return FALSE; + $sql = e107::getDb(); + + if (!($row = $sql->db_Fetch(MYSQL_ASSOC))) return FALSE; $ret = array('mail_recipient_id' => $row['user_id'], 'mail_recipient_name' => $row['user_name'], // Should this use realname? 'mail_recipient_email' => $row['user_email'], @@ -276,6 +284,11 @@ class core_mailout } else // Display existing values { + if(!vartrue($selectVals['email_to'])) + { + return; + } + if(is_numeric($selectVals['email_to'])) { $sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to'])); diff --git a/e107_plugins/calendar_menu/e_mailout.php b/e107_plugins/calendar_menu/e_mailout.php index ad5ec09d8..c95dc139f 100644 --- a/e107_plugins/calendar_menu/e_mailout.php +++ b/e107_plugins/calendar_menu/e_mailout.php @@ -9,8 +9,8 @@ * Administration - Site Maintenance * * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $ - * $Revision: 1.9 $ - * $Date: 2010-01-10 03:56:28 $ + * $Revision: 1.10 $ + * $Date: 2010-01-10 06:20:43 $ * $Author: e107coders $ * */ @@ -20,7 +20,7 @@ * * @package e107_plugins * @subpackage event_calendar - * @version $Id: e_mailout.php,v 1.9 2010-01-10 03:56:28 e107coders Exp $; + * @version $Id: e_mailout.php,v 1.10 2010-01-10 06:20:43 e107coders Exp $; */ if (!defined('e107_INIT')) { exit(); } @@ -161,7 +161,7 @@ class calendar_menu_mailout { $sql = e107::getDb(); $frm = e107::getForm(); - + $var = array(); // $ret = ""; $selects = array_flip(explode(',', $selectVals)); @@ -197,7 +197,6 @@ class calendar_menu_mailout } return $var; - // return $ret.'
    '; } } diff --git a/e107_plugins/newsletter/e_mailout.php b/e107_plugins/newsletter/e_mailout.php index cfb7ce2e9..5f79599d9 100644 --- a/e107_plugins/newsletter/e_mailout.php +++ b/e107_plugins/newsletter/e_mailout.php @@ -9,8 +9,8 @@ * Administration - Site Maintenance * * $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $ - * $Revision: 1.3 $ - * $Date: 2010-01-10 03:56:28 $ + * $Revision: 1.4 $ + * $Date: 2010-01-10 06:20:46 $ * $Author: e107coders $ * */ @@ -185,6 +185,7 @@ class newsletter_mailout { $sql = e107::getDb(); $frm = e107::getForm(); + $var = array(); $selects = array_flip(explode(',', $selectVals));