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);
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);
redirect($returnurl);
}
break;
default: