mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +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);
|
||||
|
||||
require_login($course, true, $cm);
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
print_error('invalidsesskey');
|
||||
}
|
||||
|
||||
if (!isloggedin()){
|
||||
print_error('loggedinnot');
|
||||
}
|
||||
require_sesskey();
|
||||
|
||||
if (isguestuser()) {
|
||||
print_error('loggedinnot');
|
||||
|
@ -54,13 +47,9 @@ $comment = new comment($cmt);
|
|||
|
||||
switch ($action) {
|
||||
case 'add':
|
||||
try {
|
||||
$cmt = $comment->add($content);
|
||||
if (!empty($cmt) && is_object($cmt)) {
|
||||
redirect($returnurl, get_string('pageshouldredirect'), 0);
|
||||
}
|
||||
} catch(comment_exception $e) {
|
||||
print_error($e->errorcode);
|
||||
$cmt = $comment->add($content);
|
||||
if (!empty($cmt) && is_object($cmt)) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue