mirror of
https://github.com/moodle/moodle.git
synced 2025-06-03 06:35:57 +02:00
MDL-14129, remove error() in forum mod.
This commit is contained in:
parent
d71226a4ac
commit
dde78cb8f2
@ -29,11 +29,15 @@ $string['bynameondate'] = 'by $a->name - $a->date';
|
||||
$string['cannotviewpostyet'] = 'You cannot read other students questions in this discussion yet because you haven\'t posted';
|
||||
$string['cannotadddiscussion'] = 'Adding discussions to this forum requires group membership.';
|
||||
$string['cannotadddiscussionall'] = 'You do not have permission to add a new discussion topic for all participants.';
|
||||
$string['cannotsubscribe'] = 'Sorry, but you must be a group member to subscribe.';
|
||||
$string['cannotunsubscribe'] = 'Could not unsubscribe you from that forum';
|
||||
$string['cannotaddsubscriber'] = 'Could not add subscriber with id $a to this forum!';
|
||||
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
|
||||
$string['cannotfindorcreateforum'] = 'Could not find or create a main news forum for the site';
|
||||
$string['cannotfindfirstpost'] = 'Could not find the first post in this forum';
|
||||
$string['cannotupdaterate'] = 'Could not update an old rating ($a[0] = $a[1])';
|
||||
$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
|
||||
$string['cannottrack'] = 'Could not stop tracking that forum';
|
||||
$string['cleanreadtime'] = 'Mark old posts as read hour';
|
||||
$string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.';
|
||||
$string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.';
|
||||
@ -82,11 +86,11 @@ $string['editedby'] = 'Edited by $a->name - original submission $a->date';
|
||||
$string['editing'] = 'Editing';
|
||||
$string['emptymessage'] = 'Something was wrong with your post. Perhaps you left it blank, or the attachment was too big. Your changes have NOT been saved.';
|
||||
$string['everyonecanchoose'] = 'Everyone can choose to be subscribed';
|
||||
$string['everyonecannowchoose'] = 'Everyone can now choose to be subscribed';
|
||||
$string['everyonecannowchoose'] = 'Everyone can now choose to be subscribed';
|
||||
$string['everyoneisnowsubscribed'] = 'Everyone is now subscribed to this forum';
|
||||
$string['everyoneissubscribed'] = 'Everyone is subscribed to this forum';
|
||||
$string['existingsubscribers'] = 'Existing subscribers';
|
||||
$string['forcessubscribe'] = 'This forum forces everyone to be subscribed';
|
||||
$string['forcessubscribe'] = 'This forum forces everyone to be subscribed';
|
||||
$string['forcesubscribe'] = 'Force everyone to be subscribed';
|
||||
$string['forcesubscribeq'] = 'Force everyone to be subscribed?';
|
||||
$string['forum'] = 'Forum';
|
||||
@ -132,6 +136,7 @@ $string['learningforums'] = 'Learning forums';
|
||||
$string['logblocked'] = 'Log blocked emails';
|
||||
$string['longpost'] = 'Long post';
|
||||
$string['invalidforumid'] = 'Forum ID was incorrect';
|
||||
$string['invaliddiscussionid'] = 'Discussion ID was incorrect';
|
||||
$string['invalidpostid'] = 'Invalid Post ID - $a';
|
||||
$string['invalidaccess'] = 'This page was not accessed correctly';
|
||||
$string['mailnow'] = 'Mail now';
|
||||
|
@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
error("Course id is incorrect.");
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
require_course_login($course);
|
||||
@ -182,14 +182,14 @@
|
||||
// Replace the simple subject with the three items forum name -> thread name -> subject
|
||||
// (if all three are appropriate) each as a link.
|
||||
if (! $discussion = $DB->get_record('forum_discussions', array('id' => $post->discussion))) {
|
||||
error('Discussion ID was incorrect');
|
||||
print_error('invaliddiscussionid', 'forum');
|
||||
}
|
||||
if (! $forum = $DB->get_record('forum', array('id' => "$discussion->forum"))) {
|
||||
error("Could not find forum $discussion->forum");
|
||||
print_error('invalidforumid', 'forum');
|
||||
}
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
|
||||
error('Course Module ID was incorrect');
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
$post->subject = highlight($strippedsearch, $post->subject);
|
||||
|
@ -9,15 +9,15 @@
|
||||
$returnpage = optional_param('returnpage', 'index.php', PARAM_FILE); // Page to return to.
|
||||
|
||||
if (! $forum = $DB->get_record("forum", array("id" => $id))) {
|
||||
error("Forum ID was incorrect");
|
||||
print_error('invalidforumid', 'forum');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id" => $forum->course))) {
|
||||
error("Forum doesn't belong to a course!");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if (! $cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
|
||||
error("Incorrect cm");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
require_course_login($course, false, $cm);
|
||||
@ -36,7 +36,7 @@
|
||||
add_to_log($course->id, "forum", "stop tracking", "view.php?f=$forum->id", $forum->id, $cm->id);
|
||||
redirect($returnto, get_string("nownottracking", "forum", $info), 1);
|
||||
} else {
|
||||
error("Could not stop tracking that forum", $_SERVER["HTTP_REFERER"]);
|
||||
print_error('cannottrack', '', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
} else { // subscribe
|
||||
@ -44,7 +44,7 @@
|
||||
add_to_log($course->id, "forum", "start tracking", "view.php?f=$forum->id", $forum->id, $cm->id);
|
||||
redirect($returnto, get_string("nowtracking", "forum", $info), 1);
|
||||
} else {
|
||||
error("Could not start tracking that forum", $_SERVER["HTTP_REFERER"]);
|
||||
print_error('cannottrack', '', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
$user = optional_param('user',0,PARAM_INT);
|
||||
|
||||
if (! $forum = $DB->get_record("forum", array("id" => $id))) {
|
||||
error("Forum ID was incorrect");
|
||||
print_error('invalidforumid', 'forum');
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id" => $forum->course))) {
|
||||
error("Forum doesn't belong to a course!");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
|
||||
@ -26,10 +26,10 @@
|
||||
|
||||
if ($user) {
|
||||
if (!has_capability('mod/forum:managesubscriptions', $context)) {
|
||||
error('You do not have the permission to subscribe/unsubscribe other people!');
|
||||
print_error('nopermissiontosubscribe', 'forum');
|
||||
}
|
||||
if (!$user = $DB->get_record("user", array("id" => $user))) {
|
||||
error("User ID was incorrect");
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
} else {
|
||||
$user = $USER;
|
||||
@ -39,7 +39,7 @@
|
||||
and !forum_is_subscribed($user->id, $forum)
|
||||
and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
if (!groups_get_all_groups($course->id, $USER->id)) {
|
||||
error('Sorry, but you must be a group member to subscribe.');
|
||||
print_error('cannotsubscribe', 'forum');
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
add_to_log($course->id, "forum", "unsubscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
|
||||
redirect($returnto, get_string("nownotsubscribed", "forum", $info), 1);
|
||||
} else {
|
||||
error("Could not unsubscribe you from that forum", $_SERVER["HTTP_REFERER"]);
|
||||
print_error('cannotunsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
} else { // subscribe
|
||||
@ -95,13 +95,13 @@
|
||||
print_error('disallowsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
if (!has_capability('mod/forum:viewdiscussion', $context)) {
|
||||
error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
|
||||
print_error('cannotsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
if (forum_subscribe($user->id, $forum->id) ) {
|
||||
add_to_log($course->id, "forum", "subscribe", "view.php?f=$forum->id", $forum->id, $cm->id);
|
||||
redirect($returnto, get_string("nowsubscribed", "forum", $info), 1);
|
||||
} else {
|
||||
error("Could not subscribe you to that forum", $_SERVER["HTTP_REFERER"]);
|
||||
print_error('cannotsubscribe', 'forum', $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,13 +18,13 @@
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('forum', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
|
||||
error("Course is misconfigured");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
if (! $forum = $DB->get_record("forum", array("id" => $cm->instance))) {
|
||||
error("Forum ID was incorrect");
|
||||
print_error('invalidforumid', 'forum');
|
||||
}
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
$strforum = get_string("modulename", "forum");
|
||||
@ -33,23 +33,23 @@
|
||||
} else if ($f) {
|
||||
|
||||
if (! $forum = $DB->get_record("forum", array("id" => $f))) {
|
||||
error("Forum ID was incorrect or no longer exists");
|
||||
print_error('invalidforumid', 'forum');
|
||||
}
|
||||
if (! $course = $DB->get_record("course", array("id" => $forum->course))) {
|
||||
error("Forum is misconfigured - don't know what course it's from");
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
|
||||
$strforums = get_string("modulenameplural", "forum");
|
||||
$strforum = get_string("modulename", "forum");
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
|
||||
error("Course Module missing");
|
||||
print_error('missingparameter');
|
||||
}
|
||||
|
||||
$buttontext = update_module_button($cm->id, $course->id, $strforum);
|
||||
|
||||
} else {
|
||||
error('Must specify a course module or a forum ID');
|
||||
print_error('missingparameter');
|
||||
}
|
||||
|
||||
if (!$buttontext) {
|
||||
@ -210,11 +210,11 @@
|
||||
notify("Warning! There is more than one discussion in this forum - using the most recent");
|
||||
$discussion = array_pop($discussions);
|
||||
} else {
|
||||
error("Could not find the discussion in this forum");
|
||||
print_error('nodiscussions', 'forum');
|
||||
}
|
||||
}
|
||||
if (! $post = forum_get_post_full($discussion->firstpost)) {
|
||||
error("Could not find the first post in this forum");
|
||||
print_error('cannotfindfirstpost', 'forum');
|
||||
}
|
||||
if ($mode) {
|
||||
set_user_preference("forum_displaymode", $mode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user