From a0288610be923f11127b04f1eb693faadecd05dd Mon Sep 17 00:00:00 2001
From: moodler
Date: Mon, 25 Apr 2005 10:48:01 +0000
Subject: [PATCH] Tidying up mail and stuff
---
mod/forum/lib.php | 65 +++++++++++++++++++++++------------------------
1 file changed, 32 insertions(+), 33 deletions(-)
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index 09f0629cbd6..5baf85c05cd 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -656,40 +656,39 @@ function forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $u
function forum_make_mail_html($course, $forum, $discussion, $post, $userfrom, $userto) {
global $CFG;
- if ($userto->mailformat == 1) { // HTML
-
- $strforums = get_string('forums', 'forum');
- $canreply = forum_user_can_post($forum, $userto);
- $canunsubscribe = ! forum_is_forcesubscribed($forum->id);
-
- $posthtml = '';
- $posthtml .= '';
- foreach ($CFG->stylesheets as $stylesheet) {
- $posthtml .= ' '."\n";
- }
- $posthtml .= '';
- $posthtml .= "\n\n\n";
-
- $posthtml .= "".
- "wwwroot/course/view.php?id=$course->id\">$course->shortname » ".
- "wwwroot/mod/forum/index.php?id=$course->id\">$strforums » ".
- "wwwroot/mod/forum/view.php?f=$forum->id\">".format_string($forum->name,true)." ";
- if ($discussion->name == $forum->name) {
- $posthtml .= "
";
- } else {
- $posthtml .= " » wwwroot/mod/forum/discuss.php?d=$discussion->id\">".format_string($discussion->name,true)."
";
- }
- $posthtml .= forum_make_mail_post($post, $userfrom, $userto, $course, false, $canreply, true, false);
-
- if ($canunsubscribe) {
- $posthtml .= "\nwwwroot/mod/forum/subscribe.php?id=$forum->id\">".get_string("unsubscribe", "forum")."
";
- }
-
- return $posthtml;
-
- } else {
+ if ($userto->mailformat != 1) { // Needs to be HTML
return '';
}
+
+ $strforums = get_string('forums', 'forum');
+ $canreply = forum_user_can_post($forum, $userto);
+ $canunsubscribe = ! forum_is_forcesubscribed($forum->id);
+
+ $posthtml = '';
+ foreach ($CFG->stylesheets as $stylesheet) {
+ $posthtml .= ' '."\n";
+ }
+ $posthtml .= '';
+ $posthtml .= "\n\n\n";
+
+ $posthtml .= '';
+ } else {
+ $posthtml .= ' » '.
+ format_string($discussion->name,true).' ';
+ }
+ $posthtml .= forum_make_mail_post($post, $userfrom, $userto, $course, false, $canreply, true, false);
+
+ if ($canunsubscribe) {
+ $posthtml .= ' ';
+ }
+
+ return $posthtml;
}
function forum_user_outline($course, $user, $mod, $forum) {
@@ -3157,7 +3156,7 @@ function forum_tp_mark_post_read($userid, &$post, $forumid) {
}
function forum_tp_mark_forum_read($userid, $forumid, $groupid=false) {
-/// We need a proper LEFT JOIN in here to find posts without read records
+/// Marks a whole forum as read, for a given user
global $CFG;
$cutoffdate = isset($CFG->forum_oldpostdays) ? (time() - ($CFG->forum_oldpostdays*24*60*60)) : 0;