hidden() static public method

If value of options is an array then recursively parse it to generate as many hidden input as necessary
static public hidden ( $fieldName, $options = [] ) : string
$fieldName Name of a field
$options Array of HTML attributes.
return string A generated hidden input
 /**
  * Output a form to allow searching for a user
  */
 function switchForm()
 {
     global $wgScript;
     $this->getOutput()->addModules('ext.centralauth.globaluserautocomplete');
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getPageTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), $this->msg('userrights-lookup-user')->text()) . Xml::inputLabel($this->msg('userrights-user-editname')->text(), 'user', 'username', 30, $this->mTarget, array('class' => 'mw-autocomplete-global-user')) . ' <br />' . Xml::submitButton($this->msg('editusergroup')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
 }
コード例 #2
0
	/**
	 * Returns HTML5 output of the form
	 * GLOBALS: $wgLang, $wgScript
	 * @return string
	 */
	protected function getForm() {
		global $wgLang, $wgScript;

		$form = Xml::tags( 'form',
			array(
				'action' => $wgScript,
				'method' => 'get'
			),

			'<table><tr><td>' .
				wfMsgHtml( 'translate-page-language' ) .
			'</td><td>' .
				TranslateUtils::languageSelector( $wgLang->getCode(), $this->options['language'] ) .
			'</td></tr><tr><td>' .
				wfMsgHtml( 'translate-magic-module' ) .
			'</td><td>' .
				$this->moduleSelector( $this->options['module'] ) .
			'</td></tr><tr><td colspan="2">' .
				Xml::submitButton( wfMsg( 'translate-magic-submit' ) ) . ' ' .
				Xml::submitButton( wfMsg( 'translate-magic-cm-export' ), array( 'name' => 'export' ) ) .
			'</td></tr></table>' .
			Html::hidden( 'title', $this->getTitle()->getPrefixedText() )
		);
		return $form;
	}
コード例 #3
0
 /**
  * Show profile form
  *
  * @param $items_id integer id of the profile
  * @param $target value url of target
  *
  * @return nothing
  **/
 function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
 {
     echo "<div class='firstbloc'>";
     if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
         $profile = new Profile();
         echo "<form method='post' action='" . $profile->getFormURL() . "'>";
     }
     $profile = new Profile();
     $profile->getFromDB($profiles_id);
     $rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing'));
     $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
     echo "<table class='tab_cadre_fixehov'>";
     $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment'));
     echo "<tr class='tab_bg_2'>";
     echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>";
     echo "<td colspan='5'>";
     Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment']));
     echo "</td></tr>\n";
     echo "</table>";
     if ($canedit && $closeform) {
         echo "<div class='center'>";
         echo Html::hidden('id', array('value' => $profiles_id));
         echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
         echo "</div>\n";
         Html::closeForm();
     }
     echo "</div>";
 }
コード例 #4
0
 function showForm()
 {
     $this->getfromDB(1);
     $target = self::getFormURL();
     echo "<div align='center'><form method='post'  action=\"{$target}\">";
     echo "<table class='tab_cadre' cellpadding='5'><tr ><th colspan='2'>";
     echo self::getTypeName(0) . "</th></tr>";
     echo "<tr class='tab_bg_1'><td>";
     echo "<select name=\"unit\" size=\"1\"> ";
     echo "<option ";
     if ($this->isMetricUnit()) {
         echo "selected ";
     }
     echo "value='" . self::METRIC_UNIT . "'>" . __('metric', 'racks') . "</option>";
     echo "<option ";
     if (!$this->isMetricUnit()) {
         echo "selected ";
     }
     echo "value='" . self::NON_METRIC_UNIT . "'>" . __('English', 'racks') . "</option>";
     echo "</select> ";
     echo "</td>";
     echo "<td>";
     echo Html::hidden('id', array('value' => 1));
     echo Html::submit(_sx('button', 'Post'), array('name' => 'update'));
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
コード例 #5
0
 /**
  * Show profile form
  *
  * @param $items_id integer id of the profile
  * @param $target value url of target
  *
  * @return nothing
  **/
 function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE)
 {
     echo "<div class='firstbloc'>";
     if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
         $profile = new Profile();
         echo "<form method='post' action='" . $profile->getFormURL() . "'>";
     }
     $profile = new Profile();
     $profile->getFromDB($profiles_id);
     if ($profile->getField('interface') == 'central') {
         $rights = $this->getAllRights();
         $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General')));
     }
     echo "<table class='tab_cadre_fixehov'>";
     echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Helpdesk') . "</th></tr>\n";
     $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_racks_open_ticket'));
     echo "<tr class='tab_bg_2'>";
     echo "<td width='20%'>" . __('Associable items to a ticket') . "</td>";
     echo "<td colspan='5'>";
     Html::showCheckbox(array('name' => '_plugin_racks_open_ticket', 'checked' => $effective_rights['plugin_racks_open_ticket']));
     echo "</td></tr>\n";
     echo "</table>";
     if ($canedit && $closeform) {
         echo "<div class='center'>";
         echo Html::hidden('id', array('value' => $profiles_id));
         echo Html::submit(_sx('button', 'Save'), array('name' => 'update'));
         echo "</div>\n";
         Html::closeForm();
     }
     echo "</div>";
 }
