function execute($par) { global $wgRequest, $wgUser, $wgOut; wfLoadExtensionMessages('OpenID'); $this->setHeaders(); if ($wgUser->getID() == 0) { $wgOut->showErrorPage('openiderror', 'notloggedin'); return; } $this->outputHeader(); switch ($par) { case 'Finish': $this->finish(); break; case 'Delete': $this->delete(); break; default: $openid_url = $wgRequest->getText('openid_url'); if (isset($openid_url) && strlen($openid_url) > 0) { $this->convert($openid_url); } else { $this->form(); } } }
public static function loadMessages() { global $wgVersion; if (version_compare($wgVersion, '1.16', '<')) { wfLoadExtensionMessages('DataTransfer'); } }
function wfNewuserlogHook($user = null, $byEmail = false) { global $wgUser, $wgContLang, $wgVersion; wfLoadExtensionMessages('Newuserlog'); if (is_null($user)) { // Compatibility with old versions which didn't pass the parameter $user = $wgUser; } $talk = $wgContLang->getFormattedNsText(NS_TALK); $contribs = wfMsgForContent('contribslink'); $block = wfMsgForContent('blocklink'); if ($user->getName() == $wgUser->getName()) { $message = ''; $action = 'create'; } else { // Links not necessary for self-creations, they will appear already in // recentchanges and special:log view for the creating user. // For compatability: From 1.10alpha the 'user tools' are used at special:log // see bug 4756: Long usernames break block link in new user log entries $action = 'create2'; $message = ''; if (version_compare($wgVersion, '1.10alpha', '>=')) { if ($byEmail) { $message = wfMsgForContent('newuserlog-byemail'); } } else { $message = wfMsgForContent('newuserlog-create-text', $user->getName(), $talk, $contribs, $block); } } $log = new LogPage('newusers'); $log->addEntry($action, $user->getUserPage(), $message, array($user->getId())); return true; }
function execute($subpage = '') { global $wgOut, $wgRequest; wfLoadExtensionMessages('EditMessages'); if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if (wfReadOnly()) { $wgOut->readOnlyPage(); return; } if (!$wgUser->isAllowed('siteadmin')) { $this->displayRestrictionError(); return; } $this->setHeaders(); $messageName = $wgRequest->getVal('messageName'); if ($wgRequest->getVal('editmsg_search')) { $this->showEditForm($messageName); } elseif ($wgRequest->getVal('editmsg_get_patch')) { $this->generatePatch(); } elseif ($wgRequest->getVal('editmsg_apply_patch')) { $this->applyPatch(); } else { $this->showSearchForm($messageName); } }
/** * main() */ public function execute($par) { global $wgRequest, $wgOut, $wgContLang; wfLoadExtensionMessages('Editcount'); $target = isset($par) ? $par : $wgRequest->getText('username'); list($username, $namespace) = $this->extractParamaters($target); $username = Title::newFromText($username); $username = is_object($username) ? $username->getText() : ''; $uid = User::idFromName($username); if ($this->including()) { if ($namespace === null) { if ($uid != 0) { $out = $wgContLang->formatNum(User::edits($uid)); } else { $out = ""; } } else { $out = $wgContLang->formatNum($this->editsInNs($uid, $namespace)); } $wgOut->addHTML($out); } else { if ($uid != 0) { $total = $this->getTotal($nscount = $this->editsByNs($uid)); } $html = new EditcountHTML(); $html->outputHTML($username, $uid, @$nscount, @$total); } }
function execute($par) { global $wgRequest, $wgUser, $wgLanguageCode, $wgContLang, $wgOut; wfLoadExtensionMessages('GPlusLogin'); //disconnecting? if ($wgRequest->getVal('disconnect')) { self::userDisco(); return; } //returning to the community dashboard $this->returnto = $wgLanguageCode == 'en' ? wfMsg('gpl_returnto') : "/" . $wgContLang->getNSText(NS_PROJECT) . ":" . wfMsg('communityportal'); //set that user (if we can) $this->userid = $wgRequest->getVal('gplus_id') ? $wgRequest->getVal('gplus_id') : $wgRequest->getVal('user_id'); if ($this->userid) { $this->setWgUser(); } if ($wgRequest->wasPosted() && $wgRequest->getVal('gplus_id')) { self::processForm(); return; } //get user's G+ info $gp_id = $wgRequest->getVal('user_id'); $gp_name = $wgRequest->getVal('user_name'); $gp_email = $wgRequest->getVal('user_email'); $gp_avatar = $wgRequest->getVal('user_avatar'); self::showForm($gp_id, $gp_name, $gp_email, $gp_avatar); }
public function __construct() { // Initialize special page parent::__construct('Drafts'); // Internationalization wfLoadExtensionMessages('Drafts'); }
public static function parserFunction($parser, $vid = null, $img = null) { global $wgTitle, $wgContLang; wfLoadExtensionMessages('WHVid'); if ($vid === null || $img === null) { return '<div class="errorbox">' . wfMsg('missing-params') . '</div>'; } $vid = htmlspecialchars($vid); $divId = "whvid-" . md5($vid . mt_rand(1, 1000)); $vidUrl = self::getVidUrl($vid); $imgTitle = Title::newFromURL($img, NS_IMAGE); $imgUrl = null; if ($imgTitle) { $imgFile = RepoGroup::singleton()->findFile($imgTitle); $smallImgUrl = ''; $largeImgUrl = ''; if ($imgFile) { $width = 550; $height = 309; $thumb = $imgFile->getThumbnail($width, $height); $largeImgUrl = wfGetPad($thumb->getUrl()); $width = 240; //$height = 135; $thumb = $imgFile->getThumbnail($width); $smallImgUrl = wfGetPad($thumb->getUrl()); } } return $parser->insertStripItem(wfMsgForContent('embed-html', $divId, $vidUrl, $largeImgUrl, $smallImgUrl)); }
function wfEmbedVideoParserFunction($parser, $service = null, $id = null, $width = null) { global $wgTitle; if ($service === null || $id === null) { return '<div class="errorbox">' . wfMsg('embedvideo-missing-params') . '</div>'; } wfLoadExtensionMessages('EmbedVideo'); $params = array('service' => trim($service), 'id' => trim($id), 'width' => $width === null ? null : trim($width)); global $wgEmbedVideoMinWidth, $wgEmbedVideoMaxWidth; if (!is_numeric($wgEmbedVideoMinWidth) || $wgEmbedVideoMinWidth < 100) { $wgEmbedVideoMinWidth = 100; } if (!is_numeric($wgEmbedVideoMaxWidth) || $wgEmbedVideoMaxWidth > 1024) { $wgEmbedVideoMaxWidth = 1024; } global $wgEmbedVideoServiceList; $service = $wgEmbedVideoServiceList[$params['service']]; if (!$service) { return '<div class="errorbox">' . wfMsg('embedvideo-unrecognized-service', @htmlspecialchars($params['service'])) . '</div>'; } $id = htmlspecialchars($params['id']); $idpattern = isset($service['id_pattern']) ? $service['id_pattern'] : '%[^A-Za-z0-9_\\-]%'; #echo wfBacktrace(); print_r($params); echo $id; exit; if ($id == null || $idpattern != '' && preg_match($idpattern, $id)) { return '<div class="errorbox">' . wfMsgForContent('embedvideo-bad-id', $id, @htmlspecialchars($params['service'])) . '</div>'; } # Build URL and output embedded flash object $ratio = 425 / 350; $width = 425; if ($params['width'] !== null) { if (!is_numeric($params['width']) || $params['width'] < $wgEmbedVideoMinWidth || $params['width'] > $wgEmbedVideoMaxWidth) { return '<div class="errorbox">' . wfMsgForContent('embedvideo-illegal-width', @htmlspecialchars($params['width'])) . '</div>'; } $width = $params['width']; } $height = round($width / $ratio); $url = wfMsgReplaceArgs($service['url'], array($id, $width, $height)); if ($params['service'] == 'videojug') { return $parser->insertStripItem(wfMsgForContent('embedvideo-embed-clause-videojug', $url, $width, $height)); } else { if ($params['service'] == 'popcorn') { return $parser->insertStripItem(wfMsgForContent('embedvideo-embed-clause-popcorn', $url, $width, $height)); } else { if ($params['service'] == 'wonderhowto') { $id = str_replace("&61;", "=", htmlspecialchars_decode($id)); // youtube now requires a ? after the http://www.youtube.com/v/[^?&]+). If you use // an ampersand things will autoplay. Very bad! $id = preg_replace("@(http://www.youtube.com/v/[^?&]+)(&)autoplay=@", "\$1?", $id); return $parser->insertStripItem($id); } else { if ($params['service'] == 'howcast') { return $parser->insertStripItem(wfMsgForContent('embedvideo-embed-clause-howcast', $url, $width, $height)); } else { return $parser->insertStripItem(wfMsgForContent('embedvideo-embed-clause', $url, $width, $height)); } } } } #return wfMsgForContent('embedvideo-embed-clause', $url, $width, $height); }
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 DSMWGeneralExhibits() { if (defined('SRF_VERSION')) { SpecialPage::SpecialPage('DSMWGeneralExhibits'); } wfLoadExtensionMessages('DSMW'); }
function wfSpecialCiteToolbox(&$monobook) { wfLoadExtensionMessages('SpecialCite'); if (isset($monobook->data['nav_urls']['cite'])) { if ($monobook->data['nav_urls']['cite']['href'] == '') { ?> <li id="t-iscite"><?php echo $monobook->msg('cite_article_link'); ?> </li><?php } else { ?> <li id="t-cite"><?php ?> <a href="<?php echo htmlspecialchars($monobook->data['nav_urls']['cite']['href']); ?> "><?php echo $monobook->msg('cite_article_link'); ?> </a><?php ?> </li><?php } } return true; }
/** * Main execution function * @param $par Parameters passed to the page */ function execute($par) { global $wgOut, $wgUser; wfLoadExtensionMessages('Gadgets'); $skin = $wgUser->getSkin(); $this->setHeaders(); $wgOut->setPagetitle(wfMsg("gadgets-title")); $wgOut->addWikiText(wfMsg("gadgets-pagetext")); $gadgets = wfLoadGadgetsStructured(); if (!$gadgets) { return; } $listOpen = false; $msgOpt = array('parseinline', 'parsemag'); foreach ($gadgets as $section => $entries) { if ($section !== false && $section !== '') { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}"); $lnk = $t ? $skin->makeLinkObj($t, wfMsgHTML("edit")) : htmlspecialchars($section); $ttext = wfMsgExt("gadget-section-{$section}", $msgOpt); if ($listOpen) { $wgOut->addHTML('</ul>'); $listOpen = false; } $wgOut->addHTML("\n<h2>{$ttext} [{$lnk}]</h2>\n"); } foreach ($entries as $gname => $code) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gname}"); if (!$t) { continue; } $lnk = $skin->makeLinkObj($t, wfMsgHTML("edit")); $ttext = wfMsgExt("gadget-{$gname}", $msgOpt); if (!$listOpen) { $listOpen = true; $wgOut->addHTML('<ul>'); } $wgOut->addHTML("<li>"); $wgOut->addHTML("{$ttext} [{$lnk}]<br/>"); $wgOut->addHTML(wfMsgHTML("gadgets-uses") . ": "); $first = true; foreach ($code as $codePage) { $t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$codePage}"); if (!$t) { continue; } if ($first) { $first = false; } else { $wgOut->addHTML(", "); } $lnk = $skin->makeLinkObj($t, htmlspecialchars($t->getText())); $wgOut->addHTML($lnk); } $wgOut->addHtml("</li>"); } } if ($listOpen) { $wgOut->addHTML('</ul>'); } }
function wfNewuserlogAutoCreate($user) { wfLoadExtensionMessages('Newuserlog'); $log = new LogPage('newusers'); $log->addEntry('autocreate', $user->getUserPage(), '', array($user->getId())); return true; }
function processLogoutRequest() { global $wgUser; $wgUser->logout(); wfLoadExtensionMessages('AjaxLogin'); return new AjaxResponse(wfMsg('ajaxlogin-nowloggedout')); }
function execute($par) { global $wgOut, $wgRequest, $wgUseTidy; wfLoadExtensionMessages('SpecialCite'); // Having tidy on causes whitespace and <pre> tags to // be generated around the output of the CiteOutput // class TODO FIXME. $wgUseTidy = false; $this->setHeaders(); $this->outputHeader(); $page = isset($par) ? $par : $wgRequest->getText('page'); $id = $wgRequest->getInt('id'); $title = Title::newFromText($page); if ($title) { $article = new Article($title); } $cform = new CiteForm($title); if (!$title || !$article->exists()) { $cform->execute(); } else { $cform->execute(); $cout = new CiteOutput($title, $article, $id); $cout->execute(); } }
function __construct() { parent::__construct('Metasearch'); wfLoadExtensionMessages('Metasearch'); #$this->controller = MsController::get_instance(); // (important for global function setup) }
function sendEmail(&$u, &$content) { global $wgServer; wfLoadExtensionMessages('ThumbsEmailNotifications'); $email = $u->getEmail(); $userText = $u->getName(); $semi_rand = md5(time()); $mime_boundary = "==MULTIPART_BOUNDARY_{$semi_rand}"; $mime_boundary_header = chr(34) . $mime_boundary . chr(34); $userPageLink = self::getUserPageLink($userText); $html_text = wfMsg('tn_email_html', wfGetPad(''), $userPageLink, $content); $plain_text = wfMsg('tn_email_plain', $userText, $u->getTalkPage()->getFullURL()); $body = "This is a multi-part message in MIME format.\n\n--{$mime_boundary}\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$plain_text}\n\n--{$mime_boundary}\nContent-Type: text/html; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$html_text}"; $from = new MailAddress(wfMsg('aen_from')); $subject = "Congratulations! You just got a thumbs up"; $isDev = false; if (strpos($_SERVER['HOSTNAME'], "wikidiy.com") !== false || strpos($wgServer, "wikidiy.com") !== false) { wfDebug("AuthorEmailNotification in dev not notifying: TO: " . $userText . ",FROM: {$from_name}\n"); $isDev = true; $subject = "[FROM DEV] {$subject}"; } if (!$isDev) { $to = new MailAddress($email); UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" . " boundary=" . $mime_boundary_header); } // send one to our test email account for debugging /* $to = new MailAddress ('*****@*****.**'); UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" . " boundary=" . $mime_boundary_header) ; */ return true; }
protected function getResultText($res, $outputmode) { $result = ''; if ($outputmode == SMW_OUTPUT_FILE) { // make CSV file $result .= parent::getResultText($res, $outputmode); } else { // just make link to feed if ($this->getSearchLabel($outputmode)) { $label = $this->getSearchLabel($outputmode); } else { wfLoadExtensionMessages('SemanticMediaWiki'); $label = wfMsgForContent('smw_csv_link'); } $link = $res->getQueryLink($label); $link->setParameter('csv', 'format'); $link->setParameter($this->m_sep, 'sep'); if (array_key_exists('limit', $this->m_params)) { $link->setParameter($this->m_params['limit'], 'limit'); } else { // use a reasonable default limit $link->setParameter(100, 'limit'); } // KK: support merge option if (array_key_exists('merge', $this->m_params)) { $link->setParameter($this->m_params['merge'], 'merge'); } $result .= $link->getText($outputmode, $this->mLinker); $this->isHTML = $outputmode == SMW_OUTPUT_HTML; // yes, our code can be viewed as HTML if requested, no more parsing needed } return $result; }
public static function personalUrls(&$personal_urls, &$title) { global $wgUser, $wgOptInAlwaysShowPersonalLink; global $wgOptInNeverShowPersonalLink, $wgRequest; if ($wgOptInNeverShowPersonalLink || !SpecialOptIn::isOptedIn($wgUser) && !$wgOptInAlwaysShowPersonalLink) { // Don't show the link return true; } // Loads opt-in messages wfLoadExtensionMessages('OptInLink'); $fromquery = array(); if (!$wgRequest->wasPosted()) { $fromquery = $wgRequest->getValues(); unset($fromquery['title']); } $query = array('from' => $title->getPrefixedDBKey(), 'fromquery' => wfArrayToCGI($fromquery)); // Make sure we don't create links that return to // Special:UsabilityOptIn itself if ($title->equals(SpecialPage::getTitleFor('OptIn'))) { $query['from'] = $wgRequest->getVal('from'); $query['fromquery'] = $wgRequest->getVal('fromquery'); } $addLinks = array(); // For opted-in users, add a feedback link if (SpecialOptIn::isOptedIn($wgUser)) { $addLinks['optin-feedback'] = array('text' => wfMsg('optin-feedback'), 'key' => 'optin-feedback', 'href' => SpecialPage::getTitleFor('OptIn')->getFullURL(array_merge($query, array('opt' => 'feedback'))), 'class' => 'no-text-transform'); } // Inserts a link into personal tools $key = SpecialOptIn::isOptedIn($wgUser) ? 'optin-leave' : 'optin-try'; $addLinks[$key] = array('text' => wfMsg($key), 'href' => SpecialPage::getTitleFor('OptIn')->getFullURL($query), 'class' => 'no-text-transform'); // Add the links $personal_urls = array_merge($addLinks, $personal_urls); return true; }
/** * Constructor */ function __construct() { parent::__construct('Filters'); // Backwards compatibility for MediaWiki < 1.16 if (version_compare($GLOBALS['wgVersion'], '1.16', '<')) { wfLoadExtensionMessages('SemanticDrilldown'); } }
function __construct() { parent::__construct('SemanticSocialProfile', 'editinterface'); wfLoadExtensionMessages('SemanticSocialProfile'); $wiki = SpecialWikiVersion::getVersion($this); $this->_output = $wiki->out(); $this->_user = $wiki->user(); }
function __construct() { parent::__construct('ClickTracking', 'clicktrack'); wfLoadExtensionMessages('ClickTracking'); UsabilityInitiativeHooks::initialize(); UsabilityInitiativeHooks::addStyle('ClickTracking/SpecialClickTracking.css'); UsabilityInitiativeHooks::addScript('ClickTracking/SpecialClickTracking.js'); }
public function __construct() { parent::__construct( 'PollResults', 'read' ); # for MW 1.15 (still being used by many customers) # please do not remove until 2012 if ( qp_Setup::mediaWikiVersionCompare( '1.16' ) ) { wfLoadExtensionMessages( 'QPoll' ); } }
function EmailMe() { global $wgEmailMeAddress; SpecialPage::SpecialPage("EmailMe", '', true, 'efRunEmailMe'); wfLoadExtensionMessages('EmailMe'); $this->mAddress = $wgEmailMeAddress; return true; }
function efAuthorProtectForm($action, &$article) { global $wgTitle; if ($action == 'authorprotect') { wfLoadExtensionMessages('AuthorProtect'); global $wgOut, $wgUser, $wgRequest, $wgRestrictionTypes; if ($wgUser->isAllowed('authorprotect')) { if (userIsAuthor()) { $wgOut->setPageTitle(wfMsg('authorprotect')); if (!$wgRequest->wasPosted()) { $wgOut->addHTML(makeProtectForm()); } else { if (!$wgUser->matchEditToken($wgRequest->getText('wpToken'))) { $wgOut->setPageTitle(wfMsg('errorpagetitle')); $wgOut->addWikiText(wfMsg('sessionfailure')); return; } $restrictions = array(); foreach ($wgRestrictionTypes as $type) { $rest = $wgTitle->getRestrictions($type); if ($rest !== array()) { if (!$wgUser->isAllowed($rest[0]) && !in_array('author', $rest)) { $restrictions[$type] = $rest[0]; //don't let them lower the protection level continue; } } if ($wgRequest->getCheck("check-{$type}")) { $restrictions[$type] = 'author'; } else { if (in_array('author', $rest)) { $restrictions[$type] = ''; } else { $restrictions[$type] = $rest !== array() ? $rest[0] : ''; //we're not setting it } } } $success = doProtect($restrictions, $wgRequest->getText('wpReason'), $wgRequest->getText('wpExpiryTime')); if ($success) { $wgOut->addWikiText(wfMsg('authorprotect-success')); } else { $wgOut->addWikiText(wfMsg('authorprotect-failure')); } } } else { $wgOut->setPageTitle(wfMsg('errorpagetitle')); $wgOut->addWikiText(wfMsg('authorprotect-notauthor')); } } else { $wgOut->permissionRequired('authorprotect'); } return false; //still continues hook processing, but doesn't throw an error message } return true; //unknown action, so state that the action doesn't exist }
function __construct($page_name, $default_wsgi_command, $css = '', $scripts = '', $wsgi_prefix = '') { parent::__construct($page_name); wfLoadExtensionMessages($page_name); $this->default_wsgi_command = $default_wsgi_command; $this->css = $css; $this->scripts = $scripts; $this->wsgi_prefix = $wsgi_prefix; }
function CategorySubscriptionsLocalizedPageName(&$specialPageArray, $code) { # The localized title of the special page is among the messages of the extension: wfLoadExtensionMessages('CategorySubscriptions'); # Convert from title in text form to DBKey and put it into the alias array: $title = Title::newFromText('CategorySubscriptions'); $specialPageArray['CategorySubscriptions'][] = $title->getDBKey(); return true; }
function DSMWAdmin() { global $wgHooks, $wgSpecialPages, $wgWatchingMessages; # Add all our needed hooks $wgHooks["SkinTemplateTabs"][] = $this; SpecialPage::SpecialPage('DSMWAdmin'); // avec block => pages speciales restreintes wfLoadExtensionMessages('DSMW'); }
function wfDeletedContributionsMessages($specialpage, $par, $func) { if ($specialpage->name() == 'DeletedContributions') { wfLoadExtensionMessages('DeletedContributions'); $specialpage->setHeaders(); // set again so that it actually has the f*****g message } return true; }