public function getForm($par = null) { global $wgScript, $wgRequest; $category = $par; if (!$category) { $category = $wgRequest->getVal('category'); } $f = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('randomincategory')) . Html::Hidden('title', $this->getTitle()->getPrefixedText()) . Xml::openElement('p') . Xml::label(wfMsg('randomincategory-label'), 'category') . ' ' . Xml::input('category', null, $category, array('id' => 'category')) . ' ' . Xml::submitButton(wfMsg('randomincategory-submit')) . Xml::closeElement('p') . Xml::closeElement('fieldset') . Xml::closeElement('form'); return $f; }
public function show($params) { global $wgOut; $wgOut->setPageTitle(wfMsg('deletequeue')); $this->loadSearch(); // Intro text $wgOut->addWikiMsg('deletequeue-list-text'); // Search box $searchBox = array(); // // Queue selector $selector = Xml::openElement('select', array('name' => 'queue')) . "\n"; $queues = array('speedy', 'prod', 'deletediscuss'); $attribs = array('value' => ''); if (in_array($this->mQueue, $queues)) { $attribs['selected'] = 'selected'; } $selector .= Xml::element('option', $attribs, wfMsg('deletequeue-list-anyqueue')); foreach ($queues as $queue) { $attribs = array('value' => $queue); if ($this->mQueue == $queue) { $attribs['selected'] = 'selected'; } $selector .= Xml::element('option', $attribs, wfMsg("deletequeue-queue-{$queue}")); } $selector .= Xml::closeElement('select'); $searchBox['deletequeue-list-queue'] = $selector; $searchBox['deletequeue-list-status'] = Xml::checkLabel(wfMsg('deletequeue-list-expired'), 'expired', 'mw-dq-expired', $this->mExpired); $searchBox = Xml::buildForm($searchBox, 'deletequeue-list-search'); $searchBox .= Html::Hidden('title', $this->getTitle()->getPrefixedText()); $searchBox = Xml::tags('form', array('action' => $this->getTitle()->getFullURL(), 'method' => 'get'), $searchBox); $searchBox = Xml::fieldset(wfMsg('deletequeue-list-search-legend'), $searchBox); $wgOut->addHTML($searchBox); $conds = array('dq_active' => 1); if ($this->mQueue) { $conds['dq_queue'] = $this->mQueue; } if ($this->mExpired) { $dbr = wfGetDB(DB_SLAVE); $conds[] = 'dq_expiry<' . $dbr->addQuotes($dbr->timestamp(wfTimestampNow())); } // Headers $body = ''; $headers = array('page', 'queue', 'votes', 'expiry', 'discusspage'); foreach ($headers as $header) { $body .= Xml::element('th', null, wfMsg("deletequeue-list-header-{$header}")) . "\n"; } $body = Xml::tags('tr', null, $body); // The list itself $pager = new DeleteQueuePager($conds); $body .= $pager->getBody(); $body = Xml::tags('table', array('class' => 'wikitable'), $body); $wgOut->addHTML($pager->getNavigationBar() . $body . $pager->getNavigationBar()); }
function execute($subpage) { global $wgRequest, $wgOut; $wgOut->setPageTitle('Wikitext Preview'); if ($wikitext = $wgRequest->getText('wikitext')) { $wgOut->addHTML(Xml::fieldset('Wikitext preview', $wgOut->parse($wikitext))); } $f = Xml::textarea('wikitext', $wikitext); $f .= Xml::submitButton('Preview wikitext'); $f .= Html::Hidden('title', $this->getTitle()->getPrefixedText()); $f = Xml::tags('form', array('method' => 'POST', 'action' => $this->getTitle()->getLocalURL()), $f); $wgOut->addHTML(Xml::fieldset('Preview wikitext', $f)); }
function execute($par) { global $wgRequest, $wgOut, $smwgARC2StoreConfig, $wgServer, $wgScriptPath, $wgUser; if (!$this->userCanExecute($this->getUser())) { $this->displayRestrictionError(); return; } $this->setHeaders(); $output = ""; # Get request data from, e.g. $rdfioAction = $wgRequest->getText('rdfio_action'); # instantiation $store = ARC2::getStore($smwgARC2StoreConfig); $output .= "\n===RDF Store Setup===\n'''Status:'''\n\n"; if (!$store->isSetUp()) { $output .= "* Store is '''not''' set up\n"; if ($rdfioAction == "setup") { if (!$wgUser->matchEditToken($wgRequest->getText('token'))) { die('Cross-site request forgery detected!'); } else { if ($this->isSysop) { $output .= "* Setting up now ...\n"; $store->setUp(); if ($store->isSetUp()) { $output .= "* Done!\n"; } else { $output .= "Setup failed:\n"; $store->getErrors(); } } else { $errorMessage = "Only sysops can perform this operation!"; $wgOut->addHTML("<pre>Permission Error: " . $errorMessage . "</pre>"); } } } } else { $output .= "* Store is already set up.\n"; } $wgOut->addWikiText($output); $htmlOutput = '<form method="get" action="' . $wgServer . $wgScriptPath . '/index.php/Special:RDFIOAdmin" name="createEditQuery"> <input type="submit" name="rdfio_action" value="setup">' . Html::Hidden('token', $wgUser->getEditToken()) . ' </form>'; $wgOut->addHTML($htmlOutput); $wgOut->addWikiText("\n===Data Sources===\n"); $wgOut->addWikiText("\n{{#ask: [[Category:RDFIO Data Source]]\n\t\t\t\t\t|?Equivalent URI\n\t\t\t\t\t|?RDFIO Import Type\n\t\t\t\t\t|format=table\n\t\t\t\t\t|mainlabel=Data Source\n\t\t\t\t\t|limit=10\n\t\t\t\t\t}}\n"); $wgOut->addWikiText("\n===Pages and Templates===\n"); $wgOut->addWikiText("To associate a template with a category, add <nowiki>[[Has template::Template:Name]]</nowiki> to the Category page"); $wgOut->addWikiText("{{#ask: [[:Category:+]]\n\t\t\t\t\t|?Equivalent URI\n\t\t\t\t\t|?Has template\n\t\t\t\t\t|format=table\n\t\t\t\t\t|mainlabel=Category\n\t\t\t\t\t|limit=10\n\t\t\t\t\t}}"); }
function showForm() { global $wgScript; $out = $this->getOutput(); $username = str_replace('_', ' ', $this->target); $form = Xml::openElement('form', array('name' => 'stablization', 'action' => $wgScript, 'method' => 'get')); $form .= "<fieldset><legend>" . wfMsg('usercredentials-leg') . "</legend>"; $form .= "<table><tr>"; $form .= "<td>" . Html::Hidden('title', $this->getTitle()->getPrefixedText()) . "</td>"; $form .= "<td>" . wfMsgHtml("usercredentials-user") . "</td>"; $form .= "<td>" . Xml::input('target', 35, $username, array('id' => 'wpUsername')) . "</td>"; $form .= "<td>" . Xml::submitButton(wfMsg('go')) . "</td>"; $form .= "</tr></table>"; $form .= "</fieldset></form>\n"; $out->addHTML($form); }
function showRemove(&$output, $name, &$user) { $self = SpecialPage::getTitleFor('Badimages'); $skin =& $user->getSkin(); $title = Title::makeTitleSafe(NS_IMAGE, $name); $link = $skin->makeKnownLinkObj($title, htmlspecialchars($title->getText())); $output->addHTML('<p>' . wfMsgHtml('badimages-remove-confirm', $link) . '</p>'); $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl())); $form .= Html::Hidden('action', 'remove') . Html::Hidden('wpToken', $user->editToken()) . Html::Hidden('wpImage', $name); $form .= '<table><tr><td align="right">' . wfMsgHtml('badimages-name') . '</td>'; $form .= '<td>' . Xml::input('wpImage2', false, $name, array('readonly' => 'readonly')) . '</td></tr>'; $form .= '<tr><td align="right">' . wfMsgHtml('badimages-reason') . '</td>'; $form .= '<td>' . Xml::input('wpReason', 40) . '</td><tr></tr><td></td><td>'; $form .= Xml::submitButton(wfMsg('badimages-remove-btn')) . '</td></tr></table></form>'; $output->addHTML($form); }
function execute( $par ) { global $wgRequest, $wgOut, $smwgARC2StoreConfig, $wgServer, $wgScriptPath, $wgUser; $this->setHeaders(); $output = ""; # Get request data from, e.g. $rdfio_action = $wgRequest->getText( 'rdfio_action' ); # instantiation $store = ARC2::getStore( $smwgARC2StoreConfig ); $output .= "\n===RDF Store Setup===\n'''Status:'''\n\n"; if ( !$store->isSetUp() ) { $output .= "* Store is '''not''' set up\n"; if ( $rdfio_action == "setup" ) { if ( !$wgUser->matchEditToken( $wgRequest->getText( 'token' ) ) ) { die( 'Cross-site request forgery detected!' ); } else { if ( $this->m_issysop ) { $output .= "* Setting up now ...\n"; $store->setUp(); $output .= "* Done!\n"; } else { $errormessage = "Only sysops can perform this operation!"; $wgOut->addHTML( RDFIOUtils::formatErrorHTML( "Permission Error", $errormessage ) ); } } } } else { $output .= "* Store is already set up.\n"; } $wgOut->addWikiText( $output ); $htmlOutput = '<form method="get" action="' . $wgServer . $wgScriptPath . '/index.php/Special:ARC2Admin" name="createEditQuery"> <input type="submit" name="rdfio_action" value="setup">' . Html::Hidden( 'token', $wgUser->editToken() ) . ' </form>'; $wgOut->addHTML( $htmlOutput ); }
protected function showContentForm() { if ($this->contentFormat !== CollaborationListContentHandler::FORMAT_WIKI) { return parent::showContentForm(); } $parts = explode(CollaborationListContent::HUMAN_DESC_SPLIT, $this->textbox1, 3); if (count($parts) !== 3) { return parent::showContentForm(); } $pageLang = $this->getTitle()->getPageLanguage(); $attribs = ['id' => 'wpCollabDescTextbox', 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir()]; $descTitle = wfMessage('collaborationkit-listedit-description')->text(); $listTitle = wfMessage('collaborationkit-listedit-list')->text(); $out = RequestContext::getMain()->getOutput(); $out->addHtml(Html::element('h2', ["id" => 'mw-collabkit-desc'], $descTitle) . Html::textarea('wpCollabDescTextbox', $parts[0], $attribs) . Html::element('h2', ["id" => 'mw-collabkit-list'], $listTitle)); $out->addHtml(Html::Hidden('wpCollaborationKitOptions', $parts[1])); $this->showTextbox1(null, trim($parts[2])); }
/** * Process the 'delvote' action. * @param Article $article The article to endorse/object to deletion of. */ public function process($article) { global $wgRequest, $wgOut, $wgUser; $errs = $article->mTitle->getUserPermissionsErrors('deletequeue-vote', $wgUser); if (count($errs) > 0) { $wgOut->showPermissionsErrorPage($errs); return; } $dqi = DeleteQueueItem::newFromArticle($article); $wgOut->setPageTitle(wfMsg('deletequeue-vote-title', $article->mTitle->getPrefixedText())); // Load form data $token = $wgRequest->getVal('wpEditToken'); $action = $wgRequest->getVal('wpVote'); $comments = $wgRequest->getText('wpComments'); if ($wgUser->matchEditToken($token) && in_array($action, array('endorse', 'object'))) { $dqi->addVote($action, $comments); if ($action == 'object' && $dqi->getQueue() == 'prod') { $dbw = wfGetDB(DB_MASTER); $dbw->begin(); $dqi->setQueue('deletediscuss', $dqi->getReason()); $lp = new LogPage('delete'); $lp->addEntry('requeue', $article->mTitle, $comments, array(wfMsgForContent('deletequeue-queue-prod'), wfMsgForContent("deletequeue-queue-deletediscuss"))); $dbw->commit(); $wgOut->addWikiMsg('deletequeue-vote-requeued', wfMsgNoTrans('deletequeue-queue-deletediscuss')); } else { $wgOut->addWikiMsg("deletequeue-vote-success-{$action}"); } return; } $wgOut->addWikiMsg('deletequeue-vote-text', $article->mTitle->getPrefixedText(), $dqi->getReason()); // Add main form. $fields = array(); $options = Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-endorse'), 'wpVote', 'endorse', 'mw-deletequeue-vote-endorse')); $options .= Xml::tags('p', null, Xml::radioLabel(wfMsg('deletequeue-vote-object'), 'wpVote', 'object', 'mw-deletequeue-vote-object')); $fields['deletequeue-vote-action'] = $options; $fields['deletequeue-vote-reason'] = Xml::input('wpComments', 45, $comments); $article_id = $article->getId(); $title = $this->getTitle("vote/{$article_id}"); $form = Xml::buildForm($fields, 'deletequeue-vote-submit') . Html::Hidden('wpEditToken', $wgUser->editToken()) . Html::Hidden('title', $title->getPrefixedText()); $form = Xml::tags('form', array('action' => $title->getLocalURL(), 'method' => 'POST'), $form); $form = Xml::fieldset(wfMsg('deletequeue-vote-legend'), $form); $wgOut->addHTML($form); }
/** * Get all Interwiki Links - the heart of the function * @param $prefix string Prefix to search for in list * @return string HTML */ private function getInterwikis($prefix = null) { global $wgScript; $dbr = wfGetDB(DB_SLAVE); $conds = array(); if (!is_null($prefix)) { $conds[] = "iw_prefix " . $dbr->buildLike($prefix, $dbr->anyString()); } $results = $dbr->select('interwiki', array('iw_prefix', 'iw_url'), $conds); $form = Xml::openElement('form', array('action' => $wgScript, 'method' => 'get', 'id' => 'interwikilist-search')) . Html::Hidden('title', $this->mTitle->getPrefixedText()) . Xml::inputLabel(wfMsg('interwikilist-prefix'), 'iwsearch', 'interwikilist-prefix', false, $prefix) . Xml::submitButton(wfMsg('search')) . Xml::closeElement('form'); $text = Xml::fieldSet(wfMsg('interwikilist-filter'), $form); $interwikiList = array(); foreach ($results as $row) { $interwikiList["mw-iwlist-" . $row->iw_prefix] = array($row->iw_prefix, $row->iw_url); } $dbr->freeResult($results); $text .= Xml::buildTable($interwikiList, array('id' => 'sv-software'), array(wfMsg('interwikilist-linkname'), wfMsg('interwikilist-target'))); return $text; }
/** * Add new fields (1 shown + 1-5 hidden ones) to Special:Contact. * * @param $contactForm Object: instance of EmailContactForm class * @param $form Sringt: HTML * @return Boolean: true */ function addContactFormFields($contactForm, $form) { global $wgServer, $wgDBname; $form .= '<tr> <td class="mw-label">' . Xml::label(wfMsg('contactpage-wikiurl'), 'wpWikiURL') . '</td> <td class="mw-input" id="mw-contactpage-address">' . Xml::input('wpWikiURL', 60, $wgServer, array('type' => 'text', 'maxlength' => 200)) . '</td> </tr> <tr>' . Html::Hidden('wpDBname', $wgDBname, array('maxlength' => 100)) . "</tr>\n\t\t\t"; if (class_exists('MyInfo')) { $myinfo = new MyInfo(); $myinfo->browser = get_browser(null, true); $myinfo->info = browser_detection('full'); $myinfo->info[] = browser_detection('moz_version'); $form .= '<tr>' . Html::Hidden('wpBrowser', $myinfo->getBrowser(), array('maxlength' => 255)) . '</tr> <tr>' . Html::Hidden('wpOperatingSystem', $myinfo->getOs(), array('maxlength' => 255)) . '</tr> <tr>' . Html::Hidden('wpSkinName', $myinfo->getSkin(), array('maxlength' => 35)) . '</tr> <tr>' . Html::Hidden('wpUserAgent', $myinfo->getUAgent(), array('maxlength' => 500)) . '</tr>'; } return true; }
/** * Generate a "deletion nomination" form. * @param $article Article object to nominate. */ public function buildForm($article, $queue) { global $wgOut, $wgScript, $wgUser, $wgRequest; // Check for submission if ($this->trySubmit($article, $queue)) { return; } $wgOut->setPageTitle(wfMsg("deletequeue-{$queue}-title", $article->mTitle->getPrefixedText())); $wgOut->addWikiMsg("deletequeue-{$queue}-text", $article->mTitle->getPrefixedText()); // Build deletion form. $fields = array(); $fields['deletequeue-delnom-reason'] = Xml::listDropDown('wpReason', DeleteQueueInterface::getReasonList($queue), wfMsg("deletequeue-delnom-otherreason")); $fields['deletequeue-delnom-extra'] = Xml::input('wpExtra', 45); $article_id = $article->getId(); $title = $this->getTitle("nominate/{$article_id}/{$queue}"); $form = Xml::buildForm($fields, "deletequeue-delnom-submit"); $form .= Html::Hidden('title', $title->getPrefixedText()); $form .= Html::Hidden('queue', $queue); $form .= Html::Hidden('wpEditToken', $wgUser->editToken()); $form = Xml::tags('form', array('action' => $title->getLocalUrl(), 'method' => 'POST'), $form); $wgOut->addHTML($form); }
function listForm($username, $reason) { global $wgUser, $wgOut, $wgLang; $pages = $this->getNewPages($username); if (count($pages) == 0) { $wgOut->addWikiMsg('massblank-nopages', $username); return $this->promptForm(); } $wgOut->addWikiMsg('massblank-list', $username); $massblank = $this->getTitle(); $submit = Xml::submitButton(wfMsg('massblank-submit-blank')); $wgOut->addHTML(Xml::openElement('form', array('action' => $massblank->getLocalURL('action=blank'), 'method' => 'post')) . Html::Hidden('wpEditToken', $wgUser->editToken()) . Xml::inputLabel(wfMsg('massblank-blankcomment'), 'wpReason', 'wpReason', 60, $reason) . '<br /><br />' . Xml::submitButton(wfMsg('massblank-submit-blank'))); $wgOut->addHTML('<ul>'); $sk = $wgUser->getSkin(); foreach ($pages as $info) { list($title, $edits) = $info; $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile($title) : false; $thumb = $image && $image->exists() ? $image->transform(array('width' => 120, 'height' => 120), 0) : false; $changes = wfMsgExt('nchanges', 'parsemag', $wgLang->formatNum($edits)); $wgOut->addHTML('<li>' . Xml::check('pages[]', true, array('value' => $title->getPrefixedDbKey())) . ' ' . ($thumb ? $thumb->toHtml(array('desc-link' => true)) : '') . $sk->makeKnownLinkObj($title) . ' (' . $sk->makeKnownLinkObj($title, $changes, 'action=history') . ")</li>\n"); } $wgOut->addHTML("</ul>\n" . Xml::submitButton(wfMsg('massblank-submit-blank')) . "</form>"); }
/** * Preview the template before actually saving the page. Is called when the user specified one of several predifined templates * Provides a HTML form for submitting the confirmation. An edit token is included to prevent (possibly malicious) external POST request. * * @param $page String: title of the page that needs to be edited * @param $template String: title of the selected template */ function preview($page, $template) { // TODO: set $wgTitle / PAGENAME global $wgOut, $wgUser; $wgOut->addWikiText(wfMsg('flagpage-preview')); $wgOut->addWikiText('<div class="flagpage-preview" style="background-color:#F5F5F5; border:1px solid #AAAAAA; padding:0 0.8em 0.3em 0.5em;"> {{' . $template . "}}</div>"); $token = $wgUser->editToken(); // TODO what a mess! tidy up the html code $s = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-flagpage-form')) . Xml::openElement('p') . Xml::tags('label', null, wfMsg('flagpage-confirmsave')) . Html::Hidden('page', $page) . Html::Hidden('template', $template) . Html::Hidden('token', $token) . Xml::submitButton(wfMsg('flagpage-submitbutton')) . "\n" . Xml::closeElement('p') . "\n" . Xml::closeElement('form') . "\n"; $wgOut->addHTML($s); }
protected function buildForm($parseErrors = null, $searchTitle = true, $searchContent = true) { global $wgScript, $wgOut; $wgOut->addInlineScript($this->checkboxActionJS() . $this->invertJS('caNamespaces', $this->namespaceCheckboxes()) . $this->invertJS('caSpeedcats', $this->speedcatCheckboxes())); $retval = wfMsgExt('advancedsearch-toptext', array('parse')); $retval .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)); $retval .= Html::Hidden('title', $this->getTitle()->getPrefixedDbKey()); $retval .= Html::Hidden('do', 'search'); // The big table everything is in $retval .= Xml::openElement('table'); // The fieldset+table for searching page content $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-contentsearch')); $retval .= Xml::openElement('table'); // title/content checkboxes $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td'); $retval .= wfMsg('advancedsearch-searchin'); $retval .= Xml::checkLabel(wfMsg('advancedsearch-searchin-title'), 'searchtitle', 'searchtitle', $searchTitle); $retval .= Xml::checkLabel(wfMsg('advancedsearch-searchin-content'), 'searchcontent', 'searchcontent', $searchContent); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); // Include fieldset $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-content-include')); $retval .= Xml::openElement('table'); $retval .= $this->inputRow('content-incl'); if (is_array($parseErrors) && $parseErrors[0] !== false) { $retval .= $this->errorRow($parseErrors[0]); } $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); // Exclude fieldset $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-content-exclude')); $retval .= Xml::openElement('table'); $retval .= $this->inputRow('content-excl'); if (is_array($parseErrors) && $parseErrors[1] !== false) { $retval .= $this->errorRow($parseErrors[1]); } $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); // The namespace fieldset $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-namespaces')); $retval .= $this->namespaceTable(); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); // The category fieldset $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-categorysearch')); $retval .= Xml::openElement('table'); // The include fieldset $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-category-include')); $retval .= Xml::openElement('table'); $retval .= $this->inputRow('cat-incl'); if (is_array($parseErrors) && $parseErrors[2] !== false) { $retval .= $this->errorRow($parseErrors[2]); } $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); // The exclude fieldset $retval .= Xml::openElement('tr'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-category-exclude')); $retval .= Xml::openElement('table'); $retval .= $this->inputRow('cat-excl'); if (is_array($parseErrors) && $parseErrors[3] !== false) { $retval .= $this->errorRow($parseErrors[3]); } $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('table'); // The speedcat fieldset global $wgAdvancedSearchSpeedCats; if (!empty($wgAdvancedSearchSpeedCats)) { $retval .= Xml::openElement('td', array('valign' => 'top')); $retval .= Xml::openElement('fieldset', array('class' => 'nested')); $retval .= Xml::element('legend', array('class' => 'advancedsearchLegend'), wfMsg('advancedsearch-speedcats')); $retval .= $this->speedCatTable(); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('td'); } $retval .= Xml::closeElement('table'); $retval .= Xml::closeElement('td'); $retval .= Xml::closeElement('tr'); $retval .= Xml::closeElement('table'); $retval .= Xml::checkLabel(wfMsg('advancedsearch-permalink-check'), 'permalink', 'permalink'); $retval .= Xml::element('br'); $retval .= Xml::submitButton(wfMsg('advancedsearch-submit')); $retval .= Xml::closeElement('form'); return $retval; }
private function render($mode = null) { global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgPrefSwitchGlobalOptOut, $wgAllowUserCss, $wgAllowUserJs; // Make sure links will retain the origin $query = array('from' => $this->origin, 'fromquery' => $this->originQuery); if (isset($wgPrefSwitchSurveys[$mode])) { $wgOut->addWikiMsg("prefswitch-survey-intro-{$mode}"); // Provide a "nevermind" link if ($this->originTitle) { $wgOut->addHTML(wfMsg("prefswitch-survey-cancel-{$mode}", $this->originLink)); } // Setup a form $html = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLinkURL($query), 'class' => 'prefswitch-survey', 'id' => "prefswitch-survey-{$mode}")); $html .= Html::Hidden('mode', $mode); $html .= Html::Hidden('token', $wgUser->editToken()); // Render a survey $html .= PrefSwitchSurvey::render($mode, $wgPrefSwitchSurveys[$mode]['questions'], $wgPrefSwitchSurveys[$mode]['updatable']); // Finish out the form $html .= Xml::openElement('dt', array('class' => 'prefswitch-survey-submit')); $html .= Xml::submitButton(wfMsg($wgPrefSwitchSurveys[$mode]['submit-msg']), array('id' => "prefswitch-survey-submit-{$mode}", 'class' => 'prefswitch-survey-submit')); $html .= Xml::closeElement('dt'); $html .= Xml::closeElement('form'); $wgOut->addHtml($html); } else { $wgOut->addWikiMsg('prefswitch-main', wfMsgForContent('prefswitch-feedbackpage')); if ($wgUser->isLoggedIn()) { $wgOut->addWikiMsg('prefswitch-main-logged-changes'); $oldSkin = 'monobook'; // The skin we are migrating from if ($wgAllowUserJs) { $jsPage = Title::makeTitleSafe(NS_USER, $wgUser->getName() . '/' . $oldSkin . '.js'); if ($jsPage->exists()) { $wgOut->addWikiMsg('prefswitch-jswarning', $wgUser->getName(), $oldSkin, array('parse')); } } if ($wgAllowUserCss) { $cssPage = Title::makeTitleSafe(NS_USER, $wgUser->getName() . '/' . $oldSkin . '.css'); if ($cssPage->exists()) { $wgOut->addWikiMsg('prefswitch-csswarning', $wgUser->getName(), $oldSkin, array('parse')); } } } $wgOut->addWikiMsg('prefswitch-main-feedback', wfMsgForContent('prefswitch-feedbackpage')); $state = self::userState($wgUser); switch ($state) { case 'anon': $parameters = array(SpecialPage::getTitleFor('Userlogin')->getFullURL(array('returnto' => $this->getTitle()->getPrefixedText(), 'returntoquery' => wfArrayToCGI(array_merge($query, array('mode' => 'off')))))); break; case 'on': $parameters = array($this->getTitle()->getFullURL(array_merge($query, array('mode' => 'feedback'))), $this->getTitle()->getFullURL(array_merge($query, array('mode' => 'off')))); break; case 'off': $parameters = array($this->getTitle()->getFullURL(array_merge($query, array('mode' => 'on', 'token' => $wgUser->editToken())))); break; } // Uses prefswitch-main-anon, prefswitch-main-on and prefswitch-main-off $wgOut->addWikiMsgArray('prefswitch-main-' . $state, $parameters); } }
<div class="panel panel-default"> <div class="panel-heading text-center"><h2>Sign up</h2></div> <div class="panel-body"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div id="signup_container"> <form class="form-horizontal" action="<?php echo URL; ?> login/register" method="post"> <?php require_once MESSAGE_FILE; ?> <?php echo Html::Hidden(array("name" => "gender", "object" => $this, "property" => "user->gender")); ?> <div class="form-group"> <div class="col-md-3"> <label>Profile Pic</label> </div> <div class="col-md-9"> <?php echo Html::Image(array("name" => "profile_image_id", "object" => $this, "property" => "user->profileImage->id", "from" => "profile")); ?> </div> </div> <div class="form-group"> <div class="col-md-3"> <label>First Name</label> </div>
function execute( $par ) { global $wgRequest, $wgOut, $wgUser; $this->setHeaders(); if ( !$wgUser->isAllowed( 'passwordreset' ) ) { $wgOut->permissionRequired( 'passwordreset' ); return; } $username = Title::newFromText( $wgRequest->getText( 'username' ) ); $username_text = is_object( $username ) ? $username->getText() : ''; $disableuser = $wgRequest->getCheck( 'disableuser' ); if ( $disableuser ) { $disableuserchecked = ' CHECKED'; $passwordfielddisabled = ' disabled="true"'; } else { $disableuserchecked = ''; $passwordfielddisabled = ''; } if ( strlen( $wgRequest->getText( 'username' ) . $wgRequest->getText( 'newpass' ) . $wgRequest->getText( 'confirmpass' ) ) > 0 ) { //POST data found if ( strlen( $username_text ) > 0 ) { $objUser = User::newFromName( $username->getText() ); $userID = $objUser->idForName(); if ( !is_object( $objUser ) || $userID == 0 ) { $validUser = false; $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-invalidusername' ) ) . "\n" ); } else { $validUser = true; } } else { $validUser = false; $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-emptyusername' ) ) . "\n" ); } $newpass = $wgRequest->getText( 'newpass' ); $confirmpass = $wgRequest->getText( 'confirmpass' ); if( ( $newpass == $confirmpass && strlen( $newpass ) > 0 ) || $disableuser ) { //Passwords match $passMatch = true; } else { //Passwords DO NOT match $passMatch = false; $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-nopassmatch' ) ) . "\n" ); } if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) { $validUser = false; $passMatch = false; $wgOut->addHTML( Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'passwordreset-badtoken' ) ) . "\n" ); } } else { $validUser = false; $confirmpass = ''; $newpass = ''; } $wgOut->addHTML( " <script language=\"Javascript\"> function disableUserClicked() { if (document.getElementById('disableuser').checked) { document.getElementById('newpass').disabled = false; document.getElementById('confirmpass').disabled = false; } else { document.getElementById('newpass').disabled = true; document.getElementById('confirmpass').disabled = true; } return true; } </script>" . Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'passwordresetform' ) ) . Xml::openElement( 'table', array( 'id' => 'mw-passwordreset-table' ) ) . "<tr> <td class='mw-label'>" . Xml::label( wfMsg( 'passwordreset-username' ), 'username' ) . "</td> <td class='mw-input'> <input tabindex='1' type='text' size='20' name='username' id='username' value=\"$username_text\" onFocus=\"document.getElementById('username').select;\" /> </td> </tr> <tr> <td class='mw-label'>" . Xml::label( wfMsg( 'passwordreset-newpass' ), 'newpass' ) . "</td> <td class='mw-input'> <input tabindex='2' type='password' size='20' name='newpass' id='newpass' value=\"$newpass\" onFocus=\"document.getElementById('newpass').select;\"{$passwordfielddisabled} /> </td> </tr> <tr> <td class='mw-label'>" . Xml::label( wfMsg( 'passwordreset-confirmpass' ), 'confirmpass' ) . "</td> <td class='mw-input'> <input tabindex='3' type='password' size='20' name='confirmpass' id='confirmpass' value=\"$confirmpass\" onFocus=\"document.getElementById('confirmpass').select;\"{$passwordfielddisabled} /> </td> </tr> <tr> <td class='mw-label'>" . Xml::label( wfMsg( 'passwordreset-disableuser' ), 'disableuser' ) . "</td> <td class='mw-input'> <input tabindex='4' type='checkbox' name='disableuser' id='disableuser' onmouseup='return disableUserClicked();'{$disableuserchecked} /> " . wfMsg('passwordreset-disableuserexplain') . "</td> </tr> <tr> <td></td> <td class='mw-submit'>" . Xml::submitButton( wfMsg( 'passwordreset-submit' ), array( 'name' => 'submit' ) ) . "</td> </tr>" . Xml::closeElement( 'table' ) . Html::Hidden( 'token', $wgUser->editToken() ) . Xml::closeElement( 'form' ) ); if ( $validUser && $passMatch ) { $wgOut->addWikiText ( Xml::tags( 'div', array( 'class' => 'successbox' ), $this->resetPassword( $userID, $newpass, $disableuser ) ) ); } else { //Invalid user or passwords don't match - do nothing } }
/** * Display the interwiki watchlist */ function execute($par) { global $wgUser, $wgOut, $wgLang, $wgRequest; global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; // Add feed links $wlToken = $wgUser->getOption('watchlisttoken'); if (!$wlToken) { $wlToken = sha1(mt_rand() . microtime(true)); $wgUser->setOption('watchlisttoken', $wlToken); $wgUser->saveSettings(); } global $wgServer, $wgScriptPath, $wgFeedClasses; $apiParams = array('action' => 'feedwatchlist', 'allrev' => 'allrev', 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken); $feedTemplate = wfScript('api') . '?'; foreach ($wgFeedClasses as $format => $class) { $theseParams = $apiParams + array('feedformat' => $format); $url = $feedTemplate . wfArrayToCGI($theseParams); $wgOut->addFeedLink($format, $url); } $skin = $wgUser->getSkin(); $specialTitle = SpecialPage::getTitleFor('InterwikiWatchlist'); $wgOut->setRobotPolicy('noindex,nofollow'); # Anons don't get a watchlist if ($wgUser->isAnon()) { $wgOut->setPageTitle(wfMsg('watchnologin')); $llink = $skin->linkKnown(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('loginreqlink'), array(), array('returnto' => $specialTitle->getPrefixedText())); $wgOut->addHTML(wfMsgWikiHtml('watchlistanontext', $llink)); return; } $wgOut->setPageTitle(wfMsg('interwikiwatchlist')); $sub = wfMsgExt('watchlistfor', 'parseinline', $wgUser->getName()); $sub .= '<br />' . SpecialEditWatchlist::buildTools($wgUser->getSkin()); $wgOut->setSubtitle($sub); $mode = SpecialEditWatchlist::getMode($this->getRequest(), $par); if ($mode !== false) { # TODO: localise? switch ($mode) { case SpecialEditWatchlist::EDIT_CLEAR: $mode = 'clear'; break; case SpecialEditWatchlist::EDIT_RAW: $mode = 'raw'; break; default: $mode = null; } $title = SpecialPage::getTitleFor('EditWatchlist', $mode); $wgOut->redirect($title->getLocalUrl()); return; } $uid = $wgUser->getId(); if (($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal('reset') && $wgRequest->wasPosted()) { $wgUser->clearAllNotifications(); $wgOut->redirect($specialTitle->getFullUrl()); return; } $defaults = array('days' => floatval($wgUser->getOption('watchlistdays')), 'hideMinor' => (int) $wgUser->getBoolOption('watchlisthideminor'), 'hideBots' => (int) $wgUser->getBoolOption('watchlisthidebots'), 'hideAnons' => (int) $wgUser->getBoolOption('watchlisthideanons'), 'hideLiu' => (int) $wgUser->getBoolOption('watchlisthideliu'), 'hidePatrolled' => (int) $wgUser->getBoolOption('watchlisthidepatrolled'), 'hideOwn' => (int) $wgUser->getBoolOption('watchlisthideown'), 'namespace' => 'all', 'invert' => false); extract($defaults); # Extract variables from the request, falling back to user preferences or # other default values if these don't exist $prefs['days'] = floatval($wgUser->getOption('watchlistdays')); $prefs['hideminor'] = $wgUser->getBoolOption('watchlisthideminor'); $prefs['hidebots'] = $wgUser->getBoolOption('watchlisthidebots'); $prefs['hideanons'] = $wgUser->getBoolOption('watchlisthideanon'); $prefs['hideliu'] = $wgUser->getBoolOption('watchlisthideliu'); $prefs['hideown'] = $wgUser->getBoolOption('watchlisthideown'); $prefs['hidepatrolled'] = $wgUser->getBoolOption('watchlisthidepatrolled'); # Get query variables $days = $wgRequest->getVal('days', $prefs['days']); $hideMinor = $wgRequest->getBool('hideMinor', $prefs['hideminor']); $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']); $hideAnons = $wgRequest->getBool('hideAnons', $prefs['hideanons']); $hideLiu = $wgRequest->getBool('hideLiu', $prefs['hideliu']); $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']); $hidePatrolled = $wgRequest->getBool('hidePatrolled', $prefs['hidepatrolled']); # Get namespace value, if supplied, and prepare a WHERE fragment $nameSpace = $wgRequest->getIntOrNull('namespace'); $invert = $wgRequest->getIntOrNull('invert'); if (!is_null($nameSpace)) { $nameSpace = intval($nameSpace); if ($invert && $nameSpace !== 'all') { $nameSpaceClause = "integration_rc_namespace != {$nameSpace}"; } else { $nameSpaceClause = "integration_rc_namespace = {$nameSpace}"; } } else { $nameSpace = ''; $nameSpaceClause = ''; } $dbr = wfGetDB(DB_SLAVE, 'integration_watchlist'); $recentchanges = $dbr->tableName('integration_recentchanges'); $nitems = $this->countItems(); if (is_null($days) || !is_numeric($days)) { $big = 1000; /* The magical big */ if ($nitems > $big) { # Set default cutoff shorter $days = $defaults['days'] = 12.0 / 24.0; # 12 hours... } else { $days = $defaults['days']; # default cutoff for shortlisters } } else { $days = floatval($days); } // Dump everything here $nondefaults = array(); wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hideAnons', (int) $hideAnons, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hideLiu', (int) $hideLiu, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults); wfAppendToArrayIfNotDefault('hidePatrolled', (int) $hidePatrolled, $defaults, $nondefaults); if ($nitems == 0) { $wgOut->addWikiMsg('nowatchlist'); return; } # Possible where conditions $conds = array(); if ($days <= 0) { $andcutoff = ''; } else { $conds[] = "integration_rc_timestamp > '" . $dbr->timestamp(time() - intval($days * 86400)) . "'"; } # If the watchlist is relatively short, it's simplest to zip # down its entirety and then sort the results. # If it's relatively long, it may be worth our while to zip # through the time-sorted page list checking for watched items. # Up estimate of watched items by 15% to compensate for talk pages... # Toggles if ($hideOwn) { $conds[] = "integration_rc_user != {$uid}"; } if ($hideBots) { $conds[] = 'integration_rc_bot = 0'; } if ($hideMinor) { $conds[] = 'integration_rc_minor = 0'; } if ($hideLiu) { $conds[] = 'integration_rc_user = 0'; } if ($hideAnons) { $conds[] = 'integration_rc_user != 0'; } if ($wgUser->useRCPatrol() && $hidePatrolled) { $conds[] = 'integration_rc_patrolled != 1'; } if ($nameSpaceClause) { $conds[] = $nameSpaceClause; } # Toggle watchlist content (all recent edits or just the latest) if ($wgUser->getOption('extendwatchlist')) { $limitWatchlist = intval($wgUser->getOption('wllimit')); $usePage = false; } else { # Top log Ids for a page are not stored $conds[] = 'integration_rc_this_oldid=integration_page_latest OR integration_rc_type=' . RC_LOG; $limitWatchlist = 0; $usePage = true; } # Show a message about slave lag, if applicable $lag = wfGetLB()->safeGetLag($dbr); if ($lag > 0) { $wgOut->showLagWarning($lag); } # Create output form $form = Xml::fieldset(wfMsg('watchlist-options'), false, array('id' => 'mw-watchlist-options')); # Show watchlist header $form .= wfMsgExt('watchlist-details', array('parseinline'), $wgLang->formatNum($nitems)); if ($wgUser->getOption('enotifwatchlistpages') && $wgEnotifWatchlist) { $form .= wfMsgExt('wlheader-enotif', 'parse') . "\n"; } if ($wgShowUpdatedMarker) { $form .= Xml::openElement('form', array('method' => 'post', 'action' => $specialTitle->getLocalUrl(), 'id' => 'mw-watchlist-resetbutton')) . wfMsgExt('wlheader-showupdated', array('parseinline')) . ' ' . Xml::submitButton(wfMsg('enotif_reset'), array('name' => 'dummy')) . Html::Hidden('reset', 'all') . Xml::closeElement('form'); } $form .= '<hr />'; $tables = array('integration_recentchanges', 'integration_watchlist'); $fields = array("{$recentchanges}.*"); $join_conds = array('integration_watchlist' => array('INNER JOIN', "integration_wl_user='******' AND integration_wl_namespace=integration_rc_namespace AND integration_wl_title=integration_rc_title AND integration_wl_db=integration_rc_db")); $options = array('ORDER BY' => 'integration_rc_timestamp DESC'); if ($wgShowUpdatedMarker) { $fields[] = 'integration_wl_notificationtimestamp'; } if ($limitWatchlist) { $options['LIMIT'] = $limitWatchlist; } $rollbacker = $wgUser->isAllowed('rollback'); if ($usePage || $rollbacker) { $tables[] = 'integration_page'; $join_conds['integration_page'] = array('LEFT JOIN', 'integration_rc_cur_id=integration_page_id', 'integration_rc_db=integration_page_db'); if ($rollbacker) { $fields[] = 'integration_page_latest'; } } InterwikiIntegrationFunctions::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $options, ''); wfRunHooks('SpecialWatchlistQuery', array(&$conds, &$tables, &$join_conds, &$fields)); $res = $dbr->select($tables, $fields, $conds, __METHOD__, $options, $join_conds); $numRows = $dbr->numRows($res); /* Start bottom header */ $wlInfo = ''; if ($days >= 1) { $wlInfo = wfMsgExt('rcnote', 'parseinline', $wgLang->formatNum($numRows), $wgLang->formatNum($days), $wgLang->timeAndDate(wfTimestampNow(), true), $wgLang->date(wfTimestampNow(), true), $wgLang->time(wfTimestampNow(), true)) . '<br />'; } elseif ($days > 0) { $wlInfo = wfMsgExt('wlnote', 'parseinline', $wgLang->formatNum($numRows), $wgLang->formatNum(round($days * 24))) . '<br />'; } $cutofflinks = "\n" . $this->cutoffLinks($days, $nondefaults) . "<br />\n"; # Spit out some control panel links $links[] = $this->showHideLink($nondefaults, 'rcshowhideminor', 'hideMinor', $hideMinor); $links[] = $this->showHideLink($nondefaults, 'rcshowhidebots', 'hideBots', $hideBots); $links[] = $this->showHideLink($nondefaults, 'rcshowhideanons', 'hideAnons', $hideAnons); $links[] = $this->showHideLink($nondefaults, 'rcshowhideliu', 'hideLiu', $hideLiu); $links[] = $this->showHideLink($nondefaults, 'rcshowhidemine', 'hideOwn', $hideOwn); if ($wgUser->useRCPatrol()) { $links[] = $this->showHideLink($nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled); } # Namespace filter and put the whole form together. $form .= $wlInfo; $form .= $cutofflinks; $form .= $wgLang->pipeList($links); $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'mw-watchlist-form-namespaceselector')); $form .= '<hr /><p>'; $form .= Xml::label(wfMsg('namespace'), 'namespace') . ' '; $form .= Xml::namespaceSelector($nameSpace, '') . ' '; $form .= Xml::checkLabel(wfMsg('invert'), 'invert', 'nsinvert', $invert) . ' '; $form .= Xml::submitButton(wfMsg('allpagessubmit')) . '</p>'; $form .= Html::Hidden('days', $days); if ($hideMinor) { $form .= Html::Hidden('hideMinor', 1); } if ($hideBots) { $form .= Html::Hidden('hideBots', 1); } if ($hideAnons) { $form .= Html::Hidden('hideAnons', 1); } if ($hideLiu) { $form .= Html::Hidden('hideLiu', 1); } if ($hideOwn) { $form .= Html::Hidden('hideOwn', 1); } $form .= Xml::closeElement('form'); $form .= Xml::closeElement('fieldset'); $wgOut->addHTML($form); $wgOut->addHTML(InterwikiIntegrationChangesList::flagLegend()); # If there's nothing to show, stop here if ($numRows == 0) { $wgOut->addWikiMsg('watchnochange'); return; } /* End bottom header */ /* Do link batch query */ $linkBatch = new LinkBatch(); while ($row = $dbr->fetchObject($res)) { $userNameUnderscored = str_replace(' ', '_', $row->integration_rc_user_text); if ($row->integration_rc_user != 0) { $linkBatch->add(NS_USER, $userNameUnderscored); } $linkBatch->add(NS_USER_TALK, $userNameUnderscored); $linkBatch->add($row->integration_rc_namespace, $row->integration_rc_title); } $linkBatch->execute(); $dbr->dataSeek($res, 0); $list = InterwikiIntegrationChangesList::newFromUser($wgUser); $list->setWatchlistDivs(); $s = $list->beginRecentInterwikiIntegrationChangesList(); $counter = 1; while ($obj = $dbr->fetchObject($res)) { # Make RC entry $rc = InterwikiIntegrationRecentChange::newFromRow($obj); $rc->counter = $counter++; if ($wgShowUpdatedMarker) { $updated = $obj->integration_wl_notificationtimestamp; } else { $updated = false; } if ($wgRCShowWatchingUsers && $wgUser->getOption('shownumberswatching')) { $rc->numberofWatchingusers = $dbr->selectField('integration_watchlist', 'COUNT(*)', array('integration_wl_namespace' => $obj->integration_rc_namespace, 'integration_wl_title' => $obj->integration_rc_title), __METHOD__); } else { $rc->numberofWatchingusers = 0; } $s .= $list->recentChangesLine($rc, $updated, $counter); } $s .= $list->endRecentInterwikiIntegrationChangesList(); $dbr->freeResult($res); $wgOut->addHTML($s); }
function execute($par) { global $wgRequest, $wgOut, $wgUser; $this->setHeaders(); if (!$wgUser->isAllowed('usermerge')) { $wgOut->permissionRequired('usermerge'); return; } // init variables $olduser_text = ''; $newuser_text = ''; $deleteUserCheck = false; $validNewUser = false; if (strlen($wgRequest->getText('olduser') . $wgRequest->getText('newuser')) > 0 || $wgRequest->getText('deleteuser')) { //POST data found $olduser = Title::newFromText($wgRequest->getText('olduser')); $olduser_text = is_object($olduser) ? $olduser->getText() : ''; $newuser = Title::newFromText($wgRequest->getText('newuser')); $newuser_text = is_object($newuser) ? $newuser->getText() : ''; if ($wgRequest->getText('deleteuser')) { $deleteUserCheck = true; } if (strlen($olduser_text) > 0) { $objOldUser = User::newFromName($olduser_text); $olduserID = $objOldUser->idForName(); global $wgUser; if (!is_object($objOldUser) || $objOldUser->getID() == 0) { $validOldUser = false; $wgOut->wrapWikiMsg("<div class='error'>\n\$1</div>", 'usermerge-badolduser'); } elseif ($olduserID == $wgUser->getID()) { $validOldUser = false; $wgOut->wrapWikiMsg("<div class='error'>\n\$1</div>", 'usermerge-noselfdelete'); } else { global $wgUserMergeProtectedGroups; $boolProtected = false; foreach ($objOldUser->getGroups() as $userGroup) { if (in_array($userGroup, $wgUserMergeProtectedGroups)) { $boolProtected = true; } } if ($boolProtected) { $validOldUser = false; $wgOut->wrapWikiMsg("<div class='error'>\n\$1</div>", 'usermerge-protectedgroup'); } else { $validOldUser = true; if (strlen($newuser_text) > 0) { $objNewUser = User::newFromName($newuser_text); $newuserID = $objNewUser->idForName(); if (!is_object($objNewUser) || $newuserID === 0) { if ($newuser_text === 'Anonymous') { // Merge to anonymous $validNewUser = true; $newuserID = 0; } else { //invalid newuser entered $validNewUser = false; $wgOut->wrapWikiMsg("<div class='error'>\$1</div>", 'usermerge-badnewuser'); } } else { //newuser looks good $validNewUser = true; } } else { //empty newuser string $validNewUser = false; $newuser_text = "Anonymous"; $wgOut->wrapWikiMsg("<div class='error'>\$1</div>", array('usermerge-nonewuser', $newuser_text)); } } } } else { $validOldUser = false; $wgOut->addHTML("<span style=\"color: red;\">" . wfMsg('usermerge-noolduser') . "</span><br />\n"); } } else { //NO POST data found } $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'usermergeform')) . Xml::fieldset(wfMsg('usermerge-fieldset')) . Xml::openElement('table', array('id' => 'mw-usermerge-table')) . "<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('usermerge-olduser'), 'olduser') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('olduser', 20, $olduser_text, array('type' => 'text', 'tabindex' => '1', 'onFocus' => "document.getElementById( 'olduser' ).select;")) . ' ' . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('usermerge-newuser'), 'newuser') . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::input('newuser', 20, $newuser_text, array('type' => 'text', 'tabindex' => '2', 'onFocus' => "document.getElementById( 'newuser' ).select;")) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td> " . "</td>\n\t\t\t\t<td class='mw-input'>" . Xml::checkLabel(wfMsg('usermerge-deleteolduser'), 'deleteuser', 'deleteuser', $deleteUserCheck, array('tabindex' => '3')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td> \n\t\t\t\t</td>\n\t\t\t\t<td class='mw-submit'>" . Xml::submitButton(wfMsg('usermerge-submit'), array('tabindex' => '4')) . "</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::closeElement('fieldset') . Html::Hidden('token', $wgUser->editToken()) . Xml::closeElement('form') . "\n"); if ($validNewUser && $validOldUser) { //go time, baby if (!$wgUser->matchEditToken($wgRequest->getVal('token'))) { //bad editToken $wgOut->addHTML("<span style=\"color: red;\">" . wfMsg('usermerge-badtoken') . "</span><br />\n"); } else { //good editToken $this->mergeEditcount($newuserID, $olduserID); $this->mergeUser($objNewUser, $newuser_text, $newuserID, $objOldUser, $olduser_text, $olduserID); if ($wgRequest->getText('deleteuser')) { $this->movePages($newuser_text, $olduser_text); $this->deleteUser($objOldUser, $olduserID, $olduser_text); } } } }
/** * Generate the form to be displayed at the top of the edit page and insert it. * @param $form EditPage object. * @return true */ function efMultiBoilerplate($form) { // Get various variables needed for this extension. global $wgMultiBoilerplateOptions, $wgMultiBoilerplateOverwrite, $wgTitle, $wgRequest; // If $wgMultiBoilerplateOverwrite is true then detect whether // the current page exists or not and if it does return true // to end execution of this function. if (!$wgMultiBoilerplateOverwrite && $wgTitle->exists($wgTitle->getArticleID())) { return true; } // Generate the options list used inside the boilerplate selection box. // If $wgMultiBoilerplateOptions is an array then use that, else fall back // to the MediaWiki:Multiboilerplate message. if (is_array($wgMultiBoilerplateOptions)) { $options = ''; foreach ($wgMultiBoilerplateOptions as $name => $template) { $selected = false; if ($wgRequest->getVal('boilerplate') == $template) { $selected = true; } $options .= Xml::option($name, $template, $selected); } } else { $things = wfMsgForContent('multiboilerplate'); $options = ''; $things = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $things))); // Ensure line-endings are \n foreach ($things as $row) { if (substr(ltrim($row), 0, 1) === "*") { $row = ltrim($row, '* '); // Remove the asterix (and a space if found) from the start of the line. $row = explode('|', $row); if (!isset($row[1])) { return true; } // Invalid syntax, abort. $selected = false; if ($wgRequest->getVal('boilerplate') == $row[1]) { $selected = true; } $options .= Xml::option($row[0], $row[1], $selected); } } } // No options found in either configuration file, abort. if ($options == '') { return true; } // Append the selection form to the top of the edit page. $form->editFormPageTop .= Xml::openElement('form', array('id' => 'multiboilerplateform', 'name' => 'multiboilerplateform', 'method' => 'get', 'action' => $wgTitle->getEditURL())) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('multiboilerplate-legend')) . Xml::openElement('label') . wfMsg('multiboilerplate-label') . Xml::openElement('select', array('name' => 'boilerplate')) . $options . Xml::closeElement('select') . Xml::closeElement('label') . ' ' . Html::Hidden('action', 'edit') . Html::Hidden('title', $wgRequest->getText('title')) . Xml::submitButton(wfMsg('multiboilerplate-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'); // If the Load button has been pushed replace the article text with the boilerplate. if ($wgRequest->getText('boilerplate', false)) { $plate = new Article(Title::newFromURL($wgRequest->getVal('boilerplate'))); $content = $plate->fetchContent(); /* Strip out noinclude tags and contained data, and strip includeonly * tags (but retain contained data). If a function exists in the * parser exists to do this it would be nice to replace this with it (I * found one with a name as if it would do this, but it didn't seam to * work). */ $content = preg_replace('#<noinclude>(.*?)</noinclude>#ims', '', $content); $content = preg_replace('#<includeonly>(.*?)</includeonly>#ims', '$1', $content); // TODO: Handle <onlyinclude> tags. $form->textbox1 = $content; } // Return true so things don't break. return true; }
function revisionFields() { $out = ''; foreach ($this->mRevisions as $id) { $out .= Html::Hidden('revision[]', $id); } if ($this->mTarget) { $out .= Html::Hidden('target', $this->mTarget->getPrefixedDbKey()); } foreach ($this->mTimestamps as $timestamp) { $out .= Html::Hidden('timestamp[]', wfTimestamp(TS_MW, $timestamp)); } return $out; }
/** * Generate the main HTML form, if the variable $extraFormContent is set, the * content of it will be prepended before the form * @param string $extraFormContent * @return string $htmlFormContent */ public function getHTMLFormContent( $extraFormContent = '' ) { global $wgRequest, $wgUser, $wgArticlePath; // Abbreviation (and screen) options for properties $checked_nspintitle_properties = $wgRequest->getBool( 'nspintitle_prop', false ) == 1 ? ' checked="true" ' : ''; $checked_abbrscr_properties = $wgRequest->getBool( 'abbrscr_prop', false ) == 1 ? ' checked="true" ' : ''; // Abbreviation (and screen) options for entities $checked_nspintitle_entities = $wgRequest->getBool( 'nspintitle_ent', false ) == 1 ? ' checked="true" ' : ''; $checked_abbrscr_entities = $wgRequest->getBool( 'abbrscr_ent', false ) == 1 ? ' checked="true" ' : ''; $this->m_importdata = $wgRequest->getText( 'importdata', '' ); // Create the HTML form for RDF/XML Import $htmlFormContent = '<form method="post" action="' . str_replace( '/$1', '', $wgArticlePath ) . '/Special:RDFImport" name="createEditQuery"><input type="hidden" name="action" value="Import"> ' . $extraFormContent . ' <table border="0"><tbody> <tr><td colspan="3">RDF/XML data to import:</td><tr> <tr><td colspan="3"><textarea cols="80" rows="9" name="importdata" id="importdata">' . $this->m_importdata . '</textarea> </td></tr> <tr><td width="100">Data format:</td> <td> <select id="dataformat" name="dataformat"> <option value="rdfxml" selected="selected">RDF/XML</option> <option value="turtle" >Turtle</option> </select> </td> <td style="text-align: right; font-size: 10px;"> [<a href="#" onClick="pasteExampleRDFXMLData(\'importdata\');">Paste example data</a>] [<a href="#" onClick="document.getElementById(\'importdata\').value = \'\';">Clear</a>] </td> </tr> <tr> <td colspan="3"> <table width="100%" class="wikitable"> <tr> <th style="text-size: 11px"> Options for properties </th> <th style="text-size: 11px"> Options for non-properties </th> </tr> <tr> <td style="font-size: 11px"> <input type="checkbox" name="nspintitle_prop" id="abbrprop" value="1" ' . $checked_nspintitle_properties . ' /> Use namespace prefixes in wiki titles </td> <td style="font-size: 11px"> <input type="checkbox" name="nspintitle_ent" id="abbrent" value="1" ' . $checked_nspintitle_entities . ' /> Use namespace prefixes in wiki titles </td> </tr> <tr> <td style="font-size: 11px"> <input type="checkbox" name="abbrscr_prop" id="abbrscrprop" value="1" ' . $checked_abbrscr_properties . ' /> Show abbreviation screen </td> <td style="font-size: 11px"> <input type="checkbox" name="abbrscr_ent" id="abbrscrent" value="1" ' . $checked_abbrscr_entities . ' /> Show abbreviation screen </td> </tr> </table> </td> </tr> </tbody></table> <input type="submit" value="Submit">' . Html::Hidden( 'token', $wgUser->editToken() ) . ' </form>'; return $htmlFormContent; }
/** * Builds a form that allows changing one revision's author * @param $rev Revision object * @param $errMsg String: error message * @return HTML */ private function buildOneRevForm($rev, $errMsg = '') { global $wgScript; $retval = Xml::openElement('form', array('method' => 'post', 'action' => $wgScript)); $retval .= Html::Hidden('title', $this->selfTitle->getPrefixedDBkey()); $retval .= Html::Hidden('action', 'change'); $retval .= Html::Hidden('targetrev', $rev->getId()); $retval .= Xml::openElement('fieldset'); $retval .= Xml::element('p', array(), wfMsg('changeauthor-explanation-single')); $retval .= Xml::inputLabel(wfMsg('changeauthor-comment'), 'comment', 'comment'); $retval .= Xml::submitButton(wfMsg('changeauthor-changeauthors-single')); if ($errMsg != '') { $retval .= Xml::openElement('p') . Xml::openElement('b'); $retval .= Xml::element('font', array('color' => 'red'), $errMsg); $retval .= Xml::closeElement('b') . Xml::closeElement('p'); } $retval .= Xml::element('h2', array(), wfMsg('changeauthor-revview', $rev->getId(), $rev->getTitle()->getPrefixedText())); $retval .= Xml::openElement('ul'); $retval .= $this->buildRevisionLine($rev, $rev->getTitle()); $retval .= Xml::closeElement('ul'); $retval .= Xml::closeElement('fieldset'); $retval .= Xml::closeElement('form'); return $retval; }
/** * Create the html body and (depending on the GET variables) creates the page. */ function execute( $par ) { global $wgRequest, $wgOut, $wgScript; $this->setHeaders(); # Get request data from, e.g. $action = $wgRequest->getText( 'action' ); $refname = htmlentities( $wgRequest->getText( 'refname' ) ); $author1 = htmlentities( $wgRequest->getText( 'author1' ), ENT_COMPAT, "UTF-8" ); $author2 = htmlentities( $wgRequest->getText( 'author2' ), ENT_COMPAT, "UTF-8" ); $author3 = htmlentities( $wgRequest->getText( 'author3' ), ENT_COMPAT, "UTF-8" ); $author4 = htmlentities( $wgRequest->getText( 'author4' ), ENT_COMPAT, "UTF-8" ); $author5 = htmlentities( $wgRequest->getText( 'author5' ), ENT_COMPAT, "UTF-8" ); $surname1 = htmlentities( $wgRequest->getText( 'surname1' ), ENT_COMPAT, "UTF-8" ); $surname2 = htmlentities( $wgRequest->getText( 'surname2' ), ENT_COMPAT, "UTF-8" ); $surname3 = htmlentities( $wgRequest->getText( 'surname3' ), ENT_COMPAT, "UTF-8" ); $surname4 = htmlentities( $wgRequest->getText( 'surname4' ), ENT_COMPAT, "UTF-8" ); $surname5 = htmlentities( $wgRequest->getText( 'surname5' ), ENT_COMPAT, "UTF-8" ); $pmid = htmlentities( $wgRequest->getText( 'pmid' ), ENT_COMPAT, "UTF-8" ); $articletitle = htmlentities( $wgRequest->getText( 'articletitle' ) ); $journal = htmlentities( $wgRequest->getText( 'journal' ) ); $volume = htmlentities( $wgRequest->getText( 'volume' ) ); $pages = htmlentities( $wgRequest->getText( 'pages' ) ); $year = htmlentities( $wgRequest->getText( 'year' ) ); $cat1 = htmlentities( $wgRequest->getText( 'cat1' ) ); $cat2 = htmlentities( $wgRequest->getText( 'cat2' ) ); $cat3 = htmlentities( $wgRequest->getText( 'cat3' ) ); $cat4 = htmlentities( $wgRequest->getText( 'cat4' ) ); $reqfilled = strlen( $author1 ) && strlen( $articletitle ) && strlen( $journal ) && strlen( $year ) && strlen( $refname ); if ( $action != "submit" || !$reqfilled ) { if ( strlen( $pmid ) ) { $result = RefSearch::query_pmid( $pmid ); $articletitle = $result["title"]; $journal = $result["journal"]; $volume = $result["volume"]; $pages = $result["pages"]; $year = $result["year"]; $auths = $result["authors"]; if ( isset( $auths[0] ) ) { $author1 = $auths[0][0]; $surname1 = $auths[0][1]; } if ( isset( $auths[1] ) ) { $author2 = $auths[1][0]; $surname2 = $auths[1][1]; } if ( isset( $auths[2] ) ) { $author3 = $auths[2][0]; $surname3 = $auths[2][1]; } if ( isset( $auths[3] ) ) { $author4 = $auths[3][0]; $surname4 = $auths[3][1]; } if ( isset( $auths[4] ) ) { $author5 = $auths[4][0]; $surname5 = $auths[4][1]; } } # Output $wgOut->addHTML( Xml::fieldset( wfMsg( self::MSG . 'refcreate_legend' ) ) . Xml::openElement( 'form', array( 'action' => $wgScript, 'id' => 'mw_create-ref-form' ) ) . Html::Hidden( 'title', $this->getTitle()->getPrefixedText() ) . Html::Hidden( 'action', 'submit' ) . Xml::openElement( 'table', array( 'id' => 'mw_create-ref-table' ) ) . Xml::openElement( 'tbody' ) ); $wgOut->addHTML( Xml::openElement( 'tr' ) . Xml::openElement( 'td', array( 'class' => 'mw-label' ) ) . Xml::element( 'label', array( 'for' => 'inp_pastearea' ), wfMsg( self::MSG . 'label_workspace' ) . ":" ) . Xml::closeElement( 'td' ) . Xml::openElement( 'td' ) . Xml::textarea( 'inp_pastearea', '', 20, 5, array( 'oninput' => 'autoPopulateRefFields()' ) ) . Xml::closeElement( 'td' ) . Xml::closeElement( 'tr' ) ); self::addTableRow( $wgOut, "pmid", $pmid, 'PMID', 15 ); self::add2ColTableRow( $wgOut, 'author1', 'surname1', $author1, $surname1, wfMsg( self::MSG . 'label_authorforename', '1' ), wfMsg( self::MSG . 'label_authorsurname', '1' ) ); self::add2ColTableRow( $wgOut, 'author2', 'surname2', $author2, $surname2, wfMsg( self::MSG . 'label_authorforename', '2' ), wfMsg( self::MSG . 'label_authorsurname', '2' ) ); self::add2ColTableRow( $wgOut, 'author3', 'surname3', $author3, $surname3, wfMsg( self::MSG . 'label_authorforename', '3' ), wfMsg( self::MSG . 'label_authorsurname', '3' ) ); self::add2ColTableRow( $wgOut, 'author4', 'surname4', $author4, $surname4, wfMsg( self::MSG . 'label_authorforename', '4' ), wfMsg( self::MSG . 'label_authorsurname', '4' ) ); self::add2ColTableRow( $wgOut, 'author5', 'surname5', $author5, $surname5, wfMsg( self::MSG . 'label_authorforename', '5' ), wfMsg( self::MSG . 'label_authorsurname', '5' ) ); self::addTableRow( $wgOut, "articletitle", $articletitle, wfMsg( self::MSG . 'title' ) ); self::addTableRow( $wgOut, "journal", $journal, wfMsg( self::MSG . 'journal' ) ); self::addTableRow( $wgOut, "pages", $pages, wfMsg( self::MSG . 'pages' ) ); self::addTableRow( $wgOut, "year", $year, wfMsg( self::MSG . 'year' ) ); self::addTableRow( $wgOut, "refname", $refname, wfMsg( self::MSG . 'refname' ) ); self::addTableRow( $wgOut, "cat1", $cat1, wfMsg( self::MSG . 'category', '1' ) ); self::addTableRow( $wgOut, "cat2", $cat2, wfMsg( self::MSG . 'category', '2' ) ); self::addTableRow( $wgOut, "cat3", $cat3, wfMsg( self::MSG . 'category', '3' ) ); self::addTableRow( $wgOut, "cat4", $cat4, wfMsg( self::MSG . 'category', '4' ) ); $wgOut->addHTML( Xml::openElement( 'tr' ) . Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::element( 'input', array( 'value' => wfMsg( self::MSG . 'create' ), 'type' => 'submit' ) ) . Xml::closeElement( 'td' ) . Xml::closeElement( 'tr' ) . Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' ) . Xml::closeElement( 'form' ) . Xml::closeElement( 'fieldset' ) ); } else { global $wgRefHelperCiteTemplate, $wgRefHelperPageTemplate, $wgRefHelperCiteNS; $db = wfGetDB( DB_MASTER ); $citeTitle = null; if ( strlen( $wgRefHelperCiteNS ) ) $citeTitle = Title::newFromText( "$wgRefHelperCiteNS:$refname" ); $pageTitle = Title::newFromText( $refname ); $paramtext = ''; $paramtext .= "| first1 = $author1\n"; $paramtext .= "| last1 = $surname1\n"; if ( strlen( $author2 ) || strlen( $surname2 ) ) { $paramtext .= "| first2 = $author2\n"; $paramtext .= "| last2 = $surname2\n"; } if ( strlen( $author3 ) || strlen( $surname3 ) ) { $paramtext .= "| first3 = $author3\n"; $paramtext .= "| last3 = $surname3\n"; } if ( strlen( $author4 ) || strlen( $surname4 ) ) { $paramtext .= "| first4 = $author4\n"; $paramtext .= "| last4 = $surname4\n"; } if ( strlen( $author5 ) || strlen( $surname5 ) ) { $paramtext .= "| first5 = $author5\n"; $paramtext .= "| last5 = $surname5\n"; } $paramtext .= "| refname = $refname\n"; $paramtext .= "| articletitle = $articletitle\n"; $paramtext .= "| titlelink = [[$refname|$articletitle]]\n"; $paramtext .= "| journal = $journal\n"; $paramtext .= "| volume = $volume\n"; $paramtext .= "| pages = $pages\n"; $paramtext .= "| pmid = $pmid\n"; $paramtext .= "| year = $year\n"; $paramtext .= "| lt = <\n"; // can be used to allow templates to create pages with onlyinclude, etc. $paramtext .= "| categories = "; if ( strlen( $cat1 ) ) $paramtext .= "[[Category:$cat1]]\n"; if ( strlen( $cat2 ) ) $paramtext .= "[[Category:$cat2]]\n"; if ( strlen( $cat3 ) ) $paramtext .= "[[Category:$cat3]]\n"; if ( strlen( $cat4 ) ) $paramtext .= "[[Category:$cat4]]\n"; if ( $citeTitle->exists() == false ) { $newcontent = '{{' . "$wgRefHelperCiteTemplate\n$paramtext}}\n"; $citePage = new Article( $citeTitle ); $citePage->doEdit( $newcontent, wfMsg( self::MSG . 'refcreate_autocomment' ) ); $rev_id = $citePage->insertOn( $db ); $wgOut->addWikiText( wfMsg( self::MSG . 'refcreate_success', array( "$wgRefHelperCiteNS:$refname" ) ) ); } else { $wgOut->addWikiText( wfMsg( self::MSG . 'refcreate_failure', array( "$wgRefHelperCiteNS:$refname" ) ) ); } if ( $pageTitle->exists() == false ) { $newcontent = '{{' . "$wgRefHelperPageTemplate\n$paramtext}}\n"; $newPage = new Article( $pageTitle ); $newPage->doEdit( $newcontent, wfMsg( self::MSG . 'refcreate_autocomment' ) ); $rev_id = $newPage->insertOn( $db ); $wgOut->addWikiText( wfMsg( self::MSG . 'refcreate_success', array( $refname ) ) ); } else { $wgOut->addWikiText( wfMsg( self::MSG . 'refcreate_failure', array( $refname ) ) ); } $wgOut->addWikiText( '[[Special:RefHelper|' . wfMsg( self::MSG . 'refcreate_another' ) . ']]' ); } }
public function showForm($err = '') { global $wgOut, $wgContLang, $wgRequest, $wgUser; global $wgStylePath, $wgStyleVersion; $titleObj = $this->getTitle(); $action = $titleObj->escapeLocalURL("action=submit"); $alignRight = $wgContLang->isRtl() ? 'left' : 'right'; $mIpbuser = Xml::label(wfMsg('crosswikiunblock-user'), 'mw-bi-target'); $mIpbreason = Xml::label(wfMsg('crosswikiunblock-reason'), 'mw-bi-target'); if ("" != $err) { $wgOut->setSubtitle(wfMsgHtml('formerror')); $wgOut->addHTML("<strong class='error'>{$err}</strong>\n"); } $wgOut->addHTML(wfMsgWikiHtml('crosswikiunblock-header')); $wgOut->addHTML("<form id=\"crosswikiunblock\" method=\"post\" action=\"{$action}\">\n\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align=\"{$alignRight}\">{$mIpbuser}</td>\n\t\t\t<td>\n\t\t\t\t" . Xml::input('wpUnblockTarget', 45, htmlspecialchars(strval($wgRequest->getVal('wpUnblockTarget'))), array('tabindex' => '1', 'id' => 'mw-bi-target')) . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr id=\"wpBlockReason\">\n\t\t\t<td align=\"{$alignRight}\">{$mIpbreason}</td>\n\t\t\t<td>\n\t\t\t\t" . Xml::input('wpUnblockReason', 45, htmlspecialchars(strval($wgRequest->getVal('wpUnblockReason'))), array('tabindex' => '5', 'id' => 'mw-bi-reason', 'maxlength' => '200')) . "\n\t\t\t</td>\n\t\t</tr>"); $wgOut->addHTML("\n\t\t<tr>\n\t\t\t<td style='padding-top: 1em'> </td>\n\t\t\t<td style='padding-top: 1em'>\n\t\t\t\t" . Xml::submitButton(wfMsg('crosswikiunblock-submit'), array('name' => 'wpBlock', 'tabindex' => '11')) . "\n\t\t\t</td>\n\t\t</tr>"); $token = $wgUser->editToken(); $wgOut->addHTML(Html::Hidden('wpEditToken', $token)); $wgOut->addHTML('</table></form>'); }
/** * @param $msg string */ protected function showAccountConfirmForm($msg = '') { global $wgAccountRequestTypes; $out = $this->getOutput(); $reqUser = $this->getUser(); $titleObj = $this->getFullTitle(); $accountReq = $this->accountReq; // convenience if (!$accountReq || $accountReq->isDeleted() && !$this->showRejects) { $out->addHTML($this->msg('confirmaccount-badid')->escaped()); $out->returnToMain(true, $titleObj); return; } # Output any failure message if ($msg != '') { $out->addHTML('<div class="errorbox">' . $msg . '</div><div class="visualClear"></div>'); } $out->addWikiMsg('confirmaccount-text'); $rejectTimestamp = $accountReq->getRejectTimestamp(); $heldTimestamp = $accountReq->getHeldTimestamp(); $reason = strlen($accountReq->getHandlingComment()) ? htmlspecialchars($accountReq->getHandlingComment()) : $this->msg('confirmaccount-noreason')->escaped(); $adminId = $accountReq->getHandlingUser(); if ($rejectTimestamp) { $datim = $this->getLanguage()->timeanddate($rejectTimestamp, true); $date = $this->getLanguage()->date($rejectTimestamp, true); $time = $this->getLanguage()->time($rejectTimestamp, true); # Auto-rejected requests have a user ID of zero if ($adminId) { $out->addHTML('<p><b>' . $this->msg('confirmaccount-reject', User::whoIs($adminId), $datim, $date, $time)->parse() . '</b></p>'); $out->addHTML('<p><strong>' . $this->msg('confirmaccount-rational')->escaped() . '</strong><i> ' . $reason . '</i></p>'); } else { $out->addHTML("<p><i> {$reason} </i></p>"); } } elseif ($heldTimestamp) { $datim = $this->getLanguage()->timeanddate($heldTimestamp, true); $date = $this->getLanguage()->date($heldTimestamp, true); $time = $this->getLanguage()->time($heldTimestamp, true); $out->addHTML('<p><b>' . $this->msg('confirmaccount-held', User::whoIs($adminId), $datim, $date, $time)->parse() . '</b></p>'); $out->addHTML('<p><strong>' . $this->msg('confirmaccount-rational')->escaped() . '</strong><i> ' . $reason . '</i></p>'); } $form = Xml::openElement('form', array('method' => 'post', 'name' => 'accountconfirm', 'action' => $titleObj->getLocalUrl())); $form .= "<fieldset>"; $form .= '<legend>' . $this->msg('confirmaccount-leg-user')->escaped() . '</legend>'; $form .= '<table cellpadding=\'4\'>'; $form .= "<tr><td>" . Xml::label($this->msg('username')->text(), 'wpNewName') . "</td>"; $form .= "<td>" . Xml::input('wpNewName', 30, $this->reqUsername, array('id' => 'wpNewName')) . "</td></tr>\n"; $econf = ''; if ($accountReq->getEmailAuthTimestamp()) { $econf = ' <strong>' . $this->msg('confirmaccount-econf')->escaped() . '</strong>'; } $form .= "<tr><td>" . $this->msg('confirmaccount-email')->escaped() . "</td>"; $form .= "<td>" . htmlspecialchars($accountReq->getEmail()) . $econf . "</td></tr>\n"; if (count($wgAccountRequestTypes) > 1) { $options = array(); $form .= "<tr><td><strong>" . $this->msg('confirmaccount-reqtype')->escaped() . "</strong></td><td>"; foreach ($wgAccountRequestTypes as $i => $params) { // Give grep a chance to find the usages: confirmaccount-pos-0, confirmaccount-pos-1 $options[] = Xml::option($this->msg("confirmaccount-pos-{$i}")->text(), $i, $i == $this->reqType); } $form .= Xml::openElement('select', array('name' => "wpType")); $form .= implode("\n", $options); $form .= Xml::closeElement('select') . "\n"; $form .= "</td></tr>\n"; } $form .= '</table></fieldset>'; $userAreas = ConfirmAccount::getUserAreaConfig(); if ($this->hasItem('AreasOfInterest') && count($userAreas) > 0) { $form .= '<fieldset>'; $form .= '<legend>' . $this->msg('confirmaccount-leg-areas')->escaped() . '</legend>'; $form .= "<div style='height:150px; overflow:scroll; background-color:#f9f9f9;'>"; $form .= "<table cellspacing='5' cellpadding='0' style='background-color:#f9f9f9;'><tr valign='top'>"; $count = 0; foreach ($userAreas as $name => $conf) { $count++; if ($count > 5) { $form .= "</tr><tr valign='top'>"; $count = 1; } $formName = "wpArea-" . htmlspecialchars(str_replace(' ', '_', $name)); if ($conf['project'] != '') { $pg = Linker::linkKnown(Title::newFromText($conf['project']), $this->msg('requestaccount-info')->escaped()); } else { $pg = ''; } $form .= "<td>" . Xml::checkLabel($name, $formName, $formName, $this->reqAreas[$name] > 0) . " {$pg}</td>\n"; } $form .= "</tr></table></div>"; $form .= '</fieldset>'; } if ($this->hasItem('Biography') || $this->hasItem('RealName')) { $form .= '<fieldset>'; $form .= '<legend>' . $this->msg('confirmaccount-leg-person')->escaped() . '</legend>'; if ($this->hasItem('RealName')) { $form .= '<table cellpadding=\'4\'>'; $form .= "<tr><td>" . $this->msg('confirmaccount-real')->escaped() . "</td>"; $form .= "<td>" . htmlspecialchars($accountReq->getRealName()) . "</td></tr>\n"; $form .= '</table>'; } if ($this->hasItem('Biography')) { $form .= "<p>" . $this->msg('confirmaccount-bio')->escaped() . "\n"; $form .= "<textarea tabindex='1' name='wpNewBio' id='wpNewBio' rows='12' cols='80' style='width:100%; background-color:#f9f9f9;'>" . htmlspecialchars($this->reqBio) . "</textarea></p>\n"; } $form .= '</fieldset>'; } if ($this->hasItem('CV') || $this->hasItem('Notes') || $this->hasItem('Links')) { $form .= '<fieldset>'; $form .= '<legend>' . $this->msg('confirmaccount-leg-other')->escaped() . '</legend>'; if ($this->hasItem('CV')) { $form .= '<p>' . $this->msg('confirmaccount-attach')->escaped() . ' '; if ($accountReq->getFileName() !== null) { $form .= Linker::makeKnownLinkObj($titleObj, htmlspecialchars($accountReq->getFileName()), 'file=' . $accountReq->getFileStorageKey()); } else { $form .= $this->msg('confirmaccount-none-p')->escaped(); } } if ($this->hasItem('Notes')) { $form .= "</p><p>" . $this->msg('confirmaccount-notes')->escaped() . "\n"; $form .= "<textarea tabindex='1' readonly='readonly' name='wpNotes' id='wpNotes' rows='3' cols='80' style='width:100%'>" . htmlspecialchars($accountReq->getNotes()) . "</textarea></p>\n"; } if ($this->hasItem('Links')) { $form .= "<p>" . $this->msg('confirmaccount-urls')->escaped() . "</p>\n"; $form .= self::parseLinks($accountReq->getUrls()); } $form .= '</fieldset>'; } if ($reqUser->isAllowed('requestips')) { $blokip = SpecialPage::getTitleFor('Block'); $link = Linker::makeKnownLinkObj($blokip, $this->msg('confirmaccount-blockip')->escaped(), 'ip=' . $accountReq->getIP() . '&wpCreateAccount=1'); $form .= '<fieldset>'; $form .= '<legend>' . $this->msg('confirmaccount-leg-ip')->escaped() . '</legend>'; $wordSeparator = $this->msg('word-separator')->plain(); $form .= "<p>"; // @todo FIXME: Bad i18n. Should probably be something like // "confirmaccount-ip $1 ($2)" to get rid of this mess. $form .= $this->msg('confirmaccount-ip')->escaped(); $form .= $wordSeparator; $form .= htmlspecialchars($accountReq->getIP()); $form .= $wordSeparator; $form .= $this->msg('parentheses')->rawParams($link)->escaped(); $form .= "</p>\n"; if ($accountReq->getXFF()) { $form .= "<p>" . $this->msg('confirmaccount-xff')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getXFF()) . "</p>\n"; } if ($accountReq->getAgent()) { $form .= "<p>" . $this->msg('confirmaccount-agent')->escaped() . $wordSeparator . htmlspecialchars($accountReq->getAgent()) . "</p>\n"; } $form .= '</fieldset>'; } $form .= '<fieldset>'; $form .= '<legend>' . $this->msg('confirmaccount-legend')->escaped() . '</legend>'; $form .= "<strong>" . $this->msg('confirmaccount-confirm')->parse() . "</strong>\n"; $form .= "<table cellpadding='5'><tr>"; $form .= "<td>" . Xml::radio('wpSubmitType', 'accept', $this->submitType == 'accept', array('id' => 'submitCreate', 'onclick' => 'document.getElementById("wpComment").style.display="block"')); $form .= ' ' . Xml::label($this->msg('confirmaccount-create')->text(), 'submitCreate') . "</td>\n"; $form .= "<td>" . Xml::radio('wpSubmitType', 'reject', $this->submitType == 'reject', array('id' => 'submitDeny', 'onclick' => 'document.getElementById("wpComment").style.display="block"')); $form .= ' ' . Xml::label($this->msg('confirmaccount-deny')->text(), 'submitDeny') . "</td>\n"; $form .= "<td>" . Xml::radio('wpSubmitType', 'hold', $this->submitType == 'hold', array('id' => 'submitHold', 'onclick' => 'document.getElementById("wpComment").style.display="block"')); $form .= ' ' . Xml::label($this->msg('confirmaccount-hold')->text(), 'submitHold') . "</td>\n"; $form .= "<td>" . Xml::radio('wpSubmitType', 'spam', $this->submitType == 'spam', array('id' => 'submitSpam', 'onclick' => 'document.getElementById("wpComment").style.display="none"')); $form .= ' ' . Xml::label($this->msg('confirmaccount-spam')->text(), 'submitSpam') . "</td>\n"; $form .= "</tr></table>"; $form .= "<div id='wpComment'><p>" . $this->msg('confirmaccount-reason')->escaped() . "</p>\n"; $form .= "<p><textarea name='wpReason' id='wpReason' rows='3' cols='80' style='width:80%; display=block;'>" . htmlspecialchars($this->reason) . "</textarea></p></div>\n"; $form .= "<p>" . Xml::submitButton($this->msg('confirmaccount-submit')->text()) . "</p>\n"; $form .= '</fieldset>'; $form .= Html::Hidden('title', $titleObj->getPrefixedDBKey()) . "\n"; $form .= Html::Hidden('action', 'reject'); $form .= Html::Hidden('acrid', $accountReq->getId()); $form .= Html::Hidden('wpShowRejects', $this->showRejects); $form .= Html::Hidden('wpEditToken', $reqUser->getEditToken($accountReq->getId())) . "\n"; $form .= Xml::closeElement('form'); $out->addHTML($form); global $wgMemc; # Set a key to who is looking at this request. # Have it expire in 10 minutes... $key = wfMemcKey('acctrequest', 'view', $accountReq->getId()); $wgMemc->set($key, $reqUser->getID(), 60 * 10); }
/** * Get a form to select the wiki to configure */ protected function getWikiSelectForm() { global $wgConfigureWikis, $wgScript; if ($wgConfigureWikis === false || !$this->isUserAllowedInterwiki()) { return ''; } $form = '<fieldset><legend>' . $this->msg('configure-select-wiki')->escaped() . '</legend>'; $form .= $this->msg('configure-select-wiki-view-desc')->parseAsBlock(); $form .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)); $form .= Html::Hidden('title', $this->getTitle()->getPrefixedDBkey()); $all = $this->getRequest()->getVal('view', 'all') == 'all'; $form .= Xml::radioLabel($this->msg('configure-select-wiki-view-all')->text(), 'view', 'all', 'wiki-all', $all); $form .= "<br />\n"; $form .= Xml::radioLabel($this->msg('configure-select-wiki-view-specific')->text(), 'view', 'specific', 'wiki-specific', !$all) . ' '; if (is_array($wgConfigureWikis)) { $selector = new XmlSelect('wiki', 'wiki', $this->mWiki); foreach ($wgConfigureWikis as $wiki) { $selector->addOption($wiki); } $form .= $selector->getHTML() . "<br />"; } else { $form .= Xml::input('wiki', false, $this->mWiki) . "<br />"; } $form .= Xml::submitButton($this->msg('configure-select-wiki-submit')->text()); $form .= '</form></fieldset>'; return $form; }
protected function _executeDelete($wgFarmer) { global $wgOut, $wgUser, $wgRequest; if (!$wgFarmer->getActiveWiki()->isDefaultWiki()) { $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-notaccessible', 'farmer-notaccessible-test'); return; } if (!MediaWikiFarmer::userIsFarmerAdmin($wgUser)) { $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-permissiondenied', 'farmer-permissiondenied-text'); return; } if ($wgRequest->wasPosted() && ($wiki = $wgRequest->getVal('wpWiki')) && $wiki != '-1') { if ($wgRequest->getCheck('wpConfirm')) { $wgOut->wrapWikiMsg('<div class="successbox">$1</div>', array('farmer-deleting', $wiki)); $log = new LogPage('farmer'); $log->addEntry('delete', $this->getTitle(), $wgRequest->getVal('wpReason'), array($wiki)); $deleteWiki = MediaWikiFarmer_Wiki::factory($wiki); $deleteWiki->deleteWiki(); } else { $wgOut->addWikiMsg('farmer-delete-confirm-wiki', $wiki); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . Xml::buildForm(array('farmer-delete-reason' => Xml::input('wpReason', false, $wgRequest->getVal('wpReason')), 'farmer-delete-confirm' => Xml::check('wpConfirm')), 'farmer-delete-form-submit') . "\n" . Html::Hidden('wpWiki', $wiki) . "\n" . Xml::closeElement('form')); } return; } $list = $wgFarmer->getFarmList(); $wgOut->wrapWikiMsg("== \$1 ==\n\$2", 'farmer-delete-title', 'farmer-delete-text'); $select = new XmlSelect('wpWiki', false, $wgRequest->getVal('wpWiki')); $select->addOption(wfMsg('farmer-delete-form'), '-1'); foreach ($list as $wiki) { if ($wiki['name'] != $wgFarmer->getDefaultWiki()) { $name = $wiki['name']; $title = $wiki['title']; $select->addOption("{$name} - {$title}", $name); } } $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'name' => 'deleteWiki')) . "\n" . $select->getHTML() . "\n" . Xml::submitButton(wfMsg('farmer-delete-form-submit')) . "\n" . Xml::closeElement('form')); }
/** * Get the HTML for the main SPARQL querying form. If $query is set, use it to prefill the main textarea * @param string $query * @return string $htmlForm */ private function getHTMLForm($query = '') { global $wgArticlePath, $wgUser, $wgRequest; $uriResolverURI = SpecialPage::getTitleFor('URIResolver')->getFullURL() . '/'; $defaultQuery = "@PREFIX w : <{$uriResolverURI}> .\n\nSELECT *\nWHERE { ?s ?p ?o }\nLIMIT 25"; if ($query == '') { $query = $defaultQuery; } $checked_equivuri_q = $wgRequest->getBool('equivuri_q', false) == 1 ? ' checked="true" ' : ''; $checked_equivuri_o = $wgRequest->getBool('equivuri_o', false) == 1 ? ' checked="true" ' : ''; $checked_filtervocab = $wgRequest->getBool('filtervocab', false) == 1 ? ' checked="true" ' : ''; $checked_allowwrite = $wgRequest->getBool('allowwrite', false) == 1 ? ' checked="true" ' : ''; $checked_showquery = $wgRequest->getBool('showquery', false) == 1 ? ' checked="true" ' : ''; $selected_output_html = $wgRequest->getText('output', '') == 'htmltab' ? ' selected="selected" ' : ''; $selected_output_rdfxml = $wgRequest->getText('output', '') == 'rdfxml' ? ' selected="selected" ' : ''; // Make the HTML format selected by default if ($selected_output_rdfxml == '') { $selected_output_html = ' selected="selected" '; } $htmlForm = '<form method="post" action="' . str_replace('/$1', '', $wgArticlePath) . '/Special:SPARQLEndpoint" name="createEditQuery"> <div style="font-size: 10px"> <table border="0"><tbody> <tr><td colspan="3">Enter SPARQL query:</td><tr> <tr><td colspan="3"><textarea cols="80" rows="9" name="query">' . $query . '</textarea></td></tr> <tr> <td style="vertical-align: top; border-right: 1px solid #ccc;"> <table border="0" style="background: transparent; font-size: 11px;"> <tr><td style="text-align: right">Query by Equivalent URIs:</td> <td> <input type="checkbox" name="equivuri_q" value="1" ' . $checked_equivuri_q . '/> </td></tr> </table> </td> <td width="170" style="vertical-align: top; border-right: 1px solid #ccc;"> <table border="0" style="font-size: 11px; background: transparent;"> <tr><td style="text-align: right">Output Equivalent URIs:</td> <td> <input type="checkbox" name="equivuri_o" id="outputequivuri" value="1" ' . $checked_equivuri_o . '/> </td></tr> </table> </td> <td width="260" style="vertical-align: top;"> Output Equivalent <table border="0" style="font-size: 11px; background: transparent;" > <tr><td style="text-align: right" width="180">Output format:</td> <td style="vertical-align: top"> <select id="output" name="output" onChange="toggleDisplay(\'byontology\');" > <!-- <option value="" >default</option> --> <!-- <option value="json" >JSON</option> --> <!-- <option value="plain" >Plain</option> --> <!-- <option value="php_ser" >Serialized PHP</option> --> <!-- <option value="turtle" >Turtle</option> --> <option value="htmltab" ' . $selected_output_html . '>HTML</option> <option value="xml" >XML Resultset</option> <option value="rdfxml" ' . $selected_output_rdfxml . '>RDF/XML</option> <!-- <option value="infos" >Query Structure</option> --> <!-- <option value="tsv" >TSV</option> --> </select> </td></tr> <tr> <td colspan="2"> <span style="font-family: arial, helvetica, sans-serif; font-size: 10px; color: #777;">(RDF/XML requires creating triples using <a href="http://www.w3.org/TR/rdf-sparql-query/#construct">CONSTRUCT</a>)</span> </td> </table> </td> </tr> <tr> <td colspan="3"> <div id="byontology" style="display: none; background: #ffd; border: 1px solid #ee7;"> <table border="0" style="font-size: 11px; background: transparent;" > <tr><td style="text-align: right;">Filter by vocabulary:</td> <td> <input type="checkbox" name="filtervocab" value="1" ' . $checked_filtervocab . '/> </td> <td style="text-align: right">Vocabulary URL:</td> <td> <input type="text" name="filtervocaburl" size="48" /> </td></tr> <tr> <td> </td> <td> </td> <td> </td> <td> <span style="font-family: arial, helvetica, sans-serif; font-size: 10px; color: #777">Example: http://xmlns.com/foaf/spec/index.rdf</span> </td></tr> </table> </div> </td> </table> </div> <input type="submit" value="Submit">' . Html::Hidden('token', $wgUser->getEditToken()) . ' </form>'; return $htmlForm; }