コード例 #6
0
 public static function notificator_Render($parser, $receiver = '', $receiverLabel = '')
 {
     global $wgScript, $wgTitle;
     if (!$receiverLabel) {
         $receiverLabel = $receiver;
     }
     // Check that the database table is in place
     if (!Notificator::checkDatabaseTableExists()) {
         $output = '<span class="error">' . htmlspecialchars(wfMsg('notificator-db-table-does-not-exist')) . '</span>';
         return array($output, 'noparse' => true, 'isHTML' => true);
     }
     // The rendering is different, depending on whether a valid e-mail address
     // has been provided, or not - the differing part of the HTML form is being
     // built here
     if (Notificator::receiverIsValid($receiver)) {
         // Valid e-mail address available, so build a hidden input with that address
         // set, and a button
         $receiverInputAndSubmitButton = Html::hidden('receiver', $receiver) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify-address-or-name', $receiverLabel)));
     } else {
         // No (valid) e-mail address available, build a text input and a button
         $receiverInputAndSubmitButton = Html::element('input', array('type' => 'text', 'name' => 'receiver', 'value' => wfMsg('notificator-e-mail-address'), 'onfocus' => 'if (this.value == \'' . wfMsg('notificator-e-mail-address') . '\') {this.value=\'\'}')) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify')));
     }
     // Now we assemble the form, consisting of two hidden inputs for page ID and rev ID,
     // as well as the $receiverInputAndSubmitButton built above
     $output = Html::rawElement('form', array('action' => SpecialPage::getTitleFor('Notificator')->getLocalURL(), 'method' => 'post', 'enctype' => 'multipart/form-data'), Html::hidden('pageId', $wgTitle->getArticleID()) . Html::hidden('revId', $wgTitle->getLatestRevID()) . $receiverInputAndSubmitButton);
     return $parser->insertStripItem($output, $parser->mStripState);
 }
コード例 #7
0
 public function showForm()
 {
     global $wgScript;
     // Text to explain level select (if there are several levels)
     if (FlaggedRevs::qualityVersions()) {
         $this->getOutput()->addWikiMsg('reviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
     }
     $form = Html::openElement('form', array('name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get'));
     $form .= "<fieldset><legend>" . $this->msg('reviewedpages-leg')->escaped() . "</legend>\n";
     // show/hide links
     $showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped());
     $onoff = 1 - $this->hideRedirs;
     $link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'namespace' => $this->namespace));
     $showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped();
     $fields = array();
     $namespaces = FlaggedRevs::getReviewNamespaces();
     if (count($namespaces) > 1) {
         $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' ';
     }
     if (FlaggedRevs::qualityVersions()) {
         $fields[] = FlaggedRevsXML::getLevelMenu($this->type) . ' ';
     }
     $form .= implode(' ', $fields) . ' ';
     $form .= $showhideredirs;
     if (count($fields)) {
         $form .= " " . Xml::submitButton($this->msg('go')->text());
     }
     $form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
     $form .= "</fieldset>";
     $form .= Html::closeElement('form ') . "\n";
     $this->getOutput()->addHTML($form);
 }
コード例 #8
0
 function show()
 {
     global $wgOut, $wgUser, $wgRequest;
     AbuseFilter::disableConditionLimit();
     if (!$wgUser->isAllowed('abusefilter-modify')) {
         $wgOut->addWikiMsg('abusefilter-mustbeeditor');
         return;
     }
     $this->loadParameters();
     $wgOut->setPageTitle(wfMsg('abusefilter-test'));
     $wgOut->addWikiMsg('abusefilter-test-intro', self::$mChangeLimit);
     $output = '';
     $output .= AbuseFilter::buildEditBox($this->mFilter, 'wpTestFilter') . "\n";
     $output .= Xml::inputLabel(wfMsg('abusefilter-test-load-filter'), 'wpInsertFilter', 'mw-abusefilter-load-filter', 10, '') . '&#160;' . Xml::element('input', array('type' => 'button', 'value' => wfMsg('abusefilter-test-load'), 'id' => 'mw-abusefilter-load'));
     $output = Xml::tags('div', array('id' => 'mw-abusefilter-test-editor'), $output);
     $output .= Xml::tags('p', null, Xml::checkLabel(wfMsg('abusefilter-test-shownegative'), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative));
     // Selectory stuff
     $selectFields = array();
     $selectFields['abusefilter-test-user'] = Xml::input('wpTestUser', 45, $this->mTestUser);
     $selectFields['abusefilter-test-period-start'] = Xml::input('wpTestPeriodStart', 45, $this->mTestPeriodStart);
     $selectFields['abusefilter-test-period-end'] = Xml::input('wpTestPeriodEnd', 45, $this->mTestPeriodEnd);
     $selectFields['abusefilter-test-page'] = Xml::input('wpTestPage', 45, $this->mTestPage);
     $output .= Xml::buildForm($selectFields, 'abusefilter-test-submit');
     $output .= Html::hidden('title', $this->getTitle('test')->getPrefixedText());
     $output = Xml::tags('form', array('action' => $this->getTitle('test')->getLocalURL(), 'method' => 'post'), $output);
     $output = Xml::fieldset(wfMsg('abusefilter-test-legend'), $output);
     $wgOut->addHTML($output);
     if ($wgRequest->wasPosted()) {
         $this->doTest();
     }
 }
コード例 #9
0
 function addRequestWikiForm()
 {
     $localpage = $this->getPageTitle()->getLocalUrl();
     $form = Xml::openElement('form', array('action' => $localpage, 'method' => 'post'));
     $form .= '<fieldset><legend>' . $this->msg('requestwiki')->escaped() . '</legend>';
     $form .= Xml::openElement('table');
     $form .= '<tr><td>' . $this->msg('requestwiki-label-siteurl')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('subdomain', 20, '') . '.miraheze.org' . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-sitename')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('sitename', 20, '', array('required' => '')) . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-customdomain')->escaped() . '</td>';
     $form .= '<td>' . Xml::input('customdomain', 20, '') . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-language')->escaped() . '</td>';
     $form .= '<td>' . Xml::languageSelector('en', true, null, array('name' => 'language'))[1] . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-private')->escaped() . '</td>';
     $form .= '<td>' . Xml::check('private', false, array('value' => 0)) . '</td></tr>';
     $form .= '<tr><td>' . $this->msg('requestwiki-label-comments')->escaped() . '</td>';
     $form .= '<td>' . Xml::textarea('comments', '', 40, 5, array('required' => '')) . '</td></tr>';
     $form .= '<tr><td>' . Xml::submitButton($this->msg('requestwiki-submit')->plain()) . '</td></tr>';
     $form .= Xml::closeElement('table');
     $form .= '</fieldset>';
     $form .= Html::hidden('token', $this->getUser()->getEditToken());
     $form .= Xml::closeElement('form');
     $this->getOutput()->addHTML($form);
 }
コード例 #10
0
 public function showForm()
 {
     global $wgScript;
     # Explanatory text
     $this->getOutput()->addWikiMsg('pendingchanges-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $form = Html::openElement('form', array('name' => 'pendingchanges', 'action' => $wgScript, 'method' => 'get')) . "\n";
     $form .= "<fieldset><legend>" . wfMsgHtml('pendingchanges-legend') . "</legend>\n";
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n";
     $items = array();
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getNamespaceMenu($this->namespace, '') . '</span>';
     }
     if (FlaggedRevs::qualityVersions()) {
         $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span>';
     }
     if (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected()) {
         $items[] = "<span style='white-space: nowrap;'>" . Xml::check('stable', $this->stable, array('id' => 'wpStable')) . Xml::label(wfMsg('pendingchanges-stable'), 'wpStable') . '</span>';
     }
     if ($items) {
         $form .= implode(' ', $items) . '<br />';
     }
     $items = array();
     $items[] = Xml::label(wfMsg("pendingchanges-category"), 'wpCategory') . '&#160;' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory'));
     if ($this->getUser()->getId()) {
         $items[] = Xml::check('watched', $this->watched, array('id' => 'wpWatched')) . Xml::label(wfMsg('pendingchanges-onwatchlist'), 'wpWatched');
     }
     $form .= implode(' ', $items) . '<br />';
     $form .= Xml::label(wfMsg('pendingchanges-size'), 'wpSize') . Xml::input('size', 4, $this->size, array('id' => 'wpSize')) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\n";
     $form .= "</fieldset>";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
コード例 #11
0
 public function execute($parameters)
 {
     global $wgOut, $wgRequest, $wgDisableTextSearch, $wgScript;
     $this->setHeaders();
     list($limit, $offset) = wfCheckLimits();
     $wgOut->addWikiText(wfMsgForContentNoTrans('proofreadpage_specialpage_text'));
     $this->searchList = null;
     $this->searchTerm = $wgRequest->getText('key');
     $this->suppressSqlOffset = false;
     if (!$wgDisableTextSearch) {
         $self = $this->getTitle();
         $wgOut->addHTML(Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::input('limit', false, $limit, array('type' => 'hidden')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('proofreadpage_specialpage_legend')) . Xml::input('key', 20, $this->searchTerm) . ' ' . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
         if ($this->searchTerm) {
             $index_namespace = $this->index_namespace;
             $index_ns_index = MWNamespace::getCanonicalIndex(strtolower(str_replace(' ', '_', $index_namespace)));
             $searchEngine = SearchEngine::create();
             $searchEngine->setLimitOffset($limit, $offset);
             $searchEngine->setNamespaces(array($index_ns_index));
             $searchEngine->showRedirects = false;
             $textMatches = $searchEngine->searchText($this->searchTerm);
             $escIndex = preg_quote($index_namespace, '/');
             $this->searchList = array();
             while ($result = $textMatches->next()) {
                 $title = $result->getTitle();
                 if ($title->getNamespace() == $index_ns_index) {
                     array_push($this->searchList, $title->getDBkey());
                 }
             }
             $this->suppressSqlOffset = true;
         }
     }
     parent::execute($parameters);
 }
コード例 #12
0
	/**
	 * Helper function to display a hidden field for different versions
	 * of MediaWiki.
	 */
	static function hiddenField( $name, $value ) {
		if ( class_exists( 'Html' ) ) {
			return "\t" . Html::hidden( $name, $value ) . "\n";
		} else {
			return "\t" . Xml::hidden( $name, $value ) . "\n";
		}
	}
コード例 #13
0
 protected function showForm()
 {
     global $wgScript;
     # Explanatory text
     $this->getOutput()->addWikiMsg('configuredpages-list', $this->getLang()->formatNum($this->pager->getNumRows()));
     $fields = array();
     # Namespace selector
     if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
         $fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, '');
     }
     # Default version selector
     $fields[] = FlaggedRevsXML::getDefaultFilterMenu($this->override);
     # Restriction level selector
     if (FlaggedRevs::getRestrictionLevels()) {
         $fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview);
     }
     $form = Html::openElement('form', array('name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get'));
     $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey());
     $form .= "<fieldset><legend>" . wfMsg('configuredpages') . "</legend>\n";
     $form .= implode('&#160;', $fields) . '<br/>';
     $form .= Xml::submitButton(wfMsg('go'));
     $form .= "</fieldset>\n";
     $form .= Html::closeElement('form') . "\n";
     $this->getOutput()->addHTML($form);
 }
