[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * @TODO: Doc this file 20 * 21 * @package mod_wiki 22 * @copyright 2009 Marc Alier, Jordi Piguillem marc.alier@upc.edu 23 * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu 24 * 25 * @author Jordi Piguillem 26 * @author Marc Alier 27 * @author David Jimenez 28 * @author Josep Arus 29 * @author Daniel Serrano 30 * @author Kenneth Riba 31 * 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 35 require_once('../../config.php'); 36 require_once($CFG->dirroot . "/mod/wiki/pagelib.php"); 37 require_once($CFG->dirroot . "/mod/wiki/locallib.php"); 38 require_once($CFG->dirroot . '/mod/wiki/comments_form.php'); 39 40 $pageid = required_param('pageid', PARAM_TEXT); 41 $action = optional_param('action', '', PARAM_ALPHANUMEXT); 42 $id = optional_param('id', 0, PARAM_INT); 43 $commentid = optional_param('commentid', 0, PARAM_INT); 44 $newcontent = optional_param('newcontent', '', PARAM_CLEANHTML); 45 $confirm = optional_param('confirm', 0, PARAM_BOOL); 46 47 if (!$page = wiki_get_page($pageid)) { 48 print_error('incorrectpageid', 'wiki'); 49 } 50 51 if (!$subwiki = wiki_get_subwiki($page->subwikiid)) { 52 print_error('incorrectsubwikiid', 'wiki'); 53 } 54 if (!$cm = get_coursemodule_from_instance("wiki", $subwiki->wikiid)) { 55 print_error('invalidcoursemodule'); 56 } 57 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 58 if (!$wiki = wiki_get_wiki($subwiki->wikiid)) { 59 print_error('incorrectwikiid', 'wiki'); 60 } 61 require_login($course, true, $cm); 62 63 if ($action == 'add' || $action == 'edit') { 64 //just check sesskey 65 if (!confirm_sesskey()) { 66 print_error(get_string('invalidsesskey', 'wiki')); 67 } 68 $comm = new page_wiki_handlecomments($wiki, $subwiki, $cm); 69 $comm->set_page($page); 70 } else { 71 if(!$confirm) { 72 $comm = new page_wiki_deletecomment($wiki, $subwiki, $cm); 73 $comm->set_page($page); 74 $comm->set_url(); 75 } else { 76 $comm = new page_wiki_handlecomments($wiki, $subwiki, $cm); 77 $comm->set_page($page); 78 if (!confirm_sesskey()) { 79 print_error(get_string('invalidsesskey', 'wiki')); 80 } 81 } 82 } 83 84 if ($action == 'delete') { 85 $comm->set_action($action, $commentid, 0); 86 } else { 87 if (empty($newcontent)) { 88 $form = new mod_wiki_comments_form(); 89 $newcomment = $form->get_data(); 90 $content = $newcomment->entrycomment_editor['text']; 91 } else { 92 $content = $newcontent; 93 } 94 95 if ($action == 'edit') { 96 $comm->set_action($action, $id, $content); 97 } else { 98 $action = 'add'; 99 $comm->set_action($action, 0, $content); 100 } 101 } 102 103 $comm->print_header(); 104 $comm->print_content(); 105 $comm->print_footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |