mirror of
https://github.com/e107inc/e107.git
synced 2025-08-18 12:21:45 +02:00
Start tidying things up
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/mailout.php,v $
|
||||
| $Revision: 1.17 $
|
||||
| $Date: 2009-08-28 16:10:53 $
|
||||
| $Author: marj_nl_fr $
|
||||
| $Revision: 1.18 $
|
||||
| $Date: 2009-09-03 19:32:33 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
| Work in progress - supplementary mailer plugin
|
||||
|
|
||||
@@ -466,15 +466,16 @@ Table data:
|
||||
|
||||
//. Update Preferences.
|
||||
|
||||
if (isset($_POST['updateprefs']) && getperms("0"))
|
||||
if (isset($_POST['updateprefs']) && getperms('0'))
|
||||
{
|
||||
unset($temp);
|
||||
if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) $_POST['mailer'] = 'php';
|
||||
$temp['mailer'] = $_POST['mailer'];
|
||||
// Allow qmail as an option as well - works much as sendmail
|
||||
if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) $temp['sendmail'] = $_POST['sendmail'];
|
||||
$temp['smtp_server'] = $tp->toDB($_POST['smtp_server']);
|
||||
$temp['smtp_username'] = $tp->toDB($_POST['smtp_username']);
|
||||
$temp['smtp_password'] = $tp->toDB($_POST['smtp_password']);
|
||||
if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) $temp['sendmail'] = $e107->tp->toDB($_POST['sendmail']);
|
||||
$temp['smtp_server'] = $e107->tp->toDB($_POST['smtp_server']);
|
||||
$temp['smtp_username'] = $e107->tp->toDB($_POST['smtp_username']);
|
||||
$temp['smtp_password'] = $e107->tp->toDB($_POST['smtp_password']);
|
||||
|
||||
$smtp_opts = array();
|
||||
switch (trim($_POST['smtp_options']))
|
||||
@@ -492,18 +493,15 @@ if (isset($_POST['updateprefs']) && getperms("0"))
|
||||
if (varsettrue($_POST['smtp_keepalive'])) $smtp_opts[] = 'keepalive';
|
||||
if (varsettrue($_POST['smtp_useVERP'])) $smtp_opts[] = 'useVERP';
|
||||
|
||||
$temp['smtp_pop3auth'] = in_array('pop3auth',$smpt_opts); // This will go!
|
||||
$temp['smtp_keepalive'] = $_POST['smtp_keepalive']; // This will go!
|
||||
|
||||
$temp['smtp_options'] = implode(',',$smtp_opts);
|
||||
|
||||
$temp['mail_pause'] = intval($_POST['mail_pause']);
|
||||
$temp['mail_pausetime'] = intval($_POST['mail_pausetime']);
|
||||
$temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']);
|
||||
$temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']);
|
||||
$temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']);
|
||||
$temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']);
|
||||
$temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']);
|
||||
$temp['mail_bounce_email'] = $e107->tp->toDB($_POST['mail_bounce_email']);
|
||||
$temp['mail_bounce_pop3'] = $e107->tp->toDB($_POST['mail_bounce_pop3']);
|
||||
$temp['mail_bounce_user'] = $e107->tp->toDB($_POST['mail_bounce_user']);
|
||||
$temp['mail_bounce_pass'] = $e107->tp->toDB($_POST['mail_bounce_pass']);
|
||||
$temp['mail_bounce_type'] = $e107->tp->toDB($_POST['mail_bounce_type']);
|
||||
$temp['mail_bounce_delete'] = intval($_POST['mail_bounce_delete']);
|
||||
|
||||
$temp['mailout_enabled'] = implode(',',$_POST['mail_mailer_enabled']);
|
||||
@@ -567,8 +565,8 @@ require_once(e_ADMIN."footer.php");
|
||||
//---------------------------------------------
|
||||
function showMailouts($sub_par,$mail_id)
|
||||
{
|
||||
|
||||
global $sql,$ns,$tp, $images_path;
|
||||
global $images_path;
|
||||
$e107 = e107::getInstance();
|
||||
// gen_datestamp int(10) unsigned NOT NULL default '0', - Mail ID code - to match the destination address records
|
||||
// gen_user_id int(10) unsigned NOT NULL default '0', - User ID of current author
|
||||
// gen_ip varchar(80) NOT NULL default '', - Email subject
|
||||
@@ -580,10 +578,10 @@ function showMailouts($sub_par,$mail_id)
|
||||
switch ($sub_par)
|
||||
{
|
||||
case 'delete' :
|
||||
if ($sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
if ($e107->sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
{
|
||||
$message = $sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND (`gen_type`='sendmail' OR `gen_type`='savemail')") ? LAN_DELETED : LAN_DELETED_FAILED;
|
||||
$admin_log->log_event('MAIL_04',$mail_id,E_LOG_INFORMATIVE,'');
|
||||
$message = $e107->sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND (`gen_type`='sendmail' OR `gen_type`='savemail')") ? LAN_DELETED : LAN_DELETED_FAILED;
|
||||
$e107->admin_log->log_event('MAIL_04',$mail_id,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
else
|
||||
{ // Should only happen if people fiddle!
|
||||
@@ -593,9 +591,9 @@ function showMailouts($sub_par,$mail_id)
|
||||
break;
|
||||
|
||||
case 'detail' : // Show the detail of an email run above the main list
|
||||
if ($sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
if ($e107->sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $e107->sql->db_Fetch();
|
||||
// Display a little bit of the email
|
||||
$mail = unserialize($row['gen_chardata']);
|
||||
$text = "
|
||||
@@ -612,12 +610,12 @@ function showMailouts($sub_par,$mail_id)
|
||||
<td>".LAN_MAILOUT_103."</td>
|
||||
<td>".(isset($mail['send_results']) ? implode('<br />',$mail['send_results']) : LAN_MAILOUT_104)."</td>
|
||||
</tr>\n";
|
||||
if ($sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"))
|
||||
if ($e107->sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"))
|
||||
{
|
||||
$text .= "<tr><td>".LAN_MAILOUT_105."</td><td>";
|
||||
$spacer = '';
|
||||
$i = 0;
|
||||
while (($row = $sql->db_Fetch()) && ($i < 10))
|
||||
while (($row = $e107->sql->db_Fetch()) && ($i < 10))
|
||||
{
|
||||
$this_mail = unserialize($row['gen_chardata']);
|
||||
if (isset($this_mail['send_result']))
|
||||
@@ -632,7 +630,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
$text .= "
|
||||
</table>
|
||||
";
|
||||
$ns->tablerender(LAN_MAILOUT_102,$text);
|
||||
$e107->ns->tablerender(LAN_MAILOUT_102,$text);
|
||||
}
|
||||
else
|
||||
{ // Should only happen if people fiddle!
|
||||
@@ -642,15 +640,15 @@ function showMailouts($sub_par,$mail_id)
|
||||
break;
|
||||
|
||||
case 'resend' :
|
||||
// Echo "resend: {$mail_id}<br />";
|
||||
if ($sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
// Echo "resend: {$mail_id}<br />";
|
||||
if ($e107->sql->db_Select('generic','gen_id,gen_datestamp,gen_chardata',"`gen_datestamp`={$mail_id} AND `gen_type`='savemail'"))
|
||||
{ // Put up confirmation
|
||||
$row = $sql->db_Fetch();
|
||||
$row = $e107->sql->db_Fetch();
|
||||
|
||||
$debug = (e_MENU == "debug") ? "[debug]" : "";
|
||||
$mailer_url = e_HANDLER."phpmailer/mailout_process.php?".$debug."{$row['gen_datestamp']}.{$row['gen_id']}";
|
||||
|
||||
$c = $sql->db_Count('generic','(*)',"WHERE `gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"); // Count of mails to go
|
||||
$c = $e107->sql->db_Count('generic','(*)',"WHERE `gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"); // Count of mails to go
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='{$mailer_url}' name='mailform' onsubmit=\"open('', 'popup','width=230,height=170,resizable=1,scrollbars=0');this.target = 'popup';return true;\" >
|
||||
@@ -661,7 +659,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
<input class='button' type='submit' name='cancel_emails' value='".LAN_MAILOUT_38."' />
|
||||
</div>";
|
||||
$text .= "</form><br /><br /></div>";
|
||||
$ns->tablerender(LAN_MAILOUT_99,$text);
|
||||
$e107->ns->tablerender(LAN_MAILOUT_99,$text);
|
||||
|
||||
// Display a little bit of the email
|
||||
$mail = unserialize($row['gen_chardata']);
|
||||
@@ -681,7 +679,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
</tr>\n
|
||||
</table>
|
||||
";
|
||||
$ns->tablerender(LAN_MAILOUT_101,$text);
|
||||
$e107->ns->tablerender(LAN_MAILOUT_101,$text);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -692,10 +690,10 @@ function showMailouts($sub_par,$mail_id)
|
||||
}
|
||||
break;
|
||||
case 'orphans' : // Delete any orphaned emails
|
||||
if ($sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"))
|
||||
if ($e107->sql->db_Select('generic','gen_datestamp',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'"))
|
||||
{
|
||||
$message = $sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'") ? LAN_DELETED : LAN_DELETED_FAILED;
|
||||
$admin_log->log_event('MAIL_04',$mail_i5,E_LOG_INFORMATIVE,'');
|
||||
$message = $e107->sql->db_Delete('generic',"`gen_datestamp`={$mail_id} AND `gen_type`='sendmail'") ? LAN_DELETED : LAN_DELETED_FAILED;
|
||||
$e107->admin_log->log_event('MAIL_04',$mail_id,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
else
|
||||
{ // Should only happen if people fiddle!
|
||||
@@ -709,9 +707,9 @@ function showMailouts($sub_par,$mail_id)
|
||||
}
|
||||
|
||||
|
||||
if ($message) $ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $message);
|
||||
if ($message) $e107->ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $message);
|
||||
|
||||
// Need to select main email entries; count number of addresses attached to each
|
||||
// Need to select main email entries; count number of addresses attached to each
|
||||
$gen = new convert;
|
||||
$qry = "SELECT
|
||||
u.user_name, g.*,
|
||||
@@ -722,7 +720,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
WHERE g.gen_type='savemail'
|
||||
GROUP BY g.gen_datestamp
|
||||
ORDER BY g.gen_id ASC";
|
||||
$count = $sql -> db_Select_gen($qry);
|
||||
$count = $e107->sql -> db_Select_gen($qry);
|
||||
|
||||
$emails_found = array(); // Log ID and count for later
|
||||
|
||||
@@ -731,7 +729,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
if (!$count)
|
||||
{
|
||||
$text = "<div class='forumheader2' style='text-align:center'>".LAN_MAILOUT_79."</div>";
|
||||
$ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $text);
|
||||
$e107->ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $text);
|
||||
require_once(e_ADMIN."footer.php");
|
||||
exit;
|
||||
}
|
||||
@@ -759,7 +757,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
</tr>
|
||||
";
|
||||
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $e107->sql->db_Fetch())
|
||||
{
|
||||
$datestamp = $gen->convert_date($row['gen_datestamp'], "short");
|
||||
|
||||
@@ -787,7 +785,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
}
|
||||
|
||||
$text .= "</table>\n</form><br /><br /><br /></div>";
|
||||
$ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $text);
|
||||
$e107->ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_78."</div>", $text);
|
||||
|
||||
// Now see if we can find any 'orphaned' mailout entries
|
||||
$qry = "SELECT
|
||||
@@ -797,8 +795,8 @@ function showMailouts($sub_par,$mail_id)
|
||||
WHERE g.gen_type='sendmail'
|
||||
GROUP BY g.gen_datestamp
|
||||
ORDER BY g.gen_id ASC";
|
||||
$count = $sql -> db_Select_gen($qry);
|
||||
// Echo "There are {$count} groups of unsent emails: ".count($emails_found)." in previous table<br />";
|
||||
$count = $e107->sql -> db_Select_gen($qry);
|
||||
// Echo "There are {$count} groups of unsent emails: ".count($emails_found)." in previous table<br />";
|
||||
if ($count > count($emails_found))
|
||||
{
|
||||
$text = "
|
||||
@@ -815,7 +813,7 @@ function showMailouts($sub_par,$mail_id)
|
||||
<td class='fcaption'>".LAN_OPTIONS."</td>
|
||||
</tr>\n
|
||||
";
|
||||
while ($row = $sql->db_Fetch())
|
||||
while ($row = $e107->sql->db_Fetch())
|
||||
{
|
||||
if (!isset($emails_found[$row['gen_datestamp']]))
|
||||
{
|
||||
@@ -830,10 +828,10 @@ function showMailouts($sub_par,$mail_id)
|
||||
</tr>\n
|
||||
";
|
||||
}
|
||||
// echo "ID: {$row['gen_datestamp']} Unsent: {$row['pending']}";
|
||||
// echo "ID: {$row['gen_datestamp']} Unsent: {$row['pending']}";
|
||||
}
|
||||
$text .= "</table>\n</form><br /><br /><br /></div>";
|
||||
$ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_98."</div>", $text);
|
||||
$e107->ns -> tablerender("<div style='text-align:center'>".LAN_MAILOUT_98."</div>", $text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -845,19 +843,20 @@ function showMailouts($sub_par,$mail_id)
|
||||
|
||||
function show_mailform($foo="")
|
||||
{
|
||||
global $ns,$sql,$tp,$pref,$HANDLERS_DIRECTORY;
|
||||
global $pref,$HANDLERS_DIRECTORY;
|
||||
global $mail_handlers;
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
|
||||
$email_subject = $foo['gen_ip'];
|
||||
$email_body = $tp->toForm($foo['gen_chardata']);
|
||||
$email_body = $e107->tp->toForm($foo['gen_chardata']);
|
||||
$email_id = $foo['gen_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;
|
||||
$ns -> tablerender(LAN_MAILOUT_42, $warning);
|
||||
$e107->ns -> tablerender(LAN_MAILOUT_42, $warning);
|
||||
}
|
||||
|
||||
$debug = (e_MENU == "debug") ? "?[debug]" : "";
|
||||
@@ -916,7 +915,7 @@ function show_mailform($foo="")
|
||||
|
||||
// Close one table, open another - to give a boundary between addressees and content
|
||||
$text .= "</table>
|
||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||
<colgroup span='2'>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
@@ -938,8 +937,8 @@ function show_mailform($foo="")
|
||||
<td >";
|
||||
$text .= "<select class='tbox' name='email_attachment' >
|
||||
<option value=''> </option>\n";
|
||||
$sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name");
|
||||
while ($row = $sql->db_Fetch())
|
||||
$e107->sql->db_Select("download", "download_url,download_name", "download_id !='' ORDER BY download_name");
|
||||
while ($row = $e107->sql->db_Fetch())
|
||||
{
|
||||
extract($row);
|
||||
$selected = ($_POST['email_attachment'] == $download_url) ? "selected='selected'" :
|
||||
@@ -974,16 +973,16 @@ function show_mailform($foo="")
|
||||
global $eplug_bb;
|
||||
|
||||
$eplug_bb[] = array(
|
||||
"name" => 'shortcode',
|
||||
"onclick" => 'expandit',
|
||||
"onclick_var" => "sc_selector",
|
||||
"icon" => e_IMAGE."generic/bbcode/shortcode.png",
|
||||
"helptext" => LAN_MAILOUT_11,
|
||||
"function" => "sc_Select",
|
||||
"function_var" => "sc_selector"
|
||||
'name' => 'shortcode',
|
||||
'onclick' => 'expandit',
|
||||
'onclick_var' => 'sc_selector',
|
||||
'icon' => e_IMAGE.'generic/bbcode/shortcode.png',
|
||||
'helptext' => LAN_MAILOUT_11,
|
||||
'function' => 'sc_Select',
|
||||
'function_var' => 'sc_selector'
|
||||
);
|
||||
|
||||
$text .= display_help("helpb",'mailout');
|
||||
$text .= display_help('helpb','mailout');
|
||||
|
||||
if(e_WYSIWYG)
|
||||
{
|
||||
@@ -999,10 +998,13 @@ function show_mailform($foo="")
|
||||
|
||||
|
||||
$text .= "<div class='buttons-bar center'>";
|
||||
if(isset($_POST['edit'])){
|
||||
if(isset($_POST['edit']))
|
||||
{
|
||||
$text .= "<input type='hidden' name='update_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."\" />";
|
||||
}
|
||||
|
||||
@@ -1013,8 +1015,7 @@ function show_mailform($foo="")
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
$ns->tablerender(LAN_MAILOUT_15, $text);
|
||||
|
||||
$e107->ns->tablerender(LAN_MAILOUT_15, $text);
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
@@ -1023,8 +1024,10 @@ function show_mailform($foo="")
|
||||
|
||||
function show_prefs()
|
||||
{
|
||||
global $pref,$ns;
|
||||
$text = "
|
||||
global $pref;
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
$text = "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."' id='mailsettingsform'>
|
||||
<div id='mail'>
|
||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||
@@ -1043,7 +1046,7 @@ $text = "
|
||||
<td style='vertical-align:top'>".LAN_MAILOUT_115."<br /><span class='smalltext'>".LAN_MAILOUT_116."</span></td>
|
||||
<td style='text-align:right'>
|
||||
<select class='tbox' name='mailer' onchange='disp(this.value)'>\n";
|
||||
$mailers = array("php","smtp","sendmail");
|
||||
$mailers = array('php','smtp','sendmail');
|
||||
foreach($mailers as $opt)
|
||||
{
|
||||
$sel = ($pref['mailer'] == $opt) ? "selected='selected'" : "";
|
||||
@@ -1105,7 +1108,6 @@ $text = "
|
||||
<input type='checkbox' name='smtp_useVERP' value='1' {$checked} />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table></div>";
|
||||
|
||||
|
||||
@@ -1196,7 +1198,7 @@ $text = "
|
||||
</div></form>";
|
||||
|
||||
$caption = LAN_PREFS;
|
||||
$ns->tablerender($caption, $text);
|
||||
$e107->ns->tablerender($caption, $text);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user