1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Allow email to users to also be disabled via the mailout preferences.

This commit is contained in:
Cameron
2014-10-16 19:04:24 -07:00
parent 28db46022b
commit 567fb01e12
2 changed files with 40 additions and 35 deletions

View File

@@ -854,11 +854,15 @@ class mailout_main_ui extends e_admin_ui
<td> "; <td> ";
$mail_enable = explode(',',$pref['mailout_enabled']); $mail_enable = explode(',',$pref['mailout_enabled']);
$coreCheck = (in_array('core',$mail_enable)) ? "checked='checked'" : "";
$text .= $frm->checkbox('mail_mailer_enabled[]','core', $coreCheck, 'users');
foreach ($pref['e_mailout_list'] as $mailer => $v) foreach ($pref['e_mailout_list'] as $mailer => $v)
{ {
$check = (in_array($mailer,$mail_enable)) ? "checked='checked'" : ""; $check = (in_array($mailer,$mail_enable)) ? "checked='checked'" : "";
$text .= "&nbsp;<input type='checkbox' name='mail_mailer_enabled[]' value='{$mailer}' {$check} /> {$mailer}<br />"; $text .= $frm->checkbox('mail_mailer_enabled[]',$mailer,$check,$mailer);
// $text .= "&nbsp;<input type='checkbox' name='mail_mailer_enabled[]' value='{$mailer}' {$check} /> {$mailer}<br />";
} }
$text .= "</td></tr>\n"; $text .= "</td></tr>\n";
@@ -1062,7 +1066,7 @@ class mailout_main_ui extends e_admin_ui
$temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']); $temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']);
$temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0)); $temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0));
$temp['mailout_enabled'] = implode(',',varset($_POST['mail_mailer_enabled'], '')); $temp['mailout_enabled'] = implode(',', varset($_POST['mail_mailer_enabled'], ''));
$temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']); $temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']);
foreach ($temp as &$t) foreach ($temp as &$t)
@@ -1096,7 +1100,7 @@ class mailout_admin_form_ui extends e_admin_form_ui
switch($mode) switch($mode)
{ {
case 'read': case 'read':
return varset($data['mail_send_style'], ''); return varset($data['mail_selectors'], '');
break; break;
case 'write': case 'write':

View File

@@ -546,19 +546,20 @@ class mailoutAdminClass extends e107MailManager
$ret = 0; $ret = 0;
$toLoad = explode(',', $options); $toLoad = explode(',', $options);
if(in_array('core', $toLoad) || ($options == 'all'))
$active_mailers = explode(',', varset($pref['mailout_enabled'], 'core'));
if((in_array('core', $toLoad) || ($options == 'all')) && in_array('core', $active_mailers))
{ {
require_once (e_HANDLER . 'mailout_class.php'); require_once (e_HANDLER . 'mailout_class.php');
$this->mailHandlers['core'] = new core_mailout; $this->mailHandlers['core'] = new core_mailout; // Start by loading the core mailout class
// Start by loading the core mailout class
$ret++; $ret++;
} }
$active_mailers = explode(',', varset($pref['mailout_enabled'], '')); // Load additional configured handlers e_mailout.php from plugins.
// Load additional configured handlers
foreach($pref['e_mailout_list'] as $mailer => $v) foreach($pref['e_mailout_list'] as $mailer => $v)
{ {
if(isset($pref['plug_installed'][$mailer]) && in_array($mailer, $active_mailers) && (($options == 'all') || in_array($mailer, $toLoad))) if(isset($pref['plug_installed'][$mailer]) && in_array($mailer, $active_mailers) && (($options == 'all') || in_array($mailer, $toLoad)))
{ {
// Could potentially use this handler - its installed and enabled // Could potentially use this handler - its installed and enabled
@@ -608,25 +609,19 @@ class mailoutAdminClass extends e107MailManager
*/ */
public function emailSelector($options = 'all', $selectorInfo = FALSE) public function emailSelector($options = 'all', $selectorInfo = FALSE)
{ {
$ret = ''; $tabs = array();
$tab = '';
$tabc = '';
foreach($this->mailHandlers as $key => $m) foreach($this->mailHandlers as $key => $m)
{ {
if($m->mailerEnabled) if($m->mailerEnabled)
{ {
$lactive = ($key == 'core')? " class='active'": '';
$tab .= "<li" . $lactive . "><a data-toggle='tab' href='#main-mail-" . $key . "'>" . $m->mailerName . "</a></li>";
$pactive = ($key == 'core')? 'active': '';
$tabc .= "<div id='main-mail-" . $key . "' class='tab-pane " . $pactive . "'>";
$content = $m->showSelect(TRUE, varset($selectorInfo[$key], FALSE)); $content = $m->showSelect(TRUE, varset($selectorInfo[$key], FALSE));
if(is_array($content)) if(is_array($content))
{ {
$tabc .= "<table class='table ' style='width:100%;margin-left:0px'> $text = "<table class='table ' style='width:100%;margin-left:0px'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
<col class='col-control' /> <col class='col-control' />
@@ -635,31 +630,37 @@ class mailoutAdminClass extends e107MailManager
foreach($content as $var) foreach($content as $var)
{ {
$tabc .= "<tr><td style='padding-left:0px'>" . $var['caption'] . "</td><td class='form-inline'>" . $var['html'] . "</td></tr>"; $text .= "
<tr>
<td style='padding-left:0px'>" . $var['caption'] . "</td>
<td class='form-inline'>" . $var['html'] . "</td>
</tr>";
} }
$tabc .= "</table>";
$text .= "</table>";
} }
else else
{ {
$tabc .= $content; $text = $content; //BC (0.8 only) but should be deprecated
//BC (0.8 only) but should be deprecated
} }
$tabc .= "</div>"; $tabs[$key] = array('caption'=>$m->mailerName, 'text'=>$text);
} }
} }
// $ret .= "<ul class='e-tabs e-hideme' id='core-mail-tabs'>".$tab."</ul>"; // if(count($tabs) < 2) // no tabs if there's only 1 category.
// This hides tabs! {
$ret .= "<ul class='nav nav-tabs'>" . $tab . "</ul>"; return $text;
$ret .= "<div class='tab-content'>\n"; }
$ret .= $tabc;
$ret .= "</div>";
return e107::getForm()->tabs($tabs);
return $ret;
} }
/** /**
* Get the selector details from each mail plugin (to add to mail data) * Get the selector details from each mail plugin (to add to mail data)
* *