<?php
-//$wgRequestTime = microtime();
-
-// unset( $IP );
-// @ini_set( 'allow_url_fopen', 0 ); # For security...
-
-# Valid web server entry point, enable includes.
-# Please don't move this line to includes/Defines.php. This line essentially defines
-# a valid entry point. If you put it in includes/Defines.php, then any script that includes
-# it becomes an entry point, thereby defeating its purpose.
-// define( 'MEDIAWIKI', true );
-// require_once( './includes/Defines.php' );
-// require_once( './LocalSettings.php' );
-// require_once( 'includes/Setup.php' );
require_once( 'AjaxFunctions.php' );
if ( ! $wgUseAjax ) {
if( !defined( 'MEDIAWIKI' ) )
die( -1 );
-require_once('WebRequest.php');
-
/**
* Function converts an Javascript escaped string back into a string with
* specified charset (default is UTF-8).
* @package MediaWiki
*/
-/**
- * Need the CacheManager to be loaded
- */
-require_once( 'CacheManager.php' );
-require_once( 'Revision.php' );
-
$wgArticleCurContentFields = false;
$wgArticleOldContentFields = false;
# diff page instead of the article.
if ( !is_null( $diff ) ) {
- require_once( 'DifferenceEngine.php' );
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
$de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
Article::onArticleCreate( $this->mTitle );
if(!$suppressRC) {
- require_once( 'RecentChange.php' );
$rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default',
'', strlen( $text ), $revisionId );
# Mark as patrolled if the user can and has the option set
$dbw->rollback();
} else {
# Update recentchanges and purge cache and whatnot
- require_once( 'RecentChange.php' );
$bot = (int)($wgUser->isBot() || $forceBot);
$rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
$lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
$rcid = $wgRequest->getVal( 'rcid' );
if ( !is_null ( $rcid ) ) {
if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
- require_once( 'RecentChange.php' );
RecentChange::markPatrolled( $rcid );
wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
$wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
* action=protect handler
*/
function protect() {
- require_once 'ProtectionForm.php';
$form = new ProtectionForm( $this );
$form->show();
}
--- /dev/null
+<?php
+
+/* This defines autoloading handler for whole MediaWiki framework */
+function __autoload($class_name) {
+ $classes = array(
+ 'AjaxDispatcher' => 'AjaxDispatcher.php',
+ 'AjaxCachePolicy' => 'AjaxFunctions.php',
+ 'Article' => 'Article.php',
+ 'AuthPlugin' => 'AuthPlugin.php',
+ 'BagOStuff' => 'BagOStuff.php',
+ 'HashBagOStuff' => 'BagOStuff.php',
+ 'SqlBagOStuff' => 'BagOStuff.php',
+ 'MediaWikiBagOStuff' => 'BagOStuff.php',
+ 'TurckBagOStuff' => 'BagOStuff.php',
+ 'APCBagOStuff' => 'BagOStuff.php',
+ 'eAccelBagOStuff' => 'BagOStuff.php',
+ 'Block' => 'Block.php',
+ 'CacheManager' => 'CacheManager.php',
+ 'CategoryPage' => 'CategoryPage.php',
+ 'Categoryfinder' => 'Categoryfinder.php',
+ 'RCCacheEntry' => 'ChangesList.php',
+ 'ChangesList' => 'ChangesList.php',
+ 'OldChangesList' => 'ChangesList.php',
+ 'EnhancedChangesList' => 'ChangesList.php',
+ 'DBObject' => 'Database.php',
+ 'Database' => 'Database.php',
+ 'DatabaseMysql' => 'Database.php',
+ 'ResultWrapper' => 'Database.php',
+ 'OracleBlob' => 'DatabaseOracle.php',
+ 'DatabaseOracle' => 'DatabaseOracle.php',
+ 'DatabasePgsql' => 'DatabasePostgreSQL.php',
+ 'DatabasePostgreSQL' => 'DatabasePostgreSQL.php',
+ 'DateFormatter' => 'DateFormatter.php',
+ 'DifferenceEngine' => 'DifferenceEngine.php',
+ '_DiffOp' => 'DifferenceEngine.php',
+ '_DiffOp_Copy' => 'DifferenceEngine.php',
+ '_DiffOp_Delete' => 'DifferenceEngine.php',
+ '_DiffOp_Add' => 'DifferenceEngine.php',
+ '_DiffOp_Change' => 'DifferenceEngine.php',
+ '_DiffEngine' => 'DifferenceEngine.php',
+ 'Diff' => 'DifferenceEngine.php',
+ 'MappedDiff' => 'DifferenceEngine.php',
+ 'DiffFormatter' => 'DifferenceEngine.php',
+ '_HWLDF_WordAccumulator' => 'DifferenceEngine.php',
+ 'WordLevelDiff' => 'DifferenceEngine.php',
+ 'TableDiffFormatter' => 'DifferenceEngine.php',
+ 'EditPage' => 'EditPage.php',
+ 'Exif' => 'Exif.php',
+ 'FormatExif' => 'Exif.php',
+ 'WikiExporter' => 'Export.php',
+ 'XmlDumpWriter' => 'Export.php',
+ 'DumpOutput' => 'Export.php',
+ 'DumpFileOutput' => 'Export.php',
+ 'DumpPipeOutput' => 'Export.php',
+ 'DumpGZipOutput' => 'Export.php',
+ 'DumpBZip2Output' => 'Export.php',
+ 'Dump7ZipOutput' => 'Export.php',
+ 'DumpFilter' => 'Export.php',
+ 'DumpNotalkFilter' => 'Export.php',
+ 'DumpNamespaceFilter' => 'Export.php',
+ 'DumpLatestFilter' => 'Export.php',
+ 'DumpMultiWriter' => 'Export.php',
+ 'ExternalEdit' => 'ExternalEdit.php',
+ 'ExternalStore' => 'ExternalStore.php',
+ 'ExternalStoreDB' => 'ExternalStoreDB.php',
+ 'ExternalStoreHttp' => 'ExternalStoreHttp.php',
+ 'FakeTitle' => 'FakeTitle.php',
+ 'FeedItem' => 'Feed.php',
+ 'ChannelFeed' => 'Feed.php',
+ 'RSSFeed' => 'Feed.php',
+ 'AtomFeed' => 'Feed.php',
+ 'ReplacerCallback' => 'GlobalFunctions.php',
+ 'Group' => 'Group.php',
+ 'HTMLForm' => 'HTMLForm.php',
+ 'HistoryBlob' => 'HistoryBlob.php',
+ 'ConcatenatedGzipHistoryBlob' => 'HistoryBlob.php',
+ 'HistoryBlobStub' => 'HistoryBlob.php',
+ 'HistoryBlobCurStub' => 'HistoryBlob.php',
+ 'Image' => 'Image.php',
+ 'ThumbnailImage' => 'Image.php',
+ 'ImageGallery' => 'ImageGallery.php',
+ 'ImagePage' => 'ImagePage.php',
+ 'ImageHistoryList' => 'ImagePage.php',
+ 'ImageRemote' => 'ImageRemote.php',
+ 'Job' => 'JobQueue.php',
+ 'Licenses' => 'Licenses.php',
+ 'License' => 'Licenses.php',
+ 'LinkBatch' => 'LinkBatch.php',
+ 'LinkCache' => 'LinkCache.php',
+ 'LinkFilter' => 'LinkFilter.php',
+ 'Linker' => 'Linker.php',
+ 'LinksUpdate' => 'LinksUpdate.php',
+ 'LoadBalancer' => 'LoadBalancer.php',
+ 'LogPage' => 'LogPage.php',
+ 'MacBinary' => 'MacBinary.php',
+ 'MagicWord' => 'MagicWord.php',
+ 'MathRenderer' => 'Math.php',
+ 'MessageCache' => 'MessageCache.php',
+ 'MimeMagic' => 'MimeMagic.php',
+ 'Namespace' => 'Namespace.php',
+ 'FakeMemCachedClient' => 'ObjectCache.php',
+ 'ObjectCacheManager' => 'ObjectCache.php',
+ 'MemCachedClientforWiki' => 'ObjectCache.php',
+ 'OutputPage' => 'OutputPage.php',
+ 'PageHistory' => 'PageHistory.php',
+ 'Parser' => 'Parser.php',
+ 'ParserOutput' => 'Parser.php',
+ 'ParserOptions' => 'Parser.php',
+ 'ParserCache' => 'ParserCache.php',
+ 'element' => 'ParserXML.php',
+ 'xml2php' => 'ParserXML.php',
+ 'ParserXML' => 'ParserXML.php',
+ 'ProfilerSimple' => 'ProfilerSimple.php',
+ 'ProfilerSimpleUDP' => 'ProfilerSimpleUDP.php',
+ 'Profiler' => 'Profiling.php',
+ 'ProxyTools' => 'ProxyTools.php',
+ 'ProtectionForm' => 'ProtectionForm.php',
+ 'QueryPage' => 'QueryPage.php',
+ 'PageQueryPage' => 'QueryPage.php',
+ 'RawPage' => 'RawPage.php',
+ 'RecentChange' => 'RecentChange.php',
+ 'Revision' => 'Revision.php',
+ 'Sanitizer' => 'Sanitizer.php',
+ 'SearchEngine' => 'SearchEngine.php',
+ 'SearchResultSet' => 'SearchEngine.php',
+ 'SearchResult' => 'SearchEngine.php',
+ 'SearchEngineDummy' => 'SearchEngine.php',
+ 'SearchMySQL' => 'SearchMySQL.php',
+ 'MySQLSearchResultSet' => 'SearchMySQL.php',
+ 'SearchMySQL4' => 'SearchMySQL4.php',
+ 'SearchTsearch2' => 'SearchTsearch2.php',
+ 'SearchUpdate' => 'SearchUpdate.php',
+ 'SearchUpdateMyISAM' => 'SearchUpdate.php',
+ 'SiteConfiguration' => 'SiteConfiguration.php',
+ 'SiteStatsUpdate' => 'SiteStatsUpdate.php',
+ 'Skin' => 'Skin.php',
+ 'MediaWiki_I18N' => 'SkinTemplate.php',
+ 'SkinTemplate' => 'SkinTemplate.php',
+ 'QuickTemplate' => 'SkinTemplate.php',
+ 'SpecialAllpages' => 'SpecialAllpages.php',
+ 'AncientPagesPage' => 'SpecialAncientpages.php',
+ 'IPBlockForm' => 'SpecialBlockip.php',
+ 'BookSourceList' => 'SpecialBooksources.php',
+ 'BrokenRedirectsPage' => 'SpecialBrokenRedirects.php',
+ 'CategoriesPage' => 'SpecialCategories.php',
+ 'EmailConfirmation' => 'SpecialConfirmemail.php',
+ 'contribs_finder' => 'SpecialContributions.php',
+ 'DeadendPagesPage' => 'SpecialDeadendpages.php',
+ 'DisambiguationsPage' => 'SpecialDisambiguations.php',
+ 'DoubleRedirectsPage' => 'SpecialDoubleRedirects.php',
+ 'EmailUserForm' => 'SpecialEmailuser.php',
+ 'GroupsForm' => 'SpecialGroups.php',
+ 'WikiRevision' => 'SpecialImport.php',
+ 'WikiImporter' => 'SpecialImport.php',
+ 'ImportStringSource' => 'SpecialImport.php',
+ 'ImportStreamSource' => 'SpecialImport.php',
+ 'IPUnblockForm' => 'SpecialIpblocklist.php',
+ 'ListredirectsPage' => 'SpecialListredirects.php',
+ 'ListUsersPage' => 'SpecialListusers.php',
+ 'DBLockForm' => 'SpecialLockdb.php',
+ 'LogReader' => 'SpecialLog.php',
+ 'LogViewer' => 'SpecialLog.php',
+ 'LonelyPagesPage' => 'SpecialLonelypages.php',
+ 'LongPagesPage' => 'SpecialLongpages.php',
+ 'MIMEsearchPage' => 'SpecialMIMEsearch.php',
+ 'MostcategoriesPage' => 'SpecialMostcategories.php',
+ 'MostimagesPage' => 'SpecialMostimages.php',
+ 'MostlinkedPage' => 'SpecialMostlinked.php',
+ 'MostlinkedCategoriesPage' => 'SpecialMostlinkedcategories.php',
+ 'MostrevisionsPage' => 'SpecialMostrevisions.php',
+ 'MovePageForm' => 'SpecialMovepage.php',
+ 'NewPagesPage' => 'SpecialNewpages.php',
+ 'SpecialPage' => 'SpecialPage.php',
+ 'UnlistedSpecialPage' => 'SpecialPage.php',
+ 'IncludableSpecialPage' => 'SpecialPage.php',
+ 'PopularPagesPage' => 'SpecialPopularpages.php',
+ 'PreferencesForm' => 'SpecialPreferences.php',
+ 'SpecialPrefixindex' => 'SpecialPrefixindex.php',
+ 'RevisionDeleteForm' => 'SpecialRevisiondelete.php',
+ 'RevisionDeleter' => 'SpecialRevisiondelete.php',
+ 'SpecialSearch' => 'SpecialSearch.php',
+ 'ShortPagesPage' => 'SpecialShortpages.php',
+ 'UncategorizedCategoriesPage' => 'SpecialUncategorizedcategories.php',
+ 'UncategorizedPagesPage' => 'SpecialUncategorizedpages.php',
+ 'PageArchive' => 'SpecialUndelete.php',
+ 'UndeleteForm' => 'SpecialUndelete.php',
+ 'DBUnlockForm' => 'SpecialUnlockdb.php',
+ 'UnusedCategoriesPage' => 'SpecialUnusedcategories.php',
+ 'UnusedimagesPage' => 'SpecialUnusedimages.php',
+ 'UnusedtemplatesPage' => 'SpecialUnusedtemplates.php',
+ 'UnwatchedpagesPage' => 'SpecialUnwatchedpages.php',
+ 'UploadForm' => 'SpecialUpload.php',
+ 'UploadFormMogile' => 'SpecialUploadMogile.php',
+ 'LoginForm' => 'SpecialUserlogin.php',
+ 'UserrightsForm' => 'SpecialUserrights.php',
+ 'SpecialVersion' => 'SpecialVersion.php',
+ 'WantedCategoriesPage' => 'SpecialWantedcategories.php',
+ 'WantedPagesPage' => 'SpecialWantedpages.php',
+ 'WhatLinksHerePage' => 'SpecialWhatlinkshere.php',
+ 'SquidUpdate' => 'SquidUpdate.php',
+ 'Title' => 'Title.php',
+ 'User' => 'User.php',
+ 'MailAddress' => 'UserMailer.php',
+ 'EmailNotification' => 'UserMailer.php',
+ 'WatchedItem' => 'WatchedItem.php',
+ 'WebRequest' => 'WebRequest.php',
+ 'FauxRequest' => 'WebRequest.php',
+ 'MediaWiki' => 'Wiki.php',
+ 'WikiError' => 'WikiError.php',
+ 'WikiErrorMsg' => 'WikiError.php',
+ 'WikiXmlError' => 'WikiError.php',
+ 'ZhClient' => 'ZhClient.php',
+ 'memcached' => 'memcached-client.php',
+ 'UtfNormal' => 'normal/UtfNormal.php'
+ );
+ require($classes[$class_name]);
+}
+
+?>
\ No newline at end of file
{
$fname = 'Block::loadRange';
- $iaddr = wfIP2Hex( $address );
+ $iaddr = ProxyTools::IP2Hex( $address );
if ( $iaddr === false ) {
# Invalid address
return false;
* Determine if a given integer IPv4 address is in a given CIDR network
*/
function isAddressInRange( $addr, $range ) {
- list( $network, $bits ) = wfParseCIDR( $range );
+ list( $network, $bits ) = ProxyTools::parseCIDR( $range );
if ( $network !== false && $addr >> ( 32 - $bits ) == $network >> ( 32 - $bits ) ) {
return true;
} else {
$this->mRangeStart = '';
$this->mRangeEnd = '';
if ( $this->mUser == 0 ) {
- list( $network, $bits ) = wfParseCIDR( $this->mAddress );
+ list( $network, $bits ) = ProxyTools::parseCIDR( $this->mAddress );
if ( $network !== false ) {
$this->mRangeStart = sprintf( '%08X', $network );
$this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 );
$parts = explode( '/', $range );
if ( count( $parts ) == 2 ) {
$shift = 32 - $parts[1];
- $ipint = wfIP2Unsigned( $parts[0] );
+ $ipint = ProxyTools::IP2Unsigned( $parts[0] );
$ipint = $ipint >> $shift << $shift;
$newip = long2ip( $ipint );
$range = "$newip/{$parts[1]}";
* @subpackage Cache
*/
-/**
- * We need the title class
- */
-require_once( 'Title.php' );
-
/**
* Handles talking to the file cache, putting stuff in and taking it back out.
* Mostly called from Article.php, also from DatabaseFunctions.php for the
die( -1 );
global $wgCategoryMagicGallery;
-if( $wgCategoryMagicGallery )
- /** */
- require_once('ImageGallery.php');
/**
* @package MediaWiki
* - recent changes
*/
-require_once("RecentChange.php");
/**
* @todo document
* @package MediaWiki
/**
* This is largely cadged from PageHistory::history
*/
-function showCreditsPage($article) {
- global $wgOut;
+class Credits {
+ function showCreditsPage($article) {
+ global $wgOut;
- $fname = 'showCreditsPage';
+ $fname = 'Credits::showCreditsPage';
- wfProfileIn( $fname );
+ wfProfileIn( $fname );
- $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
- $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
- $wgOut->setArticleFlag( false );
- $wgOut->setArticleRelated( true );
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
-
- if( $article->mTitle->getArticleID() == 0 ) {
- $s = wfMsg( 'nocredits' );
- } else {
- $s = getCredits($article, -1);
- }
+ $wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
+ $wgOut->setSubtitle( wfMsg( 'creditspage' ) );
+ $wgOut->setArticleFlag( false );
+ $wgOut->setArticleRelated( true );
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+
+ if( $article->mTitle->getArticleID() == 0 ) {
+ $s = wfMsg( 'nocredits' );
+ } else {
+ $s = Credits::getCredits($article, -1);
+ }
- $wgOut->addHTML( $s );
+ $wgOut->addHTML( $s );
- wfProfileOut( $fname );
-}
+ wfProfileOut( $fname );
+ }
-function getCredits($article, $cnt, $showIfMax=true) {
- $fname = 'getCredits';
- wfProfileIn( $fname );
- $s = '';
+ function getCredits($article, $cnt, $showIfMax=true) {
+ $fname = 'Credits::getCredits';
+ wfProfileIn( $fname );
+ $s = '';
- if (isset($cnt) && $cnt != 0) {
- $s = getAuthorCredits($article);
- if ($cnt > 1 || $cnt < 0) {
- $s .= ' ' . getContributorCredits($article, $cnt - 1, $showIfMax);
+ if (isset($cnt) && $cnt != 0) {
+ $s = Credits::getAuthorCredits($article);
+ if ($cnt > 1 || $cnt < 0) {
+ $s .= ' ' . Credits::getContributorCredits($article, $cnt - 1, $showIfMax);
+ }
}
+
+ wfProfileOut( $fname );
+ return $s;
}
- wfProfileOut( $fname );
- return $s;
-}
+ /**
+ *
+ */
+ function getAuthorCredits($article) {
+ global $wgLang, $wgAllowRealName;
-/**
- *
- */
-function getAuthorCredits($article) {
- global $wgLang, $wgAllowRealName;
+ $last_author = $article->getUser();
- $last_author = $article->getUser();
+ if ($last_author == 0) {
+ $author_credit = wfMsg('anonymous');
+ } else {
+ if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); }
+ $user_name = User::whoIs($last_author);
- if ($last_author == 0) {
- $author_credit = wfMsg('anonymous');
- } else {
- if($wgAllowRealName) { $real_name = User::whoIsReal($last_author); }
- $user_name = User::whoIs($last_author);
+ if (!empty($real_name)) {
+ $author_credit = Credits::creditLink($user_name, $real_name);
+ } else {
+ $author_credit = wfMsg('siteuser', Credits::creditLink($user_name));
+ }
+ }
- if (!empty($real_name)) {
- $author_credit = creditLink($user_name, $real_name);
+ $timestamp = $article->getTimestamp();
+ if ($timestamp) {
+ $d = $wgLang->timeanddate($article->getTimestamp(), true);
} else {
- $author_credit = wfMsg('siteuser', creditLink($user_name));
+ $d = '';
}
+ return wfMsg('lastmodifiedby', $d, $author_credit);
}
- $timestamp = $article->getTimestamp();
- if ($timestamp) {
- $d = $wgLang->timeanddate($article->getTimestamp(), true);
- } else {
- $d = '';
- }
- return wfMsg('lastmodifiedby', $d, $author_credit);
-}
+ /**
+ *
+ */
+ function getContributorCredits($article, $cnt, $showIfMax) {
-/**
- *
- */
-function getContributorCredits($article, $cnt, $showIfMax) {
+ global $wgLang, $wgAllowRealName;
- global $wgLang, $wgAllowRealName;
+ $contributors = $article->getContributors();
- $contributors = $article->getContributors();
+ $others_link = '';
- $others_link = '';
+ # Hmm... too many to fit!
- # Hmm... too many to fit!
-
- if ($cnt > 0 && count($contributors) > $cnt) {
- $others_link = creditOthersLink($article);
- if (!$showIfMax) {
- return wfMsg('othercontribs', $others_link);
- } else {
- $contributors = array_slice($contributors, 0, $cnt);
+ if ($cnt > 0 && count($contributors) > $cnt) {
+ $others_link = Credits::creditOthersLink($article);
+ if (!$showIfMax) {
+ return wfMsg('othercontribs', $others_link);
+ } else {
+ $contributors = array_slice($contributors, 0, $cnt);
+ }
}
- }
- $real_names = array();
- $user_names = array();
+ $real_names = array();
+ $user_names = array();
- $anon = '';
+ $anon = '';
- # Sift for real versus user names
+ # Sift for real versus user names
- foreach ($contributors as $user_parts) {
- if ($user_parts[0] != 0) {
- if ($wgAllowRealName && !empty($user_parts[2])) {
- $real_names[] = creditLink($user_parts[1], $user_parts[2]);
+ foreach ($contributors as $user_parts) {
+ if ($user_parts[0] != 0) {
+ if ($wgAllowRealName && !empty($user_parts[2])) {
+ $real_names[] = Credits::creditLink($user_parts[1], $user_parts[2]);
+ } else {
+ $user_names[] = Credits::creditLink($user_parts[1]);
+ }
} else {
- $user_names[] = creditLink($user_parts[1]);
+ $anon = wfMsg('anonymous');
}
- } else {
- $anon = wfMsg('anonymous');
}
- }
- # Two strings: real names, and user names
+ # Two strings: real names, and user names
- $real = $wgLang->listToText($real_names);
- $user = $wgLang->listToText($user_names);
+ $real = $wgLang->listToText($real_names);
+ $user = $wgLang->listToText($user_names);
- # "ThisSite user(s) A, B and C"
+ # "ThisSite user(s) A, B and C"
- if (!empty($user)) {
- $user = wfMsg('siteusers', $user);
- }
+ if (!empty($user)) {
+ $user = wfMsg('siteusers', $user);
+ }
- # This is the big list, all mooshed together. We sift for blank strings
+ # This is the big list, all mooshed together. We sift for blank strings
- $fulllist = array();
+ $fulllist = array();
- foreach (array($real, $user, $anon, $others_link) as $s) {
- if (!empty($s)) {
- array_push($fulllist, $s);
+ foreach (array($real, $user, $anon, $others_link) as $s) {
+ if (!empty($s)) {
+ array_push($fulllist, $s);
+ }
}
- }
- # Make the list into text...
+ # Make the list into text...
- $creds = $wgLang->listToText($fulllist);
+ $creds = $wgLang->listToText($fulllist);
- # "Based on work by ..."
+ # "Based on work by ..."
- return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
-}
+ return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
+ }
-/**
- *
- */
-function creditLink($user_name, $link_text = '') {
- global $wgUser, $wgContLang;
- $skin = $wgUser->getSkin();
- return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
- htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
-}
+ /**
+ *
+ */
+ function creditLink($user_name, $link_text = '') {
+ global $wgUser, $wgContLang;
+ $skin = $wgUser->getSkin();
+ return $skin->makeLink($wgContLang->getNsText(NS_USER) . ':' . $user_name,
+ htmlspecialchars( (empty($link_text)) ? $user_name : $link_text ));
+ }
-/**
- *
- */
-function creditOthersLink($article) {
- global $wgUser;
- $skin = $wgUser->getSkin();
- return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
+ /**
+ *
+ */
+ function creditOthersLink($article) {
+ global $wgUser;
+ $skin = $wgUser->getSkin();
+ return $skin->makeKnownLink($article->mTitle->getPrefixedText(), wfMsg('others'), 'action=credits');
+ }
}
-
?>
* @package MediaWiki
*/
-/**
- * Depends on the CacheManager
- */
-require_once( 'CacheManager.php' );
-
/** See Database::makeList() */
define( 'LIST_COMMA', 0 );
define( 'LIST_AND', 1 );
* @package MediaWiki
*/
-/**
- * Depends on database
- */
-require_once( 'Database.php' );
-
class OracleBlob extends DBObject {
function isLOB() {
return true;
* @package MediaWiki
*/
-/**
- * Depends on database
- */
-require_once( 'Database.php' );
-
/**
*
* @package MediaWiki
* @subpackage DifferenceEngine
*/
-/** */
-require_once( 'Revision.php' );
-
define( 'MAX_DIFF_LINE', 10000 );
define( 'MAX_DIFF_XREF_LENGTH', 10000 );
$this->summary = '';
if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
$this->textbox1 = wfMsgWeirdKey ( $this->mArticle->mTitle->getText() ) ;
- wfProxyCheck();
+ ProxyTools::proxyCheck();
}
/**
$wgOut->addHTML( "<input type=\"hidden\" name=\"wpAutoSummary\" value=\"$autosumm\" />\n" );
if ( $this->isConflict ) {
- require_once( "DifferenceEngine.php" );
$wgOut->addWikiText( '==' . wfMsg( "yourdiff" ) . '==' );
$de = new DifferenceEngine( $this->mTitle );
* @return string HTML
*/
function getDiff() {
- require_once( 'DifferenceEngine.php' );
$oldtext = $this->mArticle->fetchContent();
$newtext = $this->mArticle->replaceSection(
$this->section, $this->textbox1, $this->summary, $this->edittime );
* @subpackage SpecialPage
*/
-/** */
-require_once( 'Revision.php' );
-
define( 'MW_EXPORT_FULL', 0 );
define( 'MW_EXPORT_CURRENT', 1 );
* DB accessable external objects
*
*/
-require_once( 'LoadBalancer.php' );
-
/** @package MediaWiki */
require_once( 'DatabaseFunctions.php' );
-require_once( 'UpdateClasses.php' );
-require_once( 'LogPage.php' );
require_once( 'normal/UtfNormalUtil.php' );
require_once( 'XmlFunctions.php' );
return $wgMimeMagic;
}
- if (!class_exists("MimeMagic")) {
- #include on demand
- require_once("MimeMagic.php");
- }
-
$wgMimeMagic= new MimeMagic();
return $wgMimeMagic;
}
}
+/***** DEPRECATED INTERFACES *******/
+function wfGetForwardedFor() { return ProxyTools::getForwardedFor(); }
+function wfGetIP() { return ProxyTools::getIP(); }
+function wfIP2Unsigned($ip) { return ProxyTools::IP2Unsigned($ip); }
+function wfIP2Hex($ip) { return ProxyTools::IP2Hex($ip); }
+function wfIsIPPublic($ip) { return ProxyTools::isIPPublic($ip); }
+function wfProxyCheck() { return ProxyTools::proxyCheck(); }
+function wfParseCIDR($range) { return ProxyTools::parseCIDR($range); }
+function wfIsLocallyBlockedProxy($ip) { return ProxyTools::isLocallyBlockedProxy($ip); }
+
+function wfGetCache($type) { return ObjectCacheManager::getCache($type); }
+function wfGetMainCache() { return ObjectCacheManager::getMainCache(); }
+function wfGetMessageCacheStorage() { return ObjectCacheManager::getMessageCache(); }
+function wfGetParserCacheStorage() { return ObjectCacheManager::getParserCache(); }
+
+function renderMath($tex) { return MathRenderer::renderMath($tex); }
+
+function showCreditsPage($article) { return Credits::showCreditsPage($article); }
+function getCredits($article, $cnt, $showIfMax=true) { return Credits::getCredits($article,$cnt,$showIfMax); }
+
+function wfGetHTTP( $url, $timeout = 'default' ) { return HttpFunctions::getHTTP($url,$timeout); }
+function wfIsLocalURL( $url ) { return HttpFunctions::isLocalURL($url); }
+
?>
}
}
-
-/**
- * One-step cache variable to hold base blobs; operations that
- * pull multiple revisions may often pull multiple times from
- * the same blob. By keeping the last-used one open, we avoid
- * redundant unserialization and decompression overhead.
- */
-global $wgBlobCache;
-$wgBlobCache = array();
-
-
/**
* @package MediaWiki
*/
function getText() {
$fname = 'HistoryBlob::getText';
global $wgBlobCache;
+ /**
+ * One-step cache variable to hold base blobs; operations that
+ * pull multiple revisions may often pull multiple times from
+ * the same blob. By keeping the last-used one open, we avoid
+ * redundant unserialization and decompression overhead.
+ */
+ if (!is_array($wgBlobCache)) {
+ $wgBlobCache = array();
+ }
if( isset( $wgBlobCache[$this->mOldId] ) ) {
$obj = $wgBlobCache[$this->mOldId];
} else {
wfProfileOut( $fname );
return false;
}
- require_once('ExternalStore.php');
$row->old_text=ExternalStore::fetchFromUrl($url);
}
* Various HTTP related functions
*/
-/**
- * Get the contents of a file by HTTP
- *
- * if $timeout is 'default', $wgHTTPTimeout is used
- */
-function wfGetHTTP( $url, $timeout = 'default' ) {
- global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
+class HttpFunctions {
+ /**
+ * Get the contents of a file by HTTP
+ *
+ * if $timeout is 'default', $wgHTTPTimeout is used
+ */
+ function getHTTP( $url, $timeout = 'default' ) {
+ global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
- # Use curl if available
- if ( function_exists( 'curl_init' ) ) {
- $c = curl_init( $url );
- if ( wfIsLocalURL( $url ) ) {
- curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' );
- } else if ($wgHTTPProxy) {
- curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
- }
+ # Use curl if available
+ if ( function_exists( 'curl_init' ) ) {
+ $c = curl_init( $url );
+ if ( HttpFunctions::isLocalURL( $url ) ) {
+ curl_setopt( $c, CURLOPT_PROXY, 'localhost:80' );
+ } else if ($wgHTTPProxy) {
+ curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy);
+ }
- if ( $timeout == 'default' ) {
- $timeout = $wgHTTPTimeout;
- }
- curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
- curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
+ if ( $timeout == 'default' ) {
+ $timeout = $wgHTTPTimeout;
+ }
+ curl_setopt( $c, CURLOPT_TIMEOUT, $timeout );
+ curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" );
- # Set the referer to $wgTitle, even in command-line mode
- # This is useful for interwiki transclusion, where the foreign
- # server wants to know what the referring page is.
- # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
- # referring page.
- if ( is_object( $wgTitle ) ) {
- curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
- }
+ # Set the referer to $wgTitle, even in command-line mode
+ # This is useful for interwiki transclusion, where the foreign
+ # server wants to know what the referring page is.
+ # $_SERVER['REQUEST_URI'] gives a less reliable indication of the
+ # referring page.
+ if ( is_object( $wgTitle ) ) {
+ curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
+ }
- ob_start();
- curl_exec( $c );
- $text = ob_get_contents();
- ob_end_clean();
+ ob_start();
+ curl_exec( $c );
+ $text = ob_get_contents();
+ ob_end_clean();
- # Don't return the text of error messages, return false on error
- if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
- $text = false;
+ # Don't return the text of error messages, return false on error
+ if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
+ $text = false;
+ }
+ curl_close( $c );
+ } else {
+ # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php
+ # This may take 3 minutes to time out, and doesn't have local fetch capabilities
+ $url_fopen = ini_set( 'allow_url_fopen', 1 );
+ $text = file_get_contents( $url );
+ ini_set( 'allow_url_fopen', $url_fopen );
}
- curl_close( $c );
- } else {
- # Otherwise use file_get_contents, or its compatibility function from GlobalFunctions.php
- # This may take 3 minutes to time out, and doesn't have local fetch capabilities
- $url_fopen = ini_set( 'allow_url_fopen', 1 );
- $text = file_get_contents( $url );
- ini_set( 'allow_url_fopen', $url_fopen );
+ return $text;
}
- return $text;
-}
-/**
- * Check if the URL can be served by localhost
- */
-function wfIsLocalURL( $url ) {
- global $wgCommandLineMode, $wgConf;
- if ( $wgCommandLineMode ) {
- return false;
- }
+ /**
+ * Check if the URL can be served by localhost
+ */
+ function isLocalURL( $url ) {
+ global $wgCommandLineMode, $wgConf;
+ if ( $wgCommandLineMode ) {
+ return false;
+ }
- // Extract host part
- $matches = array();
- if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) {
- $host = $matches[1];
- // Split up dotwise
- $domainParts = explode( '.', $host );
- // Check if this domain or any superdomain is listed in $wgConf as a local virtual host
- $domainParts = array_reverse( $domainParts );
- for ( $i = 0; $i < count( $domainParts ); $i++ ) {
- $domainPart = $domainParts[$i];
- if ( $i == 0 ) {
- $domain = $domainPart;
- } else {
- $domain = $domainPart . '.' . $domain;
- }
- if ( $wgConf->isLocalVHost( $domain ) ) {
- return true;
+ // Extract host part
+ $matches = array();
+ if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) {
+ $host = $matches[1];
+ // Split up dotwise
+ $domainParts = explode( '.', $host );
+ // Check if this domain or any superdomain is listed in $wgConf as a local virtual host
+ $domainParts = array_reverse( $domainParts );
+ for ( $i = 0; $i < count( $domainParts ); $i++ ) {
+ $domainPart = $domainParts[$i];
+ if ( $i == 0 ) {
+ $domain = $domainPart;
+ } else {
+ $domain = $domainPart . '.' . $domain;
+ }
+ if ( $wgConf->isLocalVHost( $domain ) ) {
+ return true;
+ }
}
}
+ return false;
}
- return false;
}
-
?>
* extension=extensions/php_exif.dll
*/
-if ($wgShowEXIF)
- require_once('Exif.php');
-
/**
* Bump this number when serialized cache records may be incompatible.
*/
if( !defined( 'MEDIAWIKI' ) )
die( -1 );
-require_once( 'Image.php' );
-
/**
* Special handling for image description pages
* @package MediaWiki
$wgOut->addHTML($sharedtext);
if ($wgRepositoryBaseUrl && $wgFetchCommonsDescriptions) {
- require_once("HttpFunctions.php");
$ur = ini_set('allow_url_fopen', true);
- $text = wfGetHTTP($url . '?action=render');
+ $text = HttpFunctions::getHTTP($url . '?action=render');
ini_set('allow_url_fopen', $ur);
if ($text)
$this->mExtraDescription = $text;
}
function blockedIPpage() {
- require_once( 'EditPage.php' );
$edit = new EditPage( $this );
return $edit->blockedIPpage();
}
if ( $this->mRecursive ) {
$tlto = $this->mTitle->getTemplateLinksTo();
if ( count( $tlto ) ) {
- require_once( 'JobQueue.php' );
Job::queueLinksJobs( $tlto );
}
}
if ( $this->mRecursive ) {
$tlto = $this->mTitle->getTemplateLinksTo();
if ( count( $tlto ) ) {
- require_once( 'JobQueue.php' );
Job::queueLinksJobs( $tlto );
}
}
/**
* Depends on the database object
*/
-require_once( 'Database.php' );
# Valid database indexes
# Operation-based indexes
}
extract( $server );
+
# Get class for this database type
- $class = 'Database' . ucfirst( $type );
- if ( !class_exists( $class ) ) {
- require_once( "$class.php" );
+ if ($type != 'mysql' ) {
+ $class = 'Database' . ucfirst( $type );
+ } else {
+ $class = 'Database';
}
-
+
# Create object
$db = new $class( $host, $user, $password, $dbname, 1, $flags );
$db->setLBInfo( $server );
$rcComment .= ': ' . $this->comment;
}
- require_once( 'RecentChange.php' );
RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
$this->type, $this->action, $this->target, $this->comment, $this->params );
}
wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" );
return $path;
}
-
-
-}
-
-function renderMath( $tex ) {
- global $wgUser;
- $math = new MathRenderer( $tex );
- $math->setOutputMode( $wgUser->getOption('math'));
- return $math->render();
+
+ static function renderMath ( $tex ) {
+ global $wgUser;
+ $math = new MathRenderer( $tex );
+ $math->setOutputMode( $wgUser->getOption('math'));
+ return $math->render();
+ }
}
?>
* @subpackage Cache
*/
-/** */
-require_once( 'Revision.php' );
-
/**
*
*/
global $wgCaches;
$wgCaches = array();
-/** @todo document */
-function &wfGetCache( $inputType ) {
- global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
- $cache = false;
+class ObjectCacheManager {
+ /* @static */
+ function getCache( $inputType ) {
+ global $wgCaches, $wgMemCachedServers, $wgMemCachedDebug, $wgMemCachedPersistent;
+ $cache = false;
- if ( $inputType == CACHE_ANYTHING ) {
- reset( $wgCaches );
- $type = key( $wgCaches );
- if ( $type === false || $type === CACHE_NONE ) {
- $type = CACHE_DB;
+ if ( $inputType == CACHE_ANYTHING ) {
+ reset( $wgCaches );
+ $type = key( $wgCaches );
+ if ( $type === false || $type === CACHE_NONE ) {
+ $type = CACHE_DB;
+ }
+ } else {
+ $type = $inputType;
}
- } else {
- $type = $inputType;
- }
-
- if ( $type == CACHE_MEMCACHED ) {
- if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
- require_once( 'memcached-client.php' );
- if (!class_exists("MemcachedClientforWiki")) {
- class MemCachedClientforWiki extends memcached {
- function _debugprint( $text ) {
- wfDebug( "memcached: $text\n" );
- }
+ if ( $type == CACHE_MEMCACHED ) {
+ if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
+ $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
+ array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
+ $cache =& $wgCaches[CACHE_DB];
+ $cache->set_servers( $wgMemCachedServers );
+ $cache->set_debug( $wgMemCachedDebug );
+ }
+ } elseif ( $type == CACHE_ACCEL ) {
+ if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
+ if ( function_exists( 'eaccelerator_get' ) ) {
+ $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
+ } elseif ( function_exists( 'apc_fetch') ) {
+ $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
+ } elseif ( function_exists( 'mmcache_get' ) ) {
+ $wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
+ } else {
+ $wgCaches[CACHE_ACCEL] = false;
}
}
+ if ( $wgCaches[CACHE_ACCEL] !== false ) {
+ $cache =& $wgCaches[CACHE_ACCEL];
+ }
+ }
- $wgCaches[CACHE_DB] = new MemCachedClientforWiki(
- array('persistant' => $wgMemCachedPersistent, 'compress_threshold' => 1500 ) );
+ if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
+ if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
+ $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
+ }
$cache =& $wgCaches[CACHE_DB];
- $cache->set_servers( $wgMemCachedServers );
- $cache->set_debug( $wgMemCachedDebug );
}
- } elseif ( $type == CACHE_ACCEL ) {
- if ( !array_key_exists( CACHE_ACCEL, $wgCaches ) ) {
- if ( function_exists( 'eaccelerator_get' ) ) {
- require_once( 'BagOStuff.php' );
- $wgCaches[CACHE_ACCEL] = new eAccelBagOStuff;
- } elseif ( function_exists( 'apc_fetch') ) {
- require_once( 'BagOStuff.php' );
- $wgCaches[CACHE_ACCEL] = new APCBagOStuff;
- } elseif ( function_exists( 'mmcache_get' ) ) {
- require_once( 'BagOStuff.php' );
- $wgCaches[CACHE_ACCEL] = new TurckBagOStuff;
- } else {
- $wgCaches[CACHE_ACCEL] = false;
+
+ if ( $cache === false ) {
+ if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) {
+ $wgCaches[CACHE_NONE] = new FakeMemCachedClient;
}
+ $cache =& $wgCaches[CACHE_NONE];
}
- if ( $wgCaches[CACHE_ACCEL] !== false ) {
- $cache =& $wgCaches[CACHE_ACCEL];
- }
- }
- if ( $type == CACHE_DB || ( $inputType == CACHE_ANYTHING && $cache === false ) ) {
- if ( !array_key_exists( CACHE_DB, $wgCaches ) ) {
- require_once( 'BagOStuff.php' );
- $wgCaches[CACHE_DB] = new MediaWikiBagOStuff('objectcache');
- }
- $cache =& $wgCaches[CACHE_DB];
+ return $cache;
}
-
- if ( $cache === false ) {
- if ( !array_key_exists( CACHE_NONE, $wgCaches ) ) {
- $wgCaches[CACHE_NONE] = new FakeMemCachedClient;
- }
- $cache =& $wgCaches[CACHE_NONE];
+
+ /** @static */
+ function &getMainCache() {
+ global $wgMainCacheType;
+ $ret =& ObjectCacheManager::getCache( $wgMainCacheType );
+ return $ret;
}
- return $cache;
-}
-
-function &wfGetMainCache() {
- global $wgMainCacheType;
- $ret =& wfGetCache( $wgMainCacheType );
- return $ret;
-}
-
-function &wfGetMessageCacheStorage() {
- global $wgMessageCacheType;
- $ret =& wfGetCache( $wgMessageCacheType );
- return $ret;
+ /** @static */
+ function &getMessageCache() {
+ global $wgMessageCacheType;
+ $ret =& ObjectCacheManager::getCache( $wgMessageCacheType );
+ return $ret;
+ }
+
+ /** @static */
+ function &getParserCache() {
+ global $wgParserCacheType;
+ $ret =& ObjectCacheManager::getCache( $wgParserCacheType );
+ return $ret;
+ }
+
}
-function &wfGetParserCacheStorage() {
- global $wgParserCacheType;
- $ret =& wfGetCache( $wgParserCacheType );
- return $ret;
+class MemCachedClientforWiki extends memcached {
+ function _debugprint( $text ) {
+ wfDebug( "memcached: $text\n" );
+ }
}
?>
* @package MediaWiki
*/
-if ( $wgUseTeX )
- require_once 'Math.php';
-
/**
* @todo document
* @package MediaWiki
$id = $wgUser->blockedBy();
$reason = $wgUser->blockedFor();
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( is_numeric( $id ) ) {
$name = User::whoIs( $id );
* @param string $type
*/
function feed( $type ) {
- require_once 'Feed.php';
- require_once 'SpecialRecentchanges.php';
-
global $wgFeedClasses;
if( !isset( $wgFeedClasses[$type] ) ) {
global $wgOut;
* @subpackage Parser
*/
-/** */
-require_once( 'Sanitizer.php' );
-require_once( 'HttpFunctions.php' );
-require_once( 'ImageGallery.php' );
-
/**
* Update this version number when the ParserOutput format
* changes in an incompatible way, so the parser cache
$output = wfEscapeHTMLTagsOnly( $content );
break;
case 'math':
- $output = renderMath( $content );
+ $output = MathRenderer::renderMath( $content );
break;
case 'pre':
// Backwards-compatibility hack
}
}
- $text = wfGetHTTP($url);
+ $text = HttpFunctions::getHTTP($url);
if (!$text)
return wfMsg('scarytranscludefailed', $url);
* @subpackage Experimental
*/
-/** */
-require_once ('Parser.php');
-
/**
* This should one day become the XML->(X)HTML parser
* Based on work by Jan Hidders and Magnus Manske
}
}
$prof .= "\nTotal: $total\n\n";
-
return $prof;
}
} else {
$pfhost = '';
}
-
$sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
"WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'";
$dbw->query($sql);
* @package MediaWiki
*/
-function wfGetForwardedFor() {
- if( function_exists( 'apache_request_headers' ) ) {
- // More reliable than $_SERVER due to case and -/_ folding
- $set = apache_request_headers();
- $index = 'X-Forwarded-For';
- } else {
- // Subject to spoofing with headers like X_Forwarded_For
- $set = $_SERVER;
- $index = 'HTTP_X_FORWARDED_FOR';
- }
- if( isset( $set[$index] ) ) {
- return $set[$index];
- } else {
- return null;
+class ProxyTools {
+ function getForwardedFor() {
+ if( function_exists( 'apache_request_headers' ) ) {
+ // More reliable than $_SERVER due to case and -/_ folding
+ $set = apache_request_headers();
+ $index = 'X-Forwarded-For';
+ } else {
+ // Subject to spoofing with headers like X_Forwarded_For
+ $set = $_SERVER;
+ $index = 'HTTP_X_FORWARDED_FOR';
+ }
+ if( isset( $set[$index] ) ) {
+ return $set[$index];
+ } else {
+ return null;
+ }
}
-}
-/** Work out the IP address based on various globals */
-function wfGetIP() {
- global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
+ /** Work out the IP address based on various globals */
+ function getIP() {
+ global $wgSquidServers, $wgSquidServersNoPurge, $wgIP;
- # Return cached result
- if ( !empty( $wgIP ) ) {
- return $wgIP;
- }
+ # Return cached result
+ if ( !empty( $wgIP ) ) {
+ return $wgIP;
+ }
- /* collect the originating ips */
- # Client connecting to this webserver
- if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
- $ipchain = array( $_SERVER['REMOTE_ADDR'] );
- } else {
- # Running on CLI?
- $ipchain = array( '127.0.0.1' );
- }
- $ip = $ipchain[0];
-
- # Get list of trusted proxies
- # Flipped for quicker access
- $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) );
- if ( count( $trustedProxies ) ) {
- # Append XFF on to $ipchain
- $forwardedFor = wfGetForwardedFor();
- if ( isset( $forwardedFor ) ) {
- $xff = array_map( 'trim', explode( ',', $forwardedFor ) );
- $xff = array_reverse( $xff );
- $ipchain = array_merge( $ipchain, $xff );
- }
- # Step through XFF list and find the last address in the list which is a trusted server
- # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private)
- foreach ( $ipchain as $i => $curIP ) {
- if ( array_key_exists( $curIP, $trustedProxies ) ) {
- if ( isset( $ipchain[$i + 1] ) && wfIsIPPublic( $ipchain[$i + 1] ) ) {
- $ip = $ipchain[$i + 1];
+ /* collect the originating ips */
+ # Client connecting to this webserver
+ if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
+ $ipchain = array( $_SERVER['REMOTE_ADDR'] );
+ } else {
+ # Running on CLI?
+ $ipchain = array( '127.0.0.1' );
+ }
+ $ip = $ipchain[0];
+
+ # Get list of trusted proxies
+ # Flipped for quicker access
+ $trustedProxies = array_flip( array_merge( $wgSquidServers, $wgSquidServersNoPurge ) );
+ if ( count( $trustedProxies ) ) {
+ # Append XFF on to $ipchain
+ $forwardedFor = ProxyTools::getForwardedFor();
+ if ( isset( $forwardedFor ) ) {
+ $xff = array_map( 'trim', explode( ',', $forwardedFor ) );
+ $xff = array_reverse( $xff );
+ $ipchain = array_merge( $ipchain, $xff );
+ }
+ # Step through XFF list and find the last address in the list which is a trusted server
+ # Set $ip to the IP address given by that trusted server, unless the address is not sensible (e.g. private)
+ foreach ( $ipchain as $i => $curIP ) {
+ if ( array_key_exists( $curIP, $trustedProxies ) ) {
+ if ( isset( $ipchain[$i + 1] ) && ProxyTools::isIPPublic( $ipchain[$i + 1] ) ) {
+ $ip = $ipchain[$i + 1];
+ }
+ } else {
+ break;
}
- } else {
- break;
}
}
- }
-
- wfDebug( "IP: $ip\n" );
- $wgIP = $ip;
- return $ip;
-}
-/**
- * Given an IP address in dotted-quad notation, returns an unsigned integer.
- * Like ip2long() except that it actually works and has a consistent error return value.
- */
-function wfIP2Unsigned( $ip ) {
- $n = ip2long( $ip );
- if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version
- $n = false;
- } elseif ( $n < 0 ) {
- $n += pow( 2, 32 );
+ wfDebug( "IP: $ip\n" );
+ $wgIP = $ip;
+ return $ip;
+ }
+
+ /**
+ * Given an IP address in dotted-quad notation, returns an unsigned integer.
+ * Like ip2long() except that it actually works and has a consistent error return value.
+ */
+ function IP2Unsigned( $ip ) {
+ $n = ip2long( $ip );
+ if ( $n == -1 || $n === false ) { # Return value on error depends on PHP version
+ $n = false;
+ } elseif ( $n < 0 ) {
+ $n += pow( 2, 32 );
+ }
+ return $n;
}
- return $n;
-}
-/**
- * Return a zero-padded hexadecimal representation of an IP address
- */
-function wfIP2Hex( $ip ) {
- $n = wfIP2Unsigned( $ip );
- if ( $n !== false ) {
- $n = sprintf( '%08X', $n );
+ /**
+ * Return a zero-padded hexadecimal representation of an IP address
+ */
+ function IP2Hex( $ip ) {
+ $n = ProxyTools::IP2Unsigned( $ip );
+ if ( $n !== false ) {
+ $n = sprintf( '%08X', $n );
+ }
+ return $n;
}
- return $n;
-}
-/**
- * Determine if an IP address really is an IP address, and if it is public,
- * i.e. not RFC 1918 or similar
- */
-function wfIsIPPublic( $ip ) {
- $n = wfIP2Unsigned( $ip );
- if ( !$n ) {
- return false;
- }
+ /**
+ * Determine if an IP address really is an IP address, and if it is public,
+ * i.e. not RFC 1918 or similar
+ */
+ function isIPPublic( $ip ) {
+ $n = ProxyTools::IP2Unsigned( $ip );
+ if ( !$n ) {
+ return false;
+ }
- // ip2long accepts incomplete addresses, as well as some addresses
- // followed by garbage characters. Check that it's really valid.
- if( $ip != long2ip( $n ) ) {
- return false;
- }
-
- static $privateRanges = false;
- if ( !$privateRanges ) {
- $privateRanges = array(
- array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private)
- array( '172.16.0.0', '172.31.255.255' ), # "
- array( '192.168.0.0', '192.168.255.255' ), # "
- array( '0.0.0.0', '0.255.255.255' ), # this network
- array( '127.0.0.0', '127.255.255.255' ), # loopback
- );
- }
-
- foreach ( $privateRanges as $r ) {
- $start = wfIP2Unsigned( $r[0] );
- $end = wfIP2Unsigned( $r[1] );
- if ( $n >= $start && $n <= $end ) {
+ // ip2long accepts incomplete addresses, as well as some addresses
+ // followed by garbage characters. Check that it's really valid.
+ if( $ip != long2ip( $n ) ) {
return false;
}
- }
- return true;
-}
-/**
- * Forks processes to scan the originating IP for an open proxy server
- * MemCached can be used to skip IPs that have already been scanned
- */
-function wfProxyCheck() {
- global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath;
- global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry;
- global $wgProxyKey;
+ static $privateRanges = false;
+ if ( !$privateRanges ) {
+ $privateRanges = array(
+ array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private)
+ array( '172.16.0.0', '172.31.255.255' ), # "
+ array( '192.168.0.0', '192.168.255.255' ), # "
+ array( '0.0.0.0', '0.255.255.255' ), # this network
+ array( '127.0.0.0', '127.255.255.255' ), # loopback
+ );
+ }
- if ( !$wgBlockOpenProxies ) {
- return;
+ foreach ( $privateRanges as $r ) {
+ $start = ProxyTools::IP2Unsigned( $r[0] );
+ $end = ProxyTools::IP2Unsigned( $r[1] );
+ if ( $n >= $start && $n <= $end ) {
+ return false;
+ }
+ }
+ return true;
}
- $ip = wfGetIP();
+ /**
+ * Forks processes to scan the originating IP for an open proxy server
+ * MemCached can be used to skip IPs that have already been scanned
+ */
+ function proxyCheck() {
+ global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath;
+ global $wgUseMemCached, $wgMemc, $wgDBname, $wgProxyMemcExpiry;
+ global $wgProxyKey;
- # Get MemCached key
- $skip = false;
- if ( $wgUseMemCached ) {
- $mcKey = "$wgDBname:proxy:ip:$ip";
- $mcValue = $wgMemc->get( $mcKey );
- if ( $mcValue ) {
- $skip = true;
+ if ( !$wgBlockOpenProxies ) {
+ return;
}
- }
- # Fork the processes
- if ( !$skip ) {
- $title = Title::makeTitle( NS_SPECIAL, 'Blockme' );
- $iphash = md5( $ip . $wgProxyKey );
- $url = $title->getFullURL( 'ip='.$iphash );
-
- foreach ( $wgProxyPorts as $port ) {
- $params = implode( ' ', array(
- escapeshellarg( $wgProxyScriptPath ),
- escapeshellarg( $ip ),
- escapeshellarg( $port ),
- escapeshellarg( $url )
- ));
- exec( "php $params &>/dev/null &" );
- }
- # Set MemCached key
+ $ip = ProxyTools::getIP();
+
+ # Get MemCached key
+ $skip = false;
if ( $wgUseMemCached ) {
- $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
+ $mcKey = "$wgDBname:proxy:ip:$ip";
+ $mcValue = $wgMemc->get( $mcKey );
+ if ( $mcValue ) {
+ $skip = true;
+ }
}
- }
-}
-/**
- * Convert a network specification in CIDR notation to an integer network and a number of bits
- */
-function wfParseCIDR( $range ) {
- $parts = explode( '/', $range, 2 );
- if ( count( $parts ) != 2 ) {
- return array( false, false );
+ # Fork the processes
+ if ( !$skip ) {
+ $title = Title::makeTitle( NS_SPECIAL, 'Blockme' );
+ $iphash = md5( $ip . $wgProxyKey );
+ $url = $title->getFullURL( 'ip='.$iphash );
+
+ foreach ( $wgProxyPorts as $port ) {
+ $params = implode( ' ', array(
+ escapeshellarg( $wgProxyScriptPath ),
+ escapeshellarg( $ip ),
+ escapeshellarg( $port ),
+ escapeshellarg( $url )
+ ));
+ exec( "php $params &>/dev/null &" );
+ }
+ # Set MemCached key
+ if ( $wgUseMemCached ) {
+ $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry );
+ }
+ }
}
- $network = wfIP2Unsigned( $parts[0] );
- if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) {
- $bits = $parts[1];
- } else {
- $network = false;
- $bits = false;
+
+ /**
+ * Convert a network specification in CIDR notation to an integer network and a number of bits
+ */
+ function parseCIDR( $range ) {
+ $parts = explode( '/', $range, 2 );
+ if ( count( $parts ) != 2 ) {
+ return array( false, false );
+ }
+ $network = ProxyTools::IP2Unsigned( $parts[0] );
+ if ( $network !== false && is_numeric( $parts[1] ) && $parts[1] >= 0 && $parts[1] <= 32 ) {
+ $bits = $parts[1];
+ } else {
+ $network = false;
+ $bits = false;
+ }
+ return array( $network, $bits );
}
- return array( $network, $bits );
-}
-/**
- * Check if an IP address is in the local proxy list
- */
-function wfIsLocallyBlockedProxy( $ip ) {
- global $wgProxyList;
- $fname = 'wfIsLocallyBlockedProxy';
+ /**
+ * Check if an IP address is in the local proxy list
+ */
+ function isLocallyBlockedProxy( $ip ) {
+ global $wgProxyList;
+ $fname = 'ProxyTools::isLocallyBlockedProxy';
- if ( !$wgProxyList ) {
- return false;
- }
- wfProfileIn( $fname );
+ if ( !$wgProxyList ) {
+ return false;
+ }
+ wfProfileIn( $fname );
- if ( !is_array( $wgProxyList ) ) {
- # Load from the specified file
- $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
- }
+ if ( !is_array( $wgProxyList ) ) {
+ # Load from the specified file
+ $wgProxyList = array_map( 'trim', file( $wgProxyList ) );
+ }
- if ( !is_array( $wgProxyList ) ) {
- $ret = false;
- } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
- $ret = true;
- } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
- # Old-style flipped proxy list
- $ret = true;
- } else {
- $ret = false;
+ if ( !is_array( $wgProxyList ) ) {
+ $ret = false;
+ } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
+ $ret = true;
+ } elseif ( array_key_exists( $ip, $wgProxyList ) ) {
+ # Old-style flipped proxy list
+ $ret = true;
+ } else {
+ $ret = false;
+ }
+ wfProfileOut( $fname );
+ return $ret;
}
- wfProfileOut( $fname );
- return $ret;
}
-
-
-
-
?>
* @package MediaWiki
*/
-/**
- *
- */
-require_once 'Feed.php';
-
/**
* List of query page classes and their associated special pages, for periodic update purposes
*/
* @package MediaWiki
*/
-/** */
-require_once( 'Revision.php' );
-
/**
* @todo document
* @package MediaWiki
}
if ( !$ip ) {
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( !$ip ) {
$ip = '';
}
$ip='', $size = 0, $newId = 0 )
{
if ( !$ip ) {
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( !$ip ) {
$ip = '';
}
/*static*/ function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false )
{
if ( !$ip ) {
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( !$ip ) {
$ip = '';
}
$type, $action, $target, $logComment, $params )
{
if ( !$ip ) {
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( !$ip ) {
$ip = '';
}
* @todo document
*/
-/** */
-require_once( 'Database.php' );
-require_once( 'Article.php' );
-
/** @+ */
define( 'MW_REV_DELETED_TEXT', 1 );
define( 'MW_REV_DELETED_COMMENT', 2 );
wfProfileOut( $fname );
return false;
}
- require_once('ExternalStore.php');
$text=ExternalStore::fetchFromURL($url);
}
} else {
$store = $wgDefaultExternalStore;
}
- require_once('ExternalStore.php');
// Store and get the URL
$data = ExternalStore::insert( $store, $data );
if ( !$data ) {
$class = $wgSearchType;
} elseif( $wgDBtype == 'mysql' ) {
$class = 'SearchMySQL4';
- require_once( 'SearchMySQL4.php' );
} else if ( $wgDBtype == 'PostgreSQL' ) {
$class = 'SearchTsearch2';
- require_once( 'SearchTsearch2.php' );
} else {
$class = 'SearchEngineDummy';
}
* @subpackage Search
*/
-/** */
-require_once( 'SearchEngine.php' );
-
/** @package MediaWiki */
class SearchMySQL extends SearchEngine {
/**
* @subpackage Search
*/
-require_once( 'SearchMySQL.php' );
-
/**
* @package MediaWiki
* @subpackage Search
* @subpackage Search
*/
-/** */
-require_once( 'SearchEngine.php' );
-
/**
* @todo document
* @package MediaWiki
$fname = 'SearchUpdate::doUpdate';
wfProfileIn( $fname );
- require_once( 'SearchEngine.php' );
$search = SearchEngine::create();
$lc = $search->legalSearchChars() . '&#;';
die( -1 );
}
+require('AutoLoader.php');
+
if( !isset( $wgProfiling ) )
$wgProfiling = false;
if ( function_exists( 'wfProfileIn' ) ) {
/* nada, everything should be done already */
} elseif ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
- require_once( 'Profiling.php' );
$wgProfiling = true;
if ($wgProfilerType == "") {
$wgProfiler = new Profiler();
require_once( 'GlobalFunctions.php' );
require_once( 'Hooks.php' );
require_once( 'Namespace.php' );
-require_once( 'User.php' );
-require_once( 'Skin.php' );
-require_once( 'OutputPage.php' );
-require_once( 'LinkCache.php' );
-require_once( 'LinkBatch.php' );
-require_once( 'Title.php' );
-require_once( 'Article.php' );
require_once( 'MagicWord.php' );
-require_once( 'Block.php' );
-require_once( 'MessageCache.php' );
-require_once( 'Parser.php' );
-require_once( 'ParserCache.php' );
-require_once( 'WebRequest.php' );
-require_once( 'LoadBalancer.php' );
-require_once( 'HistoryBlob.php' );
-require_once( 'ProxyTools.php' );
-require_once( 'ObjectCache.php' );
-require_once( 'WikiError.php' );
-require_once( 'SpecialPage.php' );
-
-if ( $wgUseDynamicDates ) {
- require_once( 'DateFormatter.php' );
-}
+
wfProfileOut( $fname.'-includes' );
wfProfileIn( $fname.'-misc1' );
wfProfileOut( $fname.'-misc1' );
wfProfileIn( $fname.'-memcached' );
-$wgMemc =& wfGetMainCache();
-$messageMemc =& wfGetMessageCacheStorage();
-$parserMemc =& wfGetParserCacheStorage();
+$wgMemc =& ObjectCacheManager::getMainCache();
+$messageMemc =& ObjectCacheManager::getMessageCache();
+$parserMemc =& ObjectCacheManager::getParserCache();
wfDebug( 'Main cache: ' . get_class( $wgMemc ) .
"\nMessage cache: " . get_class( $messageMemc ) .
}
if( !is_object( $wgAuth ) ) {
- require_once( 'AuthPlugin.php' );
$wgAuth = new AuthPlugin();
}
$wgMwRedir =& MagicWord::get( MAG_REDIRECT );
if ( $wgUseXMLparser ) {
- require_once( 'ParserXML.php' );
$wgParser = new ParserXML();
} else {
$wgParser = new Parser();
* @subpackage Skins
*/
-# See skin.txt
-require_once( 'Linker.php' );
-require_once( 'Image.php' );
-
# Get a list of available skins
# Build using the regular expression '^(.*).php$'
# Array keys are all lower case, array value keep the case used by filename
#
-$skinDir = dir( $wgStyleDirectory );
-
-# while code from www.php.net
-while (false !== ($file = $skinDir->read())) {
- // Skip non-PHP files, hidden files, and '.dep' includes
- if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
- $aSkin = $matches[1];
- $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
- }
-}
-$skinDir->close();
-unset($matches);
-
/**
* The main skin class that provide methods and properties for all other skins.
* This base class is also the "Standard" skin.
*/
function getSkinNames() {
global $wgValidSkinNames;
+ if (!is_array($wgValidSkinNames)) {
+ Skin::initializeSkinNames();
+ }
return $wgValidSkinNames;
}
+ /**
+ * Initializes set of available skins.
+ * @return array of strings - skin names
+ * @static
+ */
+
+ function initializeSkinNames() {
+ global $wgStyleDirectory, $wgValidSkinNames;
+ $skinDir = dir( $wgStyleDirectory );
+
+ # while code from www.php.net
+ while (false !== ($file = $skinDir->read())) {
+ // Skip non-PHP files, hidden files, and '.dep' includes
+ if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
+ $aSkin = $matches[1];
+ $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
+ }
+ }
+ $skinDir->close();
+ unset($matches);
+
+ }
+
/**
* Normalize a skin preference value to a form that can be loaded.
* If a skin can't be found, it will fall back to the configured
$s = '';
if ( $wgUser->isAnon() ) {
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
- $n = wfGetIP();
+ $n = ProxyTools::getIP();
$tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
}
if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
- require_once('Credits.php');
- $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
+ $s .= ' ' . Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$s .= $this->lastModified();
}
*/
function specialPagesList() {
global $wgUser, $wgContLang, $wgServer, $wgRedirectScript, $wgAvailableRights;
- require_once('SpecialPage.php');
$a = array();
$pages = SpecialPage::getPages();
$this->credits = false;
if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
- require_once("Credits.php");
- $this->credits = getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
+ $this->credits = Credits::getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
} else {
$tpl->set('lastmod', $this->lastModified());
}
{
global $wgBlockOpenProxies, $wgOut, $wgProxyKey;
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) {
$wgOut->addWikiText( wfMsg( "disabled" ) );
* @subpackage SpecialPage
*/
+/**
+ * @todo put all global specialpages stuff into class
+ */
+global $wgSpecialPages, $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
/**
* @access private
* @access private
*/
function mainPrefsForm( $status , $message = '' ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
+ global $wgUser, $wgOut, $wgLang, $wgContLang;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
global $wgDisableLangConversion;
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
$previewtext = wfMsg('skinpreview');
# Only show members of $wgValidSkinNames rather than
# $skinNames (skins is all skin names from Language.php)
- foreach ($wgValidSkinNames as $skinkey => $skinname ) {
+ foreach (Skin::getSkinNames() as $skinkey => $skinname ) {
if ( in_array( $skinkey, $wgSkipSkins ) ) {
continue;
}
* @subpackage SpecialPage
*/
-/**
- *
- */
-require_once( 'Feed.php' );
-require_once( 'ChangesList.php' );
-require_once( 'Revision.php' );
-
/**
* Constructor
*/
*
*/
require_once 'Image.php';
-require_once 'MacBinary.php';
-require_once 'Licenses.php';
/**
* Entry point
*/
return false;
}
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( $wgEnableSorbs && !in_array( $ip, $wgProxyWhitelist ) &&
$wgUser->inSorbsBlacklist( $ip ) )
{
$u->saveSettings();
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if ( '' == $ip ) { $ip = '(Unknown)'; }
$m = wfMsg( 'passwordremindertext', $ip, $u->getName(), $np, $wgServer . $wgScript );
* @return string
*/
function IPInfo() {
- $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
+ $ip = str_replace( '--', ' - ', htmlspecialchars( ProxyTools::getIP() ) );
return "<!-- visited from $ip -->\n" .
"<span style='display:none'>visited from $ip</span>";
}
* @package MediaWiki
*/
-/** */
-require_once( 'normal/UtfNormal.php' );
-
$wgTitleInterwikiCache = array();
$wgTitleCache = array();
*/
/* static */ function indexTitle( $ns, $title ) {
global $wgContLang;
- require_once( 'SearchEngine.php' );
$lc = SearchEngine::legalSearchChars() . '&#;';
$t = $wgContLang->stripForSearch( $title );
* Check that the corresponding skin exists
*/
function isValidCssJsSubpage() {
- global $wgValidSkinNames;
- return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) );
+ return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) );
}
/**
* Trim down a .css or .js subpage title to get the corresponding skin name
* @package MediaWiki
*/
-/**
- *
- */
-
-require_once( 'SiteStatsUpdate.php' );
-require_once( 'LinksUpdate.php' );
-require_once( 'SearchUpdate.php' );
-require_once( 'SquidUpdate.php' );
-
?>
\ No newline at end of file
* @package MediaWiki
*/
-/**
- *
- */
-require_once( 'WatchedItem.php' );
-
# Number of characters in user_token field
define( 'USER_TOKEN_LENGTH', 32 );
wfDebug( "$fname: checking...\n" );
$this->mBlockedby = 0;
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
# User/IP blocking
$block = new Block();
if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) {
# Local list
- if ( wfIsLocallyBlockedProxy( $ip ) ) {
+ if ( ProxyTools::isLocallyBlockedProxy( $ip ) ) {
$this->mBlockedby = wfMsg( 'proxyblocker' );
$this->mBlockreason = wfMsg( 'proxyblockreason' );
}
$limits = $wgRateLimits[$action];
$keys = array();
$id = $this->getId();
- $ip = wfGetIP();
+ $ip = ProxyTools::getIP();
if( isset( $limits['anon'] ) && $id == 0 ) {
$keys["$wgDBname:limiter:$action:anon"] = $limits['anon'];
function getName() {
$this->loadFromDatabase();
if ( $this->mName === false ) {
- $this->mName = wfGetIP();
+ $this->mName = ProxyTools::getIP();
}
return $this->mName;
}
}
# Check if this IP address is already blocked
- $ipblock = Block::newFromDB( wfGetIP() );
+ $ipblock = Block::newFromDB( ProxyTools::getIP() );
if ( $ipblock->isValid() ) {
# If the user is already blocked. Then check if the autoblock would
# excede the user block. If it would excede, then do nothing, else
}
# Make a new block object with the desired properties
- wfDebug( "Autoblocking {$this->mName}@" . wfGetIP() . "\n" );
- $ipblock->mAddress = wfGetIP();
+ wfDebug( "Autoblocking {$this->mName}@" . ProxyTools::getIP() . "\n" );
+ $ipblock->mAddress = ProxyTools::getIP();
$ipblock->mUser = 0;
$ipblock->mBy = $userblock->mBy;
$ipblock->mReason = wfMsg( 'autoblocker', $this->getName(), $userblock->mReason );
$url = $this->confirmationTokenUrl( $expiration );
return $this->sendMail( wfMsg( 'confirmemail_subject' ),
wfMsg( 'confirmemail_body',
- wfGetIP(),
+ ProxyTools::getIP(),
$this->getName(),
$url,
$wgContLang->timeanddate( $expiration, false ) ) );
$data = $wgContLang->checkTitleEncoding( $data );
}
}
- require_once( 'normal/UtfNormal.php' );
$data = $this->normalizeUnicode( $data );
return $data;
} else {
switch( $title->getNamespace() ) {
case NS_IMAGE:
- require_once( 'includes/ImagePage.php' );
return new ImagePage( $title );
case NS_CATEGORY:
- require_once( 'includes/CategoryPage.php' );
return new CategoryPage( $title );
default:
return new Article( $title );
$n = intval( $wgJobRunRate );
}
- require_once( 'JobQueue.php' );
-
while ( $n-- && false != ($job = Job::pop())) {
$output = $job->toString() . "\n";
if ( !$job->run() ) {
}
break;
case 'credits':
- require_once( 'includes/Credits.php' );
- showCreditsPage( $article );
+ Credits::showCreditsPage( $article );
break;
case 'submit':
if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) {
$oldid = $request->getVal( 'oldid' );
if( !$this->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal ||
$section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) {
- require_once( 'includes/EditPage.php' );
$editor = new EditPage( $article );
$editor->submit();
} elseif( $this->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) {
- require_once( 'includes/ExternalEdit.php' );
$mode = $request->getVal( 'mode' );
$extedit = new ExternalEdit( $article, $mode );
$extedit->edit();
if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
$output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
}
- require_once( 'includes/PageHistory.php' );
$history = new PageHistory( $article );
$history->history();
break;
case 'raw':
- require_once( 'includes/RawPage.php' );
$raw = new RawPage( $article );
$raw->view();
break;