From 0b393d67167fe7b2b64d4f4f97b6e03beb0cadbb Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Wed, 5 Jan 2011 15:52:25 +0100 Subject: [PATCH] MDL-24561 forum subscription checks sesskey - backported from 2.0 The only case when sesskey is not available is when we came to subscribe.php from a link in email. In that case, we display a confirmation page that redirects back providing the sesskey. All other links to subscribe.php are fixed now so they provide sesskey as a parameter. --- index.php | 2 +- lang/en_utf8/forum.php | 2 ++ mod/forum/lib.php | 6 ++++-- mod/forum/subscribe.php | 25 ++++++++++++++++++++++++- mod/forum/view.php | 4 ++-- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/index.php b/index.php index 24bc1d3b05d..8515f4b2cea 100644 --- a/index.php +++ b/index.php @@ -208,7 +208,7 @@ $subtext = get_string('subscribe', 'forum'); } print_heading_block($newsforum->name); - echo ''; + echo ''; } else { print_heading_block($newsforum->name); } diff --git a/lang/en_utf8/forum.php b/lang/en_utf8/forum.php index c87639b324b..2effa4abea7 100644 --- a/lang/en_utf8/forum.php +++ b/lang/en_utf8/forum.php @@ -47,6 +47,8 @@ $string['configreplytouser'] = 'When a forum post is mailed out, should it conta $string['configshortpost'] = 'Any post under this length (in characters not including HTML) is considered short (see below).'; $string['configtrackreadposts'] = 'Set to \'yes\' if you want to track read/unread for each user.'; $string['configusermarksread'] = 'If \'yes\', the user must manually mark a post as read. If \'no\', when the post is viewed it is marked as read.'; +$string['confirmsubscribe'] = 'Do you really want to subscribe to forum \'{$a}\'?'; +$string['confirmunsubscribe'] = 'Do you really want to unsubscribe from forum \'{$a}\'?'; $string['couldnotadd'] = 'Could not add your post due to an unknown error'; $string['couldnotdeleteratings'] = 'Sorry, that cannot be deleted as people have already rated it'; $string['couldnotdeletereplies'] = 'Sorry, that cannot be deleted as people have already responded to it'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index a8b273cea30..19b4581dfe2 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4299,6 +4299,7 @@ function forum_get_subscribe_link($forum, $context, $messages = array(), $cantac $backtoindexlink = ''; } $link = ''; + $sesskeylink = '&sesskey='.sesskey(); if ($fakelink) { $link .= <<$linktext<\/a>"; + subs_link.innerHTML = "$linktext<\/a>"; } //]]>