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

Mailout bug fixes and ui cleanup

This commit is contained in:
CaMer0n
2010-01-10 03:56:28 +00:00
parent 5a8803e2ea
commit a21f57d361
9 changed files with 274 additions and 274 deletions

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $
* $Revision: 1.32 $
* $Date: 2009-12-01 20:05:51 $
* $Author: e107steved $
* $Revision: 1.33 $
* $Date: 2010-01-10 03:56:26 $
* $Author: e107coders $
*
*/
@@ -468,7 +468,7 @@ if (is_array($errors) && (count($errors) > 0))
}
if ($emessage->hasMessage())
{
$e107->ns->tablerender(LAN_MAILOUT_97, $emessage->render());
$ns->tablerender(LAN_MAILOUT_97, $emessage->render());
}
@@ -887,7 +887,9 @@ function show_prefs($mailAdmin)
//-----------------------------------------------------------
function show_maint($debug = FALSE)
{
$e107 = e107::getInstance();
$mes = e107::getMessage();
$ns = e107::getRender();
$text = "<div style='text-align:center'>";
$text .= "
@@ -904,7 +906,7 @@ function show_maint($debug = FALSE)
$text .= "<tr><td>".LAN_MAILOUT_182."</td><td><input class='button' type='submit' name='email_dross' value=\"".LAN_SUBMIT."\" /> <br /><span class='field-help'>".LAN_MAILOUT_252."</span></td></tr>";
$text .= "</tbody></table>\n</fieldset></form></div>";
$e107->ns->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".ADLAN_40."</div>", $text);
$ns->tablerender("<div style='text-align:center'>".ADLAN_136." :: ".ADLAN_40."</div>", $mes->render().$text);
// $text .= "</table></div>";
}

View File

@@ -9,8 +9,8 @@
* Form Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.111 $
* $Date: 2010-01-07 23:44:33 $
* $Revision: 1.112 $
* $Date: 2010-01-10 03:56:27 $
* $Author: e107coders $
*
*/
@@ -439,12 +439,13 @@ class e_form
/**
*
* @param object $name
* @param object $option_array
* @param array $option_array
* @param object $selected [optional]
* @param object $options [optional]
* @param boolean $defaultBlank [optional] set to TRUE if the first entry should be blank
* @return string HTML text for display
*/
function selectbox($name, $option_array, $selected = false, $options = array())
function selectbox($name, $option_array, $selected = false, $options = array(),$defaultBlank= false)
{
if(!is_array($options)) parse_str($options, $options);
@@ -455,9 +456,14 @@ class e_form
$text = $this->select_open($name, $options)."\n";
if(vartrue($options['default']))
{
{
$text .= $this->option($options['default'],'');
}
if(vartrue($defaultBlank))
{
$text .= $this->option('&nbsp;','');
}
$text .= $this->option_multi($option_array, $selected)."\n".$this->select_close();
return $text;

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_admin_class.php,v $
* $Revision: 1.10 $
* $Date: 2010-01-04 21:35:38 $
* $Author: e107steved $
* $Revision: 1.11 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -19,8 +19,8 @@
*
* @package e107
* @subpackage e107_handlers
* @version $Revision: 1.10 $
* @author $Author: e107steved $
* @version $Revision: 1.11 $
* @author $Author: e107coders $
* Various admin-related mailout functions, mostly to do with creating and handling forms.
*/
@@ -409,17 +409,15 @@ class mailoutAdminClass extends e107MailManager
{
global $pref;
$ret = 0;
$toLoad = explode(',', $options);
if (in_array('core', $toLoad) || ($options == 'all'))
{
require_once(e_HANDLER.'mailout_class.php');
$this->mailHandlers[] = new core_mailout($this); // Start by loading the core mailout class
$this->mailHandlers[] = new core_mailout; // Start by loading the core mailout class
$ret++;
}
$active_mailers = explode(',',varset($pref['mailout_enabled'],''));
// Load additional configured handlers
@@ -439,7 +437,7 @@ class mailoutAdminClass extends e107MailManager
$temp = new $mailClass;
if ($temp->mailerEnabled)
{
$this->mailHandlers[] = &$temp;
$this->mailHandlers[] = $temp;
$ret++;
if (varset($mailerExcludeDefault,FALSE) && isset($this->mailHandlers[0]) && ($this->mailHandlers[0]->mailerSource == 'core'))
{
@@ -473,14 +471,49 @@ class mailoutAdminClass extends e107MailManager
public function emailSelector($options = 'all', $selectorInfo = FALSE)
{
$ret = '';
foreach ($this->mailHandlers as $m)
$tab = '';
$tabc = '';
$ret .= "<div class='admintabs' id='tab-container'>\n";
foreach ($this->mailHandlers as $key=>$m)
{
if ($m->mailerEnabled)
{
$ret .= "<tr><td style='vertical-align: middle'>".$m->mailerName."</td><td>".$m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE))."</td></tr>";
$tab .= "<li id='tab-main_".$key."'><a href='#core-main_".$key."'>".$m->mailerName."</a></li>";
$tabc .= "<div id='core-main_".$key."'>";
$content = $m->showSelect(TRUE, varset($selectorInfo[$m->mailerSource], FALSE));
if(is_array($content))
{
$tabc .= "<table class='adminform' style='width:100%;margin-left:0px'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
";
foreach($content as $var)
{
$tabc .= "<tr><td>".$var['caption']."</td><td>".$var['html']."</td></tr>";
}
$tabc .= "</table>";
}
else
{
$tabc .= $content; //BC (0.8 only) but should be deprecated
}
$tabc .= "</div>";
}
}
$ret .= "<ul class='e-tabs e-hideme' id='core-mail-tabs'>".$tab."</ul>";
$ret .= $tabc;
$ret .= "</div>";
return $ret;
}
@@ -706,117 +739,111 @@ class mailoutAdminClass extends e107MailManager
{
global $pref,$HANDLERS_DIRECTORY;
global $mailAdmin;
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
$frm = e107::getForm();
$mes = e107::getMessage();
if (!is_array($mailSource))
{
$this->e107->ns->tablerender('ERROR!!', 'Coding error - mail not array (521)');
exit;
$mes = e107::getMessage();
$mes->add('Coding error - mail not array (521)', E_MESSAGE_ERROR);
//$ns->tablerender('ERROR!!', );
//exit;
}
$email_subject = varset($mailSource['mail_subject'], '');
$email_body = $this->e107->tp->toForm(varset($mailSource['mail_body'],''));
$email_body = $tp->toForm(varset($mailSource['mail_body'],''));
$email_id = varset($mailSource['mail_source_id'],'');
$text = '';
if(strpos($_SERVER['SERVER_SOFTWARE'],'mod_gzip') && !is_readable(e_HANDLER.'phpmailer/.htaccess'))
{
$warning = LAN_MAILOUT_40.' '.$HANDLERS_DIRECTORY.'phpmailer/ '.LAN_MAILOUT_41;
$this->e107->ns->tablerender(LAN_MAILOUT_42, $warning);
$ns->tablerender(LAN_MAILOUT_42, $warning);
}
$debug = (e_MENU == "debug") ? "?[debug]" : "";
$text .= "<div>
<form method='post' action='".e_SELF."?mode=makemail' id='mailout_form'>
".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))."
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tr>
<td>".LAN_MAILOUT_111.": </td>
<td>
<input type='text' name='email_title' class='tbox' style='width:80%' size='10' value=\"".varset($mailSource['mail_title'],'')."\" />
</td>
<td>".LAN_MAILOUT_111.": </td>
<td>".$frm->text('email_title',varset($mailSource['mail_title'],''))."</td>
</tr>
<tr>
<td>".LAN_MAILOUT_01.": </td>
<td>
<input type='text' name='email_from_name' class='tbox' style='width:80%' size='10' value=\"".varset($mailSource['mail_from_name'],USERNAME)."\" />
</td>
</tr>";
$text .="
<tr>
<td>".LAN_MAILOUT_02.": </td>
<td >
<input type='text' name='email_from_email' class='tbox' style='width:80%' value=\"".varset($mailSource['mail_from_email'],USEREMAIL)."\" />
</td>
</tr>";
// Add in the core and any plugin selectors here
$text .= $this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE));
// CC, BCC
$text .= "
<tr>
<td>".LAN_MAILOUT_04.": </td>
<td >
<input type='text' name='email_cc' class='tbox' style='width:80%' value=\"".$mailSource['mail_cc']."\" />
</td>
<td>".LAN_MAILOUT_01.": </td>
<td>".$frm->text('email_from_name',varset($mailSource['mail_from_name'],USERNAME))."</td>
</tr>
<tr>
<td>".LAN_MAILOUT_05.": </td>
<td >
<input type='text' name='email_bcc' class='tbox' style='width:80%' value='".$mailSource['mail_bcc']."' />
</td>
<td>".LAN_MAILOUT_02.": </td>
<td >".$frm->text('email_from_email',varset($mailSource['mail_from_email'],USEREMAIL))."</td>
</tr>";
// Close one table, open another - to give a boundary between addressees and content
$text .= "</table>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>";
// Subject
// Add in the core and any plugin selectors here
/*$text .= "
<tr>
<td>".LAN_MAILOUT_03.": </td>
<td>".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))."</td>
</tr>";*/
$text .= "
<tr>
<td>".LAN_MAILOUT_51.": </td>
<td>
<input type='text' name='email_subject' class='tbox' style='width:80%' value='{$email_subject}' />
</td>
<td>".LAN_MAILOUT_04.": </td>
<td>".$frm->text('email_cc',varset($mailSource['mail_cc'],''))."</td>
</tr>
<tr>
<td>".LAN_MAILOUT_05.": </td>
<td>".$frm->text('email_bcc',varset($mailSource['mail_bcc'],''))."</td>
</tr>
<tr>
<td>".LAN_MAILOUT_51.": </td>
<td>".$frm->text('email_subject',varset($email_subject,''))."</td>
</tr>";
// Attachment.
if ($this->e107->isInstalled('download'))
if (e107::isInstalled('download'))
{
// TODO - use download plugin API
$text .= "<tr>
if($sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name"))
{
$text .= "<tr>
<td>".LAN_MAILOUT_07.": </td>
<td >";
$text .= "<select class='tbox' name='email_attachment' >
$text .= "<select class='tbox' name='email_attachment' >
<option value=''>&nbsp;</option>\n";
$this->e107->sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name");
while ($row = $this->e107->sql->db_Fetch())
{
$selected = ($mailSource['mail_attach'] == $row['download_url']) ? "selected='selected'" : '';
// $text .= "<option value='".urlencode($row['download_url'])."' {$selected}>".htmlspecialchars($row['download_name'])."</option>\n";
$text .= "<option value='".$row['download_url']."' {$selected}>".htmlspecialchars($row['download_name'])."</option>\n";
while ($row = $this->e107->sql->db_Fetch())
{
$selected = ($mailSource['mail_attach'] == $row['download_url']) ? "selected='selected'" : '';
// $text .= "<option value='".urlencode($row['download_url'])."' {$selected}>".htmlspecialchars($row['download_name'])."</option>\n";
$text .= "<option value='".$row['download_url']."' {$selected}>".htmlspecialchars($row['download_name'])."</option>\n";
}
$text .= " </select>";
$text .= "</td>
</tr>";
}
$text .= " </select>";
$text .= "</td>
</tr>";
}
@@ -825,22 +852,6 @@ class mailoutAdminClass extends e107MailManager
<td>".LAN_MAILOUT_09.": </td>
<td >\n";
$text .= $this->sendStyleSelect($mailSource['mail_send_style']);
$checked = (isset($mailSource['mail_include_images']) && $mailSource['mail_include_images']) ? " checked='checked'" : '';
$text .= "&nbsp;&nbsp;<input type='checkbox' name='mail_include_images' value='1' {$checked} />".LAN_MAILOUT_225;
$text .="
</td></tr>\n
<tr>
<td colspan='2' >
<textarea rows='10' cols='20' id='email_body' name='email_body' class='e-wysiwyg tbox' style='width:80%;height:200px' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$email_body."</textarea>
</td>
</tr>";
$text .="
<tr>
<td colspan='2'>
<div>";
global $eplug_bb;
$eplug_bb[] = array(
@@ -853,7 +864,23 @@ class mailoutAdminClass extends e107MailManager
'function_var' => 'sc_selector'
);
$text .= display_help('helpb','mailout');
$text .= $this->sendStyleSelect($mailSource['mail_send_style']);
$checked = (isset($mailSource['mail_include_images']) && $mailSource['mail_include_images']) ? " checked='checked'" : '';
$text .= "&nbsp;&nbsp;<input type='checkbox' name='mail_include_images' value='1' {$checked} />".LAN_MAILOUT_225;
$text .="
</td></tr>\n
<tr>
<td>&nbsp;</td>
<td>".$frm->bbarea('email_body',$email_body,'mailout','helpb')."</td>
</tr>";
$text .="
<tr>
<td colspan='2'>
<div>";
// $text .= display_help('helpb','mailout');
if(e_WYSIWYG)
{
@@ -870,24 +897,27 @@ class mailoutAdminClass extends e107MailManager
$text .= "<div class='buttons-bar center'>";
if($email_id)
{
$text .= "<input type='hidden' name='mail_source_id' value='".$email_id."' />";
$text .= "<input class='button' type='submit' name='update_email' value=\"".LAN_UPDATE."\" />";
$text .= $frm->hidden('mail_source_id',$email_id);
$text .= $frm->admin_button('update_email',LAN_UPDATE);
//$text .= "<input type='hidden' name='mail_source_id' value='".$email_id."' />";
//$text .= "<input class='button' type='submit' name='update_email' value=\"".LAN_UPDATE."\" />";
}
else
{
$text .= "<input class='button' type='submit' name='save_email' value=\"".LAN_SAVE."\" />";
$text .= $frm->admin_button('save_email',LAN_SAVE);
}
$text .="&nbsp;<input class='button' type='submit' name='send_email' value=\"".LAN_MAILOUT_08."\" />
$text .= $frm->admin_button('send_email',LAN_MAILOUT_08);
</div>
$text .= "</div>
</form>
</div>";
$this->e107->ns->tablerender(LAN_MAILOUT_15, $text); // Render the complete form
$ns->tablerender(LAN_MAILOUT_15,$mes->render(). $text); // Render the complete form
}

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/mailout_class.php,v $
* $Revision: 1.6 $
* $Date: 2009-12-01 20:05:53 $
* $Author: e107steved $
* $Revision: 1.7 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -47,11 +47,11 @@ class core_mailout
{
protected $mailCount = 0;
protected $mailRead = 0;
protected $e107;
// protected $e107;
public $mailerSource = 'core'; // Plugin name (core mailer is special case) Must be directory for this file
public $mailerName = LAN_MAILOUT_68; // Text to identify the source of selector (displayed on left of admin page)
public $mailerEnabled = TRUE; // Mandatory - set to FALSE to disable this plugin (e.g. due to permissions restrictions)
protected $adminHandler = NULL; // Filled in with the name of the admin handler on creation
// protected $adminHandler = NULL; // Filled in with the name of the admin handler on creation
// List of fields used by selectors
private $selectFields = array('email_to',
@@ -64,8 +64,9 @@ class core_mailout
// Constructor
public function __construct()
{
$this->e107 = e107::getInstance();
$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
//FIXME Bad for Performance and causes data conflicts.
// $this->e107 = e107::getInstance();
// $this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
}
@@ -250,125 +251,58 @@ class core_mailout
*/
public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{
$ret = "<table style='width:95%'>";
$ret = "<fieldset id='core-mail-recipients'>
<table cellpadding='0' cellspacing='0' class='adminedit'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>";
$frm = e107::getForm();
$sql = e107::getDb();
$admin = e107::getRegistry('_mailout_admin');
$var = array();
$var[0]['caption'] = LAN_MAILOUT_03; // User class select
$var[1]['caption'] = LAN_MAILOUT_46; // User Search Field.
$var[2]['caption'] = LAN_MAILOUT_56; // User last visit
$var[3]['caption'] = LAN_MAILOUT_46; // Extended user field
$var[4]['caption'] = LAN_MAILOUT_46; // Extended user field
if ($allow_edit)
{
// User class select
$ret .= "<tr>
<td>".LAN_MAILOUT_03.": </td>
<td>
".$this->adminHandler->userClassesTotals('email_to', varset($selectVals['email_to'], ''))."</td>
</tr>";
// User Search Field.
$u_array = array('user_name'=>LAN_MAILOUT_43,'user_login'=>LAN_MAILOUT_44,'user_email'=>LAN_MAILOUT_45);
$ret .= "
<tr>
<td style='width:35%'>".LAN_MAILOUT_46."
<select name='user_search_name' class='tbox'>
<option value=''>&nbsp;</option>";
foreach ($u_array as $key=>$val)
{
$selected = '';
if (isset($selectVals['user_search_name']) && ($selectVals['user_search_name'] == $v)) { $selected = " selected='selected'"; }
$ret .= "<option value='{$key}' >".$val."</option>\n";
}
$ret .= "
</select> ".LAN_MAILOUT_47." </td>
<td style='width:65%'>
<input type='text' name='user_search_value' class='tbox' style='width:80%' value='".varset($selectVals['user_search_value'])."' />
</td></tr>
";
// User last visit
$ret .= "
<tr><td>".LAN_MAILOUT_56.' '.$this->adminHandler->comparisonSelect('last_visit_match', $selectVals['last_visit_match'])." </td>
<td>
<input type='text' name='last_visit_date' class='tbox' style='width:30%' value='".varset($selectVals['last_visit_date'], '')."' />
</td></tr>";
// Extended user fields
$ret .= "
<tr><td>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE).LAN_MAILOUT_48." </td>
<td>
<input type='text' name='extended_1_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_1_value'], '')."' />
</td></tr>
<tr><td>".LAN_MAILOUT_46.$this->adminHandler->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE).LAN_MAILOUT_48." </td>
<td>
<input type='text' name='extended_2_value' class='tbox' style='width:80%' value='".varset($selectVals['extended_2_value'], '')."' />
</td></tr>
";
$var[0]['html'] = $admin->userClassesTotals('email_to', varset($selectVals['email_to'], ''));
$var[1]['html'] = $frm->selectbox('user_search_name', $u_array, $selectVals['user_search_name'],'',TRUE)." ".LAN_MAILOUT_47." ".$frm->text('user_search_value', $selectVals['user_search_value']);
$var[2]['html'] = $admin->comparisonSelect('last_visit_match', $selectVals['last_visit_match'])." ".$frm->text('last_visit_date', $selectVals['last_visit_date']);
$var[3]['html'] = $admin->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE).LAN_MAILOUT_48." ".$frm->text('extended_1_value',$selectVals['extended_1_value']);
$var[4]['html'] = $admin->ret_extended_field_list('extended_2_name', varset($selectVals['extended_2_name'], ''), TRUE).LAN_MAILOUT_48." ".$frm->text('extended_2_value',$selectVals['extended_2_value']);
}
else
{ // Display existing values
else // Display existing values
{
if(is_numeric($selectVals['email_to']))
{
$this->e107->sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to']));
$row = $this->e107->sql->db_Fetch();
$sql->db_Select('userclass_classes', 'userclass_name', "userclass_id = ".intval($selectVals['email_to']));
$row = $sql->db_Fetch();
$_to = LAN_MAILOUT_23.$row['userclass_name'];
}
else
{
$_to = $selectVals['email_to'];
}
$ret .= "<tr>
<td>".LAN_MAILOUT_03."</td>
<td>".$_to."&nbsp;";
$var_0 = $_to."&nbsp;";
if($selectVals['email_to'] == "self")
{
$text .= "&lt;".USEREMAIL."&gt;";
}
$ret .= "</td></tr>";
if (vartrue($selectVals['user_search_name']) && vartrue($selectVals['user_search_value']))
{
$ret .= "
<tr>
<td>".$selectVals['user_search_name']."</td>
<td>".varset($selectVals['user_search_value'])."&nbsp;</td>
</tr>";
}
if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date']))
{
$ret .= "
<tr>
<td>".LAN_MAILOUT_56."</td>
<td>".$selectVals['last_visit_match'].' '.gmstrtotime("%D-%M-%Y",$selectVals['last_visit_date'])."&nbsp;</td>
</tr>";
}
if (vartrue($selectVals['extended_1_name']) && vartrue($selectVals['extended_1_value']))
{
$ret .= "
<tr>
<td>".$selectVals['extended_1_name']."</td>
<td>".$selectVals['extended_1_value']."&nbsp;</td>
</tr>";
}
if (vartrue($selectVals['extended_2_name']) && vartrue($selectVals['extended_2_value']))
{
$ret .= "
<tr>
<td>".$selectVals['extended_2_name']."</td>
<td>".$selectVals['extended_2_value']."&nbsp;</td>
</tr>";
$var_0 .= "&lt;".USEREMAIL."&gt;";
}
$var[0]['html'] = $var_0;
$var[1]['html'] = vartrue($selectVals['user_search_name'])." ". vartrue($selectVals['user_search_value']);
$var[2]['html'] = vartrue($selectVals['last_visit_match']).' '.gmstrftime("%D-%M-%Y",vartrue($selectVals['last_visit_date'])); //FIXME use e107 date function.
$var[3]['html'] = vartrue($selectVals['extended_1_name']).' '.vartrue($selectVals['extended_1_value']);
$var[4]['html'] = vartrue($selectVals['extended_2_name']).' '.vartrue($selectVals['extended_2_value']);
}
return $ret.'</tbody></table></fieldset>';
return $var;
}
}

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_mailout.php,v $
* $Revision: 1.15 $
* $Date: 2009-12-01 20:05:54 $
* $Author: e107steved $
* $Revision: 1.16 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -85,7 +85,7 @@ define('LAN_MAILOUT_57', 'Send bulk SMTP emails in blocks'); // SMTP KeepAlive
//define('LAN_MAILOUT_65', 'seconds');
//define('LAN_MAILOUT_66', 'Cancelled Successfully');
define('LAN_MAILOUT_67', 'The email could not be sent. Please review your SMTP settings, or select another mailing method and try again.');
define('LAN_MAILOUT_68','Include from registered users');
define('LAN_MAILOUT_68','Registered Users');
define('LAN_MAILOUT_69','matches, after ');
define('LAN_MAILOUT_70',' duplicates stripped.');
define('LAN_MAILOUT_71','Total emails to send');

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_mailout.php,v $
* $Revision: 1.8 $
* $Date: 2009-12-20 22:47:28 $
* $Author: e107steved $
* $Revision: 1.9 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -20,7 +20,7 @@
*
* @package e107_plugins
* @subpackage event_calendar
* @version $Id: e_mailout.php,v 1.8 2009-12-20 22:47:28 e107steved Exp $;
* @version $Id: e_mailout.php,v 1.9 2010-01-10 03:56:28 e107coders Exp $;
*/
if (!defined('e107_INIT')) { exit(); }
@@ -41,19 +41,15 @@ class calendar_menu_mailout
{
protected $mailCount = 0;
protected $mailRead = 0;
protected $e107;
public $mailerSource = 'calendar_menu'; // Plugin name (core mailer is special case) Must be directory for this file
public $mailerSource = 'calendar_menu'; //FIXME should be auto-detected // Plugin name (core mailer is special case) Must be directory for this file
public $mailerName = LAN_EC_MAIL_01; // Text to identify the source of selector (displayed on left of admin page)
public $mailerEnabled = TRUE; // Mandatory - set to FALSE to disable this plugin (e.g. due to permissions restrictions)
protected $adminHandler = NULL; // Filled in with the name of the admin handler on creation
private $selectorActive = FALSE; // Set TRUE if we've got a valid selector to start returning entries
// Constructor
public function __construct()
{
$this->e107 = e107::getInstance();
$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
}
@@ -90,6 +86,9 @@ class calendar_menu_mailout
*/
public function selectInit($selectVals = FALSE)
{
$sql = e107::getDb();
if (($selectVals === FALSE) || ($selectVals == ''))
{
return 0; // No valid selector - so no valid records
@@ -100,7 +99,7 @@ class calendar_menu_mailout
$qry .= ' LEFT JOIN `#user` AS u ON es.`event_subid` = u.`user_id` WHERE es.`event_cat` IN (\''.$selectVals.'\') AND u.`user_id` IS NOT NULL';
$qry .= ' GROUP BY u.`user_id`';
// 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->selectorActive = TRUE;
$this->mail_read = 0;
return $this->mail_count;
@@ -120,8 +119,10 @@ class calendar_menu_mailout
*/
public function selectAdd()
{
$sql = e107::getDb();
if (!$this->selectorActive) return FALSE;
if (!($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC))) return FALSE;
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'],
@@ -154,35 +155,49 @@ class calendar_menu_mailout
* @param boolean $allow_edit is TRUE to allow user to change the selection; FALSE to just display current settings
* @param string $selectVals is the current selection information - in the same format as returned by returnSelectors()
*
* @return string Returns HTML which is displayed in a table cell. Typically we return a complete table
* @return array Returns array which is displayed in a table cell.
*/
public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{
$ret = "<table style='width:95%'>";
$sql = e107::getDb();
$frm = e107::getForm();
// $ret = "<table style='width:95%'>";
$selects = array_flip(explode(',', $selectVals));
if ($this->e107->sql->db_Select('event_cat', 'event_cat_id, event_cat_name', "event_cat_name != 'Default'"))
if ($sql->db_Select('event_cat', 'event_cat_id, event_cat_name', "event_cat_name != 'Default'"))
{
while ($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC))
$c=0;
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$checked = (isset($selects[$row['event_cat_id']])) ? " checked='checked'" : '';
if ($allow_edit)
{
$ret .= "<tr><td><input type='checkbox' name='ec_category_sel[]' value='{$row['event_cat_id']}' {$checked}/></td><td>
".$row['event_cat_name']."</td></tr>";
$var[$c]['caption'] = $row['event_cat_name'];
$var[$c]['html'] = $frm->checkbox('ec_category_sel[]',$row['event_cat_id'],$checked);
/*$ret .= "<tr><td><input type='checkbox' name='ec_category_sel[]' value='{$row['event_cat_id']}' {$checked}/></td><td>
".$row['event_cat_name']."</td></tr>";*/
}
elseif($checked)
{
$ret .= "<tr><td>".LAN_EC_MAIL_03."</td><td>
".$row['event_cat_name']."</td></tr>";
$var[$c]['caption'] = $row['event_cat_name'];
$var[$c]['html'] = LAN_EC_MAIL_03;
/*$ret .= "<tr><td>".LAN_EC_MAIL_03."</td><td>
".$row['event_cat_name']."</td></tr>";*/
}
$c++;
}
}
else
{
$ret .= "<tr><td colspan='2'>".LAN_EC_MAIL_02.'</td></tr>';
$var[0]['caption'] = LAN_EC_MAIL_02;
$var[0]['html'] = '';
}
return $ret.'</table>';
return $var;
// return $ret.'</table>';
}
}

View File

@@ -9,13 +9,13 @@
* Event calendar - language file for mailout related routines
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/English_mailer.php,v $
* $Revision: 1.4 $
* $Date: 2009-11-22 10:11:32 $
* $Author: e107steved $
* $Revision: 1.5 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
define('LAN_EC_MAIL_01', 'Event calendar subscribers list');
define('LAN_EC_MAIL_01', 'Event Calendar Subscribers');
define('LAN_EC_MAIL_02', 'No categories defined, or database error');
define('LAN_EC_MAIL_03', 'Category: ');
define('LAN_EC_MAIL_04', 'Calendar Subscriptions');

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/e_mailout.php,v $
* $Revision: 1.2 $
* $Date: 2009-12-01 20:05:54 $
* $Author: e107steved $
* $Revision: 1.3 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -34,11 +34,9 @@ class newsletter_mailout
{
protected $mailCount = 0;
protected $mailRead = 0;
protected $e107;
public $mailerSource = 'newsletter'; // Plugin name (core mailer is special case) Must be directory for this file
public $mailerName = NLLAN_48; // Text to identify the source of selector (displayed on left of admin page)
public $mailerEnabled = TRUE; // Mandatory - set to FALSE to disable this plugin (e.g. due to permissions restrictions)
protected $adminHandler = NULL; // Filled in with the name of the admin handler on creation
private $selectorActive = FALSE; // Set TRUE if we've got a valid selector to start returning entries
private $targets = array(); // Used to store potential recipients
private $ourDB;
@@ -47,8 +45,9 @@ class newsletter_mailout
// Constructor
public function __construct()
{
$this->e107 = e107::getInstance();
$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
// BAD FOR PERFORMANCE
//$this->e107 = e107::getInstance();
//$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions
}
@@ -85,6 +84,9 @@ class newsletter_mailout
*/
public function selectInit($selectVals = FALSE)
{
$sql = e107::getDb();
if (($selectVals === FALSE) || ($selectVals == ''))
{
return 0; // No valid selector - so no valid records
@@ -92,7 +94,7 @@ class newsletter_mailout
$qry = "SELECT newsletter_id,newsletter_subscribers FROM `#newsletter` WHERE (`newsletter_parent`=0) AND (`newsletter_id` IN ({$selectVals}))";
// echo "Selector {$selectVals} query: ".$qry.'<br />';
if (!($this->e107->sql->db_Select_gen($qry))) return FALSE;
if (!($sql->db_Select_gen($qry))) return FALSE;
$this->selectorActive = TRUE;
$this->mail_count = 1; // We have no idea of how many subscribers without reading all relevant DB records
$this->mail_read = 0;
@@ -114,13 +116,17 @@ class newsletter_mailout
*/
public function selectAdd()
{
$sql = e107::getDb();
if (!$this->selectorActive) return FALSE;
while ($this->selectorActive)
{
if (count($this->targets) == 0)
{ // Read in and process another newletter mailing list
if (!($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC)))
if (!($row = $sql->db_Fetch(MYSQL_ASSOC)))
{
$this->selectorActive = FALSE;
return FALSE; // Run out of DB records
@@ -173,35 +179,42 @@ class newsletter_mailout
* @param boolean $allow_edit is TRUE to allow user to change the selection; FALSE to just display current settings
* @param string $selectVals is the current selection information - in the same format as returned by returnSelectors()
*
* @return string Returns HTML which is displayed in a table cell. Typically we return a complete table
* @return array Returns array which is displayed in a table cell
*/
public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{
$ret = "<table style='width:95%'>";
$sql = e107::getDb();
$frm = e107::getForm();
$selects = array_flip(explode(',', $selectVals));
if ($this->e107->sql->db_Select('newsletter', 'newsletter_id, newsletter_title', '`newsletter_parent`=0'))
if ($sql->db_Select('newsletter', 'newsletter_id, newsletter_title', '`newsletter_parent`=0'))
{
while ($row = $this->e107->sql->db_Fetch(MYSQL_ASSOC))
$c=0;
while ($row = $sql->db_Fetch(MYSQL_ASSOC))
{
$checked = (isset($selects[$row['newsletter_id']])) ? " checked='checked'" : '';
if ($allow_edit)
{
$ret .= "<tr><td><input type='checkbox' name='nl_category_sel[]' value='{$row['newsletter_id']}' {$checked}/></td><td>
".$row['newsletter_title']."</td></tr>";
$var[$c]['caption'] = $row['newsletter_title'];
$var[$c]['html'] = $frm->checkbox('nl_category_sel[]',$row['newsletter_id'] ,$checked);
}
elseif($checked)
{
$ret .= "<tr><td>".NLLAN_49."</td><td>
".$row['newsletter_title']."</td></tr>";
$var[$c]['caption'] = $row['newsletter_title'];
$var[$c]['html'] = NLLAN_49;
}
$c++;
}
}
else
{
$ret .= "<tr><td colspan='2'>".NLLAN_50.'</td></tr>';
$var[$c]['caption'] = NLLAN_50;
$var[$c]['html'] = '';
}
return $ret.'</table>';
return $var;
}
}

View File

@@ -9,9 +9,9 @@
* Plugin - newsfeeds
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/languages/English_admin_newsletter.php,v $
* $Revision: 1.1 $
* $Date: 2009-11-19 20:24:21 $
* $Author: e107steved $
* $Revision: 1.2 $
* $Date: 2010-01-10 03:56:28 $
* $Author: e107coders $
*
*/
@@ -65,7 +65,7 @@ define('NLLAN_44', 'Newsletter Front Page');
define('NLLAN_45', 'Create Newsletter');
define('NLLAN_46', 'Create mailing');
define('NLLAN_47', 'Newsletter Options');
define('NLLAN_48', 'Subscribers to each newsletter');
define('NLLAN_48', 'Newsletter Subscribers');
define('NLLAN_49', 'Newsletter: ');
define('NLLAN_54', 'Sending');