</p> <?php } ?> <p> <label for="wpContactWikiName"><?php echo wfMsg('specialcontact-label-bad-ad-link'); ?> </label> <input name="wpContactWikiName" /> </p> <p> <label for="wpDescription"><?php echo wfmsg('specialcontact-label-bad-ad-description'); ?> </label> <textarea name="wpDescription"></textarea> </p> <p> <label for="wpScreenshot1"><?php echo wfMsg('specialcontact-label-screenshot'); ?> </label> <input id="wpScreenshot1" name="wpScreenshot[]" type="file" accept="image/*" /> </p> <p class="additionalScreenShot"> <label for="wpScreenshot2"><?php
/** * The edit form is self-submitting, so that when things like * preview and edit conflicts occur, we get the same form back * with the extra stuff added. Only when the final submission * is made and all is well do we actually save and redirect to * the newly-edited page. * * @param string $formtype Type of form either : save, initial, diff or preview * @param bool $firsttime True to load form data from db */ function editForm($formtype, $firsttime = false) { global $wgOut, $wgUser; global $wgLang, $wgContLang, $wgParser, $wgTitle; global $wgAllowAnonymousMinor, $wgRequest; global $wgSpamRegex, $wgFilterCallback; $sk = $wgUser->getSkin(); $isConflict = false; // css / js subpages of user pages get a special treatment $isCssJsSubpage = $wgTitle->isCssJsSubpage(); if (!$this->mTitle->getArticleID()) { # new article $editintro = $wgRequest->getText('editintro'); $addstandardintro = true; if ($editintro) { $introtitle = Title::newFromText($editintro); if (isset($introtitle) && $introtitle->userCanRead()) { $rev = Revision::newFromTitle($introtitle); if ($rev) { $wgOut->addWikiText($rev->getText()); $addstandardintro = false; } } } if ($addstandardintro) { $wgOut->addWikiText(wfmsg('newarticletext')); } } if ($this->mTitle->isTalkPage()) { $wgOut->addWikiText(wfmsg('talkpagetext')); } # Attempt submission here. This will check for edit conflicts, # and redundantly check for locked database, blocked IPs, etc. # that edit() already checked just in case someone tries to sneak # in the back door with a hand-edited submission URL. if ('save' == $formtype) { # Reintegrate metadata if ($this->mMetaData != '') { $this->textbox1 .= "\n" . $this->mMetaData; } $this->mMetaData = ''; # Check for spam if ($wgSpamRegex && preg_match($wgSpamRegex, $this->textbox1, $matches)) { $this->spamPage($matches[0]); return; } if ($wgFilterCallback && $wgFilterCallback($this->mTitle, $this->textbox1, $this->section)) { # Error messages or other handling should be performed by the filter function return; } if ($wgUser->isBlockedFrom($this->mTitle, false)) { # Check block state against master, thus 'false'. $this->blockedIPpage(); return; } if (!$wgUser->isAllowed('edit')) { if ($wgUser->isAnon()) { $this->userNotLoggedInPage(); return; } else { $wgOut->readOnlyPage(); return; } } if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } if ($wgUser->pingLimiter()) { $wgOut->rateLimited(); return; } # If article is new, insert it. $aid = $this->mTitle->getArticleID(GAID_FOR_UPDATE); if (0 == $aid) { # Don't save a new article if it's blank. if ('' == $this->textbox1 || wfMsg('newarticletext') == $this->textbox1) { $wgOut->redirect($this->mTitle->getFullURL()); return; } if (wfRunHooks('ArticleSave', array(&$this->mArticle, &$wgUser, &$this->textbox1, &$this->summary, &$this->minoredit, &$this->watchthis, NULL))) { $isComment = $this->section == 'new'; $this->mArticle->insertNewArticle($this->textbox1, $this->summary, $this->minoredit, $this->watchthis, false, $isComment); wfRunHooks('ArticleSaveComplete', array(&$this->mArticle, &$wgUser, $this->textbox1, $this->summary, $this->minoredit, $this->watchthis, NULL)); } return; } # Article exists. Check for edit conflict. $this->mArticle->clear(); # Force reload of dates, etc. $this->mArticle->forUpdate(true); # Lock the article if ($this->section != 'new' && $this->mArticle->getTimestamp() != $this->edittime) { $isConflict = true; } $userid = $wgUser->getID(); if ($isConflict) { wfDebug("EditPage::editForm conflict! getting section '{$this->section}' for time '{$this->edittime}' (article time '" . $this->mArticle->getTimestamp() . "'\n"); $text = $this->mArticle->getTextOfLastEditWithSectionReplacedOrAdded($this->section, $this->textbox1, $this->summary, $this->edittime); } else { wfDebug("EditPage::editForm getting section '{$this->section}'\n"); $text = $this->mArticle->getTextOfLastEditWithSectionReplacedOrAdded($this->section, $this->textbox1, $this->summary); } # Suppress edit conflict with self if (0 != $userid && $this->mArticle->getUser() == $userid) { wfDebug("Suppressing edit conflict, same user.\n"); $isConflict = false; } else { # switch from section editing to normal editing in edit conflict if ($isConflict) { # Attempt merge if ($this->mergeChangesInto($text)) { // Successful merge! Maybe we should tell the user the good news? $isConflict = false; wfDebug("Suppressing edit conflict, successful merge.\n"); } else { $this->section = ''; $this->textbox1 = $text; wfDebug("Keeping edit conflict, failed merge.\n"); } } } if (!$isConflict) { # All's well $sectionanchor = ''; if ($this->section == 'new') { if ($this->summary != '') { $sectionanchor = $this->sectionAnchor($this->summary); } } elseif ($this->section != '') { # Try to get a section anchor from the section source, redirect to edited section if header found # XXX: might be better to integrate this into Article::getTextOfLastEditWithSectionReplacedOrAdded # for duplicate heading checking and maybe parsing $hasmatch = preg_match("/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches); # we can't deal with anchors, includes, html etc in the header for now, # headline would need to be parsed to improve this #if($hasmatch and strlen($matches[2]) > 0 and !preg_match( "/[\\['{<>]/", $matches[2])) { if ($hasmatch and strlen($matches[2]) > 0) { $sectionanchor = $this->sectionAnchor($matches[2]); } } // Save errors may fall down to the edit form, but we've now // merged the section into full text. Clear the section field // so that later submission of conflict forms won't try to // replace that into a duplicated mess. $this->textbox1 = $text; $this->section = ''; if (wfRunHooks('ArticleSave', array(&$this->mArticle, &$wgUser, &$text, &$this->summary, &$this->minoredit, &$this->watchthis, &$sectionanchor))) { # update the article here if ($this->mArticle->updateArticle($text, $this->summary, $this->minoredit, $this->watchthis, '', $sectionanchor)) { wfRunHooks('ArticleSaveComplete', array(&$this->mArticle, &$wgUser, $text, $this->summary, $this->minoredit, $this->watchthis, $sectionanchor)); return; } else { $isConflict = true; } } } } # First time through: get contents, set time for conflict # checking, etc. if ('initial' == $formtype || $firsttime) { $this->edittime = $this->mArticle->getTimestamp(); $this->textbox1 = $this->mArticle->getContent(true); $this->summary = ''; $this->proxyCheck(); } $wgOut->setRobotpolicy('noindex,nofollow'); # Enabled article-related sidebar, toplinks, etc. $wgOut->setArticleRelated(true); if ($isConflict) { $s = wfMsg('editconflict', $this->mTitle->getPrefixedText()); $wgOut->setPageTitle($s); $wgOut->addWikiText(wfMsg('explainconflict')); $this->textbox2 = $this->textbox1; $this->textbox1 = $this->mArticle->getContent(true); $this->edittime = $this->mArticle->getTimestamp(); } else { if ($this->section != '') { if ($this->section == 'new') { $s = wfMsg('editingcomment', $this->mTitle->getPrefixedText()); } else { $s = wfMsg('editingsection', $this->mTitle->getPrefixedText()); if (!$this->preview && !$this->diff) { preg_match("/^(=+)(.+)\\1/mi", $this->textbox1, $matches); if (!empty($matches[2])) { $this->summary = "/* " . trim($matches[2]) . " */ "; } } } } else { $s = wfMsg('editing', $this->mTitle->getPrefixedText()); } $wgOut->setPageTitle($s); if (!$this->checkUnicodeCompliantBrowser()) { $this->mArticle->setOldSubtitle(); $wgOut->addWikiText(wfMsg('nonunicodebrowser')); } if (isset($this->mArticle) && isset($this->mArticle->mRevision) && !$this->mArticle->mRevision->isCurrent()) { $this->mArticle->setOldSubtitle(); $wgOut->addWikiText(wfMsg('editingold')); } } if (wfReadOnly()) { $wgOut->addWikiText(wfMsg('readonlywarning')); } else { if ($isCssJsSubpage and 'preview' != $formtype) { $wgOut->addWikiText(wfMsg('usercssjsyoucanpreview')); } } if ($this->mTitle->isProtected('edit')) { $wgOut->addWikiText(wfMsg('protectedpagewarning')); } $kblength = (int) (strlen($this->textbox1) / 1024); if ($kblength > 29) { $wgOut->addWikiText(wfMsg('longpagewarning', $wgLang->formatNum($kblength))); } $rows = $wgUser->getOption('rows'); $cols = $wgUser->getOption('cols'); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } $q = 'action=submit'; #if ( "no" == $redirect ) { $q .= "&redirect=no"; } $action = $this->mTitle->escapeLocalURL($q); $summary = wfMsg('summary'); $subject = wfMsg('subject'); $minor = wfMsg('minoredit'); $watchthis = wfMsg('watchthis'); $save = wfMsg('savearticle'); $prev = wfMsg('showpreview'); $diff = wfMsg('showdiff'); $cancel = $sk->makeKnownLink($this->mTitle->getPrefixedText(), wfMsg('cancel')); $edithelpurl = $sk->makeInternalOrExternalUrl(wfMsg('edithelppage')); $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow')); global $wgRightsText; $copywarn = "<div id=\"editpage-copywarn\">\n" . wfMsg($wgRightsText ? 'copyrightwarning' : 'copyrightwarning2', '[[' . wfMsgForContent('copyrightpage') . ']]', $wgRightsText) . "\n</div>"; # Patch for FCKeditor global $wgUseEditor, $wgEditorToken; if ($wgUseEditor || isset($wgEditorToken) && eregi($wgEditorToken, $this->textbox1, $eregi_result)) { $toolbar = ''; } elseif ($wgUser->getOption('showtoolbar') and !$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) { if ($wgUser->getOption('watchdefault')) { $this->watchthis = true; } if ($wgUser->getOption('minordefault')) { $this->minoredit = true; } // activate checkbox also if user is already watching the page, // require wpWatchthis to be unset so that second condition is not // checked unnecessarily if (!$this->watchthis && $this->mTitle->userIsWatching()) { $this->watchthis = true; } } $minoredithtml = ''; if ($wgUser->isLoggedIn() || $wgAllowAnonymousMinor) { $minoredithtml = "<input tabindex='3' type='checkbox' value='1' name='wpMinoredit'" . ($this->minoredit ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-minoredit') . "' id='wpMinoredit' />" . "<label for='wpMinoredit' title='" . wfMsg('tooltip-minoredit') . "'>{$minor}</label>"; } $watchhtml = ''; if ($wgUser->isLoggedIn()) { $watchhtml = "<input tabindex='4' type='checkbox' name='wpWatchthis'" . ($this->watchthis ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-watch') . "' id='wpWatchthis' />" . "<label for='wpWatchthis' title='" . wfMsg('tooltip-watch') . "'>{$watchthis}</label>"; } $checkboxhtml = $minoredithtml . $watchhtml . '<br />'; $wgOut->addHTML('<div id="wikiPreview">'); if ('preview' == $formtype) { $previewOutput = $this->getPreviewText($isConflict, $isCssJsSubpage); if ($wgUser->getOption('previewontop')) { $wgOut->addHTML($previewOutput); if ($this->mTitle->getNamespace() == NS_CATEGORY) { $this->mArticle->closeShowCategory(); } $wgOut->addHTML("<br style=\"clear:both;\" />\n"); } } $wgOut->addHTML('</div>'); if ('diff' == $formtype) { if ($wgUser->getOption('previewontop')) { $wgOut->addHTML($this->getDiff()); } } # 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 = "{$subject}: <input tabindex='1' type='text' value=\"{$summarytext}\" name=\"wpSummary\" maxlength='200' size='60' /><br />"; $editsummary = ''; } else { $commentsubject = ''; $editsummary = "{$summary}: <input tabindex='2' type='text' value=\"{$summarytext}\" name=\"wpSummary\" maxlength='200' size='60' /><br />"; } if (!$this->preview && !$this->diff) { # Don't select the edit box on preview; this interferes with seeing what's going on. $wgOut->setOnloadHandler('document.editform.wpTextbox1.focus()'); } # Prepare a list of templates used by this page $templates = ''; $articleTemplates = $this->mArticle->getUsedTemplates(); if (count($articleTemplates) > 0) { $templates = '<br />' . wfMsg('templatesused') . '<ul>'; foreach ($articleTemplates as $tpl) { if ($titleObj = Title::makeTitle(NS_TEMPLATE, $tpl)) { $templates .= '<li>' . $sk->makeLinkObj($titleObj) . '</li>'; } } $templates .= '</ul>'; } global $wgLivePreview, $wgStylePath; /** * Live Preview lets us fetch rendered preview page content and * add it to the page without refreshing the whole page. * Set up the button for it; if not supported by the browser * it will fall through to the normal form submission method. */ if ($wgLivePreview) { global $wgJsMimeType; $wgOut->addHTML('<script type="' . $wgJsMimeType . '" src="' . htmlspecialchars($wgStylePath . '/common/preview.js') . '"></script>' . "\n"); $liveAction = $wgTitle->getLocalUrl('action=submit&wpPreview=true&live=true'); $liveOnclick = 'onclick="return !livePreview(' . 'getElementById(\'wikiPreview\'),' . 'editform.wpTextbox1.value,' . htmlspecialchars('"' . $liveAction . '"') . ')"'; } else { $liveOnclick = ''; } global $wgUseMetadataEdit; if ($wgUseMetadataEdit) { $metadata = $this->mMetaData; $metadata = htmlspecialchars($wgContLang->recodeForEdit($metadata)); $helppage = Title::newFromText(wfmsg("metadata_page")); $top = str_replace("\$1", $helppage->getInternalURL(), wfmsg("metadata")); $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>"; } else { $metadata = ""; } $safemodehtml = $this->checkUnicodeCompliantBrowser() ? "" : "<input type='hidden' name=\"safemode\" value='1' />\n"; # Patch for FCKeditor global $wgUseEditor, $wgEditorDir, $wgEditorToken, $wgScriptPath, $wgEditorToolbarSet, $wgEditorHeight; $tbox = $wgContLang->recodeForEdit($this->textbox1); if ($wgUseEditor || isset($wgEditorToken) && eregi($wgEditorToken, $tbox, $eregi_result)) { $wgUseEditor = true; $wgOut->addHTML("\n{$toolbar}\n<form id=\"editform\" name=\"editform\" method=\"post\" action=\"{$action}\"\nenctype=\"multipart/form-data\">\n{$commentsubject}"); require_once "{$wgEditorDir}/fckeditor.php"; $oFCKeditor = new FCKeditor('wpTextbox1'); $oFCKeditor->BasePath = $wgScriptPath . "/" . $wgEditorDir . "/"; $oFCKeditor->Value = $tbox; $oFCKeditor->ToolbarSet = $wgEditorToolbarSet; $oFCKeditor->Height = $wgEditorHeight; $oFCKeditor->Width = '100%'; $wgOut->addHTML($oFCKeditor->CreateHtml()); /* <textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}' cols='{$cols}'{$ew}> END . htmlspecialchars( $wgContLang->recodeForEdit( $this->textbox1 ) ) . " </textarea> */ $wgOut->addHTML("\n{$metadata}\n<br />{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"" . wfMsg('accesskey-save') . "\"" . " title=\"" . wfMsg('tooltip-save') . "\"/>\n<input tabindex='6' id='wpPreview' type='submit' {$liveOnclick} value=\"{$prev}\" name=\"wpPreview\" accesskey=\"" . wfMsg('accesskey-preview') . "\"" . " title=\"" . wfMsg('tooltip-preview') . "\"/>\n<input tabindex='7' id='wpDiff' type='submit' value=\"{$diff}\" name=\"wpDiff\" accesskey=\"" . wfMsg('accesskey-diff') . "\"" . " title=\"" . wfMsg('tooltip-diff') . "\"/>\n<em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}"); } else { # end patch $wgOut->addHTML(<<<END {$toolbar} <form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data"> {$commentsubject} <textarea tabindex='1' accesskey="," name="wpTextbox1" rows='{$rows}' cols='{$cols}'{$ew}> END . htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n{$metadata}\n<br />{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n<input tabindex='5' id='wpSave' type='submit' value=\"{$save}\" name=\"wpSave\" accesskey=\"" . wfMsg('accesskey-save') . "\"" . " title=\"" . wfMsg('tooltip-save') . "\"/>\n<input tabindex='6' id='wpPreview' type='submit' {$liveOnclick} value=\"{$prev}\" name=\"wpPreview\" accesskey=\"" . wfMsg('accesskey-preview') . "\"" . " title=\"" . wfMsg('tooltip-preview') . "\"/>\n<input tabindex='7' id='wpDiff' type='submit' value=\"{$diff}\" name=\"wpDiff\" accesskey=\"" . wfMsg('accesskey-diff') . "\"" . " title=\"" . wfMsg('tooltip-diff') . "\"/>\n<em>{$cancel}</em> | <em>{$edithelp}</em>{$templates}"); } $wgOut->addWikiText($copywarn); $wgOut->addHTML("\n<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n"); if ($wgUser->isLoggedIn()) { /** * 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. */ $token = htmlspecialchars($wgUser->editToken()); $wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n"); } if ($isConflict) { require_once "DifferenceEngine.php"; $wgOut->addWikiText('==' . wfMsg("yourdiff") . '=='); DifferenceEngine::showDiff($this->textbox2, $this->textbox1, wfMsg("yourtext"), wfMsg("storedversion")); $wgOut->addWikiText('==' . wfMsg("yourtext") . '=='); $wgOut->addHTML("<textarea tabindex=6 id='wpTextbox2' name=\"wpTextbox2\" rows='{$rows}' cols='{$cols}' wrap='virtual'>" . htmlspecialchars($this->safeUnicodeOutput($this->textbox2)) . "\n</textarea>"); } $wgOut->addHTML("</form>\n"); if ($formtype == 'preview' && !$wgUser->getOption('previewontop')) { $wgOut->addHTML('<div id="wikiPreview">' . $previewOutput . '</div>'); } if ($formtype == 'diff' && !$wgUser->getOption('previewontop')) { #$wgOut->addHTML( '<div id="wikiPreview">' . $difftext . '</div>' ); $wgOut->addHTML($this->getDiff()); } }
/** * Note that getContent/loadContent do not follow redirects anymore. * If you need to fetch redirectable content easily, try * the shortcut in Article::followContent() * FIXME * @todo There are still side-effects in this! * In general, you should use the Revision class, not Article, * to fetch text for purposes other than page views. * * @return Return the text of this revision */ function getContent() { global $wgRequest, $wgUser, $wgOut; wfProfileIn(__METHOD__); if (0 == $this->getID()) { wfProfileOut(__METHOD__); $wgOut->setRobotpolicy('noindex,nofollow'); if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) { $ret = wfMsgWeirdKey($this->mTitle->getText()); } else { // WERELATE - added namespace check $ret = wfmsg('noarticletext' . $this->mTitle->getNamespace()); if (strpos($ret, 'noarticletext') !== false) { $ret = wfMsg($wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon'); } } return "<div class='noarticletext'>{$ret}</div>"; } else { $this->loadContent(); wfProfileOut(__METHOD__); return $this->mContent; } }
/** * constructor */ function wfSpecialGotoPageOld() { global $wgOut, $wgRequest, $wgUser; $error = ''; $titleList = ''; $addPersonFamily = false; $title = null; $namespace = $wgRequest->getVal('namespace'); $titleText = $wgRequest->getVal('pagetitle'); if ($namespace == 'person') { $addPersonFamily = true; $titleText = wrConstructName($wgRequest->getVal('personGiven'), $wgRequest->getVal('personSurname')); if ($titleText) { $title = Title::newFromText($titleText, NS_PERSON); } } else { if ($namespace == 'family') { $addPersonFamily = true; $husbandText = wrConstructName($wgRequest->getVal('husbandGiven'), $wgRequest->getVal('husbandSurname')); $wifeText = wrConstructName($wgRequest->getVal('wifeGiven'), $wgRequest->getVal('wifeSurname')); $titleText = ''; if ($husbandText && $wifeText) { $titleText = $husbandText . ' and ' . $wifeText; } else { if ($husbandText) { $titleText = $husbandText . ' and Unknown'; } else { if ($wifeText) { $titleText = 'Unknown and ' . $wifeText; } } } if ($titleText) { $title = Title::newFromText($titleText, NS_FAMILY); } } else { if ($titleText) { $title = Title::newFromText($titleText, $namespace); if (is_null($title)) { $error = wfmsg('invalidtitle'); } else { if ($wgRequest->getVal('add') && ($title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK)) { // user must exist if we're adding a page for them $pos = strpos($title->getText(), '/'); if ($pos !== false) { $userName = substr($title->getText(), 0, $pos); } else { $userName = $title->getText(); } if (!User::isIP($userName) && User::idFromName($userName) == 0) { $error = 'User does not exist. Is the name spelled correctly?'; $title = null; } } } } } } if ($title) { if ($wgRequest->getVal('goto')) { if ($title->getNamespace() == NS_SPECIAL || $title->exists()) { $wgOut->redirect($title->getFullURL()); return; } else { $error = 'Title not found.'; $skin = $wgUser->getSkin(); $n = 0; $moreLink = false; $dbr =& wfGetDB(DB_SLAVE); $res = $dbr->select('page', array('page_title', 'page_namespace', 'page_is_redirect'), 'page_namespace=' . $title->getNamespace() . ' and page_title like "' . $title->getDBkey() . '%"', 'wfSpecialGotoPageOld', array('LIMIT' => 31, 'ORDER BY' => 'page_title')); while ($row = $dbr->fetchObject($res)) { if ($n == 30) { $moreLink = true; break; } if (!$titleList) { $titleList = '<h2>Titles starting with ' . $titleText . '</h2><table style="background: inherit;" border="0" width="100%">'; } $t = Title::makeTitle($row->page_namespace, $row->page_title); if ($t) { $link = ($row->page_is_redirect ? '<div class="allpagesredirect">' : '') . $skin->makeKnownLinkObj($t, htmlspecialchars($t->getPrefixedText())) . ($row->page_is_redirect ? '</div>' : ''); } else { $link = '[[' . htmlspecialchars($row->page_title) . ']]'; } if ($n % 3 == 0) { $titleList .= '<tr>'; } $titleList .= "<td>{$link}</td>"; $n++; if ($n % 3 == 0) { $titleList .= '</tr>'; } } $dbr->freeResult($res); if ($n % 3 != 0) { $titleList .= '</tr>'; } if ($titleList) { $titleList .= '</table>'; $error .= " All pages starting with {$titleText} are listed below."; } if ($moreLink) { $t = Title::makeTitle(NS_SPECIAL, 'Allpages'); $titleList .= '<p>More not shown (' . $skin->makeKnownLinkObj($t, 'show all', "from={$title->getText()}&namespace={$title->getNamespace()}") . ')</p>'; } } } else { if ($wgRequest->getVal('add')) { // PERSON and FAMILY pages must have a unique id if (($title->getNamespace() == NS_PERSON || $title->getNamespace() == NS_FAMILY) && !StructuredData::titleStringHasId($title->getText())) { // standardize name case and append a unique id $title = StructuredData::appendUniqueId(Title::newFromText((string) StructuredData::standardizeNameCase($title->getText()), $title->getNamespace())); } if ($title != null) { $wgOut->redirect($title->getFullURL('action=edit')); } return; } } } // set up page $wgOut->setPagetitle('Go to / Add page'); $wgOut->setArticleRelated(false); $wgOut->setRobotpolicy('noindex,nofollow'); if ($error) { $wgOut->addHTML("<p><font color=red>{$error}</font></p>"); } $wgOut->addHTML("<center>" . getGotoPageForm($namespace, $titleText) . "</center>"); if (!$addPersonFamily) { if ($titleList) { $wgOut->addHTML($titleList); } else { $wgOut->addWikiText("\n\n" . wfmsg('gotopageend')); } } }
public function getRedirTitleOrError() { global $wgUser; $title = null; $error = ''; if ($this->confirm) { if ($this->namespace == NS_IMAGE) { $error = 'Add images by selecting Image from the Add menu'; } else { if ($this->namespace == NS_PERSON) { $title = StructuredData::constructPersonTitle($this->givenname, $this->surname); } else { if ($this->namespace == NS_FAMILY) { $title = StructuredData::constructFamilyTitle($this->husbandGivenname, $this->husbandSurname, $this->wifeGivenname, $this->wifeSurname); } else { if ($this->namespace == NS_SOURCE) { $title = StructuredData::constructSourceTitle($this->sourceType, $this->sourceTitle, $this->author, $this->place, $this->placeIssued, $this->publisher); if (!$title) { $error = 'Please fill in the Source type, Title, and for government / church records: Place covered'; } } else { if ($this->namespace == NS_PLACE) { if (!$this->locatedIn && !$wgUser->isAllowed('patrol')) { $error = 'Please enter the place in which this place is located.'; } else { $title = StructuredData::constructPlaceTitle($this->placeName, $this->locatedIn); } } else { $title = Title::newFromText($this->titleText, $this->namespace); } } } } if (!$title && !$error) { $error = wfmsg('invalidtitle'); } } } return array($title, $error); }
/** * Show the standard favoritelist * * @param $output OutputPage * @param $user User */ private function showNormalForm($output, $user) { global $wgOut; $skin = $user->getSkin(); if ($this->countFavoritelist($user) > 0) { $form = $this->buildRemoveList($user, $skin); $output .= $form; return $output; } else { $output = wfmsg('nofavoritelist'); return $output; } }
function showRevision($revision) { global $wgOut; $dbr = wfGetDB(DB_SLAVE); $result = $this->getRevisions($dbr, array('hidden_rev_id' => $revision)); while ($row = $dbr->fetchObject($result)) { $info = $this->listRow($row); $list = $this->revisionInfo($row); $rev = new Revision($row); $text = $rev->getText(); $wgOut->addHtml("<ul>" . $info . "</ul>\n" . $list); if ($text === false) { $wgOut->addWikiText(wfmsg('hiderevision-error-missing')); } else { $wgOut->addHtml("<div>" . Xml::openElement('textarea', array('cols' => 80, 'rows' => 25, 'wrap' => 'virtual', 'readonly' => 'readonly')) . htmlspecialchars($text) . Xml::closeElement('textarea') . "</div>"); } } $dbr->freeResult($result); }
/** * Revert a modification */ function rollback() { global $wgUser, $wgOut, $wgRequest; $fname = 'Article::rollback'; if (!$wgUser->isAllowed('rollback')) { $wgOut->sysopRequired(); return; } if (wfReadOnly()) { $wgOut->readOnlyPage($this->getContent(true)); return; } if (!$wgUser->matchEditToken($wgRequest->getVal('token'), array($this->mTitle->getPrefixedText(), $wgRequest->getVal('from')))) { $wgOut->setPageTitle(wfMsg('rollbackfailed')); $wgOut->addWikiText(wfMsg('sessionfailure')); return; } $dbw =& wfGetDB(DB_MASTER); # Enhanced rollback, marks edits rc_bot=1 $bot = $wgRequest->getBool('bot'); # Replace all this user's current edits with the next one down $tt = $this->mTitle->getDBKey(); $n = $this->mTitle->getNamespace(); # Get the last editor, lock table exclusively $dbw->begin(); $current = Revision::newFromTitle($this->mTitle); if (is_null($current)) { # Something wrong... no page? $dbw->rollback(); $wgOut->addHTML(wfMsg('notanarticle')); return; } $from = str_replace('_', ' ', $wgRequest->getVal('from')); if ($from != $current->getUserText()) { $wgOut->setPageTitle(wfmsg('rollbackfailed')); $wgOut->addWikiText(wfMsg('alreadyrolled', htmlspecialchars($this->mTitle->getPrefixedText()), htmlspecialchars($from), htmlspecialchars($current->getUserText()))); if ($current->getComment() != '') { $wgOut->addHTML(wfMsg('editcomment', htmlspecialchars($current->getComment()))); } return; } # Get the last edit not by this guy $user = IntVal($current->getUser()); $user_text = $dbw->addQuotes($current->getUserText()); $s = $dbw->selectRow('revision', array('rev_id', 'rev_timestamp'), array('rev_page' => $current->getPage(), "rev_user <> {$user} OR rev_user_text <> {$user_text}"), $fname, array('USE INDEX' => 'page_timestamp', 'ORDER BY' => 'rev_timestamp DESC')); if ($s === false) { # Something wrong $dbw->rollback(); $wgOut->setPageTitle(wfMsg('rollbackfailed')); $wgOut->addHTML(wfMsg('cantrollback')); return; } if ($bot) { # Mark all reverted edits as bot $dbw->update('recentchanges', array('rc_bot' => 1), array('rc_cur_id' => $current->getPage(), 'rc_user_text' => $current->getUserText(), "rc_timestamp > '{$s->rev_timestamp}'"), $fname); } # Save it! $target = Revision::newFromId($s->rev_id); $newcomment = wfMsgForContent('revertpage', $target->getUserText(), $from); $wgOut->setPagetitle(wfMsg('actioncomplete')); $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->addHTML('<h2>' . htmlspecialchars($newcomment) . "</h2>\n<hr />\n"); $this->updateArticle($target->getText(), $newcomment, 1, $this->mTitle->userIsWatching(), $bot); Article::onArticleEdit($this->mTitle); $dbw->commit(); $wgOut->returnToMain(false); }
?> <br /> </li></ul> <input type="hidden" name="users" value="<?php echo htmlspecialchars($request->getUsers()); ?> " /> <input type="hidden" name="time" value="<?php echo htmlspecialchars($request->getTime()); ?> " /> <input type="hidden" name="priority" value="<?php echo htmlspecialchars($request->getPriority()); ?> " /> <input type="hidden" name="confirm" value="1" /> <input type="submit" value="<?php echo wfMsg('userrollback-form-confirm'); ?> " /> <input type="submit" class="secondary" name="back" value="<?php echo wfmsg('userrollback-form-back'); ?> " /> <?php } ?> </form>
echo $encEmail; ?> " /> </p> <p> <label for="wpContactWikiName"><?php echo wfMsg('specialcontact-wikiname'); ?> </label> <input name="wpContactWikiName" /> </p> <p> <label for="wpDescription"><?php echo wfmsg('specialcontact-label-account-issue-description'); ?> </label> <textarea name="wpDescription"></textarea> </p> <p> <label for="wpScreenshot1"><?php echo wfMsg('specialcontact-label-screenshot'); ?> </label> <input id="wpScreenshot1" name="wpScreenshot[]" type="file" accept="image/*" /> </p> <p class="additionalScreenShot"> <label for="wpScreenshot2"><?php
/** * This is the function that gets called for "action=edit". It * sets up various member variables, then passes execution to * another function, usually showEditForm() * * The edit form is self-submitting, so that when things like * preview and edit conflicts occur, we get the same form back * with the extra stuff added. Only when the final submission * is made and all is well do we actually save and redirect to * the newly-edited page. */ function edit() { global $wgOut, $wgUser, $wgRequest, $wgTitle; global $wgEmailConfirmToEdit; if (!wfRunHooks('AlternateEdit', array(&$this))) { return; } $fname = 'EditPage::edit'; wfProfileIn($fname); wfDebug("{$fname}: enter\n"); // this is not an article $wgOut->setArticleFlag(false); $this->importFormData($wgRequest); $this->firsttime = false; if ($this->live) { $this->livePreview(); wfProfileOut($fname); return; } if (!$this->mTitle->userCanEdit()) { wfDebug("{$fname}: user can't edit\n"); $wgOut->readOnlyPage($this->getContent(), true); wfProfileOut($fname); return; } wfDebug("{$fname}: Checking blocks\n"); if (!$this->preview && !$this->diff && $wgUser->isBlockedFrom($this->mTitle, !$this->save)) { # When previewing, don't check blocked state - will get caught at save time. # Also, check when starting edition is done against slave to improve performance. wfDebug("{$fname}: user is blocked\n"); $this->blockedPage(); wfProfileOut($fname); return; } if (!$wgUser->isAllowed('edit')) { if ($wgUser->isAnon()) { wfDebug("{$fname}: user must log in\n"); $this->userNotLoggedInPage(); wfProfileOut($fname); return; } else { wfDebug("{$fname}: read-only page\n"); $wgOut->readOnlyPage($this->getContent(), true); wfProfileOut($fname); return; } } if ($wgEmailConfirmToEdit && !$wgUser->isEmailConfirmed()) { wfDebug("{$fname}: user must confirm e-mail address\n"); $this->userNotConfirmedPage(); wfProfileOut($fname); return; } if (!$this->mTitle->userCanCreate() && !$this->mTitle->exists()) { wfDebug("{$fname}: no create permission\n"); $this->noCreatePermission(); wfProfileOut($fname); return; } if (wfReadOnly()) { wfDebug("{$fname}: read-only mode is engaged\n"); if ($this->save || $this->preview) { $this->formtype = 'preview'; } else { if ($this->diff) { $this->formtype = 'diff'; } else { $wgOut->readOnlyPage($this->getContent()); wfProfileOut($fname); return; } } } else { if ($this->save) { $this->formtype = 'save'; } else { if ($this->preview) { $this->formtype = 'preview'; } else { if ($this->diff) { $this->formtype = 'diff'; } else { # First time through $this->firsttime = true; if ($this->previewOnOpen()) { $this->formtype = 'preview'; } else { $this->extractMetaDataFromArticle(); $this->formtype = 'initial'; } } } } } wfProfileIn("{$fname}-business-end"); $this->isConflict = false; // css / js subpages of user pages get a special treatment $this->isCssJsSubpage = $wgTitle->isCssJsSubpage(); $this->isValidCssJsSubpage = $wgTitle->isValidCssJsSubpage(); /* Notice that we can't use isDeleted, because it returns true if article is ever deleted * no matter it's current state */ $this->deletedSinceEdit = false; if ($this->edittime != '') { /* Note that we rely on logging table, which hasn't been always there, * but that doesn't matter, because this only applies to brand new * deletes. This is done on every preview and save request. Move it further down * to only perform it on saves */ if ($this->mTitle->isDeleted()) { $this->lastDelete = $this->getLastDelete(); if (!is_null($this->lastDelete)) { $deletetime = $this->lastDelete->log_timestamp; if ($deletetime - $this->starttime > 0) { $this->deletedSinceEdit = true; } } } } if (!$this->mTitle->getArticleID() && ('initial' == $this->formtype || $this->firsttime)) { # new article $this->showIntro(); } if ($this->mTitle->isTalkPage()) { $wgOut->addWikiText(wfMsg('talkpagetext')); } // WERELATE - added $editHelpText = wfmsg('edithelptext' . $this->mTitle->getNamespace()); if (strpos($editHelpText, 'edithelptext') !== false) { $editHelpText = wfmsg('edithelptext'); } $wgOut->addWikiText($editHelpText); # Attempt submission here. This will check for edit conflicts, # and redundantly check for locked database, blocked IPs, etc. # that edit() already checked just in case someone tries to sneak # in the back door with a hand-edited submission URL. if ('save' == $this->formtype) { if (!$this->attemptSave()) { wfProfileOut("{$fname}-business-end"); wfProfileOut($fname); return; } } # First time through: get contents, set time for conflict # checking, etc. if ('initial' == $this->formtype || $this->firsttime) { $this->initialiseForm(); if (!$this->mTitle->getArticleId()) { wfRunHooks('EditFormPreloadText', array(&$this->textbox1, &$this->mTitle)); } } $this->showEditForm(); wfProfileOut("{$fname}-business-end"); wfProfileOut($fname); }
/** * return from error messages or notes * @param $auto automatically redirect the user after 10 seconds * @param $returnto page title to return to. Default is Main Page. */ function returnToMain($auto = true, $returnto = NULL) { global $wgUser, $wgOut, $wgRequest; if ($returnto == NULL) { $returnto = $wgRequest->getText('returnto'); } if ('' === $returnto) { $returnto = wfMsgForContent('mainpage'); } // WERELATE - use page title for link text of MyRelate when we makeLinkObj below $linkText = ''; if ($returnto == 'Special:MyRelate') { $linkText = wfmsg('myrelate'); } if (is_object($returnto)) { $titleObj = $returnto; } else { $titleObj = Title::newFromText($returnto); } if (!is_object($titleObj)) { $titleObj = Title::newMainPage(); } $sk = $wgUser->getSkin(); $link = $sk->makeLinkObj($titleObj, $linkText); $r = wfMsg('returnto', $link); // WERELATE - don't automatically redirect // if ( $auto ) { // $wgOut->addMeta( 'http:Refresh', '10;url=' . $titleObj->escapeFullURL() ); // } $wgOut->addHTML("\n<p>{$r}</p>\n"); }
/** * Show all applicable editing introductions */ protected function showIntro() { global $wgOut, $wgUser; if ($this->suppressIntro) { return; } $namespace = $this->mTitle->getNamespace(); if ($namespace == NS_MEDIAWIKI) { # Show a warning if editing an interface message $wgOut->wrapWikiMsg("<div class='mw-editinginterface'>\n\$1\n</div>", 'editinginterface'); } elseif ($namespace == NS_FILE) { # Show a hint to shared repo $file = wfFindFile($this->mTitle); if ($file && !$file->isLocal()) { $descUrl = $file->getDescriptionUrl(); # there must be a description url to show a hint to shared repo if ($descUrl) { if (!$this->mTitle->exists()) { $wgOut->wrapWikiMsg("<div class=\"mw-sharedupload-desc-create\">\n\$1\n</div>", array('sharedupload-desc-create', $file->getRepo()->getDisplayName(), $descUrl)); } else { $wgOut->wrapWikiMsg("<div class=\"mw-sharedupload-desc-edit\">\n\$1\n</div>", array('sharedupload-desc-edit', $file->getRepo()->getDisplayName(), $descUrl)); } } } } # Show a warning message when someone creates/edits a user (talk) page but the user does not exist # Show log extract when the user is currently blocked if ($namespace == NS_USER || $namespace == NS_USER_TALK) { $parts = explode('/', $this->mTitle->getText(), 2); $username = $parts[0]; $user = User::newFromName($username, false); $ip = User::isIP($username); if (!($user && $user->isLoggedIn()) && !$ip) { # User does not exist $wgOut->wrapWikiMsg("<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>", array('userpage-userdoesnotexist', wfEscapeWikiText($username))); } elseif ($user->isBlocked()) { # Show log extract if the user is currently blocked LogEventsList::showLogExtract($wgOut, 'block', $user->getUserPage(), '', array('lim' => 1, 'showIfEmpty' => false, 'msgKey' => array('blocked-notice-logextract', $user->getName()))); } } # Try to add a custom edit intro, or use the standard one if this is not possible. if (!$this->showCustomIntro() && !$this->mTitle->exists()) { if ($wgUser->isLoggedIn()) { //XXCHANGED Bebeth - message has html links in it, so couldn't use wrapper $wgOut->addHTML(wfMessage('newarticletext')->plain()); //$wgOut->wrapWikiMsg( "<div class=\"mw-newarticletext\">\n$1\n</div>", array('newarticletext') ); } else { $wgOut->addHTML(wfmsg('newarticletextanon')); //$wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1\n</div>", 'newarticletextanon' ); } } # Give a notice if the user is editing a deleted/moved page... if (!$this->mTitle->exists()) { LogEventsList::showLogExtract($wgOut, array('delete', 'move'), $this->mTitle, '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('recreate-moveddeleted-warn'))); } }