コード例 #14
0
 function showList($conds = array('af_deleted' => 0), $optarray = array())
 {
     global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
     $output = '';
     $output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
     $pager = new AbuseFilterPager($this, $conds);
     $deleted = $optarray['deleted'];
     $hidedisabled = $optarray['hidedisabled'];
     $scope = $optarray['scope'];
     # Options form
     $fields = array();
     $fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
         $fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
     }
     $fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
     $fields['abusefilter-list-limit'] = $pager->getLimitSelect();
     $options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
     $options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
     $options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
     $options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
     $output .= $options;
     if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
         $globalPager = new GlobalAbuseFilterPager($this, $conds);
         $output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
     } else {
         $output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
     }
     $this->getOutput()->addHTML($output);
 }
コード例 #15
0
 public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
 {
     global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
     $checkbox_class = $is_mandatory ? 'mandatoryField' : 'createboxInput';
     $span_class = 'checkboxSpan';
     if (array_key_exists('class', $other_args)) {
         $span_class .= ' ' . $other_args['class'];
     }
     $input_id = "input_{$sfgFieldNum}";
     // get list delimiter - default is comma
     if (array_key_exists('delimiter', $other_args)) {
         $delimiter = $other_args['delimiter'];
     } else {
         $delimiter = ',';
     }
     $cur_values = SFUtils::getValuesArray($cur_value, $delimiter);
     if (($possible_values = $other_args['possible_values']) == null) {
         $possible_values = array();
     }
     $text = '';
     foreach ($possible_values as $key => $possible_value) {
         $cur_input_name = $input_name . '[' . $key . ']';
         if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels'])) {
             $label = $other_args['value_labels'][$possible_value];
         } else {
             $label = $possible_value;
         }
         $checkbox_attrs = array('id' => $input_id, 'tabindex' => $sfgTabIndex, 'class' => $checkbox_class);
         if (in_array($possible_value, $cur_values)) {
             $checkbox_attrs['checked'] = 'checked';
         }
         if ($is_disabled) {
             $checkbox_attrs['disabled'] = 'disabled';
         }
         $checkbox_input = Html::input($cur_input_name, $possible_value, 'checkbox', $checkbox_attrs);
         // Make a span around each checkbox, for CSS purposes.
         $text .= "\t" . Html::rawElement('span', array('class' => $span_class), $checkbox_input . ' ' . $label) . "\n";
         $sfgTabIndex++;
         $sfgFieldNum++;
     }
     $outerSpanID = "span_{$sfgFieldNum}";
     $outerSpanClass = 'checkboxesSpan';
     if ($is_mandatory) {
         $outerSpanClass .= ' mandatoryFieldSpan';
     }
     if (array_key_exists('show on select', $other_args)) {
         $outerSpanClass .= ' sfShowIfChecked';
         foreach ($other_args['show on select'] as $div_id => $options) {
             if (array_key_exists($outerSpanID, $sfgShowOnSelect)) {
                 $sfgShowOnSelect[$outerSpanID][] = array($options, $div_id);
             } else {
                 $sfgShowOnSelect[$outerSpanID] = array(array($options, $div_id));
             }
         }
     }
     $text .= Html::hidden($input_name . '[is_list]', 1);
     $outerSpanAttrs = array('id' => $outerSpanID, 'class' => $outerSpanClass);
     $text = "\t" . Html::rawElement('span', $outerSpanAttrs, $text) . "\n";
     return $text;
 }
