Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
7e0b51f8
Commit
7e0b51f8
authored
Nov 24, 2011
by
Francois Marier
Committed by
Gerrit Code Review
Nov 24, 2011
Browse files
Merge "Add X-Mahara- headers to forum emails (Bug #882891)"
parents
db5e8575
0498da87
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/interaction/forum/lang/en.utf8/interaction.forum.php
View file @
7e0b51f8
...
...
@@ -107,7 +107,7 @@ $string['moderatorsdescription'] = 'Moderators can edit and delete topics and po
$string
[
'name'
]
=
'Forum'
;
$string
[
'nameplural'
]
=
'Forums'
;
$string
[
'newforum'
]
=
'New forum'
;
$string
[
'newforumpostnotificationsubject'
]
=
'
%s: %s:
%s'
;
$string
[
'newforumpostnotificationsubject
line
'
]
=
'%s'
;
$string
[
'newpost'
]
=
'New post: '
;
$string
[
'newtopic'
]
=
'New topic'
;
$string
[
'noforumpostsyet'
]
=
'There are no posts in this group yet'
;
...
...
@@ -131,7 +131,7 @@ $string['potentialmoderators'] = 'Potential Moderators';
$string
[
're'
]
=
'Re: %s'
;
$string
[
'regulartopics'
]
=
'Regular topics'
;
$string
[
'Reply'
]
=
'Reply'
;
$string
[
'replyforumpostnotificationsubject'
]
=
'Re:
%s: %s:
%s'
;
$string
[
'replyforumpostnotificationsubject
line
'
]
=
'Re: %s'
;
$string
[
'replyto'
]
=
'Reply to: '
;
$string
[
'Sticky'
]
=
'Sticky'
;
$string
[
'stickydescription'
]
=
'Sticky topics are at the top of every page'
;
...
...
htdocs/interaction/forum/lib.php
View file @
7e0b51f8
...
...
@@ -781,11 +781,16 @@ class ActivityTypeInteractionForumNewPost extends ActivityTypePlugin {
// When emailing forum posts, create Message-Id headers for threaded display by email clients
$urlinfo
=
parse_url
(
get_config
(
'wwwroot'
));
$hostname
=
$urlinfo
[
'host'
];
$cleanforumname
=
str_replace
(
'"'
,
"'"
,
strip_tags
(
$post
->
forumtitle
));
$cleanforumname
=
clean_email_headers
(
$post
->
forumtitle
);
$cleangroupname
=
clean_email_headers
(
$post
->
groupname
);
$cleanforumname
=
str_replace
(
'"'
,
"'"
,
strip_tags
(
$cleanforumname
));
$cleangroupname
=
str_replace
(
'"'
,
"'"
,
strip_tags
(
$cleangroupname
));
$this
->
customheaders
=
array
(
'List-Id: "'
.
$cleanforumname
.
'" <forum'
.
$post
->
forumid
.
'@'
.
$hostname
.
'>'
,
'List-Help: '
.
get_config
(
'wwwroot'
)
.
'interaction/forum/view.php?id='
.
$post
->
forumid
,
'Message-ID: <forumpost'
.
$this
->
postid
.
'@'
.
$hostname
.
'>'
,
'X-Mahara-Group: '
.
$cleangroupname
,
'X-Mahara-Forum: '
.
$cleanforumname
);
if
(
$post
->
parent
)
{
$this
->
customheaders
[]
=
'In-Reply-To: <forumpost'
.
$post
->
parent
.
'@'
.
$hostname
.
'>'
;
...
...
@@ -805,9 +810,9 @@ class ActivityTypeInteractionForumNewPost extends ActivityTypePlugin {
));
$this
->
strings
->
subject
=
(
object
)
array
(
'key'
=>
$post
->
parent
?
'replyforumpostnotificationsubject'
:
'newforumpostnotificationsubject'
,
'key'
=>
$post
->
parent
?
'replyforumpostnotificationsubject
line
'
:
'newforumpostnotificationsubject
line
'
,
'section'
=>
'interaction.forum'
,
'args'
=>
array
(
$post
->
groupname
,
$post
->
forumtitle
,
$post
->
parent
?
$post
->
topicsubject
:
$post
->
subject
),
'args'
=>
array
(
$post
->
parent
?
$post
->
topicsubject
:
$post
->
subject
),
);
foreach
(
$this
->
users
as
&
$user
)
{
...
...
htdocs/lib/web.php
View file @
7e0b51f8
...
...
@@ -3320,3 +3320,16 @@ function sanitize_url($url) {
}
return
$url
;
}
/**
* Sanitises header text per rfc5322
*
* @return string A string with undesired characters filtered out
*/
function
clean_email_headers
(
$headertext
)
{
$decoloned
=
str_replace
(
':'
,
''
,
$headertext
);
$filtered
=
filter_var
(
$decoloned
,
FILTER_SANITIZE_STRING
,
array
(
FILTER_FLAG_STRIP_LOW
,
FILTER_FLAG_STRIP_HIGH
));
return
substr
(
$filtered
,
0
,
100
);
}
Write
Preview
Supports
Markdown
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