1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +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

@@ -855,10 +855,14 @@ class mailout_main_ui extends e_admin_ui
$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)
{
$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";
@@ -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_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']);
foreach ($temp as &$t)
@@ -1096,7 +1100,7 @@ class mailout_admin_form_ui extends e_admin_form_ui
switch($mode)
{
case 'read':
return varset($data['mail_send_style'], '');
return varset($data['mail_selectors'], '');
break;
case 'write':

View File

@@ -546,19 +546,20 @@ class mailoutAdminClass extends e107MailManager
$ret = 0;
$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');
$this->mailHandlers['core'] = new core_mailout;
// Start by loading the core mailout class
$this->mailHandlers['core'] = new core_mailout; // Start by loading the core mailout class
$ret++;
}
$active_mailers = explode(',', varset($pref['mailout_enabled'], ''));
// Load additional configured handlers
// Load additional configured handlers e_mailout.php from plugins.
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)))
{
// Could potentially use this handler - its installed and enabled
@@ -608,25 +609,19 @@ class mailoutAdminClass extends e107MailManager
*/
public function emailSelector($options = 'all', $selectorInfo = FALSE)
{
$ret = '';
$tab = '';
$tabc = '';
$tabs = array();
foreach($this->mailHandlers as $key => $m)
{
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));
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'>
<col class='col-label' />
<col class='col-control' />
@@ -635,31 +630,37 @@ class mailoutAdminClass extends e107MailManager
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
{
$tabc .= $content;
//BC (0.8 only) but should be deprecated
$text = $content; //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>"; //
// This hides tabs!
$ret .= "<ul class='nav nav-tabs'>" . $tab . "</ul>";
$ret .= "<div class='tab-content'>\n";
$ret .= $tabc;
$ret .= "</div>";
return $ret;
if(count($tabs) < 2) // no tabs if there's only 1 category.
{
return $text;
}
return e107::getForm()->tabs($tabs);
}
/**
* Get the selector details from each mail plugin (to add to mail data)
*