コード例 #16
0
 function showList()
 {
     global $wgOut, $wgScript;
     $errors = array();
     // Validate search IP
     $ip = $this->mSearchIP;
     if (!IP::isIPAddress($ip) && strlen($ip)) {
         $errors[] = array('globalblocking-list-ipinvalid', $ip);
         $ip = '';
     }
     $wgOut->addWikiMsg('globalblocking-list-intro');
     // Build the search form
     $searchForm = '';
     $searchForm .= Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('globalblocking-search-legend'));
     $searchForm .= Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'globalblocklist-search'));
     $searchForm .= Html::hidden('title', SpecialPage::getTitleFor('GlobalBlockList')->getPrefixedText());
     if (is_array($errors) && count($errors) > 0) {
         $errorstr = '';
         foreach ($errors as $error) {
             if (is_array($error)) {
                 $msg = array_shift($error);
             } else {
                 $msg = $error;
                 $error = array();
             }
             $errorstr .= Xml::tags('li', null, wfMsgExt($msg, array('parseinline'), $error));
         }
         $wgOut->addWikiMsg('globalblocking-unblock-errors', count($errors));
         $wgOut->addHTML(Xml::tags('ul', array('class' => 'error'), $errorstr));
     }
     $fields = array();
     $fields['globalblocking-search-ip'] = Xml::input('ip', 45, $ip);
     $searchForm .= Xml::buildForm($fields, 'globalblocking-search-submit');
     $searchForm .= Xml::closeElement('form') . Xml::closeElement('fieldset');
     $wgOut->addHTML($searchForm);
     // Build a list of blocks.
     $conds = array();
     if (strlen($ip)) {
         list($range_start, $range_end) = IP::parseRange($ip);
         if ($range_start != $range_end) {
             // They searched for a range. Match that exact range only
             $conds = array('gb_address' => $ip);
         } else {
             // They searched for an IP. Match any range covering that IP
             $hex_ip = IP::toHex($ip);
             $ip_pattern = substr($hex_ip, 0, 4) . '%';
             // Don't bother checking blocks out of this /16.
             $dbr = wfGetDB(DB_SLAVE);
             $conds = array('gb_range_end>=' . $dbr->addQuotes($hex_ip), 'gb_range_start<=' . $dbr->addQuotes($hex_ip), 'gb_range_start like ' . $dbr->addQuotes($ip_pattern), 'gb_expiry>' . $dbr->addQuotes($dbr->timestamp(wfTimestampNow())));
         }
     }
     $pager = new GlobalBlockListPager($this, $conds);
     $body = $pager->getBody();
     if ($body != '') {
         $wgOut->addHTML($pager->getNavigationBar() . Html::rawElement('ul', array(), $body) . $pager->getNavigationBar());
     } else {
         $wgOut->wrapWikiMsg("<div class='mw-globalblocking-noresults'>\n\$1</div>\n", array('globalblocking-list-noresults'));
     }
 }
コード例 #17
0
 /**
  * Produce a nice little form
  * @param OutputPage $out
  */
 function getForm(OutputPage $out)
 {
     list($sum, $answer) = $this->pickSum();
     $index = $this->storeCaptcha(array('answer' => $answer));
     $form = '<table><tr><td>' . $this->fetchMath($sum) . '</td>';
     $form .= '<td>' . Html::input('wpCaptchaWord', false, false, array('tabindex' => '1', 'autocomplete' => 'off', 'required')) . '</td></tr></table>';
     $form .= Html::hidden('wpCaptchaId', $index);
     return $form;
 }
コード例 #18
0
 /** 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>' . Xml::input('wpCaptchaWord', false, false, array('tabindex' => '1')) . '</td></tr></table>';
     $form .= Html::hidden('wpCaptchaId', $index);
     return $form;
 }
コード例 #19
0
ファイル: SpecialLockdb.php プロジェクト: eFFemeer/seizamcore
 private function showForm($err = '')
 {
     global $wgOut, $wgUser;
     $wgOut->addWikiMsg('lockdbtext');
     if ($err != '') {
         $wgOut->setSubtitle(wfMsg('formerror'));
         $wgOut->addHTML('<p class="error">' . htmlspecialchars($err) . "</p>\n");
     }
     $wgOut->addHTML(Html::openElement('form', array('id' => 'lockdb', 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL('action=submit'))) . "\n" . wfMsgHtml('enterlockreason') . ":\n" . Html::textarea('wpLockReason', $this->reason, array('rows' => 4)) . "\n<table>\n\t<tr>\n\t\t" . Html::openElement('td', array('style' => 'text-align:right')) . "\n\t\t\t" . Html::input('wpLockConfirm', null, 'checkbox') . "\n\t\t</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . wfMsgHtml('lockconfirm') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>&#160;</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . "\n\t\t\t" . Html::input('wpLock', wfMsg('lockbtn'), 'submit') . "\n\t\t</td>\n\t</tr>\n</table>\n" . Html::hidden('wpEditToken', $wgUser->editToken()) . "\n" . Html::closeElement('form'));
 }
コード例 #20
0
 public function getPageHeader()
 {
     $self = SpecialPage::getTitleFor($this->getName());
     $form = Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
     $form .= '<table><tr><td align="right">' . Xml::label("Exclude titles", 'excludetitles') . '</td>';
     $form .= '<td>' . Xml::input('excludetitles', 30, $this->excludeorig, array('id' => 'excludetitles')) . '</td></tr>';
     $form .= '<tr><td></td><td>' . Xml::submitButton(wfMsg('allpagessubmit')) . '</td></tr></table>';
     $form .= Html::hidden('offset', $this->offset) . Html::hidden('limit', $this->limit) . '</form>';
     return $form;
 }
コード例 #21
0
ファイル: SF_ListBoxInput.php プロジェクト: whysasse/kmwiki
 /**
  * Returns the HTML code to be included in the output page for this input.
  */
 public function getHtmlText()
 {
     global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
     $className = $this->mIsMandatory ? 'mandatoryField' : 'createboxInput';
     if (array_key_exists('class', $this->mOtherArgs)) {
         $className .= ' ' . $this->mOtherArgs['class'];
     }
     $input_id = "input_{$sfgFieldNum}";
     // get list delimiter - default is comma
     if (array_key_exists('delimiter', $this->mOtherArgs)) {
         $delimiter = $this->mOtherArgs['delimiter'];
     } else {
         $delimiter = ',';
     }
     $cur_values = SFUtils::getValuesArray($this->mCurrentValue, $delimiter);
     $className .= ' sfShowIfSelected';
     if (($possible_values = $this->mOtherArgs['possible_values']) == null) {
         $possible_values = array();
     }
     $optionsText = '';
     foreach ($possible_values as $possible_value) {
         if (array_key_exists('value_labels', $this->mOtherArgs) && is_array($this->mOtherArgs['value_labels']) && array_key_exists($possible_value, $this->mOtherArgs['value_labels'])) {
             $optionLabel = $this->mOtherArgs['value_labels'][$possible_value];
         } else {
             $optionLabel = $possible_value;
         }
         $optionAttrs = array('value' => $possible_value);
         if (in_array($possible_value, $cur_values)) {
             $optionAttrs['selected'] = 'selected';
         }
         $optionsText .= Html::element('option', $optionAttrs, $optionLabel);
     }
     $selectAttrs = array('id' => $input_id, 'tabindex' => $sfgTabIndex, 'name' => $this->mInputName . '[]', 'class' => $className, 'multiple' => 'multiple');
     if (array_key_exists('size', $this->mOtherArgs)) {
         $selectAttrs['size'] = $this->mOtherArgs['size'];
     }
     if ($this->mIsDisabled) {
         $selectAttrs['disabled'] = 'disabled';
     }
     $text = Html::rawElement('select', $selectAttrs, $optionsText);
     $text .= Html::hidden($this->mInputName . '[is_list]', 1);
     if ($this->mIsMandatory) {
         $text = Html::rawElement('span', array('class' => 'inputSpan mandatoryFieldSpan'), $text);
     }
     if (array_key_exists('show on select', $this->mOtherArgs)) {
         foreach ($this->mOtherArgs['show on select'] as $div_id => $options) {
             if (array_key_exists($input_id, $sfgShowOnSelect)) {
                 $sfgShowOnSelect[$input_id][] = array($options, $div_id);
             } else {
                 $sfgShowOnSelect[$input_id] = array(array($options, $div_id));
             }
         }
     }
     return $text;
 }
コード例 #22
0
 /**
  * Executed when the user opens the DSMW administration special page
  * Calculates the PushFeed list and the pullfeed list (and everything that
  * is displayed on the psecial page
  *
  * @global <Object> $wgOut Output page instance
  * @global <String> $wgServerName
  * @global <String> $wgScriptPath
  * @return <bool>
  */
 public function execute()
 {
     global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath, $wgUser;
     if (!$this->userCanExecute($wgUser)) {
         // If the user is not authorized, show an error.
         $this->displayRestrictionError();
         return;
     }
     /**** Get status of refresh job, if any ****/
     $dbr =& wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWUpdateJob'), __METHOD__);
     if ($row !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row->job_namespace, $row->job_title);
         $updatejob = Job::factory($row->job_cmd, $title, Job::extractBlob($row->job_params), $row->job_id);
     } else {
         $updatejob = NULL;
     }
     $row1 = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWPropertyTypeJob'), __METHOD__);
     if ($row1 !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row1->job_namespace, $row1->job_title);
         $propertiesjob = Job::factory($row1->job_cmd, $title, Job::extractBlob($row1->job_params), $row1->job_id);
     } else {
         $propertiesjob = NULL;
     }
     /**** Execute actions if any ****/
     $action = $wgRequest->getText('action');
     if ($action == 'logootize') {
         if ($updatejob === NULL) {
             // careful, there might be race conditions here
             $title = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob = new DSMWUpdateJob($title);
             $newjob->insert();
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleupstarted') . '</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleuprunning') . '</b></font></p>');
         }
     } elseif ($action == 'addProperties') {
         if ($propertiesjob === NULL) {
             $title1 = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob1 = new DSMWPropertyTypeJob($title1);
             $newjob1->insert();
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeupstarted') . '</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeuprunning') . '</b></font></p>');
         }
     }
     $wgOut->setPagetitle('DSMW Settings');
     $wgOut->addHTML(Html::element('p', array(), wfMsg('dsmw-special-admin-intro')));
     $wgOut->addHTML(Html::rawElement('form', array('name' => 'properties', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'addProperties') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-propheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-proptext')) . Html::input('updateProperties', wfMsg('dsmw-special-admin-propheader'), 'submit')));
     $wgOut->addHTML(Html::rawElement('form', array('name' => 'logoot', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'logootize') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-upheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-uptext')) . Html::input('updateArticles', wfMsg('dsmw-special-admin-upbutton'), 'submit')));
     return false;
 }
コード例 #23
0
/**
 * Render "centralhelpsearch" parser tag
 *
 * @return string
 */
function efCreateSearchForm()
{
    $htmlOut = Xml::openElement('form', array('name' => 'bodyCentralSearch', 'id' => 'bodyCentralSearch', 'class' => 'bodyCentralSearch', 'action' => htmlspecialchars('http://community.wikia.com/wiki/Special:Search')));
    $htmlOut .= Xml::openElement('div', array('class' => 'bodyCentralSearchWrap', 'style' => 'margin: 20px auto; color: #999; width: 500px;'));
    $htmlOut .= Xml::element('input', array('type' => 'text', 'name' => 'search', 'size' => 50, 'placeholder' => wfMsg('centralhelpsearch-placeholder'), 'style' => 'border:1px solid #999; padding: 10px; width: 500px; font-size: 20px;', 'id' => 'bodyCentralSearchInput'));
    $htmlOut .= Xml::element('input', array('type' => 'hidden', 'name' => 'ns12', 'value' => 1, 'checked' => 'checked', 'id' => 'mw-inputbox-ns12'));
    $htmlOut .= Html::hidden('fulltext', 'Search');
    $htmlOut .= Xml::closeElement('div');
    $htmlOut .= Xml::closeElement('form');
    return $htmlOut;
}
コード例 #24
0
 function draw_OTP()
 {
     global $wgOut, $wgUser;
     $formu = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl('action=submit')));
     $formu .= Xml::inputLabel(wfMsg('latch-OTP') . ' ', 'txt_OTP', 'txt_OTP', 20) . '<BR>&nbsp';
     $formu .= Xml::submitButton(wfMsg('latch-enter'), array('name' => 'clickBotOTP')) . '<BR>';
     # Adding protection against CSRF
     $formu .= Html::hidden('token', $wgUser->getEditToken(), array('id' => 'token'));
     $formu .= Xml::closeElement('form');
     $wgOut->addHTML($formu);
 }
コード例 #25
0
 function getPageHeader()
 {
     global $wgScript, $wgMiserMode;
     # Do not show useless input form if wiki is running in misermode
     if ($wgMiserMode) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getTitle();
     return Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('withoutinterwiki-legend')) . Html::hidden('title', $t->getPrefixedText()) . Xml::inputLabel(wfMsg('allpagesprefix'), 'prefix', 'wiprefix', 20, $prefix) . ' ' . Xml::submitButton(wfMsg('withoutinterwiki-submit')) . Xml::closeElement('fieldset') . Xml::closeElement('form');
 }
