/** * Try to submit the form. * * @return Mixed: boolean false on failure, nothing on success; if * everything went well, the user is redirected to their new * page */ function submitForm() { global $wgOut, $wgRequest, $wgServer, $wgScript, $wgScriptPath; // check if we are editing in red link mode if ($wgRequest->getCheck('wpSubmitCreateplate')) { $mainform = new CreatePageCreateplateForm(); $mainform->showForm(''); $mainform->showCreateplate(); return false; } else { $valid = $this->checkArticleExists($wgRequest->getVal('Createtitle')); if ($valid != '') { // no title? this means overwriting Main Page... $mainform = new CreatePageCreateplateForm(); $mainform->showForm($valid); $editor = new CreatePageMultiEditor($this->mCreateplate); $editor->generateForm($editor->glueArticle()); return false; } if ($wgRequest->getCheck('wpSave')) { $editor = new CreatePageMultiEditor($this->mCreateplate); $rtitle = Title::newFromText($wgRequest->getVal('Createtitle')); $rarticle = new Article($rtitle, $rtitle->getArticleID()); $editpage = new EditPage($rarticle); $editpage->mTitle = $rtitle; $editpage->mArticle = $rarticle; $editpage->textbox1 = CreateMultiPage::unescapeBlankMarker($editor->glueArticle()); $editpage->minoredit = $wgRequest->getCheck('wpMinoredit'); $editpage->watchthis = $wgRequest->getCheck('wpWatchthis'); $editpage->summary = $wgRequest->getVal('wpSummary'); $_SESSION['article_createplate'] = $this->mCreateplate; // pipe tags to pipes wfCreatePageUnescapeKnownMarkupTags($editpage->textbox1); $editpage->attemptSave(); return false; } elseif ($wgRequest->getCheck('wpPreview')) { $mainform = new CreatePageCreatePlateForm(); $editor = new CreatePageMultiEditor($this->mCreateplate, true); $content = $editor->glueArticle(true, false); $content_static = $editor->glueArticle(true); $mainform->showForm('', $content_static); $editor->generateForm($content); return false; } elseif ($wgRequest->getCheck('wpAdvancedEdit')) { $editor = new CreatePageMultiEditor($this->mCreateplate); $content = CreateMultiPage::unescapeBlankMarker($editor->glueArticle()); wfCreatePageUnescapeKnownMarkupTags($content); $_SESSION['article_content'] = $content; $wgOut->redirect($wgServer . $wgScript . '?title=' . $wgRequest->getVal('Createtitle') . '&action=edit&createpage=true'); } elseif ($wgRequest->getCheck('wpImageUpload')) { $mainform = new CreatePageCreatePlateForm(); $mainform->showForm(''); $editor = new CreatePageMultiEditor($this->mCreateplate); $content = $editor->glueArticle(); $editor->generateForm($content); } elseif ($wgRequest->getCheck('wpCancel')) { if ($wgRequest->getVal('Createtitle') != '') { $wgOut->redirect($wgServer . $wgScript . '?title=' . $wgRequest->getVal('Createtitle')); } else { $wgOut->redirect($wgServer . $wgScript); } } } }
function axCreatepageAdvancedSwitch() { global $wgRequest; $mCreateplate = $wgRequest->getVal('createplates'); $editor = new CreatePageMultiEditor($mCreateplate); $content = CreateMultiPage::unescapeBlankMarker($editor->glueArticle()); wfCreatePageUnescapeKnownMarkupTags($content); $_SESSION['article_content'] = $content; return json_encode(true); }