示例#1
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodeditor'));
     $wgOut->setPageTitle(wfMsg('methodeditor'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodeditor.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodeditor.js'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.cookie.js'), 'extensions/wikihow/common', false));
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
示例#2
0
function wfEditPageBeforeEditToolbar(&$toolbar)
{
    global $wgStylePath, $wgOut, $wgLanguageCode;
    $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Weave links', $open = '', $close = '', $sample = '', $cssId = 'weave_button');
    $script = Xml::encodeJsCall('mw.toolbar.addButton', $params);
    $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script)));
    $params = array($image = $wgStylePath . '/owl/images/1x1_transparent.gif', $tip = 'Add Image', $open = '', $close = '', $sample = '', $cssId = 'easyimageupload_button', $onclick = "easyImageUpload.doEIUModal('advanced');return false;");
    $script = Xml::encodeJsCall('mw.toolbar.addButton', $params);
    $wgOut->addScript(Html::inlineScript(ResourceLoader::makeLoaderConditionalScript($script)));
    $wgOut->addJScode('advj');
    $wgOut->addJScode('eiuj');
    if (in_array($wgLanguageCode, array('en', 'de', 'es', 'pt'))) {
        $popbox = PopBox::getPopBoxJSAdvanced() . PopBox::getPopBoxCSS();
        $popbox_div = PopBox::getPopBoxDiv();
        $wgOut->addHTML($popbox_div . $popbox);
        $wgOut->addHTML(Easyimageupload::getUploadBoxJS(true));
    }
    return true;
}
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     $user = $this->getContext()->getUser();
     if (!$user || $user->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!$this->userAllowed($user)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_page");
     if ($wgRequest->getVal('allarticles')) {
         $wgOut->setArticleBodyOnly(true);
         $dbr = wfGetDB(DB_SLAVE);
         $date = date('Y-m-d');
         header('Content-type: application/force-download');
         header('Content-disposition: attachment; filename="methods_' . $date . '.xls"');
         $res = $dbr->select(MethodEditor::TABLE_NAME, array('ama_page'), array('ama_patrolled' => '1'), __METHOD__, array('GROUP BY' => 'ama_page'));
         foreach ($res as $row) {
             $title = Title::newFromID($row->ama_page);
             if ($title) {
                 echo $title->getFullURL() . "\n";
             }
         }
         return;
     }
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod($wgRequest->getVal('aid'));
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $articleId = $wgRequest->getVal('articleId');
             $this->skipTool->skipItem($articleId);
             $this->skipTool->unUseItem($articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setPageTitle(wfMessage('methodeditor')->text());
     $wgOut->addJScode('csjs');
     $wgOut->addCSScode('methc');
     $wgOut->addJScode('methj');
     $wgOut->addJScode('jcookj');
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $groups = $user->getGroups();
     $showList = in_array('staff', $groups) || in_array('staff_widget', $groups);
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('showList' => $showList));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
示例#4
0
    /**
     * Send the edit form and related headers to $wgOut
     * @param $formCallback Optional callable that takes an OutputPage
     *                      parameter; will be called during form output
     *                      near the top, for captchas and the like.
     */
    function showEditForm($formCallback = null)
    {
        global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMaxArticleSize, $wgTitle;
        $fname = 'EditPage::showEditForm';
        wfProfileIn($fname);
        $sk = $wgUser->getSkin();
        wfRunHooks('EditPage::showEditForm:initial', array(&$this));
        $wgOut->setRobotpolicy('noindex,nofollow');
        # Enabled article-related sidebar, toplinks, etc.
        $wgOut->setArticleRelated(true);
        if ($this->formtype == 'preview') {
            $wgOut->setPageTitleActionText(wfMsg('preview'));
        }
        if ($this->isConflict) {
            $s = wfMsg('editconflict', $wgTitle->getPrefixedText());
            $wgOut->setPageTitle($s);
            $wgOut->addWikiMsg('explainconflict');
            $this->textbox2 = $this->textbox1;
            $this->textbox1 = $this->getContent();
            $this->edittime = $this->mArticle->getTimestamp();
        } else {
            if ($this->section != '') {
                if ($this->section == 'new') {
                    $s = wfMsg('editingcomment', $wgTitle->getPrefixedText());
                } else {
                    $s = wfMsg('editingsection', $wgTitle->getPrefixedText());
                    $matches = array();
                    if (!$this->summary && !$this->preview && !$this->diff) {
                        preg_match("/^(=+)(.+)\\1/mi", $this->textbox1, $matches);
                        if (!empty($matches[2])) {
                            global $wgParser;
                            $this->summary = "/* " . $wgParser->stripSectionName(trim($matches[2])) . " */ ";
                        }
                    }
                }
            } else {
                $s = wfMsg('editing', $wgTitle->getPrefixedText());
            }
            $wgOut->setPageTitle($s);
            if ($this->missingComment) {
                $wgOut->wrapWikiMsg('<div id="mw-missingcommenttext">$1</div>', 'missingcommenttext');
            }
            if ($this->missingSummary && $this->section != 'new') {
                $wgOut->wrapWikiMsg('<div id="mw-missingsummary">$1</div>', 'missingsummary');
            }
            if ($this->missingSummary && $this->section == 'new') {
                $wgOut->wrapWikiMsg('<div id="mw-missingcommentheader">$1</div>', 'missingcommentheader');
            }
            if ($this->hookError !== '') {
                $wgOut->addWikiText($this->hookError);
            }
            if (!$this->checkUnicodeCompliantBrowser()) {
                $wgOut->addWikiMsg('nonunicodebrowser');
            }
            if (isset($this->mArticle) && isset($this->mArticle->mRevision)) {
                // Let sysop know that this will make private content public if saved
                if (!$this->mArticle->mRevision->userCan(Revision::DELETED_TEXT)) {
                    $wgOut->addWikiMsg('rev-deleted-text-permission');
                } else {
                    if ($this->mArticle->mRevision->isDeleted(Revision::DELETED_TEXT)) {
                        $wgOut->addWikiMsg('rev-deleted-text-view');
                    }
                }
                if (!$this->mArticle->mRevision->isCurrent()) {
                    $this->mArticle->setOldSubtitle($this->mArticle->mRevision->getId());
                    $wgOut->addWikiMsg('editingold');
                }
            }
        }
        if (wfReadOnly()) {
            $wgOut->addHTML('<div id="mw-read-only-warning">' . wfMsgWikiHTML('readonlywarning') . '</div>');
        } elseif ($wgUser->isAnon() && $this->formtype != 'preview') {
            $wgOut->addHTML('<div id="mw-anon-edit-warning">' . wfMsgWikiHTML('anoneditwarning') . '</div>');
        } else {
            if ($this->isCssJsSubpage && $this->formtype != 'preview') {
                # Check the skin exists
                if ($this->isValidCssJsSubpage) {
                    $wgOut->addWikiMsg('usercssjsyoucanpreview');
                } else {
                    $wgOut->addWikiMsg('userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage());
                }
            }
        }
        if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
            # Show a warning if editing an interface message
            $wgOut->addWikiMsg('editinginterface');
        } elseif ($this->mTitle->isProtected('edit')) {
            # Is the title semi-protected?
            if ($this->mTitle->isSemiProtected()) {
                $noticeMsg = 'semiprotectedpagewarning';
            } else {
                # Then it must be protected based on static groups (regular)
                $noticeMsg = 'protectedpagewarning';
            }
            $wgOut->addWikiMsg($noticeMsg);
        }
        if ($this->mTitle->isCascadeProtected()) {
            # Is this page under cascading protection from some source pages?
            list($cascadeSources, ) = $this->mTitle->getCascadeProtectionSources();
            $notice = "\$1\n";
            if (count($cascadeSources) > 0) {
                # Explain, and list the titles responsible
                foreach ($cascadeSources as $page) {
                    $notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
                }
            }
            $wgOut->wrapWikiMsg($notice, array('cascadeprotectedwarning', count($cascadeSources)));
        }
        if (!$this->mTitle->exists() && $this->mTitle->getRestrictions('create') != array()) {
            $wgOut->addWikiMsg('titleprotectedwarning');
        }
        if ($this->kblength === false) {
            $this->kblength = (int) (strlen($this->textbox1) / 1024);
        }
        if ($this->tooBig || $this->kblength > $wgMaxArticleSize) {
            $wgOut->addWikiMsg('longpageerror', $wgLang->formatNum($this->kblength), $wgMaxArticleSize);
        } elseif ($this->kblength > 29) {
            $wgOut->addWikiMsg('longpagewarning', $wgLang->formatNum($this->kblength));
        }
        #need to parse the preview early so that we know which templates are used,
        #otherwise users with "show preview after edit box" will get a blank list
        if ($this->formtype == 'preview') {
            $previewOutput = $this->getPreviewText();
        }
        $rows = $wgUser->getIntOption('rows');
        $cols = $wgUser->getIntOption('cols');
        $ew = $wgUser->getOption('editwidth');
        if ($ew) {
            $ew = " style=\"width:100%\"";
        } else {
            $ew = '';
        }
        $q = 'action=submit';
        #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
        $action = $wgTitle->escapeLocalURL($q);
        $summary = wfMsg('summary');
        $subject = wfMsg('subject');
        $cancel = $sk->makeKnownLink($wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')), '', '', '', 'class="button secondary" id="edit_cancel_btn"');
        global $wgRightsText;
        if ($wgRightsText) {
            $copywarnMsg = array('copyrightwarning', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText);
        } else {
            $copywarnMsg = array('copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]');
        }
        // XXCHANGED
        if (!$wgUser->getOption('disablewarning')) {
            $wgOut->addHTML("<script language=\"JavaScript\">\n\t\t\t\tvar needToConfirm = false;\n\t\t\t\twindow.onbeforeunload = confirmExit;\n\t\t\t\tfunction confirmExit() {\n\t\t\t\t\tif (needToConfirm) \n\t\t\t\t\t\treturn \"" . wfMsg('all-changes-lost') . "\";\n\t\t\t\t}\n\t\t\t\t(function (\$) {\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('.mw-toolbar-editbutton, #weave_button, #easyimageupload_button').click(function () {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('textarea').focus(function () {\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\n\t\t\t\t</script>");
        }
        if ($wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage) {
            # prepare toolbar for edit buttons
            $toolbar = $this->getEditToolbar();
        } else {
            $toolbar = '';
        }
        // activate checkboxes if user wants them to be always active
        if (!$this->preview && !$this->diff) {
            # Sort out the "watch" checkbox
            if ($wgUser->getOption('watchdefault')) {
                # Watch all edits
                $this->watchthis = true;
            } elseif ($wgUser->getOption('watchcreations') && !$this->mTitle->exists()) {
                # Watch creations
                $this->watchthis = true;
            } elseif ($this->mTitle->userIsWatching()) {
                # Already watched
                $this->watchthis = true;
            }
            if ($wgUser->getOption('minordefault')) {
                $this->minoredit = true;
            }
        }
        $wgOut->addHTML($this->editFormPageTop);
        if ($wgUser->getOption('previewontop')) {
            if ('preview' == $this->formtype) {
                $this->showPreview($previewOutput);
            } else {
                $wgOut->addHTML('<div id="wikiPreview"></div>');
            }
            if ('diff' == $this->formtype) {
                $this->showDiff();
            }
        }
        //ADDED FOR WYSIWYG
        wfRunHooks('EditPage::showEditForm:initial2', array(&$this));
        $wgOut->addHTML($this->editFormTextTop);
        # if this is a comment, show a subject line at the top, which is also the edit summary.
        # Otherwise, show a summary field at the bottom
        $summarytext = htmlspecialchars($wgContLang->recodeForEdit($this->summary));
        # FIXME
        if ($this->section == 'new') {
            $commentsubject = "<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}</label></span>\n<div class='editOptions'>\n<input tabindex='1' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
            $editsummary = '';
            $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('subject-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : '';
            $summarypreview = '';
        } else {
            $commentsubject = '';
            $editsummary = "<span id='wpSummaryLabel'><label for='wpSummary'>{$summary}</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"{$summarytext}\" name='wpSummary' id='wpSummary' maxlength='200' size='60' /><br />";
            $summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg('summary-preview') . ':' . $sk->commentBlock($this->summary, $this->mTitle) . "</div>\n" : '';
            $subjectpreview = '';
        }
        # Set focus to the edit box on load, except on preview or diff, where it would interfere with the display
        if (!$this->preview && !$this->diff) {
            $wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()');
        }
        $templates = $this->preview || $this->section != '' ? $this->mPreviewTemplates : $this->mArticle->getUsedTemplates();
        $formattedtemplates = $sk->formatTemplates($templates, $this->preview, $this->section != '');
        global $wgUseMetadataEdit;
        if ($wgUseMetadataEdit) {
            $metadata = $this->mMetaData;
            $metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata));
            $top = wfMsgWikiHtml('metadata_help');
            $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
        } else {
            $metadata = "";
        }
        $hidden = '';
        $recreate = '';
        if ($this->deletedSinceEdit) {
            if ('save' != $this->formtype) {
                $wgOut->addWikiMsg('deletedwhileediting');
            } else {
                // Hide the toolbar and edit area, use can click preview to get it back
                // Add an confirmation checkbox and explanation.
                $toolbar = '';
                $hidden = 'type="hidden" style="display:none;"';
                $recreate = $wgOut->parse(wfMsg('confirmrecreate', $this->lastDelete->user_name, $this->lastDelete->log_comment));
                $recreate .= "<br /><input tabindex='1' type='checkbox' value='1' name='wpRecreate' id='wpRecreate' />" . "<label for='wpRecreate' title='" . wfMsg('tooltip-recreate') . "'>" . wfMsg('recreate') . "</label>";
            }
        }
        $tabindex = 2;
        $checkboxes = self::getCheckboxes($tabindex, $sk, array('minor' => $this->minoredit, 'watch' => $this->watchthis));
        $checkboxhtml = implode($checkboxes, "\n");
        $buttons = $this->getEditButtons($tabindex);
        $buttonshtml = implode($buttons, "\n");
        $safemodehtml = $this->checkUnicodeCompliantBrowser() ? '' : Xml::hidden('safemode', '1');
        $jsUrl = wfGetPad('/extensions/min/f/skins/common/clientscript.js?rev=') . WH_SITEREV;
        $wgOut->addHTML("<script type='text/javascript' src='{$jsUrl}'></script>");
        $wgOut->addHTML(<<<END
\t<script type='text/javascript'>
\t\tvar isGuided = false;
\t</script>

<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
<div class="minor_section">
{$toolbar}
END
);
        if (is_callable($formCallback)) {
            call_user_func_array($formCallback, array(&$wgOut));
        }
        wfRunHooks('EditPage::showEditForm:fields', array(&$this, &$wgOut));
        // Put these up at the top to ensure they aren't lost on early form submission
        $popbox = '';
        $popbox_div = '';
        global $wgLanguageCode;
        if (in_array($wgLanguageCode, array('en', 'de', 'es'))) {
            $popbox = PopBox::getPopBoxJSAdvanced() . PopBox::getPopBoxCSS();
            $popbox_div = PopBox::getPopBoxDiv();
        }
        // Put these up at the top to ensure they aren't lost on early form submission
        $wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n<input type='hidden' value=\"{$this->scrolltop}\" name=\"wpScrolltop\" id=\"wpScrolltop\" />\n {$popbox}\n");
        // XXCHANGED -- use CDN
        $wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
{$subjectpreview}
{$this->editFormTextBeforeContent}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}' class="adv_edit_box"
cols='{$cols}'{$ew} {$hidden}>
END
 . htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n {$popbox_div}\n\t</div>");
        $wgOut->addHTML($this->editFormTextAfterWarn);
        $wgOut->addHTML("<div class=\"minor_section\">\n{$metadata}\n{$editsummary}\n{$summarypreview}\n{$checkboxhtml}\n{$safemodehtml}\n");
        // XXCHANGED -- use CDN
        $wgOut->addHTML("<div class='editButtons'>{$cancel} {$buttonshtml}</div><!-- editButtons --><br />");
        $wgOut->addHtml('<div class="mw-editTools">');
        $wgOut->addWikiMsgArray('edittools', array(), array('content'));
        $wgOut->addHtml('</div>');
        $wgOut->wrapWikiMsg("<div id=\"editpage-copywarn\">\n\$1\n</div>", $copywarnMsg);
        $wgOut->addHTML("</div>");
        $wgOut->addHTML($this->editFormTextAfterTools);
        /**
         * To make it harder for someone to slip a user a page
         * which submits an edit form to the wiki without their
         * knowledge, a random token is associated with the login
         * session. If it's not passed back with the submission,
         * we won't save the page, or render user JavaScript and
         * CSS previews.
         *
         * For anon editors, who may not have a session, we just
         * include the constant suffix to prevent editing from
         * broken text-mangling proxies.
         */
        if (!$this instanceof EditPageWrapper) {
            $token = md5($wgUser->getName() . $this->mTitle->getArticleID() . time());
            wfTrackEditToken($wgUser, $token, $this->mTitle, $this instanceof EditPageWrapper);
            $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditTokenTrack\" />\n");
        }
        $token = htmlspecialchars($wgUser->editToken());
        $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n");
        //XXADDED patrol undone edits automatically
        global $wgRequest;
        if ($wgRequest->getVal('undo', null) != null) {
            $undo_id = $wgRequest->getVal('undo', null);
            $wgOut->addHTML("\n<input type='hidden' value=\"{$undo_id}\" name=\"wpUndoEdit\" />\n");
        }
        # If a blank edit summary was previously provided, and the appropriate
        # user preference is active, pass a hidden tag here. This will stop the
        # user being bounced back more than once in the event that a summary
        # is not required.
        if ($this->missingSummary) {
            $wgOut->addHTML("<input type=\"hidden\" name=\"wpIgnoreBlankSummary\" value=\"1\" />\n");
        }
        # For a bit more sophisticated detection of blank summaries, hash the
        # automatic one and pass that in a hidden field.
        $autosumm = $this->autoSumm ? $this->autoSumm : md5($this->summary);
        $wgOut->addHtml(wfHidden('wpAutoSummary', $autosumm));
        if ($this->isConflict) {
            $wgOut->wrapWikiMsg('==$1==', "yourdiff");
            $de = new DifferenceEngine($this->mTitle);
            $de->setText($this->textbox2, $this->textbox1);
            $de->showDiff(wfMsg("yourtext"), wfMsg("storedversion"));
            $wgOut->wrapWikiMsg('==$1==', "yourtext");
            $wgOut->addHTML("<textarea tabindex='6' id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}'>" . htmlspecialchars($this->safeUnicodeOutput($this->textbox2)) . "\n</textarea>");
        }
        $wgOut->addHTML($this->editFormTextBottom);
        $wgOut->addHTML("</form>\n");
        if (!$wgUser->getOption('previewontop')) {
            if ($this->formtype == 'preview') {
                $this->showPreview($previewOutput);
            } else {
                $wgOut->addHTML('<div id="wikiPreview"></div>');
            }
            if ($this->formtype == 'diff') {
                $this->showDiff();
            }
        }
        $wgOut->addHTML("</div> <!--edit page article_inner-->\n");
        if ($formattedtemplates) {
            $wgOut->addHTML("<div class='templatesUsed minor_section'>{$formattedtemplates}</div>");
        }
        wfProfileOut($fname);
    }