コード例 #26
0
 protected function getUpdateForm()
 {
     global $wgScript;
     $form = "<table>";
     $form .= "<tr>\n                    <td style='text-align:right; width:200px;'>\n                        <label>" . wfMessage('categorywatchlist-watch')->text() . "</label>\n                    </td>\n                    <td>\n                        <input type='text' name='watchlist-add' id='watchlist-add'>\n                    </td>\n                 </tr>";
     $form .= "<tr>\n                    <td style='text-align:right; width:200px;'>\n                        <label>" . wfMessage('categorywatchlist-del')->text() . "</label>\n                    </td>\n                    <td>\n                        <input type='text' name='watchlist-del' id='watchlist-del'>\n                    </td>\n                 </tr>";
     $form .= "</table>";
     $form .= "<tr>\n                    <td colspan='2'>\n                        <input type='submit' value='" . wfMessage('categorywatchlist-submit')->text() . "'>\n                    </td>\n                 </tr>";
     $out = Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'id' => 'ext-categorywatchlist-form')) . Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . Html::hidden('token', $this->getUser()->getEditToken()) . Html::hidden('update', 1) . $form . Html::closeElement('fieldset') . Html::closeElement('form') . "\n";
     return $out;
 }
コード例 #27
0
ファイル: SF_FormUtils.php プロジェクト: schwarer2006/wikia
 /**
  * Add a hidden input for each field in the template call that's
  * not handled by the form itself
  */
 static function unhandledFieldsHTML($templateName, $templateContents)
 {
     $text = "";
     foreach ($templateContents as $key => $value) {
         if (!is_null($key) && !is_numeric($key)) {
             $key = urlencode($key);
             $text .= Html::hidden('_unhandled_' . $templateName . '_' . $key, $value);
         }
     }
     return $text;
 }
コード例 #28
0
 /**
  * @return string|null
  */
 public function execute()
 {
     global $wgLang;
     $r = $this->parent->request;
     $userLang = $r->getVal('uselang');
     $contLang = $r->getVal('ContLang');
     $languages = Language::fetchLanguageNames();
     $lifetime = intval(ini_get('session.gc_maxlifetime'));
     if (!$lifetime) {
         $lifetime = 1440;
         // PHP default
     }
     if ($r->wasPosted()) {
         # Do session test
         if ($this->parent->getSession('test') === null) {
             $requestTime = $r->getVal('LanguageRequestTime');
             if (!$requestTime) {
                 // The most likely explanation is that the user was knocked back
                 // from another page on POST due to session expiry
                 $msg = 'config-session-expired';
             } elseif (time() - $requestTime > $lifetime) {
                 $msg = 'config-session-expired';
             } else {
                 $msg = 'config-no-session';
             }
             $this->parent->showError($msg, $wgLang->formatTimePeriod($lifetime));
         } else {
             if (isset($languages[$userLang])) {
                 $this->setVar('_UserLang', $userLang);
             }
             if (isset($languages[$contLang])) {
                 $this->setVar('wgLanguageCode', $contLang);
             }
             return 'continue';
         }
     } elseif ($this->parent->showSessionWarning) {
         # The user was knocked back from another page to the start
         # This probably indicates a session expiry
         $this->parent->showError('config-session-expired', $wgLang->formatTimePeriod($lifetime));
     }
     $this->parent->setSession('test', true);
     if (!isset($languages[$userLang])) {
         $userLang = $this->getVar('_UserLang', 'en');
     }
     if (!isset($languages[$contLang])) {
         $contLang = $this->getVar('wgLanguageCode', 'en');
     }
     $this->startForm();
     $s = Html::hidden('LanguageRequestTime', time()) . $this->getLanguageSelector('uselang', 'config-your-language', $userLang, $this->parent->getHelpBox('config-your-language-help')) . $this->getLanguageSelector('ContLang', 'config-wiki-language', $contLang, $this->parent->getHelpBox('config-wiki-language-help'));
     $this->addHTML($s);
     $this->endForm('continue', false);
     return null;
 }
コード例 #29
0
 function formatThreadField($field, $threadid)
 {
     if (!is_object($threadid)) {
         $t = Threads::withId($threadid);
     } else {
         $t = $threadid;
         $threadid = $t->id();
     }
     $out = Html::hidden($field, $threadid);
     $out .= LqtView::permalink($t);
     return $out;
 }
コード例 #30
-1
 function getPageHeader()
 {
     # Do not show useless input form if special page is cached
     if ($this->isCached()) {
         return '';
     }
     $prefix = $this->prefix;
     $t = $this->getPageTitle();
     return Html::openElement('form', array('method' => 'get', 'action' => wfScript())) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', null, $this->msg('withoutinterwiki-legend')->text()) . "\n" . Html::hidden('title', $t->getPrefixedText()) . "\n" . Xml::inputLabel($this->msg('allpagesprefix')->text(), 'prefix', 'wiprefix', 20, $prefix) . "\n" . Xml::submitButton($this->msg('withoutinterwiki-submit')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form');
 }