1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

More mailout fixes

This commit is contained in:
CaMer0n
2010-01-10 06:20:46 +00:00
parent a21f57d361
commit 3c772dee49
5 changed files with 74 additions and 35 deletions

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $
* $Revision: 1.33 $ * $Revision: 1.34 $
* $Date: 2010-01-10 03:56:26 $ * $Date: 2010-01-10 06:20:31 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -219,6 +219,7 @@ switch ($action)
case 'makemail' : case 'makemail' :
$newMail = TRUE; $newMail = TRUE;
if (isset($_POST['save_email'])) if (isset($_POST['save_email']))
{ {
$subAction = 'new'; $subAction = 'new';

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $
* $Revision: 1.11 $ * $Revision: 1.12 $
* $Date: 2010-01-10 03:56:28 $ * $Date: 2010-01-10 06:20:41 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -19,7 +19,7 @@
* *
* @package e107 * @package e107
* @subpackage e107_handlers * @subpackage e107_handlers
* @version $Revision: 1.11 $ * @version $Revision: 1.12 $
* @author $Author: e107coders $ * @author $Author: e107coders $
* Various admin-related mailout functions, mostly to do with creating and handling forms. * Various admin-related mailout functions, mostly to do with creating and handling forms.
@@ -476,12 +476,14 @@ class mailoutAdminClass extends e107MailManager
$ret .= "<div class='admintabs' id='tab-container'>\n"; $ret .= "<div class='admintabs' id='tab-container'>\n";
foreach ($this->mailHandlers as $key=>$m) foreach ($this->mailHandlers as $m)
{ {
$key = $m->mailerSource;
if ($m->mailerEnabled) if ($m->mailerEnabled)
{ {
$tab .= "<li id='tab-main_".$key."'><a href='#core-main_".$key."'>".$m->mailerName."</a></li>"; $tab .= "<li id='tab-main_".$key."'><a href='#main-mail-".$key."'>".$m->mailerName."</a></li>";
$tabc .= "<div id='core-main_".$key."'>"; $tabc .= "<div id='main-mail-".$key."'>";
$content = $m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE)); $content = $m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE));
@@ -549,7 +551,9 @@ class mailoutAdminClass extends e107MailManager
$ret = ''; $ret = '';
$this->checkDB(2); // Make sure DB object created $this->checkDB(2); // Make sure DB object created
$ret .= "<select style='width:80%' class='tbox' name='{$name}' >\n"; $ret .= "<select style='width:80%' class='tbox' name='{$name}' >
<option value=''>&nbsp;</option>\n";
foreach ($fixedClasses as $k => $v) foreach ($fixedClasses as $k => $v)
{ {
$sel = ($k == $curSel) ? " selected='selected'" : ''; $sel = ($k == $curSel) ? " selected='selected'" : '';
@@ -612,17 +616,22 @@ class mailoutAdminClass extends e107MailManager
*/ */
public function parseEmailPost($newMail = TRUE) public function parseEmailPost($newMail = TRUE)
{ {
$ret = array( 'mail_title' => $this->e107->tp->toDB($_POST['email_title']), $tp = e107::getParser();
'mail_subject' => $this->e107->tp->toDB($_POST['email_subject']),
'mail_body' => $this->e107->tp->toDB($_POST['email_body']), $ret = array( 'mail_title' => $_POST['email_title'],
'mail_sender_email' => $this->e107->tp->toDB($_POST['email_from_email']), 'mail_subject' => $_POST['email_subject'],
'mail_sender_name' => $this->e107->tp->toDB($_POST['email_from_name']), 'mail_body' => $_POST['email_body'],
'mail_copy_to' => $this->e107->tp->toDB($_POST['email_cc']), 'mail_sender_email' => $_POST['email_from_email'],
'mail_bcopy_to' => $this->e107->tp->toDB($_POST['email_bcc']), 'mail_sender_name' => $_POST['email_from_name'],
'mail_attach' => $this->e107->tp->toDB(trim($_POST['email_attachment'])), 'mail_copy_to' => $_POST['email_cc'],
'mail_send_style' => $this->e107->tp->toDB(varset($_POST['send_style'],'textonly')), '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) 'mail_include_images' => (isset($_POST['mail_include_images']) ? 1 : 0)
); );
$ret = $tp->toDB($ret); // recursive
if (isset($_POST['mail_source_id'])) if (isset($_POST['mail_source_id']))
{ {
$ret['mail_source_id'] = intval($_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') public function showMailDetail(&$mailSource, $options='basic')
{ {
$tp = e107::getParser();
if (!isset($this->mailDetailDisplay[$options])) if (!isset($this->mailDetailDisplay[$options]))
{ {
return "<tr><td colspan='2'>Programming bungle - invalid option value: {$options}</td></tr>"; return "<tr><td colspan='2'>Programming bungle - invalid option value: {$options}</td></tr>";
@@ -693,7 +705,7 @@ class mailoutAdminClass extends e107MailManager
foreach ($this->mailDetailDisplay[$options] as $k => $v) foreach ($this->mailDetailDisplay[$options] as $k => $v)
{ {
$res .= '<tr><td>'.$this->fields['mail_content'][$k]['title'].'</td><td>'; $res .= '<tr><td>'.$this->fields['mail_content'][$k]['title'].'</td><td>';
$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 .= '</td></tr>'."\n"; $res .= '</td></tr>'."\n";
} }
return $res; return $res;
@@ -768,6 +780,8 @@ class mailoutAdminClass extends e107MailManager
$debug = (e_MENU == "debug") ? "?[debug]" : ""; $debug = (e_MENU == "debug") ? "?[debug]" : "";
$text .= "<div> $text .= "<div>
<form method='post' action='".e_SELF."?mode=makemail' id='mailout_form'> <form method='post' action='".e_SELF."?mode=makemail' id='mailout_form'>
".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))." ".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))."
@@ -1150,6 +1164,10 @@ class mailoutAdminClass extends e107MailManager
*/ */
public function sendEmailCircular($mailData, $fromHold = FALSE) public function sendEmailCircular($mailData, $fromHold = FALSE)
{ {
$sql = e107::getDb();
$mes = e107::getMessage();
if ($fromHold) if ($fromHold)
{ // Email data already generated { // Email data already generated
$mailMainID = $mailData['mail_source_id']; $mailMainID = $mailData['mail_source_id'];
@@ -1228,9 +1246,16 @@ class mailoutAdminClass extends e107MailManager
// Add in core and any plugin selectors here // Add in core and any plugin selectors here
foreach ($this->mailHandlers as $m) foreach ($this->mailHandlers as $m)
{ {
if ($m->mailerEnabled)
if ($m->mailerEnabled && ($contentArray = $m->showSelect(FALSE,$mailData['mail_selectors'][$m->mailerSource])))
{ {
$text .= '<tr><td>'.LAN_MAILOUT_180.'<br />'.$m->mailerName.'</td><td>'.$m->showSelect(FALSE).'</td></tr>'; $text .= '<tr><td>'.LAN_MAILOUT_180.'<br />'.$m->mailerName.'</td>';
$text .= '<td><ul>';
foreach($contentArray as $val)
{
$text .= "<li>".$val['caption']." : ".$val['html']."</li>";
}
$text .= '</ul></td></tr>';
} }
} }
@@ -1251,8 +1276,8 @@ class mailoutAdminClass extends e107MailManager
$text .= "</div> $text .= "</div>
</form> </form>
</div>"; </div>";
$this->e107->ns->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".LAN_MAILOUT_179."</div>", $text); e107::getRender()->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".LAN_MAILOUT_179."</div>",$mes->render(). $text);
} // End of previewed email } // End of previewed email

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2010-01-10 03:56:28 $ * $Date: 2010-01-10 06:20:43 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -80,12 +80,15 @@ class core_mailout
*/ */
public function returnSelectors() public function returnSelectors()
{ {
$tp = e107::getParser();
$res = array(); $res = array();
foreach ($this->selectFields as $k) foreach ($this->selectFields as $k)
{ {
if (varsettrue($_POST[$k])) if (varsettrue($_POST[$k]))
{ {
$res[$k] = $this->e107->tp->toDB($_POST[$k]); $res[$k] = $tp->toDB($_POST[$k]);
} }
} }
return $res; return $res;
@@ -103,6 +106,9 @@ class core_mailout
*/ */
public function selectInit($selectVals = FALSE) public function selectInit($selectVals = FALSE)
{ {
$sql = e107::getDb();
$where = array(); $where = array();
$incExtended = array(); $incExtended = array();
if ($selectVals === FALSE) if ($selectVals === FALSE)
@@ -195,7 +201,7 @@ class core_mailout
$qry .= ' WHERE '.implode(' AND ',$where).' ORDER BY u.user_name'; $qry .= ' WHERE '.implode(' AND ',$where).' ORDER BY u.user_name';
// echo "Selector query: ".$qry.'<br />'; // echo "Selector query: ".$qry.'<br />';
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; $this->mail_read = 0;
return $this->mail_count; return $this->mail_count;
} }
@@ -214,7 +220,9 @@ class core_mailout
*/ */
public function selectAdd() 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'], $ret = array('mail_recipient_id' => $row['user_id'],
'mail_recipient_name' => $row['user_name'], // Should this use realname? 'mail_recipient_name' => $row['user_name'], // Should this use realname?
'mail_recipient_email' => $row['user_email'], 'mail_recipient_email' => $row['user_email'],
@@ -276,6 +284,11 @@ class core_mailout
} }
else // Display existing values else // Display existing values
{ {
if(!vartrue($selectVals['email_to']))
{
return;
}
if(is_numeric($selectVals['email_to'])) if(is_numeric($selectVals['email_to']))
{ {
$sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to'])); $sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to']));

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $
* $Revision: 1.9 $ * $Revision: 1.10 $
* $Date: 2010-01-10 03:56:28 $ * $Date: 2010-01-10 06:20:43 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -20,7 +20,7 @@
* *
* @package e107_plugins * @package e107_plugins
* @subpackage event_calendar * @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(); } if (!defined('e107_INIT')) { exit(); }
@@ -161,7 +161,7 @@ class calendar_menu_mailout
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$frm = e107::getForm(); $frm = e107::getForm();
$var = array();
// $ret = "<table style='width:95%'>"; // $ret = "<table style='width:95%'>";
$selects = array_flip(explode(',', $selectVals)); $selects = array_flip(explode(',', $selectVals));
@@ -197,7 +197,6 @@ class calendar_menu_mailout
} }
return $var; return $var;
// return $ret.'</table>';
} }
} }

View File

@@ -9,8 +9,8 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* $Date: 2010-01-10 03:56:28 $ * $Date: 2010-01-10 06:20:46 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -185,6 +185,7 @@ class newsletter_mailout
{ {
$sql = e107::getDb(); $sql = e107::getDb();
$frm = e107::getForm(); $frm = e107::getForm();
$var = array();
$selects = array_flip(explode(',', $selectVals)); $selects = array_flip(explode(',', $selectVals));