function wfAutotimestamp(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags) { if (strpos($text, "{{") !== false) { $t1 = preg_replace('/\\<nowiki\\>.*<\\/nowiki>/', '', $text); preg_match_all('/{{[^}]*}}/im', $t1, $matches); $templates = split(' ', strtolower(wfMsg('templates_needing_autotimestamps'))); $templates = array_flip($templates); foreach ($matches[0] as $m) { $mm = preg_replace('/\\|[^}]*/', '', $m); $mm = preg_replace('/[}{]/', '', $mm); if (isset($templates[strtolower($mm)])) { if (strpos($m, "date=") === false) { $m1 = str_replace("}}", "|date=" . date('Y-m-d') . "}}", $m); $text = str_replace($m, $m1, $text); } else { preg_match('/date=(.*)}}/', $m, $mmatches); $mmm = $mmatches[1]; if ($mmm !== date('Y-m-d', strtotime($mmm))) { $text = str_replace($mmm, date('Y-m-d', strtotime($mmm)), $text); } } } else { //echo "wouldn't substitute on $m<br/>"; } } } return true; }
protected function getDisabledMessage() { if ($this->disabledExtension) { return wfMsg('oasis-toolbar-not-enabled-here'); } return parent::getDisabledMessage(); }
function doTagRow($tag, $hitcount) { static $sk = null, $doneTags = array(); if (!$sk) { global $wgUser; $sk = $wgUser->getSkin(); } if (in_array($tag, $doneTags)) { return ''; } $newRow = ''; $newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag)); $disp = ChangeTags::tagDescription($tag); $disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')'; $newRow .= Xml::tags('td', null, $disp); $desc = wfMsgExt("tag-{$tag}-description", 'parseinline'); $desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc; $desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')'; $newRow .= Xml::tags('td', null, $desc); $hitcount = wfMsg('tags-hitcount', $hitcount); $hitcount = $sk->link(SpecialPage::getTitleFor('RecentChanges'), $hitcount, array(), array('tagfilter' => $tag)); $newRow .= Xml::tags('td', null, $hitcount); $doneTags[] = $tag; return Xml::tags('tr', null, $newRow) . "\n"; }
/** * Create a new poll * @param wgRequest question * @param wgRequest answer (expects PHP array style in the form <input name=answer[]>) * Page Content should be of a different style so we have to translate * *question 1\n * *question 2\n */ public static function create() { wfProfileIn(__METHOD__); $app = F::app(); $title = $app->wg->Request->getVal('question'); $answers = $app->wg->Request->getArray('answer'); // array $title_object = Title::newFromText($title, NS_WIKIA_POLL); if (is_object($title_object) && $title_object->exists()) { $res = array('success' => false, 'error' => $app->renderView('Error', 'Index', array(wfMsg('wikiapoll-error-duplicate')))); } else { if ($title_object == null) { $res = array('success' => false, 'error' => $app->renderView('Error', 'Index', array(wfMsg('wikiapoll-error-invalid-title')))); } else { $content = ""; foreach ($answers as $answer) { $content .= "*{$answer}\n"; } /* @var $article WikiPage */ $article = new Article($title_object, NS_WIKIA_POLL); $article->doEdit($content, 'Poll Created', EDIT_NEW, false, $app->wg->User); $title_object = $article->getTitle(); // fixme: check status object $res = array('success' => true, 'pollId' => $article->getID(), 'url' => $title_object->getLocalUrl(), 'question' => $title_object->getPrefixedText()); } } wfProfileOut(__METHOD__); return $res; }
function wfFormatEmail(&$to, &$from, &$subject, &$text) { global $wgUser; $ul = $wgUser->getUserPage(); $text = wfMsg('email_header') . $text . wfMsg('email_footer', $wgUser->getName(), $ul->getFullURL()); return true; }
/** * Returns the HTML which is added to $wgOut after the article text. * * @return string */ protected function getHtml() { wfProfileIn(__METHOD__ . ' (SMW)'); if ($this->limit > 0) { // limit==0: configuration setting to disable this completely $store = smwfGetStore(); $description = new SMWConceptDescription($this->getDataItem()); $query = SMWPageLister::getQuery($description, $this->limit, $this->from, $this->until); $queryResult = $store->getQueryResult($query); $diWikiPages = $queryResult->getResults(); if ($this->until !== '') { $diWikiPages = array_reverse($diWikiPages); } $errors = $queryResult->getErrors(); } else { $diWikiPages = array(); $errors = array(); } $pageLister = new SMWPageLister($diWikiPages, null, $this->limit, $this->from, $this->until); $this->mTitle->setFragment('#SMWResults'); // Make navigation point to the result list. $navigation = $pageLister->getNavigationLinks($this->mTitle); $titleText = htmlspecialchars($this->mTitle->getText()); $resultNumber = min($this->limit, count($diWikiPages)); $result = "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . '<h2>' . wfMsg('smw_concept_header', $titleText) . "</h2>\n" . wfMsgExt('smw_conceptarticlecount', array('parsemag'), $resultNumber) . smwfEncodeMessages($errors) . "\n" . $navigation . $pageLister->formatList() . $navigation . "</div>\n"; wfProfileOut(__METHOD__ . ' (SMW)'); return $result; }
/** * @param User $user * @param Array $defaultPreferences * @return bool */ function onGetPreferences($user, &$defaultPreferences) { global $wgOut, $wgJsMimeType, $wgExtensionsPath, $wgCityId; $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/SpecialUnsubscribe/UnsubscribePreferences.js\"></script>"); $unsubscribe = array('unsubscribed' => array('type' => 'toggle', 'section' => 'personal/email', 'label-message' => 'unsubscribe-preferences-toggle')); $notice = array('no-email-notice-followedpages' => array('type' => 'info', 'section' => 'watchlist/basic', 'default' => wfMsg('unsubscribe-preferences-notice'))); // move e-mail options higher up $emailAddress = array('emailaddress' => $defaultPreferences['emailaddress']); unset($defaultPreferences['emailaddress']); $defaultPreferences = self::insert($defaultPreferences, 'language', $emailAddress, false); // move founder emails higher up $founderEmailsFirstKey = "adoptionmails-label-{$wgCityId}"; if (!empty($defaultPreferences[$founderEmailsFirstKey])) { $founderEmails = array($founderEmailsFirstKey => $defaultPreferences[$founderEmailsFirstKey]); unset($defaultPreferences[$founderEmailsFirstKey]); $defaultPreferences = self::insert($defaultPreferences, 'emailaddress', $founderEmails); } // add the unsubscribe checkbox $defaultPreferences = self::insert($defaultPreferences, 'emailauthentication', $unsubscribe); // add a notice if needed if ($user->getOption('unsubscribe')) { $defaultPreferences = self::insert($defaultPreferences, 'watchdefault', $notice, false); } $defaultPreferences = self::insert($defaultPreferences, 'language', $emailAddress, false); return true; }
public function tag_runphp(&$code, &$params, &$parser) { if (!self::checkExecuteRight($parser->mTitle)) { return 'SecurePHP: ' . wfMsg('badaccess'); } return self::executeCode($code); }
/** * @brief Displays the main menu for the admin dashboard * */ public function index() { $this->wg->Out->setPageTitle(wfMsg('admindashboard-title')); if (!$this->wg->User->isAllowed('admindashboard')) { $this->displayRestrictionError(); return false; // skip rendering } $this->tab = $this->getVal('tab', 'general'); // links $this->urlThemeDesigner = Title::newFromText('ThemeDesigner', NS_SPECIAL)->getFullURL(); $this->urlRecentChanges = Title::newFromText('RecentChanges', NS_SPECIAL)->getFullURL(); $this->urlTopNavigation = Title::newFromText('Wiki-navigation', NS_MEDIAWIKI)->getFullURL('action=edit'); $this->urlWikiFeatures = Title::newFromText('WikiFeatures', NS_SPECIAL)->getFullURL(); $this->urlPageLayoutBuilder = Title::newFromText('PageLayoutBuilder', NS_SPECIAL)->getFullURL('action=list'); $this->urlListUsers = Title::newFromText('ListUsers', NS_SPECIAL)->getFullURL(); $this->urlUserRights = Title::newFromText('UserRights', NS_SPECIAL)->getFullURL(); $this->urlCommunityCorner = Title::newFromText('Community-corner', NS_MEDIAWIKI)->getFullURL('action=edit'); $this->urlAllCategories = Title::newFromText('Categories', NS_SPECIAL)->getFullURL(); $this->urlAddPage = Title::newFromText('CreatePage', NS_SPECIAL)->getFullURL(); $this->urlAddPhoto = Title::newFromText('Upload', NS_SPECIAL)->getFullURL(); $this->urlCreateBlogPage = Title::newFromText('CreateBlogPage', NS_SPECIAL)->getFullURL(); $this->urlMultipleUpload = Title::newFromText('MultipleUpload', NS_SPECIAL)->getFullURL(); $this->urlGetPromoted = Title::newFromText('Promote', NS_SPECIAL)->getFullURL(); // special:specialpages $this->advancedSection = (string) $this->app->sendRequest('AdminDashboardSpecialPage', 'getAdvancedSection', array()); // icon display logic $this->displayPageLayoutBuilder = !empty($this->wg->EnablePageLayoutBuilder); $this->displayWikiFeatures = !empty($this->wg->EnableWikiFeatures); $this->displaySpecialPromote = !empty($this->wg->EnableSpecialPromoteExt); // add messages package F::build('JSMessages')->enqueuePackage('AdminDashboard', JSMessages::INLINE); }
/** * */ function wfSpecialExport($page = '') { global $wgOut, $wgLang, $wgRequest; if ($wgRequest->getVal('action') == 'submit') { $page = $wgRequest->getText('pages'); $curonly = $wgRequest->getCheck('curonly'); } else { # Pre-check the 'current version only' box in the UI $curonly = true; } if ($page != '') { $wgOut->disable(); header("Content-type: application/xml; charset=utf-8"); $pages = explode("\n", $page); $db =& wfGetDB(DB_SLAVE); $history = $curonly ? MW_EXPORT_CURRENT : MW_EXPORT_FULL; $exporter = new WikiExporter($db, $history); $exporter->openStream(); $exporter->pagesByName($pages); $exporter->closeStream(); return; } $wgOut->addWikiText(wfMsg("exporttext")); $titleObj = Title::makeTitle(NS_SPECIAL, "Export"); $action = $titleObj->escapeLocalURL('action=submit'); $wgOut->addHTML("\n<form method='post' action=\"{$action}\">\n<input type='hidden' name='action' value='submit' />\n<textarea name='pages' cols='40' rows='10'></textarea><br />\n<label><input type='checkbox' name='curonly' value='true' checked='checked' />\n" . wfMsg("exportcuronly") . "</label><br />\n<input type='submit' />\n</form>\n"); }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ public function execute($par) { global $wgOut; $wgOut->setPageTitle(wfMsg('myip')); $ip = wfGetIP(); $wgOut->addWikiText(wfMsg('myip-out') . " {$ip}"); }
function getHtmlResult() { $ballot = $this->election->getBallot(); if ( !is_callable( array( $ballot, 'getColumnLabels' ) ) ) { throw new MWException( __METHOD__.': ballot type not supported by this tallier' ); } $optionLabels = array(); foreach ( $this->question->getOptions() as $option ) { $optionLabels[$option->getId()] = $option->parseMessageInline( 'text' ); } $labels = $ballot->getColumnLabels( $this->question ); $s = "<table class=\"securepoll-table\">\n" . "<tr>\n" . "<th> </th>\n"; foreach ( $labels as $label ) { $s .= Xml::element( 'th', array(), $label ) . "\n"; } $s .= Xml::element( 'th', array(), wfMsg( 'securepoll-average-score' ) ); $s .= "</tr>\n"; foreach ( $this->averages as $oid => $average ) { $s .= "<tr>\n" . Xml::tags( 'td', array( 'class' => 'securepoll-results-row-heading' ), $optionLabels[$oid] ) . "\n"; foreach ( $labels as $score => $label ) { $s .= Xml::element( 'td', array(), $this->histogram[$oid][$score] ) . "\n"; } $s .= Xml::element( 'td', array(), $average ) . "\n"; $s .= "</tr>\n"; } $s .= "</table>\n"; return $s; }
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); }
/** * @param $tpl * @return bool */ public static function addToolboxLink( &$tpl ) { global $wgOut, $wgShortUrlPrefix; if ( !is_string( $wgShortUrlPrefix ) ) { $urlPrefix = SpecialPage::getTitleFor( 'ShortUrl' )->getCanonicalUrl() . '/'; } else { $urlPrefix = $wgShortUrlPrefix; } $title = $wgOut->getTitle(); if ( ShortUrlUtils::needsShortUrl( $title ) ) { $shortId = ShortUrlUtils::encodeTitle( $title ); $shortURL = $urlPrefix . $shortId; $html = Html::rawElement( 'li', array( 'id' => 't-shorturl' ), Html::Element( 'a', array( 'href' => $shortURL, 'title' => wfMsg( 'shorturl-toolbox-title' ) ), wfMsg( 'shorturl-toolbox-text' ) ) ); echo $html; } return true; }
function efFastCatSelector(&$categories) { global $wgTitle, $wgArticle; // BugId:26491 if (empty($wgTitle) || empty($wgArticle)) { return true; } $artname = $wgTitle->getText(); $artid = $wgArticle->getID(); $spice = sha1("Kroko-katMeNot-" . $artid . "-" . $artname . "-NotMekat-Schnapp"); $catUrl = Title::newFromText('FastCat', NS_SPECIAL)->getFullURL(); $ret = "<form action=\"{$catUrl}\" method='post'>\n<p><b>" . wfMsg('fastcat-box-title') . "</b><br>\n<small>" . wfMsg('fastcat-box-intro') . "</small>\n</p>\n<input type='hidden' name='id' value='{$artid}'>\n<input type='hidden' name='spice' value='{$spice}'>\n<input type='hidden' name='artname' value='{$artname}'>\n<p style=\"text-indent:-1em;margin-left:1em\">"; $kat = explode("\n", wfMsgForContent('fastcat-categories-list')); foreach ($kat as $k) { if (strpos($k, '* ') === 0) { $k = trim($k, '* '); $ret .= "</p><p style=\"text-indent:-1em;margin-left:1em\">\n"; $ret .= "<button style=\"font-size:smaller;\" name=\"cat\" value=\"{$k}\"><b>{$k}</b></button>\n"; } else { $k = trim($k, '* '); $ret .= "<button style=\"font-size:smaller;\" name=\"cat\" value=\"{$k}\">{$k}</button>\n"; } } $ret .= <<<EORET \t\t</p> \t\t</form> EORET; $categories = $ret; return true; }
/** * This function is called when the special page is accessed * @param $par parameters * @see includes/SpecialPage.php */ function execute($par) { global $wgRequest, $wgOut; $this->setHeaders(); $param = $wgRequest->getText('param'); wfDebugLog(basename(__FILE__, ".php"), __METHOD__ . ': ' . "Parameters: {$param}"); // build the page $html = ""; if ($this->multiAuthPlugin->isLoggedIn()) { // login success $html .= "<p>" . wfMsg('msg_loginSuccess') . "</p>\n"; } else { if (isset($_GET['method']) && $this->multiAuthPlugin->isValidMethod($_GET['method'])) { $this->initLogin($_GET['method']); // the above function will issue a redirect } else { if (!is_null($this->multiAuthPlugin->getCurrentMethodName()) && $this->multiAuthPlugin->getCurrentMethodName() != 'local') { // external authentication success but not authorized $html .= "<p>" . wfMsg('msg_notAuthorized') . "</p>\n"; unset($_SESSION['MA_methodName']); } else { $this->addLoginLinks($html); } } } $wgOut->addHTML($html); $wgOut->returnToMain(); }
/** * Main method. * * @since 0.1 * * @param string $subPage */ public function execute($subPage) { parent::execute($subPage); $out = $this->getOutput(); if (trim($subPage) === '') { $this->getOutput()->redirect(SpecialPage::getTitleFor('Institutions')->getLocalURL()); } else { $out->setPageTitle(wfMsgExt('ep-institution-title', 'parsemag', $this->subPage)); $org = EPOrg::selectRow(null, array('name' => $this->subPage)); if ($org === false) { $this->displayNavigation(); if ($this->getUser()->isAllowed('ep-org')) { $out->addWikiMsg('ep-institution-create', $this->subPage); EPOrg::displayAddNewControl($this->getContext(), array('name' => $this->subPage)); } else { $out->addWikiMsg('ep-institution-none', $this->subPage); } } else { $links = array(); if ($this->getUser()->isAllowed('ep-org')) { $links[wfMsg('ep-institution-nav-edit')] = SpecialPage::getTitleFor('EditInstitution', $this->subPage); } $this->displayNavigation($links); $this->displaySummary($org); $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-courses'))); EPCourse::displayPager($this->getContext(), array('org_id' => $org->getId())); if ($this->getUser()->isAllowed('ep-course')) { $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-add-course'))); EPCourse::displayAddNewControl($this->getContext(), array('org' => $org->getId())); } } } }
public static function createUserJudgeHTML($edit_id, $page_id, $timestamp, $username, $html_diff) { $notSpamMsg = wfMsg('not-spam'); $delSpamMsg = wfMsg('delete-permanently'); $page_title = self::getArticleTitleFromID($page_id); $pageName = wfMsg('page-name', $page_title); $authorLabel = wfMsg('author-label', $username); $submittedOn = wfMsg('submitted-on', $timestamp); $htmlout = <<<HTML <div class="spam-diff"> <div class="diff-header"> <h4>{$pageName}</h4> <p>{$authorLabel}<br /> {$submittedOn}</p> </div> <div class="diff-holder"> {$html_diff} </div> <div class="diff-footer"> <fieldset> <label for="del-spam-{$edit_id}"> <input type="radio" id="del-spam-{$edit_id}" name="spam_not_spam-{$edit_id}" value="del-{$edit_id}" checked="checked" /> {$delSpamMsg} </label> <label for="not-spam-{$edit_id}"> <input type="radio" id="not-spam-{$edit_id}" name="spam_not_spam-{$edit_id}" value="not-spam-{$edit_id}" /> {$notSpamMsg} </label> </fieldset> </div> </div><br /><br /> HTML; return $htmlout; }
/** * Execute special page. Only available to wikiHow staff. */ public function execute() { global $wgRequest, $wgOut, $wgUser, $wgLang, $wgLanguageCode, $wgHooks; $wgHooks['ShowSideBar'][] = array($this, 'removeSideBarCallback'); $userGroups = $wgUser->getGroups(); if ($wgLanguageCode != 'en' || $wgUser->isBlocked() || !in_array('staff', $userGroups) && $wgUser->getName() != "G.bahij") { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext'); } // Fetch images before or after time 't' $timeCutoff = $wgRequest->getVal('t') or wfTimestamp(TS_MW); if (!ctype_digit($timeCutoff)) { $timeCutoff = wfTimestamp(TS_MW); } $after = (bool) $wgRequest->getVal('a'); $gridView = (bool) $wgRequest->getVal('g'); $rowsPerPage = $wgRequest->getVal('r'); if ($rowsPerPage && is_numeric($rowsPerPage) && ctype_digit($rowsPerPage)) { $rowsPerPage = max(5, min(100, $rowsPerPage)); } else { $rowsPerPage = $this->defaultRowsPerPage; } $copyVioFilter = (bool) $wgRequest->getVal('c'); $title = 'Admin - Manage User Completed Images'; $wgOut->setHTMLTitle(wfMsg('pagetitle', $title)); $wgOut->setPageTitle('Manage User Completed Images'); $tmpl = $this->genAdminForm($timeCutoff, $after, $rowsPerPage, $gridView, $copyVioFilter); $wgOut->addHTML($tmpl); }
protected function getTypeProperties($typeLabel) { global $wgRequest, $smwgTypePagingLimit; if ($smwgTypePagingLimit <= 0) { return ''; } // not too useful, but we comply to this request $from = $wgRequest->getVal('from'); $until = $wgRequest->getVal('until'); $typeValue = SMWDataValueFactory::newTypeIDValue('__typ', $typeLabel); $store = smwfGetStore(); $options = SMWPageLister::getRequestOptions($smwgTypePagingLimit, $from, $until); $diWikiPages = $store->getPropertySubjects(new SMWDIProperty('_TYPE'), $typeValue->getDataItem(), $options); if (!$options->ascending) { $diWikiPages = array_reverse($diWikiPages); } $result = ''; if (count($diWikiPages) > 0) { $pageLister = new SMWPageLister($diWikiPages, null, $smwgTypePagingLimit, $from, $until); $title = $this->getTitleFor('Types', $typeLabel); $title->setFragment('#SMWResults'); // Make navigation point to the result list. $navigation = $pageLister->getNavigationLinks($title); $resultNumber = min($smwgTypePagingLimit, count($diWikiPages)); $typeName = $typeValue->getLongWikiText(); $result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . '<h2>' . wfMsg('smw_type_header', $typeName) . "</h2>\n<p>" . wfMsgExt('smw_typearticlecount', array('parsemag'), $resultNumber) . "</p>\n" . $navigation . $pageLister->formatList() . $navigation . "\n</div>"; } return $result; }
function execute( $par ) { global $wgRequest, $wgOut, $wgPiwikURL, $wgScriptPath, $wgPiwikIDSite, $wgPiwikSpecialPageDate; $this->setHeaders(); $wgOut->setPagetitle( 'Piwik' ); $selfTitle = $this->getTitle(); $lastvisits = wfMsg( 'piwik-lastvisits' ); $countries = wfMsg( 'piwik-countries' ); $browsers = wfMsg( 'piwik-browsers' ); if ( $wgPiwikSpecialPageDate != 'today' && $wgPiwikSpecialPageDate != 'yesterday' ) { $wgPiwikSpecialPageDate = 'yesterday'; } // checking $piwikpage = <<<PIWIK <h2>{$lastvisits}</h2> <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&columns[]=nb_visits&moduleToWidgetize=VisitsSummary&actionToWidgetize=getEvolutionGraph&idSite={$wgPiwikIDSite}&period=day&date=last30&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" height="250" scrolling="no" width="100%"></iframe> <h2>{$countries}</h2> <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserCountry&actionToWidgetize=getCountry&idSite={$wgPiwikIDSite}&period=day&date={$wgPiwikSpecialPageDate}&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> <h2>{$browsers}</h2> <iframe src="http://{$wgPiwikURL}index.php?module=Widgetize&action=iframe&moduleToWidgetize=UserSettings&actionToWidgetize=getBrowser&idSite={$wgPiwikIDSite}&period=day&date={$wgPiwikSpecialPageDate}&disableLink=1" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" height="400" width="100%"></iframe> PIWIK; $wgOut->addHTML( $piwikpage ); }
public function getConnectForm() { if ($this->getVar('wgDBserver') == 'localhost') { $this->parent->setVar('wgDBserver', ''); } return $this->getTextBox('wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox('config-db-host-oracle-help')) . Html::openElement('fieldset') . Html::element('legend', array(), wfMsg('config-db-wiki-settings')) . $this->getTextBox('wgDBprefix', 'config-db-prefix') . $this->getTextBox('_OracleDefTS', 'config-oracle-def-ts') . $this->getTextBox('_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox('config-db-oracle-help')) . Html::closeElement('fieldset') . $this->parent->getWarningBox(wfMsg('config-db-account-oracle-warn')) . $this->getInstallUserBox() . $this->getWebUserBox(); }
function getTopLevelCategories() { global $wgCategoriesArticle; wfLoadExtensionMessages('Sitemap'); $results = array(); $revision = Revision::newFromTitle(Title::newFromText(wfMsg('categories_article'))); if (!$revision) { return $results; } // INTL: If there is a redirect to a localized page name, follow it if (strpos($revision->getText(), "#REDIRECT") !== false) { $revision = Revision::newFromTitle(Title::newFromRedirect($revision->getText())); } $lines = split("\n", $revision->getText()); foreach ($lines as $line) { if (preg_match('/^\\*[^\\*]/', $line)) { $line = trim(substr($line, 1)); switch ($line) { case "Other": case "wikiHow": break; default: $results[] = $line; } } } return $results; }
function execute() { global $wgRequest, $wgOut, $wgUser, $wgArticle; $sitting_of = $wgRequest->getVal('sitting_of'); $session_number = $wgRequest->getVal('session_number'); $sitting_start_date_time = $wgRequest->getVal('sitting_start_date_and_time'); $sitting_end_date_time = $wgRequest->getVal('sitting_end_date_and_time'); $sitting_session_number = $wgRequest->getVal('sitting_session_number'); $wpEditToken = $wgRequest->getVal('wpEditToken'); $sitting_desc = $wgRequest->getVal('sitting_desc'); $sitting_start_date = substr($sitting_start_date_time, 0, strpos($sitting_start_date_time, ' ')); $sitting_start_time = substr($sitting_start_date_time, strpos($sitting_start_date_time, ' ') + 1); $sitting_end_date = substr($sitting_end_date_time, 0, strpos($sitting_end_date_time, ' ')); $sitting_end_time = substr($sitting_end_date_time, strpos($sitting_end_date_time, ' ') + 1); $sitting_name = $sitting_of . '-' . $sitting_start_date; //$sitting_of.'-'.$sitting_start_date_time.'-' $title = Title::newFromText($sitting_name, MV_NS_SITTING); $wgArticle = new Article($title); $wgArticle->doEdit($sitting_desc, wfMsg('mv_summary_add_sitting')); $dbkey = $title->getDBKey(); $sitting = new MV_Sitting(array('name' => $dbkey, 'start_date' => $sitting_start_date, 'start_time' => $sitting_start_time, 'end_date' => $sitting_end_date, 'end_time' => $sitting_end_time)); //$sitting->db_load_sitting(); //$sitting->db_load_streams(); if ($sitting->insertSitting()) { if ($wgArticle->exists()) { $wgOut->redirect($title->getLocalURL("action=staff")); } else { $html .= 'Article ' . $sitting_name . ' does not exist'; $wgOut->addHtml($html); } } else { $WgOut->addHTML('Error: Duplicate Sitting Name?'); } }
public function onView() { $rc = RecentChange::newFromId($this->getRequest()->getInt('rcid')); if (is_null($rc)) { throw new ErrorPageError('markedaspatrollederror', 'markedaspatrollederrortext'); } $errors = $rc->doMarkPatrolled($this->getUser()); if (in_array(array('rcpatroldisabled'), $errors)) { throw new ErrorPageError('rcpatroldisabled', 'rcpatroldisabledtext'); } if (in_array(array('hookaborted'), $errors)) { // The hook itself has handled any output return; } # It would be nice to see where the user had actually come from, but for now just guess $returnto = $rc->getAttribute('rc_type') == RC_NEW ? 'Newpages' : 'Recentchanges'; $return = SpecialPage::getTitleFor($returnto); if (in_array(array('markedaspatrollederror-noautopatrol'), $errors)) { $this->getOutput()->setPageTitle(wfMsg('markedaspatrollederror')); $this->getOutput()->addWikiMsg('markedaspatrollederror-noautopatrol'); $this->getOutput()->returnToMain(null, $return); return; } if (!empty($errors)) { $this->getOutput()->showPermissionsErrorPage($errors); return; } # Inform the user $this->getOutput()->setPageTitle(wfMsg('markedaspatrolled')); $this->getOutput()->addWikiMsg('markedaspatrolledtext', $rc->getTitle()->getPrefixedText()); $this->getOutput()->returnToMain(null, $return); }
function formatResult($skin, $result) { global $wgContLang; $fname = 'DoubleRedirectsPage::formatResult'; $titleA = Title::makeTitle($result->namespace, $result->title); if ($result && !isset($result->nsb)) { $dbr =& wfGetDB(DB_SLAVE); $sql = $this->getSQLText($dbr, $result->namespace, $result->title); $res = $dbr->query($sql, $fname); if ($res) { $result = $dbr->fetchObject($res); $dbr->freeResult($res); } } if (!$result) { return ''; } $titleB = Title::makeTitle($result->nsb, $result->tb); $titleC = Title::makeTitle($result->nsc, $result->tc); $linkA = $skin->makeKnownLinkObj($titleA, '', 'redirect=no'); $edit = $skin->makeBrokenLinkObj($titleA, "(" . wfMsg("qbedit") . ")", 'redirect=no'); $linkB = $skin->makeKnownLinkObj($titleB, '', 'redirect=no'); $linkC = $skin->makeKnownLinkObj($titleC); $arr = $wgContLang->isRTL() ? '←' : '→'; return "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}"; }
/** * execute -- main entry point to api method * * use secret hash for checking if api is called by proper engine * * @access public * * @return api result */ public function execute() { global $wgTheSchwartzSecretToken, $wgCityId, $wgServer, $wgExtensionMessagesFiles; $params = $this->extractRequestParams(); $status = 0; if (isset($params["token"]) && $params["token"] === $wgTheSchwartzSecretToken) { /** * get creator from param */ $founder = User::newFromId($params["user_id"]); $founder->load(); /** * get city_founding_user from city_list */ if (!$founder) { $wiki = WikiFactory::getWikiByID($wgCityId); $founder = User::newFromId($wiki->city_founding_user); } Wikia::log(__METHOD__, "user", $founder->getName()); if ($founder && $founder->isEmailConfirmed()) { if ($founder->sendMail(wfMsg("autocreatewiki-reminder-subject"), wfMsg("autocreatewiki-reminder-body", array($founder->getName(), $wgServer)), null, null, "AutoCreateWikiReminder", wfMsg("autocreatewiki-reminder-body-HTML", array($founder->getName(), $wgServer)))) { $status = 1; } } } else { $this->dieUsageMsg(array("sessionfailure")); } $result = array("status" => $status); $this->getResult()->setIndexedTagName($result, 'status'); $this->getResult()->addValue(null, $this->getModuleName(), $result); }
/** * Displays the main form for removing a gift * @return HTML output */ function displayForm() { global $wgUser, $wgOut, $wgUploadPath; $rel = new UserGifts($wgUser->getName()); $gift = $rel->getUserGift($this->gift_id); $user = Title::makeTitle(NS_USER, $gift['user_name_from']); $gift_image = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="gift" />'; $output = $wgOut->setPageTitle(wfMsg('g-remove-title', $gift['name'])); $output .= '<div class="back-links"> <a href="' . $wgUser->getUserPage()->escapeFullURL() . '">' . wfMsg('g-back-link', $gift['user_name_to']) . '</a> </div> <form action="" method="post" enctype="multipart/form-data" name="form1"> <div class="g-remove-message">' . wfMsg('g-remove-message', $gift['name']) . '</div> <div class="g-container">' . $gift_image . '<div class="g-name">' . $gift['name'] . '</div> <div class="g-from">' . wfMsg('g-from', $user->escapeFullURL(), $gift['user_name_from']) . '</div>'; if ($gift['message']) { $output .= '<div class="g-user-message">' . $gift['message'] . '</div>'; } $output .= '</div> <div class="cleared"></div> <div class="g-buttons"> <input type="hidden" name="user" value="' . addslashes($gift['user_name_from']) . '"> <input type="button" class="site-button" value="' . wfMsg('g-remove') . '" size="20" onclick="document.form1.submit()" /> <input type="button" class="site-button" value="' . wfMsg('g-cancel') . '" size="20" onclick="history.go(-1)" /> </div> </form>'; return $output; }
public function checkEditPageWithAkismet($editor, $newText, $section, &$error) { global $wgUser; $oldText = $editor->mArticle->getContent(); $username = $wgUser->getName(); $url = $editor->mTitle->getFullURL(); $containsSpam = $this->changeIsSpam($oldText, $newText, $username, $url); // Don't allow the edit to be persisted. Display the edit page again with an error message if ($containsSpam) { // Add the edit to the database, so the user can view it manually later. if (!empty($editor->mArticle->mRevision)) { $rev_id = $editor->mArticle->mRevision->getId(); } else { $rev_id = null; } $page_id = $editor->mArticle->getId(); $submitted_diff = $this->extractDiff($oldText, $newText); $title = $editor->mArticle->getTitle(); $html_diff = $this->getHtmlDiff($title, $oldText, $newText); $this->addSuspectedSpamToDB($page_id, $rev_id, $newText, $username, $submitted_diff, $html_diff); $spamDetectedMsg = wfMsg('spam-detected'); $error = "<b>{$spamDetectedMsg}</b>"; $editor->showEditForm(array(&$this, 'editCallback')); return false; } // Allow the edit return true; }
function processLogoutRequest() { global $wgUser; $wgUser->logout(); wfLoadExtensionMessages('AjaxLogin'); return new AjaxResponse(wfMsg('ajaxlogin-nowloggedout')); }