本文整理汇总了PHP中wfHidden函数的典型用法代码示例。如果您正苦于以下问题:PHP wfHidden函数的具体用法?PHP wfHidden怎么用?PHP wfHidden使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfHidden函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* @param WebRequest $request
*/
function show($request)
{
global $wgOut, $wgUser;
$first = $this->revisions[0];
$wgOut->addWikiText(wfMsg('revdelete-selected', $this->page->getPrefixedText()));
$wgOut->addHtml("<ul>");
foreach ($this->revisions as $revid) {
$rev = Revision::newFromTitle($this->page, $revid);
$wgOut->addHtml($this->historyLine($rev));
$bitfields[] = $rev->mDeleted;
// FIXME
}
$wgOut->addHtml("</ul>");
$wgOut->addWikiText(wfMsg('revdelete-text'));
$items = array(wfInputLabel(wfMsg('revdelete-log'), 'wpReason', 'wpReason', 60), wfSubmitButton(wfMsg('revdelete-submit')));
$hidden = array(wfHidden('wpEditToken', $wgUser->editToken()), wfHidden('target', $this->page->getPrefixedText()));
foreach ($this->revisions as $revid) {
$hidden[] = wfHidden('oldid[]', $revid);
}
$special = Title::makeTitle(NS_SPECIAL, 'Revisiondelete');
$wgOut->addHtml(wfElement('form', array('method' => 'post', 'action' => $special->getLocalUrl('action=submit'))));
$wgOut->addHtml('<fieldset><legend>' . wfMsgHtml('revdelete-legend') . '</legend>');
foreach ($this->checks as $item) {
list($message, $name, $field) = $item;
$wgOut->addHtml('<div>' . wfCheckLabel(wfMsg($message), $name, $name, $rev->isDeleted($field)) . '</div>');
}
$wgOut->addHtml('</fieldset>');
foreach ($items as $item) {
$wgOut->addHtml('<p>' . $item . '</p>');
}
foreach ($hidden as $item) {
$wgOut->addHtml($item);
}
$wgOut->addHtml('</form>');
}
示例2: showRequestForm
/**
* Show a nice form for the user to request a confirmation mail
*/
function showRequestForm()
{
global $wgOut, $wgUser, $wgLang, $wgRequest;
if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
$ok = $wgUser->sendConfirmationMail();
if (WikiError::isError($ok)) {
$wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
} else {
$wgOut->addWikiMsg('confirmemail_sent');
}
} else {
if ($wgUser->isEmailConfirmed()) {
$time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
$wgOut->addWikiMsg('emailauthenticated', $time);
}
if ($wgUser->isEmailConfirmationPending()) {
$wgOut->addWikiMsg('confirmemail_pending');
}
$wgOut->addWikiMsg('confirmemail_text');
$self = SpecialPage::getTitleFor('Confirmemail');
$form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
$form .= wfHidden('token', $wgUser->editToken());
$form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
$form .= wfCloseElement('form');
$wgOut->addHtml($form);
}
}
示例3: showForm
function showForm()
{
global $wgOut, $wgUser, $wgLang, $wgRequest;
$self = SpecialPage::getTitleFor('Resetpass');
$form = '<div id="userloginForm">' . wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())) . '<h2>' . wfMsgHtml('resetpass_header') . '</h2>' . '<div id="userloginprompt">' . wfMsgExt('resetpass_text', array('parse')) . '</div>' . '<table>' . wfHidden('token', $wgUser->editToken()) . wfHidden('wpName', $this->mName) . wfHidden('wpPassword', $this->mTemporaryPassword) . wfHidden('returnto', $wgRequest->getVal('returnto')) . $this->pretty(array(array('wpName', 'username', 'text', $this->mName), array('wpNewPassword', 'newpassword', 'password', ''), array('wpRetype', 'yourpasswordagain', 'password', ''))) . '<tr>' . '<td></td>' . '<td>' . Xml::checkLabel(wfMsg('remembermypassword'), 'wpRemember', 'wpRemember', $wgRequest->getCheck('wpRemember')) . '</td>' . '</tr>' . '<tr>' . '<td></td>' . '<td>' . wfSubmitButton(wfMsgHtml('resetpass_submit')) . '</td>' . '</tr>' . '</table>' . wfCloseElement('form') . '</div>';
$wgOut->addHtml($form);
}
示例4: getForm
/** Produce a nice little form */
function getForm()
{
list($sum, $answer) = $this->pickSum();
$index = $this->storeCaptcha(array('answer' => $answer));
$form = '<table><tr><td>' . $this->fetchMath($sum) . '</td>';
$form .= '<td>' . wfInput('wpCaptchaAnswer', false, false, array('tabindex' => '1')) . '</td></tr></table>';
$form .= wfHidden('wpCaptchaId', $index);
return $form;
}
示例5: showRequestForm
/**
* Show a nice form for the user to request a confirmation mail
*/
function showRequestForm()
{
global $wgOut, $wgUser, $wgLang, $wgRequest;
if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
$ok = $wgUser->sendConfirmationMail();
$message = WikiError::isError($ok) ? 'confirmemail_sendfailed' : 'confirmemail_sent';
$wgOut->addWikiText(wfMsg($message));
} else {
if ($wgUser->isEmailConfirmed()) {
$time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
$wgOut->addWikiText(wfMsg('emailauthenticated', $time));
}
$wgOut->addWikiText(wfMsg('confirmemail_text'));
$self = Title::makeTitle(NS_SPECIAL, 'Confirmemail');
$form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
$form .= wfHidden('token', $wgUser->editToken());
$form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
$form .= wfCloseElement('form');
$wgOut->addHtml($form);
}
}
示例6: wfSpecialExport
/**
*
*/
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);
}
示例7: showEditForm
//.........这里部分代码省略.........
$metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>";
} else {
$metadata = "";
}
$hidden = '';
$recreate = '';
if ($this->deletedSinceEdit) {
if ('save' != $this->formtype) {
$wgOut->addWikiText(wfMsg('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>";
}
}
$temp = array('id' => 'wpSave', 'name' => 'wpSave', 'type' => 'submit', 'tabindex' => '5', 'value' => wfMsg('savearticle'), 'accesskey' => wfMsg('accesskey-save'), 'title' => wfMsg('tooltip-save'));
$buttons['save'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpDiff', 'name' => 'wpDiff', 'type' => 'submit', 'tabindex' => '7', 'value' => wfMsg('showdiff'), 'accesskey' => wfMsg('accesskey-diff'), 'title' => wfMsg('tooltip-diff'));
$buttons['diff'] = wfElement('input', $temp, '');
global $wgLivePreview;
if ($wgLivePreview && $wgUser->getOption('uselivepreview')) {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => '', 'title' => wfMsg('tooltip-preview'), 'style' => 'display: none;');
$buttons['preview'] = wfElement('input', $temp, '');
$temp = array('id' => 'wpLivePreview', 'name' => 'wpLivePreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showlivepreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => '', 'onclick' => $this->doLivePreviewScript());
$buttons['live'] = wfElement('input', $temp, '');
} else {
$temp = array('id' => 'wpPreview', 'name' => 'wpPreview', 'type' => 'submit', 'tabindex' => '6', 'value' => wfMsg('showpreview'), 'accesskey' => wfMsg('accesskey-preview'), 'title' => wfMsg('tooltip-preview'));
$buttons['preview'] = wfElement('input', $temp, '');
$buttons['live'] = '';
}
$safemodehtml = $this->checkUnicodeCompliantBrowser() ? "" : "<input type='hidden' name=\"safemode\" value='1' />\n";
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
END
);
if (is_callable($formCallback)) {
call_user_func_array($formCallback, array(&$wgOut));
}
// 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");
$wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} {$hidden}>
END
. htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n\t\t");
$wgOut->addWikiText($copywarn);
$wgOut->addHTML("\n{$metadata}\n{$editsummary}\n{$checkboxhtml}\n{$safemodehtml}\n");
$wgOut->addHTML("<div class='editButtons'>\n\t{$buttons['save']}\n\t{$buttons['preview']}\n\t{$buttons['live']}\n\t{$buttons['diff']}\n\t<span class='editHelp'>{$cancel} | {$edithelp}</span>\n</div><!-- editButtons -->\n</div><!-- editOptions -->");
$wgOut->addWikiText(wfMsgForContent('edittools'));
$wgOut->addHTML("\n<div class='templatesUsed'>\n{$templates}\n</div>\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 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->addWikiText('==' . wfMsg("yourdiff") . '==');
$de = new DifferenceEngine($this->mTitle);
$de->setText($this->textbox2, $this->textbox1);
$de->showDiff(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 (!$wgUser->getOption('previewontop')) {
if ($this->formtype == 'preview') {
$this->showPreview();
} else {
$wgOut->addHTML('<div id="wikiPreview"></div>');
}
if ($this->formtype == 'diff') {
$wgOut->addHTML($this->getDiff());
}
}
wfProfileOut($fname);
}
示例8: getPageHeader
/**
* Show a form for filtering namespace and username
*
* @return string
*/
function getPageHeader()
{
$self = Title::makeTitle(NS_SPECIAL, $this->getName());
$form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
$form .= '<table><tr><td align="right">' . wfMsgHtml('namespace') . '</td>';
$form .= '<td>' . HtmlNamespaceSelector($this->namespace) . '</td><tr>';
$form .= '<tr><td align="right">' . wfMsgHtml('newpages-username') . '</td>';
$form .= '<td>' . wfInput('username', 30, $this->username) . '</td></tr>';
$form .= '<tr><td></td><td>' . wfSubmitButton(wfMsg('allpagessubmit')) . '</td></tr></table>';
$form .= wfHidden('offset', $this->offset) . wfHidden('limit', $this->limit) . '</form>';
return $form;
}
示例9: wfSpecialExport
/**
*
*/
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);
//.........这里部分代码省略.........
示例10: execute
function execute()
{
global $wgOut, $wgTitle, $wgScript;
$wgOut->addHTML(wfElement('form', array('id' => 'specialfilepath', 'method' => 'get', 'action' => $wgScript), null) . wfHidden('title', $wgTitle->getPrefixedText()) . wfOpenElement('label') . wfMsgHtml('filepath-page') . ' ' . wfElement('input', array('type' => 'text', 'size' => 25, 'name' => 'file', 'value' => is_object($this->mTitle) ? $this->mTitle->getText() : ''), '') . ' ' . wfElement('input', array('type' => 'submit', 'value' => wfMsgHtml('filepath-submit')), '') . wfCloseElement('label') . wfCloseElement('form'));
}
示例11: showEditForm
//.........这里部分代码省略.........
$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');
$wgOut->addHTML(<<<END
{$toolbar}
<form id="editform" name="editform" method="post" action="{$action}" enctype="multipart/form-data">
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
$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");
$wgOut->addHTML(<<<END
{$recreate}
{$commentsubject}
{$subjectpreview}
{$this->editFormTextBeforeContent}
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='{$rows}'
cols='{$cols}'{$ew} {$hidden}>
END
. htmlspecialchars($this->safeUnicodeOutput($this->textbox1)) . "\n</textarea>\n\t\t");
$wgOut->wrapWikiMsg("<div id=\"editpage-copywarn\">\n\$1\n</div>", $copywarnMsg);
$wgOut->addHTML($this->editFormTextAfterWarn);
$wgOut->addHTML("\n{$metadata}\n{$editsummary}\n{$summarypreview}\n{$checkboxhtml}\n{$safemodehtml}\n");
$wgOut->addHTML("<div class='editButtons'>\n{$buttonshtml}\n\t<span class='editHelp'>{$cancel} | {$edithelp}</span>\n</div><!-- editButtons -->\n</div><!-- editOptions -->");
$wgOut->addHtml('<div class="mw-editTools">');
$wgOut->addWikiMsgArray('edittools', array(), array('content'));
$wgOut->addHtml('</div>');
$wgOut->addHTML($this->editFormTextAfterTools);
$wgOut->addHTML("\n<div class='templatesUsed'>\n{$formattedtemplates}\n</div>\n");
/**
* 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.
*/
$token = htmlspecialchars($wgUser->editToken());
$wgOut->addHTML("\n<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\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();
}
}
wfProfileOut($fname);
}
示例12: mainPrefsForm
//.........这里部分代码省略.........
# Password
if ($wgAuth->allowPasswordChange()) {
$wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('changepassword'))) . $this->tableRow(Xml::label(wfMsg('oldpassword'), 'wpOldpass'), Xml::password('wpOldpass', 25, $this->mOldpass, array('id' => 'wpOldpass'))) . $this->tableRow(Xml::label(wfMsg('newpassword'), 'wpNewpass'), Xml::password('wpNewpass', 25, $this->mNewpass, array('id' => 'wpNewpass'))) . $this->tableRow(Xml::label(wfMsg('retypenew'), 'wpRetypePass'), Xml::password('wpRetypePass', 25, $this->mRetypePass, array('id' => 'wpRetypePass'))) . Xml::tags('tr', null, Xml::tags('td', array('colspan' => '2'), $this->getToggle("rememberpassword"))));
}
# <FIXME>
# Enotif
if ($wgEnableEmail) {
$moreEmail = '';
if ($wgEnableUserEmail) {
$emf = wfMsg('allowemail');
$disabled = $disableEmailPrefs ? ' disabled="disabled"' : '';
$moreEmail = "<input type='checkbox' {$emfc} {$disabled} value='1' name='wpEmailFlag' id='wpEmailFlag' /> <label for='wpEmailFlag'>{$emf}</label>";
}
$wgOut->addHTML($this->tableRow(Xml::element('h2', null, wfMsg('email'))) . $this->tableRow($emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail . $this->getToggle('ccmeonemails')));
}
# </FIXME>
$wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('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
#
示例13: searchForm
function searchForm()
{
global $wgTitle, $wgScript, $wgRequest;
return wfElement('form', array('action' => $wgScript), null) . wfHidden('title', $wgTitle->getPrefixedDbKey()) . wfElement('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'search')) . wfElement('input', array('type' => 'hidden', 'name' => 'limit', 'value' => $wgRequest->getText('limit'))) . wfElement('input', array('name' => 'ip', 'value' => $this->ip)) . wfElement('input', array('type' => 'submit', 'value' => wfMsg('search'))) . '</form>';
}
示例14: mainPrefsForm
//.........这里部分代码省略.........
$thumbsboxoptions = "<div style='margin:3px 0 3px 0;padding:3px;'>{$thumbsNotifyField} {$thumbsEmailNotifyField}</div>\n";
} else {
$thumbsboxoptions = "";
}
//XXADDED Marketing emails
$memf = wfMsg('allowmarketingemail');
//XXADDED UserTalk emails
$ut_emf = wfMsg('usertalknotifications');
$marketingEmail = "<div><input type='checkbox' class='input_med' {$memfc} {$disabled} value='1' name='wpMarketingEmailFlag' id='wpMarketingEmailFlag' /> <label class='normal_font' for='wpMarketingEmailFlag'>{$memf}</label></div>";
$usertalkEmail = "<div><input type='checkbox' class='input_med' {$ut_emfc} {$disabled} value='1' name='wpUserTalkNotifications' id='wpUserTalkNotifications' /> <label class='normal_font' for='wpUserTalkNotifications'>{$ut_emf}</label></div>";
$articleEmail = "<div><a href='/Special:AuthorEmailNotification'>" . wfMsg('author_emails') . "</a></div>";
$emailboxoptions = "<div style='margin:3px 0 3px 0;padding:3px;'>{$marketingEmail} {$usertalkEmail} {$articleEmail}</div>\n";
}
$wgOut->addHTML($this->tableRow(Xml::element('legend', null, wfMsg('email'))) . $this->tableRow($emailboxoptions . $thumbsboxoptions . $emailauthenticated . $enotifrevealaddr . $enotifwatchlistpages . $enotifusertalkpages . $enotifminoredits . $moreEmail . $authorEmail . $this->getToggle('ccmeonemails')));
}
# </FIXME>
$wgOut->addHTML(Xml::closeElement('table') . Xml::closeElement('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' class='input_med' 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<h2>\n" . wfMsg('skin') . "</h2>\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" );
示例15: showHistory
//.........这里部分代码省略.........
$revisions = $archive->listRevisions();
$files = $archive->listFiles();
$haveRevisions = $revisions && $revisions->numRows() > 0;
$haveFiles = $files && $files->numRows() > 0;
# Batch existence check on user and talk pages
if ($haveRevisions) {
$batch = new LinkBatch();
while ($row = $revisions->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->ar_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->ar_user_text));
}
$batch->execute();
$revisions->seek(0);
}
if ($haveFiles) {
$batch = new LinkBatch();
while ($row = $files->fetchObject()) {
$batch->addObj(Title::makeTitleSafe(NS_USER, $row->fa_user_text));
$batch->addObj(Title::makeTitleSafe(NS_USER_TALK, $row->fa_user_text));
}
$batch->execute();
$files->seek(0);
}
if ($this->mAllowed) {
$titleObj = Title::makeTitle(NS_SPECIAL, "Undelete");
$action = $titleObj->getLocalURL("action=submit");
# Start the form here
$top = wfOpenElement('form', array('method' => 'post', 'action' => $action, 'id' => 'undelete'));
$wgOut->addHtml($top);
}
# Show relevant lines from the deletion log:
$wgOut->addHTML("<h2>" . htmlspecialchars(LogPage::logName('delete')) . "</h2>\n");
$logViewer = new LogViewer(new LogReader(new FauxRequest(array('page' => $this->mTargetObj->getPrefixedText(), 'type' => 'delete'))));
$logViewer->showList($wgOut);
if ($this->mAllowed && ($haveRevisions || $haveFiles)) {
# Format the user-visible controls (comment field, submission button)
# in a nice little table
$table = '<fieldset><table><tr>';
$table .= '<td colspan="2">' . wfMsgWikiHtml('undeleteextrahelp') . '</td></tr><tr>';
$table .= '<td align="right"><strong>' . wfMsgHtml('undeletecomment') . '</strong></td>';
$table .= '<td>' . wfInput('wpComment', 50, $this->mComment) . '</td>';
$table .= '</tr><tr><td> </td><td>';
$table .= wfSubmitButton(wfMsg('undeletebtn'), array('name' => 'restore'));
$table .= wfElement('input', array('type' => 'reset', 'value' => wfMsg('undeletereset')));
$table .= '</td></tr></table></fieldset>';
$wgOut->addHtml($table);
}
$wgOut->addHTML("<h2>" . htmlspecialchars(wfMsg("history")) . "</h2>\n");
if ($haveRevisions) {
# The page's stored (deleted) history:
$wgOut->addHTML("<ul>");
$target = urlencode($this->mTarget);
while ($row = $revisions->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->ar_timestamp);
if ($this->mAllowed) {
$checkBox = wfCheck("ts{$ts}");
$pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}×tamp={$ts}");
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate($ts, true);
}
$userLink = $sk->userLink($row->ar_user, $row->ar_user_text) . $sk->userToolLinks($row->ar_user, $row->ar_user_text);
$comment = $sk->commentBlock($row->ar_comment);
$wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$comment}</li>\n");
}
$revisions->free();
$wgOut->addHTML("</ul>");
} else {
$wgOut->addWikiText(wfMsg("nohistory"));
}
if ($haveFiles) {
$wgOut->addHtml("<h2>" . wfMsgHtml('imghistory') . "</h2>\n");
$wgOut->addHtml("<ul>");
while ($row = $files->fetchObject()) {
$ts = wfTimestamp(TS_MW, $row->fa_timestamp);
if ($this->mAllowed && $row->fa_storage_key) {
$checkBox = wfCheck("fileid" . $row->fa_id);
$key = urlencode($row->fa_storage_key);
$target = urlencode($this->mTarget);
$pageLink = $sk->makeKnownLinkObj($titleObj, $wgLang->timeanddate($ts, true), "target={$target}&file={$key}");
} else {
$checkBox = '';
$pageLink = $wgLang->timeanddate($ts, true);
}
$userLink = $sk->userLink($row->fa_user, $row->fa_user_text) . $sk->userToolLinks($row->fa_user, $row->fa_user_text);
$data = wfMsgHtml('widthheight', $wgLang->formatNum($row->fa_width), $wgLang->formatNum($row->fa_height)) . ' (' . wfMsgHtml('nbytes', $wgLang->formatNum($row->fa_size)) . ')';
$comment = $sk->commentBlock($row->fa_description);
$wgOut->addHTML("<li>{$checkBox} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n");
}
$files->free();
$wgOut->addHTML("</ul>");
}
if ($this->mAllowed) {
# Slip in the hidden controls here
$misc = wfHidden('target', $this->mTarget);
$misc .= wfHidden('wpEditToken', $wgUser->editToken());
$wgOut->addHtml($misc . '</form>');
}
return true;
}