From 4e05e64e950dd6cd976171d160f6195943edc680 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 28 Mar 2012 12:24:52 +1300 Subject: [PATCH 1/3] MDL-32018 mod_wiki: Improved form definitions to ensure they consistent and secure --- mod/wiki/comments_form.php | 7 +++---- mod/wiki/create_form.php | 11 +++++++---- mod/wiki/edit_form.php | 34 +++++++++++++++++----------------- mod/wiki/filesedit_form.php | 6 +++++- mod/wiki/mod_form.php | 31 ++++++++++++++----------------- 5 files changed, 46 insertions(+), 43 deletions(-) diff --git a/mod/wiki/comments_form.php b/mod/wiki/comments_form.php index 0dc86403b3a..fe53834d317 100644 --- a/mod/wiki/comments_form.php +++ b/mod/wiki/comments_form.php @@ -7,9 +7,8 @@ if (!defined('MOODLE_INTERNAL')) { require_once($CFG->dirroot . '/lib/formslib.php'); class mod_wiki_comments_form extends moodleform { - function definition() { - $pageid = optional_param('pageid', 0, PARAM_INT); - $mform =& $this->_form; + protected function definition() { + $mform = $this->_form; $current = $this->_customdata['current']; $commentoptions = $this->_customdata['commentoptions']; @@ -24,7 +23,7 @@ class mod_wiki_comments_form extends moodleform { $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'action', ''); - $mform->setType('action', PARAM_ACTION); + $mform->setType('action', PARAM_ALPHAEXT); //------------------------------------------------------------------------------- // buttons diff --git a/mod/wiki/create_form.php b/mod/wiki/create_form.php index a6099913473..ff2b7afeeb3 100644 --- a/mod/wiki/create_form.php +++ b/mod/wiki/create_form.php @@ -29,8 +29,7 @@ require_once($CFG->libdir.'/formslib.php'); class mod_wiki_create_form extends moodleform { protected function definition() { - global $CFG; - $mform =& $this->_form; + $mform = $this->_form; $formats = $this->_customdata['formats']; $defaultformat = $this->_customdata['defaultformat']; @@ -43,6 +42,8 @@ class mod_wiki_create_form extends moodleform { $textoptions = array('readonly'=>'readonly'); } $mform->addElement('text', 'pagetitle', get_string('newpagetitle', 'wiki'), $textoptions); + $mform->setType('pagetitle', PARAM_TEXT); + $mform->addRule('pagetitle', get_string('required'), 'required', null, 'client'); if ($forceformat) { $mform->addElement('hidden', 'pageformat', $defaultformat); @@ -60,10 +61,12 @@ class mod_wiki_create_form extends moodleform { $mform->addElement('radio', 'pageformat', '', get_string('format'.$format, 'wiki'), $format, $attr); } } + $mform->setType('pageformat', PARAM_ALPHANUMEXT); + $mform->addRule('pageformat', get_string('required'), 'required', null, 'client'); //hiddens - $mform->addElement('hidden', 'action'); - $mform->setDefault('action', 'create'); + $mform->addElement('hidden', 'action', 'create'); + $mform->setType('action', PARAM_ALPHA); $this->add_action_buttons(false, get_string('createpage', 'wiki')); } diff --git a/mod/wiki/edit_form.php b/mod/wiki/edit_form.php index b121f8c0148..cc56932219e 100644 --- a/mod/wiki/edit_form.php +++ b/mod/wiki/edit_form.php @@ -38,20 +38,16 @@ class mod_wiki_edit_form extends moodleform { protected function definition() { global $CFG; - $mform =& $this->_form; + $mform = $this->_form; $version = $this->_customdata['version']; $format = $this->_customdata['format']; - $tags = !isset($this->_customdata['tags'])?"":$this->_customdata['tags']; - - if ($format != 'html') { - $contextid = $this->_customdata['contextid']; - $filearea = $this->_customdata['filearea']; - $fileitemid = $this->_customdata['fileitemid']; - } + $pagetitle = $this->_customdata['pagetitle']; + $contextid = $this->_customdata['contextid']; if (isset($this->_customdata['pagetitle'])) { - $pagetitle = get_string('editingpage', 'wiki', $this->_customdata['pagetitle']); + // Page title must be formatted properly here as this is output and not an element. + $pagetitle = get_string('editingpage', 'wiki', format_string($pagetitle, true, array('context' => get_context_instance_by_id($contextid, MUST_EXIST)))); } else { $pagetitle = get_string('editing', 'wiki'); } @@ -65,7 +61,7 @@ class mod_wiki_edit_form extends moodleform { $ft = new filetype_parser; $extensions = $ft->get_extensions('image'); $fs = get_file_storage(); - $tree = $fs->get_area_tree($contextid, 'mod_wiki', 'attachments', $fileitemid); + $tree = $fs->get_area_tree($contextid, 'mod_wiki', $this->_customdata['filearea'], $this->_customdata['fileitemid']); $files = array(); foreach ($tree['files'] as $file) { $filename = $file->get_filename(); @@ -77,30 +73,34 @@ class mod_wiki_edit_form extends moodleform { } $mform->addElement('wikieditor', 'newcontent', $fieldname, array('cols' => 100, 'rows' => 20, 'wiki_format' => $format, 'files'=>$files)); $mform->addHelpButton('newcontent', 'format'.$format, 'wiki'); + $mform->setType('newcontent', PARAM_RAW); // processed by trust text or cleaned before the display } else { $mform->addElement('editor', 'newcontent_editor', $fieldname, null, page_wiki_edit::$attachmentoptions); $mform->addHelpButton('newcontent_editor', 'formathtml', 'wiki'); + $mform->setType('newcontent_editor', PARAM_RAW); // processed by trust text or cleaned before the display } //hiddens if ($version >= 0) { - $mform->addElement('hidden', 'version'); - $mform->setDefault('version', $version); + $mform->addElement('hidden', 'version', $version); + $mform->setType('version', PARAM_FLOAT); } - $mform->addElement('hidden', 'contentformat'); - $mform->setDefault('contentformat', $format); + $mform->addElement('hidden', 'contentformat', $format); + $mform->setType('contentformat', PARAM_ALPHANUMEXT); if (!empty($CFG->usetags)) { + $tags = !isset($this->_customdata['tags'])?"":$this->_customdata['tags']; $mform->addElement('header', 'tagshdr', get_string('tags', 'tag')); $mform->addElement('tags', 'tags', get_string('tags')); $mform->setDefault('tags', $tags); + $mform->setType('tags', PARAM_TEXT); } $buttongroup = array(); - $buttongroup[] =& $mform->createElement('submit', 'editoption', get_string('save', 'wiki'), array('id' => 'save')); - $buttongroup[] =& $mform->createElement('submit', 'editoption', get_string('preview'), array('id' => 'preview')); - $buttongroup[] =& $mform->createElement('submit', 'editoption', get_string('cancel'), array('id' => 'cancel')); + $buttongroup[] = $mform->createElement('submit', 'editoption', get_string('save', 'wiki'), array('id' => 'save')); + $buttongroup[] = $mform->createElement('submit', 'editoption', get_string('preview'), array('id' => 'preview')); + $buttongroup[] = $mform->createElement('submit', 'editoption', get_string('cancel'), array('id' => 'cancel')); $mform->addGroup($buttongroup, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); diff --git a/mod/wiki/filesedit_form.php b/mod/wiki/filesedit_form.php index f086611a7e7..a440a53ee5b 100644 --- a/mod/wiki/filesedit_form.php +++ b/mod/wiki/filesedit_form.php @@ -27,15 +27,19 @@ defined('MOODLE_INTERNAL') || die(); require_once("$CFG->libdir/formslib.php"); class mod_wiki_filesedit_form extends moodleform { - function definition() { + protected function definition() { $mform = $this->_form; $data = $this->_customdata['data']; $options = $this->_customdata['options']; $mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options); + $mform->addElement('hidden', 'returnurl', $data->returnurl); + $mform->setType('returnurl', PARAM_URL); + $mform->addElement('hidden', 'subwiki', $data->subwikiid); + $mform->setType('subwiki', PARAM_INT); $this->add_action_buttons(true, get_string('savechanges')); diff --git a/mod/wiki/mod_form.php b/mod/wiki/mod_form.php index dcf9a06b642..ef5b26907e2 100644 --- a/mod/wiki/mod_form.php +++ b/mod/wiki/mod_form.php @@ -41,28 +41,24 @@ require_once($CFG->dirroot . '/lib/datalib.php'); class mod_wiki_mod_form extends moodleform_mod { - function definition() { - - global $COURSE; - $mform =& $this->_form; + protected function definition() { + $mform = $this->_form; + $required = get_string('required'); //------------------------------------------------------------------------------- - /// Adding the "general" fieldset, where all the common settings are showed + // Adding the "general" fieldset, where all the common settings are showed $mform->addElement('header', 'general', get_string('general', 'form')); - /// Adding the standard "name" field + + // Adding the standard "name" field $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64')); $mform->setType('name', PARAM_TEXT); - $mform->addRule('name', null, 'required', null, 'client'); - /// Adding the optional "intro" and "introformat" pair of fields - // $mform->addElement('htmleditor', 'intro', get_string('wikiintro', 'wiki')); - // $mform->setType('intro', PARAM_RAW); - // $mform->addRule('intro', get_string('required'), 'required', null, 'client'); - // - // $mform->addElement('format', 'introformat', get_string('format')); + $mform->addRule('name', $required, 'required', null, 'client'); + // Adding the optional "intro" and "introformat" pair of fields $this->add_intro_editor(true, get_string('wikiintro', 'wiki')); + //------------------------------------------------------------------------------- - /// Adding the rest of wiki settings, spreeading all them into this fieldset - /// or adding more fieldsets ('header' elements) if needed for better logic + // Adding the rest of wiki settings, spreeading all them into this fieldset + // or adding more fieldsets ('header' elements) if needed for better logic $mform->addElement('header', 'wikifieldset', get_string('wikisettings', 'wiki')); @@ -75,9 +71,9 @@ class mod_wiki_mod_form extends moodleform_mod { $mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr); $mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki'); - + $mform->setType('firstpagetitle', PARAM_TEXT); if (empty($this->_instance)) { - $mform->addRule('firstpagetitle', null, 'required', null, 'client'); + $mform->addRule('firstpagetitle', $required, 'required', null, 'client'); } $wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki')); @@ -96,6 +92,7 @@ class mod_wiki_mod_form extends moodleform_mod { } $mform->addElement('select', 'defaultformat', get_string('defaultformat', 'wiki'), $editoroptions); $mform->addHelpButton('defaultformat', 'defaultformat', 'wiki'); + $mform->addElement('checkbox', 'forceformat', get_string('forceformat', 'wiki')); $mform->addHelpButton('forceformat', 'forceformat', 'wiki'); From 2ab31346076c3c479e3cc9a467fd0b12a44fd645 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 28 Mar 2012 13:20:15 +1300 Subject: [PATCH 2/3] MDL-32018 mod_wiki: Fixed formatting of the page title so that is is consistent and secure --- mod/wiki/create.php | 6 ++--- mod/wiki/edit_form.php | 12 ++++++++- mod/wiki/locallib.php | 17 +++++++----- mod/wiki/pagelib.php | 59 +++++++++++++++++++++++++----------------- mod/wiki/renderer.php | 9 ++++--- 5 files changed, 63 insertions(+), 40 deletions(-) diff --git a/mod/wiki/create.php b/mod/wiki/create.php index d9e8d2d8d0e..f7174c117eb 100644 --- a/mod/wiki/create.php +++ b/mod/wiki/create.php @@ -28,7 +28,7 @@ require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); // page editing page. $action = optional_param('action', 'new', PARAM_TEXT); // The title of the new page, can be empty -$title = optional_param('title', '', PARAM_TEXT); +$title = optional_param('title', get_string('newpage', 'wiki'), PARAM_TEXT); $wid = optional_param('wid', 0, PARAM_INT); $swid = optional_param('swid', 0, PARAM_INT); $gid = optional_param('gid', 0, PARAM_INT); @@ -78,9 +78,7 @@ if (!empty($swid)) { $wikipage->set_uid($uid); } -if (empty($title)) { - $title = get_string('newpage', 'wiki'); -} + $wikipage->set_title($title); // set page action, and initialise moodle form diff --git a/mod/wiki/edit_form.php b/mod/wiki/edit_form.php index cc56932219e..5a24be62cf4 100644 --- a/mod/wiki/edit_form.php +++ b/mod/wiki/edit_form.php @@ -43,7 +43,17 @@ class mod_wiki_edit_form extends moodleform { $version = $this->_customdata['version']; $format = $this->_customdata['format']; $pagetitle = $this->_customdata['pagetitle']; - $contextid = $this->_customdata['contextid']; + + if (empty($this->_customdata['contextid'])) { + // Hack alert + // This is being done ONLY to aid those who may have created there own wiki pages. It should be removed sometime + // after the release of 2.3 (not creating an issue because this whole thing should be reviewed) + debugging('You must always provide mod_wiki_edit_form with a contextid in its custom data', DEBUG_DEVELOPER); + global $PAGE; + $contextid = $PAGE->context->id; + } else { + $contextid = $this->_customdata['contextid']; + } if (isset($this->_customdata['pagetitle'])) { // Page title must be formatted properly here as this is output and not an element. diff --git a/mod/wiki/locallib.php b/mod/wiki/locallib.php index ca65c62a514..b858354829e 100644 --- a/mod/wiki/locallib.php +++ b/mod/wiki/locallib.php @@ -320,7 +320,7 @@ function wiki_refresh_page_links($page, $links) { * @param int $userid */ function wiki_create_page($swid, $title, $format, $userid) { - global $DB, $PAGE; + global $DB; $subwiki = wiki_get_subwiki($swid); $cm = get_coursemodule_from_instance('wiki', $subwiki->wikiid); $context = get_context_instance(CONTEXT_MODULE, $cm->id); @@ -605,10 +605,12 @@ function wiki_parse_content($markup, $pagecontent, $options = array()) { * * NOTE: Empty pages and non-existent pages must be print in red color. * - * @param link name of a page - * @param $options + * !!!!!! IMPORTANT !!!!!! + * It is critical that you call format_string on the content before it is used. * - * @return + * @param string|page_wiki $link name of a page + * @param array $options + * @return array Array('content' => string, 'url' => string, 'new' => bool, 'link_info' => array) * * @TODO Doc return and options */ @@ -1394,9 +1396,9 @@ function wiki_print_upload_table($context, $filearea, $fileitemid, $deleteupload /** * Generate wiki's page tree * - * @param $page. A wiki page object - * @param $node. Starting navigation_node - * @param $keys. An array to store keys + * @param page_wiki $page. A wiki page object + * @param navigation_node $node. Starting navigation_node + * @param array $keys. An array to store keys * @return an array with all tree nodes */ function wiki_build_tree($page, $node, &$keys) { @@ -1412,6 +1414,7 @@ function wiki_build_tree($page, $node, &$keys) { array_push($keys, $key); $l = wiki_parser_link($p); $link = new moodle_url('/mod/wiki/view.php', array('pageid' => $p->id)); + // navigation_node::get_content will format the title for us $nodeaux = $node->add($p->title, $link, null, null, null, $icon); if ($l['new']) { $nodeaux->add_class('wiki_newentry'); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 6085483f0e1..7b51e962c23 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -204,6 +204,7 @@ abstract class page_wiki { $this->page = $page; $this->title = $page->title; + // set_title calls format_string itself so no probs there $PAGE->set_title($this->title); } @@ -217,6 +218,7 @@ abstract class page_wiki { $this->page = null; $this->title = $title; + // set_title calls format_string itself so no probs there $PAGE->set_title($this->title); } @@ -347,7 +349,7 @@ class page_wiki_view extends page_wiki { print_error(get_string('invalidparameters', 'wiki')); } - $PAGE->set_url($CFG->wwwroot . '/mod/wiki/view.php', $params); + $PAGE->set_url(new moodle_url($CFG->wwwroot . '/mod/wiki/view.php', $params)); } function set_coursemodule($id) { @@ -355,7 +357,7 @@ class page_wiki_view extends page_wiki { } protected function create_navbar() { - global $PAGE, $CFG; + global $PAGE; $PAGE->navbar->add(format_string($this->title)); $PAGE->navbar->add(get_string('view', 'wiki')); @@ -540,7 +542,13 @@ class page_wiki_edit extends page_wiki { $url .= "§ion=" . urlencode($this->section); } - $params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $version->contentformat, 'version' => $versionnumber, 'pagetitle'=>$this->page->title); + $params = array( + 'attachmentoptions' => page_wiki_edit::$attachmentoptions, + 'format' => $version->contentformat, + 'version' => $versionnumber, + 'pagetitle' => $this->page->title, + 'contextid' => $this->modcontext->id + ); $data = new StdClass(); $data->newcontent = $content; @@ -556,11 +564,10 @@ class page_wiki_edit extends page_wiki { break; default: break; - } + } if ($version->contentformat != 'html') { $params['fileitemid'] = $this->subwiki->id; - $params['contextid'] = $this->modcontext->id; $params['component'] = 'mod_wiki'; $params['filearea'] = 'attachments'; } @@ -865,19 +872,17 @@ class page_wiki_create extends page_wiki { global $PAGE, $CFG; $params = array(); + $params['swid'] = $this->swid; if ($this->action == 'new') { $params['action'] = 'new'; - $params['swid'] = $this->swid; $params['wid'] = $this->wid; if ($this->title != get_string('newpage', 'wiki')) { $params['title'] = $this->title; } - $PAGE->set_url($CFG->wwwroot . '/mod/wiki/create.php', $params); } else { $params['action'] = 'create'; - $params['swid'] = $this->swid; - $PAGE->set_url($CFG->wwwroot . '/mod/wiki/create.php', $params); } + $PAGE->set_url(new moodle_url('/mod/wiki/create.php', $params)); } function set_format($format) { @@ -908,7 +913,7 @@ class page_wiki_create extends page_wiki { protected function create_navbar() { global $PAGE; - + // navigation_node::get_content formats this before printing. $PAGE->navbar->add($this->title); } @@ -1009,10 +1014,14 @@ class page_wiki_preview extends page_wiki_edit { if (!empty($this->section)) { $url .= "§ion=" . urlencode($this->section); } - $params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $this->format, 'version' => $this->versionnumber); + $params = array( + 'attachmentoptions' => page_wiki_edit::$attachmentoptions, + 'format' => $this->format, + 'version' => $this->versionnumber, + 'contextid' => $this->modcontext->id + ); if ($this->format != 'html') { - $params['contextid'] = $this->modcontext->id; $params['component'] = 'mod_wiki'; $params['filearea'] = 'attachments'; $params['fileitemid'] = $this->page->id; @@ -1502,10 +1511,10 @@ class page_wiki_map extends page_wiki { $user = $users[$version->userid]; } - $link = wiki_parser_link(format_string($page->title), array('swid' => $swid)); + $link = wiki_parser_link($page->title, array('swid' => $swid)); $class = ($link['new']) ? 'class="wiki_newentry"' : ''; - $linkpage = '' . $link['content'] . ''; + $linkpage = '' . format_string($link['content'], true, array('context' => $this->modcontext)) . ''; $icon = $OUTPUT->user_picture($user, array('popup' => true)); $table->data[] = array("$icon $linkpage"); @@ -1582,6 +1591,7 @@ class page_wiki_map extends page_wiki { $page = $fresh['page']; } + // navigation_node get_content calls format string for us $node = new navigation_node($page->title); $keys = array(); @@ -1616,15 +1626,12 @@ class page_wiki_map extends page_wiki { $strspecial = get_string('special', 'wiki'); foreach ($pages as $page) { - $letter = strtoupper(substr($page->title, 0, 1)); + $letter = format_string($page->title, true, array('context' => $this->modcontext)); + $letter = strtoupper(substr($letter, 0, 1)); if (preg_match('/[A-Z]/', $letter)) { - $stdaux->{ - $letter} - [] = wiki_parser_link($page); + $stdaux->{$letter}[] = wiki_parser_link($page); } else { - $stdaux->{ - $strspecial} - [] = wiki_parser_link($page); + $stdaux->{$strspecial}[] = wiki_parser_link($page); } } @@ -1635,7 +1642,7 @@ class page_wiki_map extends page_wiki { foreach ($stdaux as $key => $elem) { $table->data[] = array($key); foreach ($elem as $e) { - $table->data[] = array(html_writer::link($e['url'], $e['content'])); + $table->data[] = array(html_writer::link($e['url'], format_string($e['content'], true, array('context' => $this->modcontext)))); } } echo html_writer::table($table); @@ -1993,11 +2000,15 @@ class page_wiki_save extends page_wiki_edit { $url .= "§ion=" . urlencode($this->section); } - $params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $this->format, 'version' => $this->versionnumber); + $params = array( + 'attachmentoptions' => page_wiki_edit::$attachmentoptions, + 'format' => $this->format, + 'version' => $this->versionnumber, + 'contextid' => $this->modcontext->id + ); if ($this->format != 'html') { $params['fileitemid'] = $this->page->id; - $params['contextid'] = $this->modcontext->id; $params['component'] = 'mod_wiki'; $params['filearea'] = 'attachments'; } diff --git a/mod/wiki/renderer.php b/mod/wiki/renderer.php index 31594b2697d..763a6735ce9 100644 --- a/mod/wiki/renderer.php +++ b/mod/wiki/renderer.php @@ -44,7 +44,7 @@ class mod_wiki_renderer extends plugin_renderer_base { $pages = wiki_get_page_list($swid); $selectoptions = array(); foreach ($pages as $page) { - $selectoptions[$page->id] = $page->title; + $selectoptions[$page->id] = format_string($page->title, true, array('context' => $this->page->context)); } $label = get_string('pageindex', 'wiki') . ': '; $select = new single_select(new moodle_url('/mod/wiki/view.php'), 'pageid', $selectoptions); @@ -365,7 +365,7 @@ class mod_wiki_renderer extends plugin_renderer_base { $baseurl->params($params); echo $this->output->container_start('wiki_right'); - groups_print_activity_menu($cm, $baseurl->out()); + groups_print_activity_menu($cm, $baseurl); echo $this->output->container_end(); return; } else if ($wiki->wikimode == 'individual') { @@ -415,14 +415,15 @@ class mod_wiki_renderer extends plugin_renderer_base { CASE VISIBLEGROUPS: if ($wiki->wikimode == 'collaborative') { // We need to print a select to choose a course group - $params = array('wid'=>$wiki->id, 'title'=>urlencode($page->title)); + // moodle_url will take care of encoding for us + $params = array('wid'=>$wiki->id, 'title'=>$page->title); if ($pagetype == 'files') { $params['pageid'] = $page->id; } $baseurl->params($params); echo $this->output->container_start('wiki_right'); - groups_print_activity_menu($cm, $baseurl->out()); + groups_print_activity_menu($cm, $baseurl); echo $this->output->container_end(); return; From 00568190ce0398a2024f20fae059d0b7054a24e4 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Thu, 29 Mar 2012 10:12:50 +1300 Subject: [PATCH 3/3] MDL-32018 mod_wiki: Fixed up whitespace after peer-review --- mod/wiki/create.php | 1 - mod/wiki/edit_form.php | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mod/wiki/create.php b/mod/wiki/create.php index f7174c117eb..0931b54b9fb 100644 --- a/mod/wiki/create.php +++ b/mod/wiki/create.php @@ -78,7 +78,6 @@ if (!empty($swid)) { $wikipage->set_uid($uid); } - $wikipage->set_title($title); // set page action, and initialise moodle form diff --git a/mod/wiki/edit_form.php b/mod/wiki/edit_form.php index 5a24be62cf4..5412ee7557a 100644 --- a/mod/wiki/edit_form.php +++ b/mod/wiki/edit_form.php @@ -41,7 +41,7 @@ class mod_wiki_edit_form extends moodleform { $mform = $this->_form; $version = $this->_customdata['version']; - $format = $this->_customdata['format']; + $format = $this->_customdata['format']; $pagetitle = $this->_customdata['pagetitle']; if (empty($this->_customdata['contextid'])) { @@ -50,9 +50,9 @@ class mod_wiki_edit_form extends moodleform { // after the release of 2.3 (not creating an issue because this whole thing should be reviewed) debugging('You must always provide mod_wiki_edit_form with a contextid in its custom data', DEBUG_DEVELOPER); global $PAGE; - $contextid = $PAGE->context->id; + $contextid = $PAGE->context->id; } else { - $contextid = $this->_customdata['contextid']; + $contextid = $this->_customdata['contextid']; } if (isset($this->_customdata['pagetitle'])) { @@ -100,7 +100,7 @@ class mod_wiki_edit_form extends moodleform { $mform->setType('contentformat', PARAM_ALPHANUMEXT); if (!empty($CFG->usetags)) { - $tags = !isset($this->_customdata['tags'])?"":$this->_customdata['tags']; + $tags = !isset($this->_customdata['tags'])?"":$this->_customdata['tags']; $mform->addElement('header', 'tagshdr', get_string('tags', 'tag')); $mform->addElement('tags', 'tags', get_string('tags')); $mform->setDefault('tags', $tags);