Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
c9eee17c
Commit
c9eee17c
authored
Jan 14, 2019
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert Notifications classes to namespaces
parent
d9cf5d54
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
23 deletions
+19
-23
emails.php
qa-include/app/emails.php
+10
-6
Email.php
qa-src/Notifications/Email.php
+5
-7
Mailer.php
qa-src/Notifications/Mailer.php
+2
-5
Status.php
qa-src/Notifications/Status.php
+2
-5
No files found.
qa-include/app/emails.php
View file @
c9eee17c
...
...
@@ -24,15 +24,19 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
exit
;
}
use
Q2A\Notifications\Email
;
use
Q2A\Notifications\Mailer
;
use
Q2A\Notifications\Status
as
NotifyStatus
;
/**
* @deprecated: Use Q2A_Notifications_Status::suspend() instead.
* Suspend the sending of all email notifications via qa_send_notification(...) if $suspend is true, otherwise
* reinstate it. A counter is kept to allow multiple calls.
* @param bool $suspend
* @deprecated: Use \Q2A\Notifications\Status::suspend() instead.
*/
function
qa_suspend_notifications
(
$suspend
=
true
)
{
Q2A_Notifications_
Status
::
suspend
(
$suspend
);
Notify
Status
::
suspend
(
$suspend
);
}
...
...
@@ -53,14 +57,14 @@ function qa_send_notification($userid, $email, $handle, $subject, $body, $subs,
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
if
(
Q2A_Notifications_
Status
::
isSuspended
())
{
if
(
Notify
Status
::
isSuspended
())
{
return
;
}
if
(
$userid
)
{
$sender
=
Q2A_Notifications_
Email
::
CreateByUserID
(
$userid
,
$email
,
$handle
);
$sender
=
Email
::
CreateByUserID
(
$userid
,
$email
,
$handle
);
}
else
{
$sender
=
Q2A_Notifications_
Email
::
CreateByEmailAddress
(
$email
,
$handle
);
$sender
=
Email
::
CreateByEmailAddress
(
$email
,
$handle
);
}
return
$sender
->
sendMessage
(
$subject
,
$body
,
$subs
,
$html
);
...
...
@@ -76,7 +80,7 @@ function qa_send_email($params)
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
$mailer
=
new
Q2A_Notifications_
Mailer
(
$params
);
$mailer
=
new
Mailer
(
$params
);
$send_status
=
$mailer
->
send
();
if
(
!
$send_status
)
{
...
...
qa-
include/Q2A
/Notifications/Email.php
→
qa-
src
/Notifications/Email.php
View file @
c9eee17c
...
...
@@ -18,18 +18,16 @@
More about this license: http://www.question2answer.org/license.php
*/
use
Q2A\Exceptions\FatalErrorException
;
namespace
Q2A\Notifications
;
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../../'
);
exit
;
}
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'
;
class
Q2A_Notifications_
Email
class
Email
{
private
$email
;
private
$handle
;
...
...
@@ -105,7 +103,7 @@ class Q2A_Notifications_Email
$bodyPrefix
=
(
empty
(
$this
->
handle
)
?
''
:
qa_lang_sub
(
'emails/to_handle_prefix'
,
$this
->
handle
));
if
(
PHPMailer
::
validateAddress
(
$this
->
email
))
{
$mailer
=
new
Q2A_Notifications_
Mailer
(
array
(
$mailer
=
new
Mailer
(
array
(
'fromemail'
=>
qa_opt
(
'from_email'
),
'fromname'
=>
qa_opt
(
'site_title'
),
'toemail'
=>
$this
->
email
,
...
...
qa-
include/Q2A
/Notifications/Mailer.php
→
qa-
src
/Notifications/Mailer.php
View file @
c9eee17c
...
...
@@ -18,14 +18,11 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../../'
);
exit
;
}
namespace
Q2A\Notifications
;
require_once
QA_INCLUDE_DIR
.
'vendor/PHPMailer/PHPMailerAutoload.php'
;
class
Q2A_Notifications_
Mailer
extends
PHPMailer
class
Mailer
extends
PHPMailer
{
public
function
__construct
(
$params
=
array
())
{
...
...
qa-
include/Q2A
/Notifications/Status.php
→
qa-
src
/Notifications/Status.php
View file @
c9eee17c
...
...
@@ -18,12 +18,9 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../../'
);
exit
;
}
namespace
Q2A\Notifications
;
class
Q2A_Notifications_
Status
class
Status
{
protected
static
$notifications_suspended
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment