Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
a7dd9328
authored
2011-04-11 19:39:14 +0000
by
Chris Boden
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Parsed subject line, removed HTML from subject line
1 parent
9827b8e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
com/Notifications/Notifications.php
com/Notifications/Notifications.php
View file @
a7dd932
...
...
@@ -188,21 +188,15 @@ function remove_notice($notification_id = -1) {
@trigger = notification unique slug name
*/
function
send_triggered_notification
(
$uid
,
$trigger
=
"NO_TRIGGER"
,
$args
=
array
(),
$send_override
=
false
)
{
$notification
=
get_notification_by_trigger
(
$trigger
);
if
(
$notification
)
{
// get the notification and notificatio details....
$nid
=
$notification
->
ID
;
$details
=
get_post_meta
(
$nid
,
'details'
,
true
);
$email
=
get_post_meta
(
$nid
,
'email'
,
true
);
$system
=
get_post_meta
(
$nid
,
'system'
,
true
);
$notification
->
trigger
=
$details
[
'trigger'
];
$notification
->
status
=
isset
(
$details
[
'status'
])
?
$details
[
'status'
]
:
"active"
;
$notification
->
type
=
$details
[
'type'
];
...
...
@@ -210,7 +204,6 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$notification
->
is_email
=
((
$email
[
'text'
]
!=
""
||
$email
[
'html'
]
!=
""
)
&&
$email
[
'subject'
]
!=
""
)
?
true
:
false
;
$notification
->
is_system
=
(
isset
(
$system
[
'message'
])
&&
$system
[
'message'
]
!=
""
)
?
true
:
false
;
// if is_system ==========================================
if
(
$notification
->
is_system
&&
$uid
!=
0
)
{
get_user_notices
(
$uid
);
...
...
@@ -234,22 +227,17 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
update_user_meta
(
$uid
,
'notices'
,
$notices
);
}
// if is_email ===========================================
if
(
$notification
->
is_email
)
{
send_email
(
$uid
,
$email
,
$args
,
true
);
}
}
// if the system notification has set current user than get current user otherwise loop through the users needed.
}
function
send_email
(
$uid
=
0
,
$contents
,
$args
,
$override
=
false
)
{
if
(
$uid
==
0
&&
!
isset
(
$args
[
'email'
]))
{
return
;
}
if
(
isset
(
$args
[
'email'
]))
{
$to_email
=
$args
[
'email'
];
}
else
{
...
...
@@ -272,8 +260,7 @@ function send_email($uid = 0, $contents,$args, $override = false) {
$from_address
=
get_bloginfo
(
'admin_email'
);
$subject
=
$contents
[
'subject'
];
$subject
=
strip_tags
(
$contents
[
'subject'
]);
$html
=
$contents
[
'html'
];
$alttext
=
$contents
[
'text'
];
...
...
@@ -296,9 +283,9 @@ function send_email($uid = 0, $contents,$args, $override = false) {
if
(
(
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
&&
!
empty
(
$html
))
{
$message
=
str_replace
(
"
{
".$key."
}
"
,
"<a href='"
.
$val
.
"'>"
.
$val
.
"</a>"
,
$message
);
}
else
{
$message
=
str_replace
(
"
{
".$key."
}
"
,
$val
,
$message
);
$message
=
str_replace
(
"
{
".$key."
}
"
,
$val
,
$message
);
$subject
=
str_replace
(
"
{
".$key."
}
"
,
$val
,
$subject
);
}
}
// Additional headers
...
...
Please
register
or
sign in
to post a comment