1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +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 * 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.32 $ * $Revision: 1.33 $
* $Date: 2009-12-01 20:05:51 $ * $Date: 2010-01-10 03:56:26 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -468,7 +468,7 @@ if (is_array($errors) && (count($errors) > 0))
} }
if ($emessage->hasMessage()) 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) function show_maint($debug = FALSE)
{ {
$e107 = e107::getInstance(); $mes = e107::getMessage();
$ns = e107::getRender();
$text = "<div style='text-align:center'>"; $text = "<div style='text-align:center'>";
$text .= " $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 .= "<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>"; $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>"; // $text .= "</table></div>";
} }

View File

@@ -9,8 +9,8 @@
* Form Handler * Form Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.111 $ * $Revision: 1.112 $
* $Date: 2010-01-07 23:44:33 $ * $Date: 2010-01-10 03:56:27 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -439,12 +439,13 @@ class e_form
/** /**
* *
* @param object $name * @param object $name
* @param object $option_array * @param array $option_array
* @param object $selected [optional] * @param object $selected [optional]
* @param object $options [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 * @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); if(!is_array($options)) parse_str($options, $options);
@@ -459,6 +460,11 @@ class e_form
$text .= $this->option($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(); $text .= $this->option_multi($option_array, $selected)."\n".$this->select_close();
return $text; return $text;
} }

View File

@@ -9,9 +9,9 @@
* 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.10 $ * $Revision: 1.11 $
* $Date: 2010-01-04 21:35:38 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -19,8 +19,8 @@
* *
* @package e107 * @package e107
* @subpackage e107_handlers * @subpackage e107_handlers
* @version $Revision: 1.10 $ * @version $Revision: 1.11 $
* @author $Author: e107steved $ * @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.
*/ */
@@ -409,14 +409,12 @@ class mailoutAdminClass extends e107MailManager
{ {
global $pref; global $pref;
$ret = 0; $ret = 0;
$toLoad = explode(',', $options); $toLoad = explode(',', $options);
if (in_array('core', $toLoad) || ($options == 'all')) if (in_array('core', $toLoad) || ($options == 'all'))
{ {
require_once(e_HANDLER.'mailout_class.php'); 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++; $ret++;
} }
@@ -439,7 +437,7 @@ class mailoutAdminClass extends e107MailManager
$temp = new $mailClass; $temp = new $mailClass;
if ($temp->mailerEnabled) if ($temp->mailerEnabled)
{ {
$this->mailHandlers[] = &$temp; $this->mailHandlers[] = $temp;
$ret++; $ret++;
if (varset($mailerExcludeDefault,FALSE) && isset($this->mailHandlers[0]) && ($this->mailHandlers[0]->mailerSource == 'core')) 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) public function emailSelector($options = 'all', $selectorInfo = FALSE)
{ {
$ret = ''; $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) 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; return $ret;
} }
@@ -707,26 +740,37 @@ class mailoutAdminClass extends e107MailManager
global $pref,$HANDLERS_DIRECTORY; global $pref,$HANDLERS_DIRECTORY;
global $mailAdmin; global $mailAdmin;
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
$frm = e107::getForm();
$mes = e107::getMessage();
if (!is_array($mailSource)) if (!is_array($mailSource))
{ {
$this->e107->ns->tablerender('ERROR!!', 'Coding error - mail not array (521)'); $mes = e107::getMessage();
exit; $mes->add('Coding error - mail not array (521)', E_MESSAGE_ERROR);
//$ns->tablerender('ERROR!!', );
//exit;
} }
$email_subject = varset($mailSource['mail_subject'], ''); $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'],''); $email_id = varset($mailSource['mail_source_id'],'');
$text = ''; $text = '';
if(strpos($_SERVER['SERVER_SOFTWARE'],'mod_gzip') && !is_readable(e_HANDLER.'phpmailer/.htaccess')) if(strpos($_SERVER['SERVER_SOFTWARE'],'mod_gzip') && !is_readable(e_HANDLER.'phpmailer/.htaccess'))
{ {
$warning = LAN_MAILOUT_40.' '.$HANDLERS_DIRECTORY.'phpmailer/ '.LAN_MAILOUT_41; $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]" : ""; $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))."
<table cellpadding='0' cellspacing='0' class='adminform'> <table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
@@ -734,79 +778,59 @@ class mailoutAdminClass extends e107MailManager
</colgroup> </colgroup>
<tr> <tr>
<td>".LAN_MAILOUT_111.": </td> <td>".LAN_MAILOUT_111.": </td>
<td> <td>".$frm->text('email_title',varset($mailSource['mail_title'],''))."</td>
<input type='text' name='email_title' class='tbox' style='width:80%' size='10' value=\"".varset($mailSource['mail_title'],'')."\" />
</td>
</tr> </tr>
<tr> <tr>
<td>".LAN_MAILOUT_01.": </td> <td>".LAN_MAILOUT_01.": </td>
<td> <td>".$frm->text('email_from_name',varset($mailSource['mail_from_name'],USERNAME))."</td>
<input type='text' name='email_from_name' class='tbox' style='width:80%' size='10' value=\"".varset($mailSource['mail_from_name'],USERNAME)."\" /> </tr>
</td>
</tr>";
$text .="
<tr> <tr>
<td>".LAN_MAILOUT_02.": </td> <td>".LAN_MAILOUT_02.": </td>
<td > <td >".$frm->text('email_from_email',varset($mailSource['mail_from_email'],USEREMAIL))."</td>
<input type='text' name='email_from_email' class='tbox' style='width:80%' value=\"".varset($mailSource['mail_from_email'],USEREMAIL)."\" />
</td>
</tr>"; </tr>";
// Add in the core and any plugin selectors here // Add in the core and any plugin selectors here
$text .= $this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE));
/*$text .= "
<tr>
<td>".LAN_MAILOUT_03.": </td>
<td>".$this->emailSelector('all', varset($mailSource['mail_selectors'], FALSE))."</td>
</tr>";*/
// CC, BCC
$text .= " $text .= "
<tr> <tr>
<td>".LAN_MAILOUT_04.": </td> <td>".LAN_MAILOUT_04.": </td>
<td > <td>".$frm->text('email_cc',varset($mailSource['mail_cc'],''))."</td>
<input type='text' name='email_cc' class='tbox' style='width:80%' value=\"".$mailSource['mail_cc']."\" />
</td>
</tr> </tr>
<tr> <tr>
<td>".LAN_MAILOUT_05.": </td> <td>".LAN_MAILOUT_05.": </td>
<td > <td>".$frm->text('email_bcc',varset($mailSource['mail_bcc'],''))."</td>
<input type='text' name='email_bcc' class='tbox' style='width:80%' value='".$mailSource['mail_bcc']."' /> </tr>
</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
$text .= "
<tr> <tr>
<td>".LAN_MAILOUT_51.": </td> <td>".LAN_MAILOUT_51.": </td>
<td> <td>".$frm->text('email_subject',varset($email_subject,''))."</td>
<input type='text' name='email_subject' class='tbox' style='width:80%' value='{$email_subject}' />
</td>
</tr>"; </tr>";
// Attachment. // Attachment.
if ($this->e107->isInstalled('download')) if (e107::isInstalled('download'))
{ {
// TODO - use download plugin API // TODO - use download plugin API
if($sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name"))
{
$text .= "<tr> $text .= "<tr>
<td>".LAN_MAILOUT_07.": </td> <td>".LAN_MAILOUT_07.": </td>
<td >"; <td >";
$text .= "<select class='tbox' name='email_attachment' > $text .= "<select class='tbox' name='email_attachment' >
<option value=''>&nbsp;</option>\n"; <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()) while ($row = $this->e107->sql->db_Fetch())
{ {
$selected = ($mailSource['mail_attach'] == $row['download_url']) ? "selected='selected'" : ''; $selected = ($mailSource['mail_attach'] == $row['download_url']) ? "selected='selected'" : '';
@@ -820,27 +844,14 @@ class mailoutAdminClass extends e107MailManager
} }
}
$text .= " $text .= "
<tr> <tr>
<td>".LAN_MAILOUT_09.": </td> <td>".LAN_MAILOUT_09.": </td>
<td >\n"; <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; global $eplug_bb;
$eplug_bb[] = array( $eplug_bb[] = array(
@@ -853,7 +864,23 @@ class mailoutAdminClass extends e107MailManager
'function_var' => 'sc_selector' '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) if(e_WYSIWYG)
{ {
@@ -870,24 +897,27 @@ class mailoutAdminClass extends e107MailManager
$text .= "<div class='buttons-bar center'>"; $text .= "<div class='buttons-bar center'>";
if($email_id) if($email_id)
{ {
$text .= "<input type='hidden' name='mail_source_id' value='".$email_id."' />"; $text .= $frm->hidden('mail_source_id',$email_id);
$text .= "<input class='button' type='submit' name='update_email' value=\"".LAN_UPDATE."\" />"; $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 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> </form>
</div>"; </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 * 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.6 $ * $Revision: 1.7 $
* $Date: 2009-12-01 20:05:53 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -47,11 +47,11 @@ class core_mailout
{ {
protected $mailCount = 0; protected $mailCount = 0;
protected $mailRead = 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 $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 $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) 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 // List of fields used by selectors
private $selectFields = array('email_to', private $selectFields = array('email_to',
@@ -64,8 +64,9 @@ class core_mailout
// Constructor // Constructor
public function __construct() public function __construct()
{ {
$this->e107 = e107::getInstance(); //FIXME Bad for Performance and causes data conflicts.
$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions // $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) public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{ {
$ret = "<table style='width:95%'>"; $frm = e107::getForm();
$sql = e107::getDb();
$admin = e107::getRegistry('_mailout_admin');
$ret = "<fieldset id='core-mail-recipients'> $var = array();
<table cellpadding='0' cellspacing='0' class='adminedit'>
<colgroup span='2'> $var[0]['caption'] = LAN_MAILOUT_03; // User class select
<col class='col-label' /> $var[1]['caption'] = LAN_MAILOUT_46; // User Search Field.
<col class='col-control' /> $var[2]['caption'] = LAN_MAILOUT_56; // User last visit
</colgroup> $var[3]['caption'] = LAN_MAILOUT_46; // Extended user field
<tbody>"; $var[4]['caption'] = LAN_MAILOUT_46; // Extended user field
if ($allow_edit) 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); $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) $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
{ {
$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>
";
}
else
{ // Display existing values
if(is_numeric($selectVals['email_to'])) if(is_numeric($selectVals['email_to']))
{ {
$this->e107->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']));
$row = $this->e107->sql->db_Fetch(); $row = $sql->db_Fetch();
$_to = LAN_MAILOUT_23.$row['userclass_name']; $_to = LAN_MAILOUT_23.$row['userclass_name'];
} }
else else
{ {
$_to = $selectVals['email_to']; $_to = $selectVals['email_to'];
} }
$ret .= "<tr>
<td>".LAN_MAILOUT_03."</td> $var_0 = $_to."&nbsp;";
<td>".$_to."&nbsp;";
if($selectVals['email_to'] == "self") if($selectVals['email_to'] == "self")
{ {
$text .= "&lt;".USEREMAIL."&gt;"; $var_0 .= "&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'])) $var[0]['html'] = $var_0;
{ $var[1]['html'] = vartrue($selectVals['user_search_name'])." ". vartrue($selectVals['user_search_value']);
$ret .= " $var[2]['html'] = vartrue($selectVals['last_visit_match']).' '.gmstrftime("%D-%M-%Y",vartrue($selectVals['last_visit_date'])); //FIXME use e107 date function.
<tr> $var[3]['html'] = vartrue($selectVals['extended_1_name']).' '.vartrue($selectVals['extended_1_value']);
<td>".LAN_MAILOUT_56."</td> $var[4]['html'] = vartrue($selectVals['extended_2_name']).' '.vartrue($selectVals['extended_2_value']);
<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'])) return $var;
{
$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>";
}
}
return $ret.'</tbody></table></fieldset>';
} }
} }

View File

@@ -9,9 +9,9 @@
* Administration - Site Maintenance * Administration - Site Maintenance
* *
* $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_mailout.php,v $ * $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_mailout.php,v $
* $Revision: 1.15 $ * $Revision: 1.16 $
* $Date: 2009-12-01 20:05:54 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $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_65', 'seconds');
//define('LAN_MAILOUT_66', 'Cancelled Successfully'); //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_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_69','matches, after ');
define('LAN_MAILOUT_70',' duplicates stripped.'); define('LAN_MAILOUT_70',' duplicates stripped.');
define('LAN_MAILOUT_71','Total emails to send'); define('LAN_MAILOUT_71','Total emails to send');

View File

@@ -9,9 +9,9 @@
* 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.8 $ * $Revision: 1.9 $
* $Date: 2009-12-20 22:47:28 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $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.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(); } if (!defined('e107_INIT')) { exit(); }
@@ -41,19 +41,15 @@ class calendar_menu_mailout
{ {
protected $mailCount = 0; protected $mailCount = 0;
protected $mailRead = 0; protected $mailRead = 0;
protected $e107; public $mailerSource = 'calendar_menu'; //FIXME should be auto-detected // Plugin name (core mailer is special case) Must be directory for this file
public $mailerSource = 'calendar_menu'; // 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 $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) 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 $selectorActive = FALSE; // Set TRUE if we've got a valid selector to start returning entries
// Constructor // Constructor
public function __construct() 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) public function selectInit($selectVals = FALSE)
{ {
$sql = e107::getDb();
if (($selectVals === FALSE) || ($selectVals == '')) if (($selectVals === FALSE) || ($selectVals == ''))
{ {
return 0; // No valid selector - so no valid records 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 .= ' 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`'; $qry .= ' GROUP BY u.`user_id`';
// 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->selectorActive = TRUE; $this->selectorActive = TRUE;
$this->mail_read = 0; $this->mail_read = 0;
return $this->mail_count; return $this->mail_count;
@@ -120,8 +119,10 @@ class calendar_menu_mailout
*/ */
public function selectAdd() public function selectAdd()
{ {
$sql = e107::getDb();
if (!$this->selectorActive) return FALSE; 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'], $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'],
@@ -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 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() * @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) 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)); $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'" : ''; $checked = (isset($selects[$row['event_cat_id']])) ? " checked='checked'" : '';
if ($allow_edit) if ($allow_edit)
{ {
$ret .= "<tr><td><input type='checkbox' name='ec_category_sel[]' value='{$row['event_cat_id']}' {$checked}/></td><td> $var[$c]['caption'] = $row['event_cat_name'];
".$row['event_cat_name']."</td></tr>"; $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) elseif($checked)
{ {
$ret .= "<tr><td>".LAN_EC_MAIL_03."</td><td> $var[$c]['caption'] = $row['event_cat_name'];
".$row['event_cat_name']."</td></tr>"; $var[$c]['html'] = LAN_EC_MAIL_03;
/*$ret .= "<tr><td>".LAN_EC_MAIL_03."</td><td>
".$row['event_cat_name']."</td></tr>";*/
} }
$c++;
} }
} }
else 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 * Event calendar - language file for mailout related routines
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/English_mailer.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/English_mailer.php,v $
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Date: 2009-11-22 10:11:32 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $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_02', 'No categories defined, or database error');
define('LAN_EC_MAIL_03', 'Category: '); define('LAN_EC_MAIL_03', 'Category: ');
define('LAN_EC_MAIL_04', 'Calendar Subscriptions'); define('LAN_EC_MAIL_04', 'Calendar Subscriptions');

View File

@@ -9,9 +9,9 @@
* 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.2 $ * $Revision: 1.3 $
* $Date: 2009-12-01 20:05:54 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -34,11 +34,9 @@ class newsletter_mailout
{ {
protected $mailCount = 0; protected $mailCount = 0;
protected $mailRead = 0; protected $mailRead = 0;
protected $e107;
public $mailerSource = 'newsletter'; // Plugin name (core mailer is special case) Must be directory for this file 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 $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) 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 $selectorActive = FALSE; // Set TRUE if we've got a valid selector to start returning entries
private $targets = array(); // Used to store potential recipients private $targets = array(); // Used to store potential recipients
private $ourDB; private $ourDB;
@@ -47,8 +45,9 @@ class newsletter_mailout
// Constructor // Constructor
public function __construct() public function __construct()
{ {
$this->e107 = e107::getInstance(); // BAD FOR PERFORMANCE
$this->adminHandler = e107::getRegistry('_mailout_admin'); // Get the mailer admin object - we want to use some of its functions //$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) public function selectInit($selectVals = FALSE)
{ {
$sql = e107::getDb();
if (($selectVals === FALSE) || ($selectVals == '')) if (($selectVals === FALSE) || ($selectVals == ''))
{ {
return 0; // No valid selector - so no valid records 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}))"; $qry = "SELECT newsletter_id,newsletter_subscribers FROM `#newsletter` WHERE (`newsletter_parent`=0) AND (`newsletter_id` IN ({$selectVals}))";
// echo "Selector {$selectVals} query: ".$qry.'<br />'; // 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->selectorActive = TRUE;
$this->mail_count = 1; // We have no idea of how many subscribers without reading all relevant DB records $this->mail_count = 1; // We have no idea of how many subscribers without reading all relevant DB records
$this->mail_read = 0; $this->mail_read = 0;
@@ -114,13 +116,17 @@ class newsletter_mailout
*/ */
public function selectAdd() public function selectAdd()
{ {
$sql = e107::getDb();
if (!$this->selectorActive) return FALSE; if (!$this->selectorActive) return FALSE;
while ($this->selectorActive) while ($this->selectorActive)
{ {
if (count($this->targets) == 0) if (count($this->targets) == 0)
{ // Read in and process another newletter mailing list { // 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; $this->selectorActive = FALSE;
return FALSE; // Run out of DB records 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 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() * @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) public function showSelect($allow_edit = FALSE, $selectVals = FALSE)
{ {
$ret = "<table style='width:95%'>"; $sql = e107::getDb();
$frm = e107::getForm();
$selects = array_flip(explode(',', $selectVals)); $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'" : ''; $checked = (isset($selects[$row['newsletter_id']])) ? " checked='checked'" : '';
if ($allow_edit) if ($allow_edit)
{ {
$ret .= "<tr><td><input type='checkbox' name='nl_category_sel[]' value='{$row['newsletter_id']}' {$checked}/></td><td> $var[$c]['caption'] = $row['newsletter_title'];
".$row['newsletter_title']."</td></tr>"; $var[$c]['html'] = $frm->checkbox('nl_category_sel[]',$row['newsletter_id'] ,$checked);
} }
elseif($checked) elseif($checked)
{ {
$ret .= "<tr><td>".NLLAN_49."</td><td> $var[$c]['caption'] = $row['newsletter_title'];
".$row['newsletter_title']."</td></tr>"; $var[$c]['html'] = NLLAN_49;
} }
$c++;
} }
} }
else 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 * Plugin - newsfeeds
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/languages/English_admin_newsletter.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/newsletter/languages/English_admin_newsletter.php,v $
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Date: 2009-11-19 20:24:21 $ * $Date: 2010-01-10 03:56:28 $
* $Author: e107steved $ * $Author: e107coders $
* *
*/ */
@@ -65,7 +65,7 @@ define('NLLAN_44', 'Newsletter Front Page');
define('NLLAN_45', 'Create Newsletter'); define('NLLAN_45', 'Create Newsletter');
define('NLLAN_46', 'Create mailing'); define('NLLAN_46', 'Create mailing');
define('NLLAN_47', 'Newsletter Options'); define('NLLAN_47', 'Newsletter Options');
define('NLLAN_48', 'Subscribers to each newsletter'); define('NLLAN_48', 'Newsletter Subscribers');
define('NLLAN_49', 'Newsletter: '); define('NLLAN_49', 'Newsletter: ');
define('NLLAN_54', 'Sending'); define('NLLAN_54', 'Sending');