1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Code cleanup.

This commit is contained in:
lonalore
2016-12-15 15:35:18 +01:00
parent d03cdda0af
commit a03fe161d5
4 changed files with 38 additions and 35 deletions

View File

@@ -30,6 +30,8 @@ define('PAGE_NAME', LANCONTACT_00);
require_once(HEADERF); require_once(HEADERF);
$tp = e107::getParser();
$ns = e107::getRender();
if (!vartrue($CONTACT_FORM)) if (!vartrue($CONTACT_FORM))
{ {
@@ -52,7 +54,6 @@ if (!vartrue($CONTACT_FORM))
if(isset($_POST['send-contactus'])) if(isset($_POST['send-contactus']))
{ {
$error = ""; $error = "";
$ignore = false; $ignore = false;

View File

@@ -588,7 +588,8 @@ class media_form_ui extends e_admin_form_ui
return; return;
} }
$tagid = vartrue($_GET['tagid']); $tagid = vartrue($_GET['tagid']);
$tagid = e107::getParser()->filter($tagid);
$path = $this->getController()->getListModel()->get('media_url'); $path = $this->getController()->getListModel()->get('media_url');
$title = $this->getController()->getListModel()->get('media_name'); $title = $this->getController()->getListModel()->get('media_name');
$id = $this->getController()->getListModel()->get('media_id'); $id = $this->getController()->getListModel()->get('media_id');
@@ -935,14 +936,14 @@ class media_admin_ui extends e_admin_ui
if($this->getAction() == 'youtube') if($this->getAction() == 'youtube')
{ {
$parm = array('search'=>$_GET['search']); $parm = array('search' => $tp->filter($_GET['search']));
echo $this->videoTab($parm); echo $this->videoTab($parm);
exit; exit;
} }
if($this->getAction() == 'glyph') if($this->getAction() == 'glyph')
{ {
$parm = array('search'=>$_GET['search']); $parm = array('search' => $tp->filter($_GET['search']));
echo $this->glyphTab($parm); echo $this->glyphTab($parm);
exit; exit;
} }

View File

@@ -385,7 +385,8 @@ class mailout_main_ui extends e_admin_ui
if($_GET['action'] == 'preview') if($_GET['action'] == 'preview')
{ {
echo $this->previewPage($_GET['id'], $_GET['user']); $tp = e107::getParser();
echo $this->previewPage($tp->filter($_GET['id']), $tp->filter($_GET['user']));
exit; exit;
} }
@@ -480,7 +481,7 @@ class mailout_main_ui extends e_admin_ui
$text = $this->getDKIMPublicKey(); $text = $this->getDKIMPublicKey();
e107::getMessage()->addInfo("Add the following to your ".e_DOMAIN." DNS Zone records:".print_a($text,true)); e107::getMessage()->addInfo("Add the following to your ".e_DOMAIN." DNS Zone records:".print_a($text,true));
e107::getMessage()->addinfo("Consider testing it using this website: http://dkimvalidator.com"); e107::getMessage()->addInfo("Consider testing it using this website: http://dkimvalidator.com");
return false; return false;
} }
@@ -515,7 +516,7 @@ class mailout_main_ui extends e_admin_ui
$text = $tp->lanVars($dnsEntry, $pubString); $text = $tp->lanVars($dnsEntry, $pubString);
e107::getMessage()->addInfo("Add the following ".$keyLength." bit key to your ".e_DOMAIN." DNS Zone records:".print_a($text,true)); e107::getMessage()->addInfo("Add the following ".$keyLength." bit key to your ".e_DOMAIN." DNS Zone records:".print_a($text,true));
e107::getMessage()->addinfo("Consider testing it using this website: http://dkimvalidator.com"); e107::getMessage()->addInfo("Consider testing it using this website: http://dkimvalidator.com");
} }
@@ -1364,7 +1365,7 @@ class mailout_main_ui extends e_admin_ui
$temp['sendmail'] = ''; $temp['sendmail'] = '';
} }
$temp['bulkmailer'] = $_POST['bulkmailer']; $temp['bulkmailer'] = $tp->filter($_POST['bulkmailer']);
$temp['smtp_server'] = $tp->toDB($_POST['smtp_server']); $temp['smtp_server'] = $tp->toDB($_POST['smtp_server']);
$temp['smtp_username'] = $tp->toDB($_POST['smtp_username']); $temp['smtp_username'] = $tp->toDB($_POST['smtp_username']);
$temp['smtp_password'] = $tp->toDB($_POST['smtp_password']); $temp['smtp_password'] = $tp->toDB($_POST['smtp_password']);
@@ -1595,7 +1596,7 @@ class mailout_admin_form_ui extends e_admin_form_ui
$text .= "<a href='".$link."' class='btn btn-default' title='Send Mail'>".E_32_MAIL."</a>"; $text .= "<a href='".$link."' class='btn btn-default' title='Send Mail'>".E_32_MAIL."</a>";
$text .= "<a rel='external' class='btn btn-default e-modal' data-modal-caption='Email preview' href='".$preview."' title='Preview'>".E_32_SEARCH."</a>"; $text .= "<a rel='external' class='btn btn-default e-modal' data-modal-caption='Email preview' href='".$preview."' title='Preview'>".E_32_SEARCH."</a>";
$text .= $this->renderValue('options',$value,$att,$id); $text .= $this->renderValue('options',$value,$attributes,$id);
return $text; return $text;
} }
@@ -1609,9 +1610,9 @@ class mailout_admin_form_ui extends e_admin_form_ui
$text = "<span class='btn-group'>"; $text = "<span class='btn-group'>";
$text .= "<a href='".$link."' class='btn btn-default e-modal' data-modal-caption='Recipients for Mail #".$id."' title='Recipients'>".E_32_USER."</a>"; $text .= "<a href='".$link."' class='btn btn-default e-modal' data-modal-caption='Recipients for Mail #".$id."' title='Recipients'>".E_32_USER."</a>";
$text .= "<a rel='external' class='btn btn-default e-modal' data-modal-caption='Email preview' href='".$preview."' title='Preview'>".E_32_SEARCH."</a>"; $text .= "<a rel='external' class='btn btn-default e-modal' data-modal-caption='Email preview' href='".$preview."' title='Preview'>".E_32_SEARCH."</a>";
$att['readParms']['editClass'] = e_UC_NOBODY; $attributes['readParms']['editClass'] = e_UC_NOBODY;
$text .= $this->renderValue('options',$value,$att,$id); $text .= $this->renderValue('options',$value,$attributes,$id);
$text .= "</span>"; $text .= "</span>";
return $text; return $text;
} }
@@ -1681,7 +1682,7 @@ class mailout_recipients_ui extends e_admin_ui
$id = $row['mail_detail_id']; $id = $row['mail_detail_id'];
$array[$id] = $id." : ".vartrue($row['mail_title'], "(No Name)"); $array[$id] = $id." : ".vartrue($row['mail_title'], "(No Name)");
} }
$this->fields['mail_detail_id']['writeParms'] = $array; $this->fields['mail_detail_id']['writeParms'] = varset($array, array());
$this->mailStatus = array( $this->mailStatus = array(

View File

@@ -210,7 +210,7 @@ class e107Email extends PHPMailer
$this->pref = $pref; $this->pref = $pref;
$this->CharSet = 'utf-8'; $this->CharSet = 'utf-8';
$this->SetLanguage(CORE_LC); $this->setLanguage(CORE_LC);
if (($overrides === FALSE) || !is_array($overrides)) if (($overrides === FALSE) || !is_array($overrides))
@@ -279,14 +279,14 @@ class e107Email extends PHPMailer
} }
unset($temp_opts); unset($temp_opts);
$this->IsSMTP(); // Enable SMTP functions $this->isSMTP(); // Enable SMTP functions
if (vartrue($smtp_options['helo'])) $this->Helo = $smtp_options['helo']; if (vartrue($smtp_options['helo'])) $this->Helo = $smtp_options['helo'];
if (isset($smtp_options['pop3auth'])) // We've made sure this is set if (isset($smtp_options['pop3auth'])) // We've made sure this is set
{ // Need POP-before-SMTP authorisation { // Need POP-before-SMTP authorisation
require_once(e_HANDLER.'phpmailer/class.pop3.php'); require_once(e_HANDLER.'phpmailer/class.pop3.php');
$pop = new POP3(); $pop = new POP3();
$pop->Authorise($overrides['smtp_server'], 110, 30, $overrides['smtp_username'], $overrides['smtp_password'], 1); $pop->authorise($overrides['smtp_server'], 110, 30, $overrides['smtp_username'], $overrides['smtp_password'], 1);
} }
$this->Mailer = 'smtp'; $this->Mailer = 'smtp';
@@ -509,29 +509,29 @@ class e107Email extends PHPMailer
switch ($list) switch ($list)
{ {
case 'to' : case 'to' :
$this->AddAddress($adr, $to_name); $this->addAddress($adr, $to_name);
break; break;
case 'replyto' : case 'replyto' :
$this->AddReplyTo($adr, $to_name); $this->addReplyTo($adr, $to_name);
break; break;
case 'cc' : case 'cc' :
if($this->Mailer == 'mail') if($this->Mailer == 'mail')
{ {
$this->AddCustomHeader('Cc: '.$adr); $this->addCustomHeader('Cc: '.$adr);
} }
else else
{ {
$this->AddCC($adr, $to_name); $this->addCC($adr, $to_name);
} }
break; break;
case 'bcc' : case 'bcc' :
if($this->Mailer == 'mail') if($this->Mailer == 'mail')
{ {
$this->AddCustomHeader('Bcc: '.$adr); $this->addCustomHeader('Bcc: '.$adr);
} }
else else
{ {
$this->AddBCC($adr, $to_name); $this->addBCC($adr, $to_name);
} }
break; break;
default : default :
@@ -650,7 +650,7 @@ class e107Email extends PHPMailer
else else
{ {
$ext = pathinfo($attach, PATHINFO_EXTENSION); $ext = pathinfo($attach, PATHINFO_EXTENSION);
$this->AddAttachment($attach, $tempName,'base64',$this->_mime_types($ext)); $this->addAttachment($attach, $tempName,'base64',$this->_mime_types($ext));
} }
} }
@@ -677,7 +677,7 @@ class e107Email extends PHPMailer
if(is_readable($inline_img) && !is_dir($inline_img)) if(is_readable($inline_img) && !is_dir($inline_img))
{ {
$ext = pathinfo($inline_img, PATHINFO_EXTENSION); $ext = pathinfo($inline_img, PATHINFO_EXTENSION);
$this->AddEmbeddedImage($inline_img, md5($inline_img), basename($inline_img),'base64',$this->_mime_types($ext)); $this->addEmbeddedImage($inline_img, md5($inline_img), basename($inline_img),'base64',$this->_mime_types($ext));
} }
} }
} }
@@ -906,7 +906,7 @@ class e107Email extends PHPMailer
if (!empty($eml['returnreceipt'])) { $this->ConfirmReadingTo = $eml['returnreceipt']; } if (!empty($eml['returnreceipt'])) { $this->ConfirmReadingTo = $eml['returnreceipt']; }
if (!empty($eml['inline_images'])) { $this->addInlineImages($eml['inline_images']); } if (!empty($eml['inline_images'])) { $this->addInlineImages($eml['inline_images']); }
if (!empty($eml['priority'])) { $this->Priority = $eml['priority']; } if (!empty($eml['priority'])) { $this->Priority = $eml['priority']; }
if (!empty($eml['e107_header'])) { $this->AddCustomHeader($identifier.": {$eml['e107_header']}"); } if (!empty($eml['e107_header'])) { $this->addCustomHeader($identifier.": {$eml['e107_header']}"); }
if (!empty($eml['wordwrap'])) { $this->WordWrap = $eml['wordwrap']; } if (!empty($eml['wordwrap'])) { $this->WordWrap = $eml['wordwrap']; }
if (!empty($eml['split'])) { $this->SingleTo = ($eml['split'] != FALSE); } if (!empty($eml['split'])) { $this->SingleTo = ($eml['split'] != FALSE); }
if (!empty($eml['smtp_username'])) { $this->Username = $eml['smtp_username']; } if (!empty($eml['smtp_username'])) { $this->Username = $eml['smtp_username']; }
@@ -1032,7 +1032,7 @@ class e107Email extends PHPMailer
$_SERVER["HTTP_X_FORWARDED_FOR"] = $_SERVER['SERVER_ADDR']; $_SERVER["HTTP_X_FORWARDED_FOR"] = $_SERVER['SERVER_ADDR'];
$_SERVER["HTTP_CF_CONNECTING_IP"] = $_SERVER['SERVER_ADDR']; $_SERVER["HTTP_CF_CONNECTING_IP"] = $_SERVER['SERVER_ADDR'];
$result = $this->Send(); // Actually send email $result = $this->send(); // Actually send email
$_SERVER['PHP_SELF'] = $oldphpself; $_SERVER['PHP_SELF'] = $oldphpself;
@@ -1040,7 +1040,7 @@ class e107Email extends PHPMailer
$_SERVER["HTTP_X_FORWARDED_FOR"] = $oldremoteaddr; $_SERVER["HTTP_X_FORWARDED_FOR"] = $oldremoteaddr;
$_SERVER["HTTP_CF_CONNECTING_IP"] = $oldremoteaddr; $_SERVER["HTTP_CF_CONNECTING_IP"] = $oldremoteaddr;
if (!$bulkmail && !$this->SMTPKeepAlive && ($this->Mailer == 'smtp')) $this->SmtpClose(); if (!$bulkmail && !$this->SMTPKeepAlive && ($this->Mailer == 'smtp')) $this->smtpClose();
} }
else else
{ // Debug { // Debug
@@ -1057,7 +1057,7 @@ class e107Email extends PHPMailer
if (($bulkmail == true) && ($this->pause_amount > 0) && ($this->SendCount >= $this->pause_amount)) if (($bulkmail == true) && ($this->pause_amount > 0) && ($this->SendCount >= $this->pause_amount))
{ {
if ($this->SMTPKeepAlive && ($this->Mailer == 'smtp')) $this->SmtpClose(); if ($this->SMTPKeepAlive && ($this->Mailer == 'smtp')) $this->smtpClose();
sleep($this->pause_time); sleep($this->pause_time);
$this->SendCount = 0; $this->SendCount = 0;
} }
@@ -1075,8 +1075,8 @@ class e107Email extends PHPMailer
} }
$this->ClearAddresses(); // In case we send another email $this->clearAddresses(); // In case we send another email
$this->ClearCustomHeaders(); $this->clearCustomHeaders();
if ($result) if ($result)
{ {
@@ -1109,7 +1109,7 @@ class e107Email extends PHPMailer
{ {
if ($this->SMTPKeepAlive && ($this->Mailer == 'smtp') && ($this->SendCount > 0)) if ($this->SMTPKeepAlive && ($this->Mailer == 'smtp') && ($this->SendCount > 0))
{ {
$this->SmtpClose(); $this->smtpClose();
$this->SendCount = 0; $this->SendCount = 0;
} }
} }
@@ -1195,7 +1195,7 @@ class e107Email extends PHPMailer
if ( (strlen($basedir) > 1) && (substr($basedir,-1) != '/') && (substr($basedir,-1) != '\\')) { $basedir .= '/'; } if ( (strlen($basedir) > 1) && (substr($basedir,-1) != '/') && (substr($basedir,-1) != '\\')) { $basedir .= '/'; }
if ( strlen($directory) > 1 && substr($directory,-1) != '/' && substr($directory,-1) != '\\') { $directory .= '/'; } if ( strlen($directory) > 1 && substr($directory,-1) != '/' && substr($directory,-1) != '\\') { $directory .= '/'; }
//echo "Add image: {$basedir}|{$directory}|{$filename}<br />"; //echo "Add image: {$basedir}|{$directory}|{$filename}<br />";
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) if ( $this->addEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) )
{ {
// $images[1][$i] contains 'src' or 'background' // $images[1][$i] contains 'src' or 'background'
$message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($images[3][$i], '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, $message); $message = preg_replace("/".$images[1][$i]."=".$delim.preg_quote($images[3][$i], '/').$delim."/Ui", $images[1][$i]."=".$delim.$cid.$delim, $message);
@@ -1226,7 +1226,7 @@ class e107Email extends PHPMailer
} }
$this->IsHTML(true); $this->isHTML(true);
$this->Body = $message; $this->Body = $message;
//print_a($message); //print_a($message);
$textMsg = str_replace("\n", "", $message); $textMsg = str_replace("\n", "", $message);
@@ -1355,7 +1355,7 @@ function sendemail($send_to, $subject, $message, $to_name='', $send_from='', $fr
$identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id'); $identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id');
if (vartrue($mailheader_e107id)) $mail->AddCustomHeader($identifier.": {$mailheader_e107id}"); if (vartrue($mailheader_e107id)) $mail->addCustomHeader($identifier.": {$mailheader_e107id}");
$mail->legacyBody = TRUE; // Need to handle plain text email conversion to HTML $mail->legacyBody = TRUE; // Need to handle plain text email conversion to HTML
$mail->makeBody($message); // Add body, with conversion if required $mail->makeBody($message); // Add body, with conversion if required
@@ -1366,7 +1366,7 @@ function sendemail($send_to, $subject, $message, $to_name='', $send_from='', $fr
if (trim($send_from)) if (trim($send_from))
{ {
$mail->SetFrom($send_from, $from_name); // These have already been defaulted to sitewide options, so no need to set again if blank $mail->setFrom($send_from, $from_name); // These have already been defaulted to sitewide options, so no need to set again if blank
} }
$mail->Subject = $subject; $mail->Subject = $subject;