mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-21940 removing the old custom exception handling from nonajax code too + redirects without messags are always better
This commit is contained in:
parent
01910dff66
commit
2c3c4c8d63
1 changed files with 4 additions and 15 deletions
|
@ -25,14 +25,7 @@ $contextid = optional_param('contextid', SYSCONTEXTID, PARAM_INT);
|
||||||
list($context, $course, $cm) = get_context_info_array($contextid);
|
list($context, $course, $cm) = get_context_info_array($contextid);
|
||||||
|
|
||||||
require_login($course, true, $cm);
|
require_login($course, true, $cm);
|
||||||
|
require_sesskey();
|
||||||
if (!confirm_sesskey()) {
|
|
||||||
print_error('invalidsesskey');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isloggedin()){
|
|
||||||
print_error('loggedinnot');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isguestuser()) {
|
if (isguestuser()) {
|
||||||
print_error('loggedinnot');
|
print_error('loggedinnot');
|
||||||
|
@ -54,13 +47,9 @@ $comment = new comment($cmt);
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
try {
|
$cmt = $comment->add($content);
|
||||||
$cmt = $comment->add($content);
|
if (!empty($cmt) && is_object($cmt)) {
|
||||||
if (!empty($cmt) && is_object($cmt)) {
|
redirect($returnurl);
|
||||||
redirect($returnurl, get_string('pageshouldredirect'), 0);
|
|
||||||
}
|
|
||||||
} catch(comment_exception $e) {
|
|
||||||
print_error($e->errorcode);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue