MDL-28724 wiki : Fixed bugs in wiki forms

This commit is contained in:
Aparup Banerjee
2011-09-12 17:27:56 +12:00
committed by Sam Hemelryk
parent 9e6ef6ccc2
commit 910671644c
5 changed files with 112 additions and 18 deletions
+21 -2
View File
@@ -42,6 +42,7 @@ $action = optional_param('action', '', PARAM_ACTION);
$id = optional_param('id', 0, PARAM_INT);
$commentid = optional_param('commentid', 0, PARAM_INT);
$newcontent = optional_param('newcontent', '', PARAM_CLEANHTML);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
if (!$page = wiki_get_page($pageid)) {
print_error('incorrectpageid', 'wiki');
@@ -59,8 +60,26 @@ if (!$wiki = wiki_get_wiki($subwiki->wikiid)) {
}
require_login($course->id, true, $cm);
$comm = new page_wiki_handlecomments($wiki, $subwiki, $cm);
$comm->set_page($page);
if ($action == 'add' || $action == 'edit') {
//just check sesskey
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
}
$comm = new page_wiki_handlecomments($wiki, $subwiki, $cm);
$comm->set_page($page);
} else {
if(!$confirm) {
$comm = new page_wiki_deletecomment($wiki, $subwiki, $cm);
$comm->set_page($page);
$comm->set_url();
} else {
$comm = new page_wiki_handlecomments($wiki, $subwiki, $cm);
$comm->set_page($page);
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
}
}
}
if ($action == 'delete') {
$comm->set_action($action, $commentid, 0);