/** * */ function wfSpecialExport($page = '') { global $wgOut, $wgRequest, $wgExportAllowListContributors; global $wgExportAllowHistory, $wgExportMaxHistory; $curonly = true; if ($wgRequest->getVal('action') == 'submit') { $page = $wgRequest->getText('pages'); $curonly = $wgRequest->getCheck('curonly'); } if ($wgRequest->getCheck('history')) { $curonly = false; } if (!$wgExportAllowHistory) { // Override $curonly = true; } $list_authors = $wgRequest->getCheck('listauthors'); if (!$curonly || !$wgExportAllowListContributors) { $list_authors = false; } if ($page != '') { $wgOut->disable(); // Cancel output buffering and gzipping if set // This should provide safer streaming for pages with history while ($status = ob_get_status()) { ob_end_clean(); if ($status['name'] == 'ob_gzhandler') { header('Content-Encoding:'); } } header("Content-type: application/xml; charset=utf-8"); $pages = explode("\n", $page); $db =& wfGetDB(DB_SLAVE); $history = $curonly ? MW_EXPORT_CURRENT : MW_EXPORT_FULL; $exporter = new WikiExporter($db, $history); $exporter->list_authors = $list_authors; $exporter->openStream(); foreach ($pages as $page) { if ($wgExportMaxHistory && !$curonly) { $title = Title::newFromText($page); if ($title) { $count = Revision::countByTitle($db, $title); if ($count > $wgExportMaxHistory) { wfDebug(__FUNCTION__ . ": Skipped {$page}, {$count} revisions too big\n"); continue; } } } $exporter->pageByName($page); } $exporter->closeStream(); return; } $wgOut->addWikiText(wfMsg("exporttext")); $titleObj = Title::makeTitle(NS_SPECIAL, "Export"); $form = wfOpenElement('form', array('method' => 'post', 'action' => $titleObj->getLocalUrl())); $form .= wfOpenElement('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10)) . '</textarea><br />'; if ($wgExportAllowHistory) { $form .= wfCheck('curonly', true, array('value' => 'true', 'id' => 'curonly')); $form .= wfLabel(wfMsg('exportcuronly'), 'curonly') . '<br />'; } else { $wgOut->addWikiText(wfMsg('exportnohistory')); } $form .= wfHidden('action', 'submit'); $form .= wfSubmitButton(wfMsg('export-submit')) . '</form>'; $wgOut->addHtml($form); }
/** * @access private */ function mainPrefsForm($status, $message = '') { global $wgUser, $wgOut, $wgLang, $wgContLang; global $wgAllowRealName, $wgImageLimits, $wgThumbLimits; global $wgDisableLangConversion; global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits; global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress; global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication; global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth; $wgOut->setPageTitle(wfMsg('preferences')); $wgOut->setArticleRelated(false); $wgOut->setRobotpolicy('noindex,nofollow'); if ($this->mSuccess || 'success' == $status) { $wgOut->addWikitext('<div class="successbox"><strong>' . wfMsg('savedprefs') . '</strong></div>'); } else { if ('error' == $status) { $wgOut->addWikitext('<div class="errorbox"><strong>' . $message . '</strong></div>'); } else { if ('' != $status) { $wgOut->addWikitext($message . "\n----"); } } } $qbs = $wgLang->getQuickbarSettings(); $skinNames = $wgLang->getSkinNames(); $mathopts = $wgLang->getMathNames(); $dateopts = $wgLang->getDatePreferences(); $togs = User::getToggles(); $titleObj = SpecialPage::getTitleFor('Preferences'); $action = $titleObj->escapeLocalURL(); # Pre-expire some toggles so they won't show if disabled $this->mUsedToggles['shownumberswatching'] = true; $this->mUsedToggles['showupdated'] = true; $this->mUsedToggles['enotifwatchlistpages'] = true; $this->mUsedToggles['enotifusertalkpages'] = true; $this->mUsedToggles['enotifminoredits'] = true; $this->mUsedToggles['enotifrevealaddr'] = true; $this->mUsedToggles['ccmeonemails'] = true; $this->mUsedToggles['uselivepreview'] = true; # Enotif # <FIXME> $this->mUserEmail = htmlspecialchars($this->mUserEmail); $this->mRealName = htmlspecialchars($this->mRealName); $rawNick = $this->mNick; $this->mNick = htmlspecialchars($this->mNick); if (!$this->mEmailFlag) { $emfc = 'checked="checked"'; } else { $emfc = ''; } if ($wgEmailAuthentication && $this->mUserEmail != '') { if ($wgUser->getEmailAuthenticationTimestamp()) { $emailauthenticated = wfMsg('emailauthenticated', $wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true)) . '<br />'; $disableEmailPrefs = false; } else { $disableEmailPrefs = true; $skin = $wgUser->getSkin(); $emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Confirmemail'), wfMsg('emailconfirmlink')); } } else { $emailauthenticated = ''; $disableEmailPrefs = false; } if ($this->mUserEmail == '') { $emailauthenticated = wfMsg('noemailprefs'); } $ps = $this->namespacesCheckboxes(); $enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : ''; $enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : ''; $enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : ''; $enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : ''; # </FIXME> $wgOut->addHTML("<form action=\"{$action}\" method='post'>"); $wgOut->addHTML("<div id='preferences'>"); # User data # $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('prefs-personal') . "</legend>\n<table>\n"); $userInformationHtml = $this->addRow(wfMsg('username'), $wgUser->getName()) . $this->addRow(wfMsg('uid'), $wgUser->getID()); if (wfRunHooks('PreferencesUserInformationPanel', array($this, &$userInformationHtml))) { $wgOut->addHtml($userInformationHtml); } if ($wgAllowRealName) { $wgOut->addHTML($this->addRow('<label for="wpRealName">' . wfMsg('yourrealname') . '</label>', "<input type='text' name='wpRealName' id='wpRealName' value=\"{$this->mRealName}\" size='25' />")); } if ($wgEnableEmail) { $wgOut->addHTML($this->addRow('<label for="wpUserEmail">' . wfMsg('youremail') . '</label>', "<input type='text' name='wpUserEmail' id='wpUserEmail' value=\"{$this->mUserEmail}\" size='25' />")); } global $wgParser; if (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($rawNick)) { $invalidSig = $this->addRow(' ', '<span class="error">' . wfMsgHtml('badsig') . '<span>'); } else { $invalidSig = ''; } $wgOut->addHTML($this->addRow('<label for="wpNick">' . wfMsg('yournick') . '</label>', "<input type='text' name='wpNick' id='wpNick' value=\"{$this->mNick}\" size='25' />") . $invalidSig . $this->addRow(' ', $this->getToggle('fancysig'))); /** * Make sure the site language is in the list; a custom language code * might not have a defined name... */ $languages = Language::getLanguageNames(true); if (!array_key_exists($wgContLanguageCode, $languages)) { $languages[$wgContLanguageCode] = $wgContLanguageCode; } ksort($languages); /** * If a bogus value is set, default to the content language. * Otherwise, no default is selected and the user ends up * with an Afrikaans interface since it's first in the list. */ $selectedLang = isset($languages[$this->mUserLanguage]) ? $this->mUserLanguage : $wgContLanguageCode; $options = "\n"; foreach ($languages as $code => $name) { $selected = $code == $selectedLang; $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n"; } $wgOut->addHTML($this->addRow('<label for="wpUserLanguage">' . wfMsg('yourlanguage') . '</label>', "<select name='wpUserLanguage' id='wpUserLanguage'>{$options}</select>")); /* see if there are multiple language variants to choose from*/ if (!$wgDisableLangConversion) { $variants = $wgContLang->getVariants(); $variantArray = array(); foreach ($variants as $v) { $v = str_replace('_', '-', strtolower($v)); if (array_key_exists($v, $languages)) { // If it doesn't have a name, we'll pretend it doesn't exist $variantArray[$v] = $languages[$v]; } } $options = "\n"; foreach ($variantArray as $code => $name) { $selected = $code == $this->mUserVariant; $options .= Xml::option("{$code} - {$name}", $code, $selected) . "\n"; } if (count($variantArray) > 1) { $wgOut->addHtml($this->addRow(wfMsg('yourvariant'), "<select name='wpUserVariant'>{$options}</select>")); } } $wgOut->addHTML('</table>'); # Password if ($wgAuth->allowPasswordChange()) { $this->mOldpass = htmlspecialchars($this->mOldpass); $this->mNewpass = htmlspecialchars($this->mNewpass); $this->mRetypePass = htmlspecialchars($this->mRetypePass); $wgOut->addHTML('<fieldset><legend>' . wfMsg('changepassword') . '</legend><table>'); $wgOut->addHTML($this->addRow('<label for="wpOldpass">' . wfMsg('oldpassword') . '</label>', "<input type='password' name='wpOldpass' id='wpOldpass' value=\"{$this->mOldpass}\" size='20' />") . $this->addRow('<label for="wpNewpass">' . wfMsg('newpassword') . '</label>', "<input type='password' name='wpNewpass' id='wpNewpass' value=\"{$this->mNewpass}\" size='20' />") . $this->addRow('<label for="wpRetypePass">' . wfMsg('retypenew') . '</label>', "<input type='password' name='wpRetypePass' id='wpRetypePass' value=\"{$this->mRetypePass}\" size='20' />") . "</table>\n" . $this->getToggle("rememberpassword") . "</fieldset>\n\n"); } # <FIXME> # Enotif if ($wgEnableEmail) { $wgOut->addHTML('<fieldset><legend>' . wfMsg('email') . '</legend>'); $wgOut->addHTML($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits); if ($wgEnableUserEmail) { $emf = wfMsg('allowemail'); $disabled = $disableEmailPrefs ? ' disabled="disabled"' : ''; $wgOut->addHTML("<div><input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label></div>"); } $wgOut->addHtml($this->getToggle('ccmeonemails')); $wgOut->addHTML('</fieldset>'); } # </FIXME> # Show little "help" tips for the real name and email address options if ($wgAllowRealName || $wgEnableEmail) { if ($wgAllowRealName) { $tips[] = wfMsg('prefs-help-realname'); } if ($wgEnableEmail) { $tips[] = wfMsg('prefs-help-email'); } $wgOut->addHtml('<div class="prefsectiontip">' . implode('<br />', $tips) . '</div>'); } $wgOut->addHTML('</fieldset>'); # Quickbar # if ($this->mSkin == 'cologneblue' || $this->mSkin == 'standard') { $wgOut->addHtml("<fieldset>\n<legend>" . wfMsg('qbsettings') . "</legend>\n"); for ($i = 0; $i < count($qbs); ++$i) { if ($i == $this->mQuickbar) { $checked = ' checked="checked"'; } else { $checked = ""; } $wgOut->addHTML("<div><label><input type='radio' name='wpQuickbar' value=\"{$i}\"{$checked} />{$qbs[$i]}</label></div>\n"); } $wgOut->addHtml("</fieldset>\n\n"); } else { # Need to output a hidden option even if the relevant skin is not in use, # otherwise the preference will get reset to 0 on submit $wgOut->addHtml(wfHidden('wpQuickbar', $this->mQuickbar)); } # Skin # $wgOut->addHTML("<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n"); $mptitle = Title::newMainPage(); $previewtext = wfMsg('skinpreview'); # Only show members of Skin::getSkinNames() rather than # $skinNames (skins is all skin names from Language.php) $validSkinNames = Skin::getSkinNames(); # Sort by UI skin name. First though need to update validSkinNames as sometimes # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). foreach ($validSkinNames as $skinkey => &$skinname) { if (isset($skinNames[$skinkey])) { $skinname = $skinNames[$skinkey]; } } asort($validSkinNames); foreach ($validSkinNames as $skinkey => $sn) { if (in_array($skinkey, $wgSkipSkins)) { continue; } $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; $mplink = htmlspecialchars($mptitle->getLocalURL("useskin={$skinkey}")); $previewlink = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>"; if ($skinkey == $wgDefaultSkin) { $sn .= ' (' . wfMsg('default') . ')'; } $wgOut->addHTML("<input type='radio' name='wpSkin' id=\"wpSkin{$skinkey}\" value=\"{$skinkey}\"{$checked} /> <label for=\"wpSkin{$skinkey}\">{$sn}</label> {$previewlink}<br />\n"); } $wgOut->addHTML("</fieldset>\n\n"); # Math # global $wgUseTeX; if ($wgUseTeX) { $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('math') . '</legend>'); foreach ($mathopts as $k => $v) { $checked = $k == $this->mMath ? ' checked="checked"' : ''; $wgOut->addHTML("<div><label><input type='radio' name='wpMath' value=\"{$k}\"{$checked} /> " . wfMsg($v) . "</label></div>\n"); } $wgOut->addHTML("</fieldset>\n\n"); } # Files # $wgOut->addHTML("<fieldset>\n" . Xml::element('legend', null, wfMsg('files')) . "\n"); $imageLimitOptions = null; foreach ($wgImageLimits as $index => $limits) { $selected = $index == $this->mImageSize; $imageLimitOptions .= Xml::option("{$limits[0]}×{$limits[1]}" . wfMsg('unit-pixel'), $index, $selected); } $imageSizeId = 'wpImageSize'; $wgOut->addHTML("<div>" . Xml::label(wfMsg('imagemaxsize'), $imageSizeId) . " " . Xml::openElement('select', array('name' => $imageSizeId, 'id' => $imageSizeId)) . $imageLimitOptions . Xml::closeElement('select') . "</div>\n"); $imageThumbOptions = null; foreach ($wgThumbLimits as $index => $size) { $selected = $index == $this->mThumbSize; $imageThumbOptions .= Xml::option($size . wfMsg('unit-pixel'), $index, $selected); } $thumbSizeId = 'wpThumbSize'; $wgOut->addHTML("<div>" . Xml::label(wfMsg('thumbsize'), $thumbSizeId) . " " . Xml::openElement('select', array('name' => $thumbSizeId, 'id' => $thumbSizeId)) . $imageThumbOptions . Xml::closeElement('select') . "</div>\n"); $wgOut->addHTML("</fieldset>\n\n"); # Date format # # Date/Time # $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('datetime') . "</legend>\n"); if ($dateopts) { $wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('dateformat') . "</legend>\n"); $idCnt = 0; $epoch = '20010115161234'; # Wikipedia day foreach ($dateopts as $key) { if ($key == 'default') { $formatted = wfMsgHtml('datedefault'); } else { $formatted = htmlspecialchars($wgLang->timeanddate($epoch, false, $key)); } $key == $this->mDate ? $checked = ' checked="checked"' : ($checked = ''); $wgOut->addHTML("<div><input type='radio' name=\"wpDate\" id=\"wpDate{$idCnt}\" " . "value=\"{$key}\"{$checked} /> <label for=\"wpDate{$idCnt}\">{$formatted}</label></div>\n"); $idCnt++; } $wgOut->addHTML("</fieldset>\n"); } $nowlocal = $wgLang->time($now = wfTimestampNow(), true); $nowserver = $wgLang->time($now, false); $wgOut->addHTML('<fieldset><legend>' . wfMsg('timezonelegend') . '</legend><table>' . $this->addRow(wfMsg('servertime'), $nowserver) . $this->addRow(wfMsg('localtime'), $nowlocal) . $this->addRow('<label for="wpHourDiff">' . wfMsg('timezoneoffset') . '</label>', "<input type='text' name='wpHourDiff' id='wpHourDiff' value=\"" . htmlspecialchars($this->mHourDiff) . "\" size='6' />") . "<tr><td colspan='2'>\r\n\t\t\t\t<input type='button' value=\"" . wfMsg('guesstimezone') . "\"\r\n\t\t\t\tonclick='javascript:guessTimezone()' id='guesstimezonebutton' style='display:none;' />\r\n\t\t\t\t</td></tr></table><div class='prefsectiontip'>¹" . wfMsg('timezonetext') . "</div></fieldset>\r\n\t\t</fieldset>\n\n"); # Editing # global $wgLivePreview; $wgOut->addHTML('<fieldset><legend>' . wfMsg('textboxsize') . '</legend> <div>' . wfInputLabel(wfMsg('rows'), 'wpRows', 'wpRows', 3, $this->mRows) . ' ' . wfInputLabel(wfMsg('columns'), 'wpCols', 'wpCols', 3, $this->mCols) . "</div>" . $this->getToggles(array('editsection', 'editsectiononrightclick', 'editondblclick', 'editwidth', 'showtoolbar', 'previewonfirst', 'previewontop', 'minordefault', 'externaleditor', 'externaldiff', $wgLivePreview ? 'uselivepreview' : false, 'forceeditsummary')) . '</fieldset>'); # Recent changes $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('prefs-rc') . '</legend>'); $rc = '<table><tr>'; $rc .= '<td>' . Xml::label(wfMsg('recentchangesdays'), 'wpRecentDays') . '</td>'; $rc .= '<td>' . Xml::input('wpRecentDays', 3, $this->mRecentDays, array('id' => 'wpRecentDays')) . '</td>'; $rc .= '</tr><tr>'; $rc .= '<td>' . Xml::label(wfMsg('recentchangescount'), 'wpRecent') . '</td>'; $rc .= '<td>' . Xml::input('wpRecent', 3, $this->mRecent, array('id' => 'wpRecent')) . '</td>'; $rc .= '</tr></table>'; $wgOut->addHtml($rc); $wgOut->addHtml('<br />'); $toggles[] = 'hideminor'; if ($wgRCShowWatchingUsers) { $toggles[] = 'shownumberswatching'; } $toggles[] = 'usenewrc'; $wgOut->addHtml($this->getToggles($toggles)); $wgOut->addHtml('</fieldset>'); # Watchlist $wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('prefs-watchlist') . '</legend>'); $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-days'), 'wpWatchlistDays', 'wpWatchlistDays', 3, $this->mWatchlistDays)); $wgOut->addHtml('<br /><br />'); $wgOut->addHtml($this->getToggle('extendwatchlist')); $wgOut->addHtml(wfInputLabel(wfMsg('prefs-watchlist-edits'), 'wpWatchlistEdits', 'wpWatchlistEdits', 3, $this->mWatchlistEdits)); $wgOut->addHtml('<br /><br />'); $wgOut->addHtml($this->getToggles(array('watchlisthideown', 'watchlisthidebots', 'watchlisthideminor'))); /* BizzWiki -- can't enforce namespace dependant policies here. if( $wgUser->isAllowed( 'createpage' ) || $wgUser->isAllowed( 'createtalk' ) ) $wgOut->addHtml( $this->getToggle( 'watchcreations' ) ); foreach( array( 'edit' => 'watchdefault', 'move' => 'watchmoves', 'delete' => 'watchdeletion' ) as $action => $toggle ) { if( $wgUser->isAllowed( $action ) ) $wgOut->addHtml( $this->getToggle( $toggle ) ); } */ $this->mUsedToggles['watchcreations'] = true; $this->mUsedToggles['watchdefault'] = true; $this->mUsedToggles['watchmoves'] = true; $this->mUsedToggles['watchdeletion'] = true; $wgOut->addHtml('</fieldset>'); # Search $wgOut->addHTML('<fieldset><legend>' . wfMsg('searchresultshead') . '</legend><table>' . $this->addRow(wfLabel(wfMsg('resultsperpage'), 'wpSearch'), wfInput('wpSearch', 4, $this->mSearch, array('id' => 'wpSearch'))) . $this->addRow(wfLabel(wfMsg('contextlines'), 'wpSearchLines'), wfInput('wpSearchLines', 4, $this->mSearchLines, array('id' => 'wpSearchLines'))) . $this->addRow(wfLabel(wfMsg('contextchars'), 'wpSearchChars'), wfInput('wpSearchChars', 4, $this->mSearchChars, array('id' => 'wpSearchChars'))) . "</table><fieldset><legend>" . wfMsg('defaultns') . "</legend>{$ps}</fieldset></fieldset>"); # Misc # $wgOut->addHTML('<fieldset><legend>' . wfMsg('prefs-misc') . '</legend>'); $wgOut->addHTML(wfInputLabel(wfMsg('stubthreshold'), 'wpStubs', 'wpStubs', 6, $this->mStubs)); $msgUnderline = htmlspecialchars(wfMsg('tog-underline')); $msgUnderlinenever = htmlspecialchars(wfMsg('underline-never')); $msgUnderlinealways = htmlspecialchars(wfMsg('underline-always')); $msgUnderlinedefault = htmlspecialchars(wfMsg('underline-default')); $uopt = $wgUser->getOption("underline"); $s0 = $uopt == 0 ? ' selected="selected"' : ''; $s1 = $uopt == 1 ? ' selected="selected"' : ''; $s2 = $uopt == 2 ? ' selected="selected"' : ''; $wgOut->addHTML("\r\n<div class='toggle'><p><label for='wpOpunderline'>{$msgUnderline}</label>\r\n<select name='wpOpunderline' id='wpOpunderline'>\r\n<option value=\"0\"{$s0}>{$msgUnderlinenever}</option>\r\n<option value=\"1\"{$s1}>{$msgUnderlinealways}</option>\r\n<option value=\"2\"{$s2}>{$msgUnderlinedefault}</option>\r\n</select></p></div>"); foreach ($togs as $tname) { if (!array_key_exists($tname, $this->mUsedToggles)) { $wgOut->addHTML($this->getToggle($tname)); } } $wgOut->addHTML('</fieldset>'); $token = $wgUser->editToken(); $skin = $wgUser->getSkin(); $wgOut->addHTML("\r\n\t<div id='prefsubmit'>\r\n\t<div>\r\n\t\t<input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml('saveprefs') . '"' . $skin->tooltipAndAccesskey('save') . " />\r\n\t\t<input type='submit' name='wpReset' value=\"" . wfMsgHtml('resetprefs') . "\" />\r\n\t</div>\r\n\r\n\t</div>\r\n\r\n\t<input type='hidden' name='wpEditToken' value='{$token}' />\r\n\t</div></form>\n"); $wgOut->addWikiText('<div class="prefcache">' . wfMsg('clearyourcache') . '</div>'); }
/** * Convenience function to build an HTML radio button with a label * @return string HTML */ function wfRadioLabel($label, $name, $value, $id, $checked = false, $attribs = array()) { return wfRadio($name, $checked, $value, array('id' => $id) + $attribs) . ' ' . wfLabel($label, $id); }
/** * */ function wfSpecialExport($page = '') { global $wgOut, $wgRequest, $wgExportAllowListContributors; global $wgExportAllowHistory, $wgExportMaxHistory; $curonly = true; $fullHistory = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory); if ($wgRequest->wasPosted()) { $page = $wgRequest->getText('pages'); $curonly = $wgRequest->getCheck('curonly'); $rawOffset = $wgRequest->getVal('offset'); if ($rawOffset) { $offset = wfTimestamp(TS_MW, $rawOffset); } else { $offset = null; } $limit = $wgRequest->getInt('limit'); $dir = $wgRequest->getVal('dir'); $history = array('dir' => 'asc', 'offset' => false, 'limit' => $wgExportMaxHistory); $historyCheck = $wgRequest->getCheck('history'); if ($curonly) { $history = WikiExporter::CURRENT; } elseif (!$historyCheck) { if ($limit > 0 && $limit < $wgExportMaxHistory) { $history['limit'] = $limit; } if (!is_null($offset)) { $history['offset'] = $offset; } if (strtolower($dir) == 'desc') { $history['dir'] = 'desc'; } } } else { // Default to current-only for GET requests $page = $wgRequest->getText('pages', $page); $historyCheck = $wgRequest->getCheck('history'); if ($historyCheck) { $history = WikiExporter::FULL; } else { $history = WikiExporter::CURRENT; } } if (!$wgExportAllowHistory) { // Override $history = WikiExporter::CURRENT; } $list_authors = $wgRequest->getCheck('listauthors'); if (!$curonly || !$wgExportAllowListContributors) { $list_authors = false; } if ($page != '') { $wgOut->disable(); // Cancel output buffering and gzipping if set // This should provide safer streaming for pages with history while ($status = ob_get_status()) { ob_end_clean(); if ($status['name'] == 'ob_gzhandler') { header('Content-Encoding:'); } } header("Content-type: application/xml; charset=utf-8"); $pages = explode("\n", $page); $db =& wfGetDB(DB_SLAVE); $exporter = new WikiExporter($db, $history); $exporter->list_authors = $list_authors; $exporter->openStream(); foreach ($pages as $page) { /* if( $wgExportMaxHistory && !$curonly ) { $title = Title::newFromText( $page ); if( $title ) { $count = Revision::countByTitle( $db, $title ); if( $count > $wgExportMaxHistory ) { wfDebug( __FUNCTION__ . ": Skipped $page, $count revisions too big\n" ); continue; } } }*/ $exporter->pageByName($page); } $exporter->closeStream(); return; } $wgOut->addWikiText(wfMsg("exporttext")); $titleObj = Title::makeTitle(NS_SPECIAL, "Export"); $form = wfOpenElement('form', array('method' => 'post', 'action' => $titleObj->getLocalUrl())); $form .= wfOpenElement('textarea', array('name' => 'pages', 'cols' => 40, 'rows' => 10)) . '</textarea><br />'; if ($wgExportAllowHistory) { $form .= wfCheck('curonly', true, array('value' => 'true', 'id' => 'curonly')); $form .= wfLabel(wfMsg('exportcuronly'), 'curonly') . '<br />'; } else { $wgOut->addWikiText(wfMsg('exportnohistory')); } $form .= wfHidden('action', 'submit'); $form .= wfSubmitButton(wfMsg('export-submit')) . '</form>'; $wgOut->addHtml($form); }
function makeNamespaceForm() { $self = Title::makeTitle(NS_SPECIAL, $this->getName()); $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())); $form .= wfLabel(wfMsg('newestpages-namespace'), 'namespace') . ' '; $form .= htmlNamespaceSelector($this->namespace, 'all'); $form .= wfHidden('limit', $this->limit); $form .= wfHidden('redirects', $this->redirects); $form .= wfSubmitButton(wfMsg('newestpages-submit')) . '</form>'; return $form; }