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:
Cameron
2020-03-01 13:16:36 -08:00
parent f948629796
commit 89f58fafa6
3 changed files with 16 additions and 12 deletions

View File

@@ -1172,7 +1172,7 @@ class e107Email extends PHPMailer
// Error sending email // Error sending email
e107::getLog()->e_log_event(3,debug_backtrace(),"MAIL","Send Failed",$this->ErrorInfo,false,LOG_TO_ROLLING); e107::getLog()->addEvent(3,debug_backtrace(),"MAIL","Send Failed",$this->ErrorInfo,false,LOG_TO_ROLLING);
$this->TotalErrors++; $this->TotalErrors++;
$this->closeLog(); $this->closeLog();
return $this->ErrorInfo; return $this->ErrorInfo;

View File

@@ -125,7 +125,11 @@ class e107MailManager
private $debugMode = false; private $debugMode = false;
protected $e107; protected $e107;
/** @var e_db_pdo */
protected $db = NULL; // Use our own database object - this one for reading data protected $db = NULL; // Use our own database object - this one for reading data
/** @var e_db_pdo */
protected $db2 = NULL; // Use our own database object - this one for updates protected $db2 = NULL; // Use our own database object - this one for updates
protected $queryActive = FALSE; // Keeps track of unused records in currently active query protected $queryActive = FALSE; // Keeps track of unused records in currently active query
protected $mailCounters = array(); // Counters to track adding recipients protected $mailCounters = array(); // Counters to track adding recipients
@@ -134,6 +138,7 @@ class e107MailManager
protected $currentMailBody = ''; // Buffers current mail body protected $currentMailBody = ''; // Buffers current mail body
protected $currentTextBody = ''; // Alternative text body (if required) protected $currentTextBody = ''; // Alternative text body (if required)
/** @var e107Email */
protected $mailer = NULL; // Mailer class when required protected $mailer = NULL; // Mailer class when required
protected $mailOverrides = FALSE; // Any overrides to be passed to the mailer protected $mailOverrides = FALSE; // Any overrides to be passed to the mailer
@@ -1079,7 +1084,7 @@ class e107MailManager
{ {
$this->checkDB(2); // Make sure we have a DB object to use $this->checkDB(2); // Make sure we have a DB object to use
$dbData = $this->mailToDB($emailData, FALSE); // Convert array formats $dbData = $this->mailToDb($emailData, FALSE); // Convert array formats
// print_a($dbData); // print_a($dbData);
@@ -1333,7 +1338,7 @@ class e107MailManager
if (!$this->db->update('mail_content',$query)) if (!$this->db->update('mail_content',$query))
{ {
e107::getLog()->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_content: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING); e107::getLog()->addEvent(10,-1,'MAIL','Activate/hold mail','mail_content: '.$query.'[!br!]Fail: '.$this->db->getLastErrorText(),FALSE,LOG_TO_ROLLING);
return FALSE; return FALSE;
} }
@@ -1342,7 +1347,7 @@ class e107MailManager
// echo "Update individual emails: {$query}<br />"; // echo "Update individual emails: {$query}<br />";
if (FALSE === $this->db->update('mail_recipients',$query)) if (FALSE === $this->db->update('mail_recipients',$query))
{ {
e107::getLog()->e_log_event(10,-1,'MAIL','Activate/hold mail','mail_recipient: '.$query.'[!br!]Fail: '.$this->db->mySQLlastErrText,FALSE,LOG_TO_ROLLING); e107::getLog()->addEvent(10,-1,'MAIL','Activate/hold mail','mail_recipient: '.$query.'[!br!]Fail: '.$this->db->getLastErrorText(),FALSE,LOG_TO_ROLLING);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@@ -1507,8 +1512,7 @@ class e107MailManager
{ {
if($plug == 'core') if($plug == 'core')
{ {
require_once(e_HANDLER.'user_handler.php'); if($err = e107::getUserSession()->userStatusUpdate('bounce', $uid, $emailAddress));
if($err = userHandler::userStatusUpdate('bounce', $uid, $emailAddress));
{ {
$errors[] = $err; $errors[] = $err;
} }
@@ -1664,7 +1668,7 @@ class e107MailManager
/** /**
* Returns the detail of the next email which satisfies the query done in selectEmailStatus() * Returns the detail of the next email which satisfies the query done in selectEmailStatus()
* @return Returns an array of data relating to a single email if available (in 'flat' format). FALSE on no data or error * @return bool Returns an array of data relating to a single email if available (in 'flat' format). FALSE on no data or error
*/ */
public function getNextEmailStatus() public function getNextEmailStatus()
{ {

View File

@@ -1870,7 +1870,7 @@ class mailoutAdminClass extends e107MailManager
// First thing, delete temporary records from both tables // First thing, delete temporary records from both tables
if(($res = $this->db2->db_Delete('mail_content', '`mail_content_status` = ' . MAIL_STATUS_TEMP)) === FALSE) if(($res = $this->db2->db_Delete('mail_content', '`mail_content_status` = ' . MAIL_STATUS_TEMP)) === FALSE)
{ {
$results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting temporary records from mail_content'; $results[] = 'Error ' . $this->db2->getLastErrorNumber() . ':' . $this->db2->getLastErrorText() . ' deleting temporary records from mail_content';
$noError = FALSE; $noError = FALSE;
} }
else else
@@ -1886,7 +1886,7 @@ class mailoutAdminClass extends e107MailManager
} }
if(($res = $this->db2->delete('mail_recipients', '`mail_status` = ' . MAIL_STATUS_TEMP)) === FALSE) if(($res = $this->db2->delete('mail_recipients', '`mail_status` = ' . MAIL_STATUS_TEMP)) === FALSE)
{ {
$results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting temporary records from mail_recipients'; $results[] = 'Error ' . $this->db2->getLastErrorNumber() . ':' . $this->db2->getLastErrorText() . ' deleting temporary records from mail_recipients';
$noError = FALSE; $noError = FALSE;
} }
else else
@@ -1906,7 +1906,7 @@ class mailoutAdminClass extends e107MailManager
LEFT JOIN `#mail_content` ON `#mail_recipients`.`mail_detail_id` = `#mail_content`.`mail_source_id` LEFT JOIN `#mail_content` ON `#mail_recipients`.`mail_detail_id` = `#mail_content`.`mail_source_id`
WHERE `#mail_content`.`mail_source_id` IS NULL")) === FALSE) WHERE `#mail_content`.`mail_source_id` IS NULL")) === FALSE)
{ {
$results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting orphaned records from mail_recipients'; $results[] = 'Error ' . $this->db2->getLastErrorNumber() . ':' . $this->db2->getLastErrorText() . ' deleting orphaned records from mail_recipients';
$noError = FALSE; $noError = FALSE;
} }
elseif($res) elseif($res)
@@ -1920,7 +1920,7 @@ class mailoutAdminClass extends e107MailManager
WHERE (`mail_content_status` >" . MAIL_STATUS_FAILED . ") AND (`mail_content_status` <=" . MAIL_STATUS_MAX_ACTIVE . ") WHERE (`mail_content_status` >" . MAIL_STATUS_FAILED . ") AND (`mail_content_status` <=" . MAIL_STATUS_MAX_ACTIVE . ")
AND ((`mail_togo_count`=0) OR ( (`mail_last_date` != 0) AND (`mail_last_date` < " . time() . ")))")) === FALSE) AND ((`mail_togo_count`=0) OR ( (`mail_last_date` != 0) AND (`mail_last_date` < " . time() . ")))")) === FALSE)
{ {
$results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' checking bad status in mail_content'; $results[] = 'Error ' . $this->db2->getLastErrorNumber() . ':' . $this->db2->getLastErrorText() . ' checking bad status in mail_content';
$noError = FALSE; $noError = FALSE;
} }
else else
@@ -1961,7 +1961,7 @@ class mailoutAdminClass extends e107MailManager
GROUP BY mr.`mail_status`, mc.`mail_source_id` ORDER BY mc.`mail_source_id` GROUP BY mr.`mail_status`, mc.`mail_source_id` ORDER BY mc.`mail_source_id`
")) === FALSE) ")) === FALSE)
{ {
$results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' assembling email counts'; $results[] = 'Error ' . $this->db2->getLastErrorNumber() . ':' . $this->db2->getLastErrorText() . ' assembling email counts';
$noError = FALSE; $noError = FALSE;
} }
else else