Commit 2a90152f by Scott

Reorganize PHPMailer loading, fix syntax

parent c9eee17c
......@@ -62,9 +62,9 @@ function qa_send_notification($userid, $email, $handle, $subject, $body, $subs,
}
if ($userid) {
$sender = Email::CreateByUserID($userid, $email, $handle);
$sender = Email::createByUserID($userid, $email, $handle);
} else {
$sender = Email::CreateByEmailAddress($email, $handle);
$sender = Email::createByEmailAddress($email, $handle);
}
return $sender->sendMessage($subject, $body, $subs, $html);
......
......@@ -176,7 +176,7 @@ function qa_initialize_constants_1()
define('QA_CATEGORY_DEPTH', 4); // you can't change this number!
if (!defined('QA_BASE_DIR'))
define('QA_BASE_DIR', dirname(dirname(__FILE__)) . '/'); // try out best if not set in index.php or qa-index.php - won't work with symbolic links
define('QA_BASE_DIR', dirname(dirname(__FILE__)) . '/'); // try our best if not set in index.php or qa-index.php - won't work with symbolic links
define('QA_EXTERNAL_DIR', QA_BASE_DIR . 'qa-external/');
define('QA_INCLUDE_DIR', QA_BASE_DIR . 'qa-include/');
......@@ -207,6 +207,8 @@ function qa_initialize_constants_1()
}
}
require_once QA_INCLUDE_DIR . 'vendor/PHPMailer/PHPMailerAutoload.php';
// Polyfills
// password_hash compatibility for 5.3-5.4
......
......@@ -22,10 +22,7 @@ namespace Q2A\Notifications;
use Q2A\Exceptions\FatalErrorException;
use Q2A\Notifications\Mailer;
require_once QA_INCLUDE_DIR . 'db/selects.php'; //required for qa_db_select_with_pending()
require_once QA_INCLUDE_DIR . 'app/options.php'; //required for qa_opt()
require_once QA_INCLUDE_DIR . 'vendor/PHPMailer/PHPMailerAutoload.php';
use PHPMailer;
class Email
{
......@@ -36,6 +33,9 @@ class Email
{
$this->email = $email;
$this->handle = $handle;
require_once QA_INCLUDE_DIR . 'db/selects.php'; //required for qa_db_select_with_pending()
require_once QA_INCLUDE_DIR . 'app/options.php'; //required for qa_opt()
}
/**
......@@ -46,7 +46,7 @@ class Email
* @return \self
* @throws FatalErrorException
*/
public static function CreateByUserID($userid, $email = '', $handle = '')
public static function createByUserID($userid, $email = '', $handle = '')
{
if (!(int)$userid) {
throw new FatalErrorException('User ID not specified in Notifications/Email/CreateByUserID.');
......@@ -92,7 +92,7 @@ class Email
* @param type $handle
* @return \self
*/
public static function CreateByEmailAddress($email, $handle = '')
public static function createByEmailAddress($email, $handle = '')
{
return new self($email, $handle);
}
......
......@@ -20,7 +20,7 @@
namespace Q2A\Notifications;
require_once QA_INCLUDE_DIR . 'vendor/PHPMailer/PHPMailerAutoload.php';
use PHPMailer;
class Mailer extends PHPMailer
{
......
......@@ -34,7 +34,7 @@ class Status
self::$notifications_suspended += ($suspend ? 1 : -1);
}
public static function IsSuspended()
public static function isSuspended()
{
return self::$notifications_suspended > 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment