MDL-21940 removing the old custom exception handling from nonajax code too + redirects without messags are always better

This commit is contained in:
Petr Skoda 2010-03-28 10:08:18 +00:00
parent 01910dff66
commit 2c3c4c8d63

View file

@ -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, get_string('pageshouldredirect'), 0); redirect($returnurl);
}
} catch(comment_exception $e) {
print_error($e->errorcode);
} }
break; break;
default: default: