* s~\t+$~~
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sat, 7 Jan 2006 13:31:29 +0000 (13:31 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sat, 7 Jan 2006 13:31:29 +0000 (13:31 +0000)
220 files changed:
config/index.php
includes/Article.php
includes/AuthPlugin.php
includes/Block.php
includes/CacheManager.php
includes/ChangesList.php
includes/Database.php
includes/DatabasePostgreSQL.php
includes/DateFormatter.php
includes/DefaultSettings.php
includes/DifferenceEngine.php
includes/EditPage.php
includes/Exif.php
includes/Export.php
includes/ExternalEdit.php
includes/ExternalStore.php
includes/ExternalStoreDB.php
includes/Feed.php
includes/GlobalFunctions.php
includes/Group.php
includes/HTMLForm.php
includes/HistoryBlob.php
includes/Hooks.php
includes/Image.php
includes/ImageGallery.php
includes/ImagePage.php
includes/Licenses.php
includes/LinkBatch.php
includes/LinkCache.php
includes/Linker.php
includes/LinksUpdate.php
includes/LoadBalancer.php
includes/LogPage.php
includes/MacBinary.php
includes/MagicWord.php
includes/Math.php
includes/MessageCache.php
includes/MimeMagic.php
includes/OutputPage.php
includes/PageHistory.php
includes/Parser.php
includes/ParserCache.php
includes/ParserXML.php
includes/ProfilerSimple.php
includes/ProfilerSimpleUDP.php
includes/Profiling.php
includes/ProtectionForm.php
includes/ProxyTools.php
includes/QueryPage.php
includes/RawPage.php
includes/RecentChange.php
includes/Sanitizer.php
includes/SearchEngine.php
includes/SearchMySQL.php
includes/SearchMySQL4.php
includes/SearchTsearch2.php
includes/SearchUpdate.php
includes/SiteConfiguration.php
includes/Skin.php
includes/SkinPHPTal.php
includes/SkinTemplate.php
includes/SpecialAllmessages.php
includes/SpecialAllpages.php
includes/SpecialAncientpages.php
includes/SpecialBlockip.php
includes/SpecialBlockme.php
includes/SpecialBooksources.php
includes/SpecialBrokenRedirects.php
includes/SpecialCategories.php
includes/SpecialConfirmemail.php
includes/SpecialDeadendpages.php
includes/SpecialDisambiguations.php
includes/SpecialDoubleRedirects.php
includes/SpecialEmailuser.php
includes/SpecialExport.php
includes/SpecialGroups.php
includes/SpecialImagelist.php
includes/SpecialImport.php
includes/SpecialIpblocklist.php
includes/SpecialListredirects.php
includes/SpecialListusers.php
includes/SpecialLockdb.php
includes/SpecialLonelypages.php
includes/SpecialMIMEsearch.php
includes/SpecialMaintenance.php
includes/SpecialMostcategories.php
includes/SpecialMostimages.php
includes/SpecialMostlinked.php
includes/SpecialMostlinkedcategories.php
includes/SpecialMostrevisions.php
includes/SpecialMovepage.php
includes/SpecialNewpages.php
includes/SpecialPage.php
includes/SpecialPreferences.php
includes/SpecialPrefixindex.php
includes/SpecialRecentchanges.php
includes/SpecialRecentchangeslinked.php
includes/SpecialSearch.php
includes/SpecialShortpages.php
includes/SpecialSpecialpages.php
includes/SpecialStatistics.php
includes/SpecialUncategorizedpages.php
includes/SpecialUndelete.php
includes/SpecialUnusedimages.php
includes/SpecialUnwatchedpages.php
includes/SpecialUpload.php
includes/SpecialUploadMogile.php
includes/SpecialUserlogin.php
includes/SpecialUserlogout.php
includes/SpecialUserrights.php
includes/SpecialValidate.php
includes/SpecialVersion.php
includes/SpecialWantedcategories.php
includes/SpecialWantedpages.php
includes/SpecialWatchlist.php
includes/SpecialWhatlinkshere.php
includes/SquidUpdate.php
includes/StreamFile.php
includes/Title.php
includes/User.php
includes/UserMailer.php
includes/WatchedItem.php
includes/WebRequest.php
includes/Wiki.php
includes/WikiError.php
includes/ZhClient.php
includes/compatability/ctype.php
includes/normal/CleanUpTest.php
includes/normal/RandomTest.php
includes/normal/Utf8Test.php
includes/normal/UtfNormal.php
includes/normal/UtfNormalBench.php
includes/normal/UtfNormalGenerate.php
includes/normal/UtfNormalTest.php
includes/templates/Userlogin.php
languages/Language.php
languages/LanguageBe.php
languages/LanguageBg.php
languages/LanguageBr.php
languages/LanguageCs.php
languages/LanguageDe.php
languages/LanguageEl.php
languages/LanguageEo.php
languages/LanguageEs.php
languages/LanguageFr.php
languages/LanguageFy.php
languages/LanguageHr.php
languages/LanguageIt.php
languages/LanguageJa.php
languages/LanguageKo.php
languages/LanguageLi.php
languages/LanguageNds.php
languages/LanguageNl.php
languages/LanguageNo.php
languages/LanguageOc.php
languages/LanguagePl.php
languages/LanguagePt.php
languages/LanguageSr.php
languages/LanguageUtf8.php
languages/LanguageVi.php
languages/LanguageZh_cn.php
languages/Names.php
maintenance/FiveUpgrade.inc
maintenance/InitialiseMessages.inc
maintenance/addwiki.php
maintenance/attachLatest.php
maintenance/attribute.php
maintenance/backup.inc
maintenance/backupPrefetch.inc
maintenance/changePassword.php
maintenance/checkUsernames.php
maintenance/cleanupCaps.php
maintenance/cleanupDupes.inc
maintenance/cleanupTitles.php
maintenance/commandLine.inc
maintenance/convertLinks.inc
maintenance/convertUtf8.php
maintenance/deleteImageMemcached.php
maintenance/diffLanguage.php
maintenance/dumpHTML.inc
maintenance/dumpHTML.php
maintenance/dumpReplayLog.php
maintenance/dumpTextPass.php
maintenance/fixSlaveDesync.php
maintenance/generateSitemap.php
maintenance/importLogs.inc
maintenance/importLogs.php
maintenance/importPhase2.php
maintenance/importUseModWiki.php
maintenance/lang2po.php
maintenance/languages.inc
maintenance/mcc.php
maintenance/namespaceDupes.php
maintenance/orphans.php
maintenance/ourusers.php
maintenance/parserTests.inc
maintenance/parserTestsParserHook.php
maintenance/portal.php
maintenance/rebuildImages.php
maintenance/rebuildInterwiki.inc
maintenance/rebuildInterwiki.php
maintenance/rebuildrecentchanges.inc
maintenance/refreshLinks.inc
maintenance/removeUnusedAccounts.inc
maintenance/storage/compressOld.inc
maintenance/storage/resolveStubs.php
maintenance/transstat.php
maintenance/updateSearchIndex.inc
maintenance/updaters.inc
maintenance/userDupes.inc
skins/CologneBlue.php
skins/Nostalgia.php
skins/Standard.php
skins/disabled/HTMLDump.php
tests/ArticleTest.php
tests/DatabaseTest.php
tests/GlobalTest.php
tests/SanitizerTest.php
tests/SearchEngineTest.php
tests/SearchMySQL4Test.php

index e7de01c..12c38ba 100644 (file)
@@ -987,7 +987,7 @@ if( count( $errs ) ) {
 
                <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
        </div>
-       
+
        <div class="config-input"><label class="column">Database charset</label>
                <div>Select one:</div>
                <ul class="plain">
@@ -1290,10 +1290,10 @@ function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
 
        if(!(isset($id)) or ($id == "") ) $id = $field;
        $nolabel = ($type == "radio") || ($type == "hidden");
-       
+
        if ($type == 'radio')
                $id .= $radioCount++;
-       
+
        if( $nolabel ) {
                echo "\t\t<label>";
        } else {
index 91ab894..bb3c81a 100644 (file)
@@ -108,13 +108,13 @@ class Article {
                        }
                        wfProfileOut( $fname );
                        $wgOut->setRobotpolicy( 'noindex,nofollow' );
-                       
+
                        if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                                $ret = wfMsgWeirdKey ( $this->mTitle->getText() ) ;
                        } else {
                                $ret = wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' );
                        }
-                       
+
                        return "<div class='noarticletext'>$ret</div>";
                } else {
                        $this->loadContent( $noredir );
@@ -394,7 +394,7 @@ class Article {
                if ( $this->mContentLoaded ) {
                        return $this->mContent;
                }
-               
+
                $dbr =& $this->getDB();
                $fname = 'Article::fetchContent';
 
@@ -836,7 +836,7 @@ class Article {
                                        $redir = $sk->makeKnownLink( $this->mRedirectedFrom, '', 'redirect=no' );
                                        $s = wfMsg( 'redirectedfrom', $redir );
                                        $wgOut->setSubtitle( $s );
-                                       
+
                                        // Check the parser cache again, for the target page
                                        if( $pcache ) {
                                                if( $wgOut->tryParserCache( $this, $wgUser ) ) {
@@ -996,7 +996,7 @@ class Article {
                $wgOut->setArticleBodyOnly(true);
                $this->view();
        }
-       
+
        function purge() {
                global $wgUser, $wgRequest, $wgOut, $wgUseSquid;
 
@@ -1159,7 +1159,7 @@ class Article {
                        wfProfileOut( $fname );
                        return false;
                }
-               
+
                $this->mGoodAdjustment = (int)$this->isCountable( $text );
                $this->mTotalAdjustment = 1;
 
@@ -1390,7 +1390,7 @@ class Article {
                                'minor_edit' => $isminor,
                                'text'       => $text
                                ) );
-                       
+
                        $dbw->immediateCommit();
                        $dbw->begin();
                        $revisionId = $revision->insertOn( $dbw );
@@ -1409,7 +1409,7 @@ class Article {
                                        $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
                                        $revisionId );
                                $dbw->commit();
-                               
+
                                // Update caches outside the main transaction
                                Article::onArticleEdit( $this->mTitle );
                        }
@@ -1444,7 +1444,7 @@ class Article {
 
                        $urls = array();
                        # Invalidate caches of all articles using this article as a template
-                       
+
                        # Template namespace
                        # Purge all articles linking here
                        $titles = $this->mTitle->getTemplateLinksTo();
@@ -1488,14 +1488,14 @@ class Article {
 
                $fname = 'Article::showArticle';
                wfProfileIn( $fname );
-               
+
                # Output the redirect
                if( $this->isRedirect( $text ) )
                        $r = 'redirect=no';
                else
                        $r = '';
                $wgOut->redirect( $this->mTitle->getFullURL( $r ).$sectionanchor );
-               
+
                wfProfileOut( $fname );
        }
 
@@ -1617,14 +1617,14 @@ class Article {
                $form = new ProtectionForm( $this );
                $form->show();
        }
-       
+
        /**
         * action=unprotect handler (alias)
         */
        function unprotect() {
                $this->protect();
        }
-       
+
        /**
         * Update the article's restriction field, and leave a log entry.
         *
@@ -1650,7 +1650,7 @@ class Article {
 
                $flat = Article::flattenRestrictions( $limit );
                $protecting = ($flat != '');
-               
+
                if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser,
                        $limit, $reason ) ) ) {
 
@@ -1676,7 +1676,7 @@ class Article {
                }
                return true;
        }
-       
+
        /**
         * Take an array of page restrictions and flatten it to a string
         * suitable for insertion into the page_restrictions field.
@@ -1719,7 +1719,7 @@ class Article {
                        $wgOut->sysopRequired();
                        return;
                }
-               
+
                if( wfReadOnly() ) {
                        $wgOut->readOnlyPage();
                        return;
@@ -2141,7 +2141,7 @@ class Article {
 
                $fname = 'Article::editUpdates';
                wfProfileIn( $fname );
-               
+
                # Parse the text
                $options = new ParserOptions;
                $poutput = $wgParser->parse( $text, $this->mTitle, $options, true, true, $newid );
@@ -2159,7 +2159,7 @@ class Article {
                        if ( 0 == mt_rand( 0, 999 ) ) {
                                # Periodically flush old entries from the recentchanges table.
                                global $wgRCMaxAge;
-                               
+
                                $dbw =& wfGetDB( DB_MASTER );
                                $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
                                $recentchanges = $dbw->tableName( 'recentchanges' );
@@ -2434,9 +2434,9 @@ class Article {
 
        function onArticleDelete( $title ) {
                global $wgMessageCache;
-               
+
                $title->touchLinks();
-               
+
                if( $title->getNamespace() == NS_MEDIAWIKI) {
                        $wgMessageCache->replace( $title->getDBkey(), false );
                }
@@ -2447,9 +2447,9 @@ class Article {
         */
        function onArticleEdit( $title ) {
                global $wgUseSquid, $wgPostCommitUpdateList, $wgUseFileCache;
-               
+
                $urls = array();
-               
+
                // Template namespace? Purge all articles linking here.
                // FIXME: When a templatelinks table arrives, use it for all includes.
                if ( $title->getNamespace() == NS_TEMPLATE) {
index c085d21..4c3672c 100644 (file)
@@ -50,7 +50,7 @@ class AuthPlugin {
                # Override this!
                return false;
        }
-       
+
        /**
         * Check if a username+password pair is a valid login.
         * The name will be normalized to MediaWiki's requirements, so
@@ -66,7 +66,7 @@ class AuthPlugin {
                # Override this!
                return false;
        }
-       
+
        /**
         * Modify options in the login template.
         *
@@ -134,7 +134,7 @@ class AuthPlugin {
        function autoCreate() {
                return false;
        }
-       
+
        /**
         * Set the given password in the authentication database.
         * Return true if successful.
@@ -195,7 +195,7 @@ class AuthPlugin {
        function strict() {
                return false;
        }
-       
+
        /**
         * When creating a user account, optionally fill in preferences and such.
         * For instance, you might pull the email address or real name from the
@@ -210,7 +210,7 @@ class AuthPlugin {
        function initUser( &$user ) {
                # Override this to do something.
        }
-       
+
        /**
         * If you want to munge the case of an account name before the final
         * check, now is your chance.
index d04f565..d4fabc7 100644 (file)
@@ -178,7 +178,7 @@ class Block
                # Only scan ranges which start in this /16, this improves search speed
                # Blocks should not cross a /16 boundary.
                $range = substr( $iaddr, 0, 4 );
-               
+
                $options = '';
                $db =& $this->getDBOptions( $options );
                $ipblocks = $db->tableName( 'ipblocks' );
@@ -198,7 +198,7 @@ class Block
                                $success = true;
                        }
                }
-               
+
                $db->freeResult( $res );
                return $success;
        }
@@ -246,7 +246,7 @@ class Block
                                $this->mRangeStart = sprintf( '%08X', $network );
                                $this->mRangeEnd = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 );
                        }
-               }       
+               }
        }
 
        /**
index 90b9677..0d116f7 100644 (file)
@@ -25,26 +25,26 @@ require_once( 'Title.php' );
  */
 class CacheManager {
        var $mTitle, $mFileCache;
-       
+
        function CacheManager( &$title ) {
                $this->mTitle =& $title;
                $this->mFileCache = '';
        }
-       
+
        function fileCacheName() {
                global $wgFileCacheDirectory;
                if( !$this->mFileCache ) {
                        $key = $this->mTitle->getPrefixedDbkey();
                        $hash = md5( $key );
                        $key = str_replace( '.', '%2E', urlencode( $key ) );
-                       
+
                        $hash1 = substr( $hash, 0, 1 );
                        $hash2 = substr( $hash, 0, 2 );
                        $this->mFileCache = "{$wgFileCacheDirectory}/{$hash1}/{$hash2}/{$key}.html";
-                       
+
                        if($this->useGzip())
                                $this->mFileCache .= '.gz';
-                       
+
                        wfDebug( " fileCacheName() - {$this->mFileCache}\n" );
                }
                return $this->mFileCache;
@@ -53,20 +53,20 @@ class CacheManager {
        function isFileCached() {
                return file_exists( $this->fileCacheName() );
        }
-       
+
        function fileCacheTime() {
                return wfTimestamp( TS_MW, filemtime( $this->fileCacheName() ) );
        }
-       
+
        function isFileCacheGood( $timestamp ) {
                global $wgCacheEpoch;
-               
+
                if( !$this->isFileCached() ) return false;
-               
+
                $cachetime = $this->fileCacheTime();
                $good = (( $timestamp <= $cachetime ) &&
                         ( $wgCacheEpoch <= $cachetime ));
-               
+
                wfDebug(" isFileCacheGood() - cachetime $cachetime, touched {$timestamp} epoch {$wgCacheEpoch}, good $good\n");
                return $good;
        }
@@ -75,12 +75,12 @@ class CacheManager {
                global $wgUseGzip;
                return $wgUseGzip;
        }
-       
+
        /* In handy string packages */
        function fetchRawText() {
                return file_get_contents( $this->fileCacheName() );
        }
-       
+
        function fetchPageText() {
                if( $this->useGzip() ) {
                        /* Why is there no gzfile_get_contents() or gzdecode()? */
@@ -89,18 +89,18 @@ class CacheManager {
                        return $this->fetchRawText();
                }
        }
-       
+
        /* Working directory to/from output */
        function loadFromFileCache() {
                global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode;
                wfDebug(" loadFromFileCache()\n");
-               
+
                $filename=$this->fileCacheName();
                $wgOut->sendCacheControl();
 
                header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
                header( "Content-language: $wgContLanguageCode" );
-               
+
                if( $this->useGzip() ) {
                        if( wfClientAcceptsGzip() ) {
                                header( 'Content-Encoding: gzip' );
@@ -112,24 +112,24 @@ class CacheManager {
                }
                readfile( $filename );
        }
-       
+
        function checkCacheDirs() {
                $filename = $this->fileCacheName();
                $mydir2=substr($filename,0,strrpos($filename,'/')); # subdirectory level 2
                $mydir1=substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
-               
+
                if(!file_exists($mydir1)) { mkdir($mydir1,0775); } # create if necessary
                if(!file_exists($mydir2)) { mkdir($mydir2,0775); }
        }
-       
+
        function saveToFileCache( $origtext ) {
                $text = $origtext;
                if(strcmp($text,'') == 0) return '';
-               
+
                wfDebug(" saveToFileCache()\n", false);
-               
+
                $this->checkCacheDirs();
-               
+
                $f = fopen( $this->fileCacheName(), 'w' );
                if($f) {
                        $now = wfTimestampNow();
index 97da138..e9b7f63 100644 (file)
@@ -39,7 +39,7 @@ class ChangesList {
                $this->skin =& $skin;
                $this->preCacheMessages();
        }
-       
+
        function newFromUser( &$user ) {
                $sk =& $user->getSkin();
                if( $user->getOption('usenewrc') ) {
@@ -192,7 +192,7 @@ class ChangesList {
                        $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
                }
        }
-       
+
        /**
         * Check whether to enable RC-Patrol features
         * @return bool
@@ -202,7 +202,7 @@ class ChangesList {
                return $wgUseRCPatrol && $wgUser->isLoggedIn() &&
                  ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed( 'patrol' ) );
        }
-       
+
        /**
         * Make user link (or user contributions for unregistered users)
         * @param int $userId
@@ -221,7 +221,7 @@ class ChangesList {
                        return $this->skin->makeLinkObj( $userPage, $encName );
                }
        }
-       
+
        /**
         * @param int $userId
         * @param string $userText
@@ -232,7 +232,7 @@ class ChangesList {
                global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
                $talkable = !( $wgDisableAnonTalk && 0 == $userId );
                $blockable = ( $wgSysopUserBans || 0 == $userId );
-               
+
                $items = array();
                if( $talkable ) {
                        $items[] = $this->userTalkLink( $userId, $userText );
@@ -240,14 +240,14 @@ class ChangesList {
                if( $blockable && $wgUser->isAllowed( 'block' ) ) {
                        $items[] = $this->blockLink( $userId, $userText );
                }
-               
+
                if( $items ) {
                        return ' (' . implode( ' | ', $items ) . ')';
                } else {
                        return '';
                }
        }
-       
+
        /**
         * @param int $userId
         * @param string $userText
@@ -257,12 +257,12 @@ class ChangesList {
        function userTalkLink( $userId, $userText ) {
                global $wgContLang;
                $talkname = $wgContLang->getNsText( NS_TALK ); # use the shorter name
-               
+
                $userTalkPage = Title::makeTitle( NS_USER_TALK, $userText );
                $userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
                return $userTalkLink;
        }
-       
+
        /**
         * @param int $userId
         * @param string $userText
@@ -430,7 +430,7 @@ class EnhancedChangesList extends ChangesList {
                }
 
                $rc->userlink = $this->userLink( $rc_user, $rc_user_text );
-               
+
                $rc->lastlink = $lastLink;
                $rc->curlink  = $curLink;
                $rc->difflink = $diffLink;
@@ -452,7 +452,7 @@ class EnhancedChangesList extends ChangesList {
                }
                return $ret;
        }
-       
+
        /**
         * Enhanced RC group
         */
@@ -575,7 +575,7 @@ class EnhancedChangesList extends ChangesList {
                $this->rcCacheIndex++;
                return $r;
        }
-       
+
        function maybeWatchedLink( $link, $watched=false ) {
                if( $watched ) {
                        // FIXME: css style might be more appropriate
@@ -584,7 +584,7 @@ class EnhancedChangesList extends ChangesList {
                        return $link;
                }
        }
-       
+
        /**
         * Generate HTML for an arrow or placeholder graphic
         * @param string $dir one of '', 'd', 'l', 'r'
@@ -598,7 +598,7 @@ class EnhancedChangesList extends ChangesList {
                $encAlt = htmlspecialchars( $alt );
                return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
        }
-       
+
        /**
         * Generate HTML for a right- or left-facing arrow,
         * depending on language direction.
@@ -610,7 +610,7 @@ class EnhancedChangesList extends ChangesList {
                $dir = $wgContLang->isRTL() ? 'l' : 'r';
                return $this->arrow( $dir, '+' );
        }
-       
+
        /**
         * Generate HTML for a down-facing arrow
         * depending on language direction.
@@ -620,7 +620,7 @@ class EnhancedChangesList extends ChangesList {
        function downArrow() {
                return $this->arrow( 'd', '-' );
        }
-       
+
        /**
         * Generate HTML for a spacer image
         * @return string HTML <img> tag
index 326b229..bfc8d10 100644 (file)
@@ -246,7 +246,7 @@ class Database {
         */
        function open( $server, $user, $password, $dbName ) {
                global $wguname;
-               
+
                # Test for missing mysql.so
                # First try to load it
                if (!@extension_loaded('mysql')) {
@@ -302,14 +302,14 @@ class Database {
                if ( !$success ) {
                        $this->reportConnectionError();
                }
-               
+
                global $wgDBmysql5;
                if( $wgDBmysql5 ) {
                        // Tell the server we're communicating with it in UTF-8.
                        // This may engage various charset conversions.
                        $this->query( 'SET NAMES utf8' );
                }
-               
+
                $this->mOpened = $success;
                return $success;
        }
@@ -343,7 +343,7 @@ class Database {
                if ( $myError ) {
                        $error = $myError;
                }
-               
+
                if ( $this->mFailFunction ) {
                        if ( !is_int( $this->mFailFunction ) ) {
                                $ff = $this->mFailFunction;
@@ -1042,7 +1042,7 @@ class Database {
                        $opts[] = 'IGNORE';
                return implode(' ', $opts);
        }
-       
+
        /**
         * UPDATE wrapper, takes a condition array and a SET array
         *
@@ -1226,7 +1226,7 @@ class Database {
                $s=str_replace(array('%','_'),array('\%','\_'),$s);
                return $s;
        }
-               
+
        /**
         * Returns an appropriately quoted sequence value for inserting a new row.
         * MySQL has autoincrement fields, so this is just NULL. But the PostgreSQL
@@ -1800,7 +1800,7 @@ border=\"0\" ALT=\"Google\"></A>
        }
 
        wfLogDBError( "Connection error: $error\n" );
-       
+
        $text = str_replace( '$1', $error, $noconnect );
        $text .= wfGetSiteNotice();
 
index d7e3853..d21fc1f 100644 (file)
@@ -56,9 +56,9 @@ class DatabasePgsql extends Database {
                $this->mPassword = $password;
                $this->mDBname = $dbName;
                $this->mSchemas = array($wgDBschema,'public');
-               
+
                $success = false;
-               
+
                if ( '' != $dbName ) {
                        # start a database connection
                        $hstring="";
@@ -77,7 +77,7 @@ class DatabasePgsql extends Database {
                }
                return $this->mConn;
        }
-       
+
        /**
         * Closes a database connection, if it is open
         * Returns success, true if already closed
@@ -90,25 +90,25 @@ class DatabasePgsql extends Database {
                        return true;
                }
        }
-       
+
        function doQuery( $sql ) {
                return $this->mLastResult=pg_query( $this->mConn , $sql);
        }
-               
+
        function queryIgnore( $sql, $fname = '' ) {
                return $this->query( $sql, $fname, true );
        }
-       
+
        function freeResult( $res ) {
                if ( !@pg_free_result( $res ) ) {
                        wfDebugDieBacktrace( "Unable to free PostgreSQL result\n" );
                }
        }
-       
+
        function fetchObject( $res ) {
                @$row = pg_fetch_object( $res );
                # FIXME: HACK HACK HACK HACK debug
-               
+
                # TODO:
                # hashar : not sure if the following test really trigger if the object
                #          fetching failled.
@@ -135,7 +135,7 @@ class DatabasePgsql extends Database {
        }
        function numFields( $res ) { return pg_num_fields( $res ); }
        function fieldName( $res, $n ) { return pg_field_name( $res, $n ); }
-       
+
        /**
         * This must be called after nextSequenceVal
         */
@@ -150,7 +150,7 @@ class DatabasePgsql extends Database {
        function affectedRows() {
                return pg_affected_rows( $this->mLastResult );
        }
-       
+
        /**
         * Returns information about an index
         * If errors are explicitly ignored, returns NULL on failure
@@ -161,7 +161,7 @@ class DatabasePgsql extends Database {
                if ( !$res ) {
                        return NULL;
                }
-               
+
                while ( $row = $this->fetchObject( $res ) ) {
                        if ( $row->Key_name == $index ) {
                                return $row;
@@ -179,7 +179,7 @@ class DatabasePgsql extends Database {
                while ($row = $this->fetchObject( $res ))
                        return true;
                return false;
-               
+
        }
 
        function fieldInfo( $table, $field ) {
@@ -226,7 +226,7 @@ class DatabasePgsql extends Database {
 
                return $retVal;
        }
-       
+
        /** @todo FIXME */
        function startTimer( $timeout ) {
                wfDebugDieBacktrace( 'Database::startTimer() error : mysql_thread_id() not implemented for postgre' );
@@ -247,7 +247,7 @@ class DatabasePgsql extends Database {
                        case 'old':
                        case 'group':
                                return '"' . $name . '"';
-                       
+
                        default:
                                return $name;
                }
@@ -285,7 +285,7 @@ class DatabasePgsql extends Database {
        # occurred in MySQL
        function replace( $table, $uniqueIndexes, $rows, $fname = 'Database::replace' ) {
                $table = $this->tableName( $table );
-       
+
                if (count($rows)==0) {
                        return;
                }
@@ -359,14 +359,14 @@ class DatabasePgsql extends Database {
                $res =$this->query($sql);
                $row=$this->fetchObject($res);
                if ($row->ftype=="varchar") {
-                       $size=$row->size-4;     
+                       $size=$row->size-4;
                } else {
                        $size=$row->size;
                }
                $this->freeResult( $res );
                return $size;
        }
-       
+
        function lowPriorityOption() {
                return '';
        }
@@ -374,7 +374,7 @@ class DatabasePgsql extends Database {
        function limitResult($sql, $limit,$offset) {
                return "$sql LIMIT $limit ".(is_numeric($offset)?" OFFSET {$offset} ":"");
        }
-       
+
        /**
         * Returns an SQL expression for a simple conditional.
         * Uses CASE on PostgreSQL.
@@ -420,7 +420,7 @@ class DatabasePgsql extends Database {
        function getSoftwareLink() {
                return "[http://www.postgresql.org/ PostgreSQL]";
        }
-       
+
        /**
         * @return string Version information from the database
         */
index 0b92de1..4aff477 100755 (executable)
@@ -29,16 +29,16 @@ class DateFormatter
 {
        var $mSource, $mTarget;
        var $monthNames = '', $rxDM, $rxMD, $rxDMY, $rxYDM, $rxMDY, $rxYMD;
-       
+
        var $regexes, $pDays, $pMonths, $pYears;
        var $rules, $xMonths;
-       
+
        /**
         * @todo document
         */
        function DateFormatter() {
                global $wgContLang;
-               
+
                $this->monthNames = $this->getMonthRegex();
                for ( $i=1; $i<=12; $i++ ) {
                        $this->xMonths[$wgContLang->lc( $wgContLang->getMonthName( $i ) )] = $i;
@@ -53,9 +53,9 @@ class DateFormatter
                $this->prxY = '\[\[(\d{1,4}([ _]BC|))]]';
                $this->prxISO1 = '\[\[(-?\d{4})]]-\[\[(\d{2})-(\d{2})]]';
                $this->prxISO2 = '\[\[(-?\d{4})-(\d{2})-(\d{2})]]';
-               
+
                # Real regular expressions
-               $this->regexes[DF_DMY] = "/{$this->prxDM} *,? *{$this->prxY}{$this->regexTrail}";       
+               $this->regexes[DF_DMY] = "/{$this->prxDM} *,? *{$this->prxY}{$this->regexTrail}";
                $this->regexes[DF_YDM] = "/{$this->prxY} *,? *{$this->prxDM}{$this->regexTrail}";
                $this->regexes[DF_MDY] = "/{$this->prxMD} *,? *{$this->prxY}{$this->regexTrail}";
                $this->regexes[DF_YMD] = "/{$this->prxY} *,? *{$this->prxMD}{$this->regexTrail}";
@@ -63,7 +63,7 @@ class DateFormatter
                $this->regexes[DF_MD] = "/{$this->prxMD}{$this->regexTrail}";
                $this->regexes[DF_ISO1] = "/{$this->prxISO1}{$this->regexTrail}";
                $this->regexes[DF_ISO2] = "/{$this->prxISO2}{$this->regexTrail}";
-               
+
                # Extraction keys
                # See the comments in replace() for the meaning of the letters
                $this->keys[DF_DMY] = 'jFY';
@@ -93,7 +93,7 @@ class DateFormatter
                $this->rules[DF_ALL][DF_DM]     = DF_DM;
                $this->rules[DF_NONE][DF_ISO2]  = DF_ISO1;
        }
-       
+
        /**
         * @static
         */
@@ -108,8 +108,8 @@ class DateFormatter
                        }
                }
                return $dateFormatter;
-       }       
-       
+       }
+
        /**
         * @param $preference
         * @param $text
@@ -150,11 +150,11 @@ class DateFormatter
                }
 
                $format = $this->targets[$this->mTarget];
-               
+
                # Construct new date
                $text = '';
                $fail = false;
-               
+
                for ( $p=0; $p < strlen( $format ); $p++ ) {
                        $char = $format{$p};
                        switch ( $char ) {
@@ -220,7 +220,7 @@ class DateFormatter
                }
                return $text;
        }
-       
+
        /**
         * @todo document
         */
index e57abfa..0703e9b 100644 (file)
@@ -743,7 +743,7 @@ $wgBlockAllowsUTEdit    = false; # Blocks allow users to edit their own user tal
 # Also note that this will only protect _pages in the wiki_.
 # Uploaded files will remain readable. Make your upload
 # directory name unguessable, or use .htaccess to protect it.
-$wgWhitelistRead = false;      
+$wgWhitelistRead = false;
 
 /**
  * Permission keys given to users in each group.
index cbbd4be..178e967 100644 (file)
@@ -75,7 +75,7 @@ class DifferenceEngine {
                       $wgUseExternalEditor, $wgUseRCPatrol;
                $fname = 'DifferenceEngine::showDiffPage';
                wfProfileIn( $fname );
-                               
+
                # If external diffs are enabled both globally and for the user,
                # we'll use the application/x-external-editor interface to call
                # an external diff tool like kompare, kdiff3, etc.
@@ -83,7 +83,7 @@ class DifferenceEngine {
                        global $wgInputEncoding,$wgServer,$wgScript,$wgLang;
                        $wgOut->disable();
                        header ( "Content-type: application/x-external-editor; charset=".$wgInputEncoding );
-                       $url1=$this->mTitle->getFullURL("action=raw&oldid=".$this->mOldid);                     
+                       $url1=$this->mTitle->getFullURL("action=raw&oldid=".$this->mOldid);
                        $url2=$this->mTitle->getFullURL("action=raw&oldid=".$this->mNewid);
                        $special=$wgLang->getNsText(NS_SPECIAL);
                        $control=<<<CONTROL
@@ -128,7 +128,7 @@ CONTROL;
                if ( $this->mNewRev->isCurrent() ) {
                        $wgOut->setArticleFlag( true );
                }
-               
+
                $wgOut->suppressQuickbar();
 
                $oldTitle = $this->mOldPage->getPrefixedText();
@@ -316,7 +316,7 @@ CONTROL;
         */
        function getDiffBody() {
                global $wgUseExternalDiffEngine, $wgContLang, $wgMemc, $wgDBname;
-               
+
                // Cacheable?
                $key = false;
                if ( $this->mOldid && $this->mNewid ) {
@@ -328,11 +328,11 @@ CONTROL;
                                return $difftext;
                        }
                }
-               
+
                if ( !$this->loadText() ) {
                        return false;
                }
-               
+
                $otext = $wgContLang->segmentForDiff($this->mOldtext);
                $ntext = $wgContLang->segmentForDiff($this->mNewtext);
                if ( $wgUseExternalDiffEngine ) {
@@ -431,10 +431,10 @@ CONTROL;
                        $this->mPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) );
                        $this->mNewtitle = "<a href='$newLink'>{$this->mPagetitle}</a>";
                }
-                       
+
                $this->mNewUser = $this->mNewRev->getUserText();
                $this->mNewComment = $this->mNewRev->getComment();
-               
+
                // Load the old revision object
                $this->mOldRev = false;
                if( $this->mOldid ) {
@@ -455,11 +455,11 @@ CONTROL;
                        $oldLink = $this->mOldPage->escapeLocalUrl( 'oldid=' . $this->mOldid );
                        $this->mOldtitle = "<a href='$oldLink'>" . htmlspecialchars( wfMsg( 'revisionasof', $t ) ) . '</a>';
 
-                       
+
                        $this->mOldUser = $this->mOldRev->getUserText();
                        $this->mOldComment = $this->mOldRev->getComment();
                }
-               
+
                return true;
        }
 
@@ -473,7 +473,7 @@ CONTROL;
                        // Whether it succeeds or fails, we don't want to try again
                        $this->mTextLoaded = 2;
                }
-               
+
                if ( !$this->loadRevisionData() ) {
                        return false;
                }
@@ -501,8 +501,8 @@ CONTROL;
                $this->mNewtext = $this->mNewRev->getText();
                return true;
        }
-               
-       
+
+
 }
 
 // A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)
@@ -645,7 +645,7 @@ class _DiffEngine
        function diff ($from_lines, $to_lines) {
                $fname = '_DiffEngine::diff';
                wfProfileIn( $fname );
-               
+
                $n_from = sizeof($from_lines);
                $n_to = sizeof($to_lines);
 
@@ -674,7 +674,7 @@ class _DiffEngine
                for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
                        $xhash[$this->_line_hash($from_lines[$xi])] = 1;
                }
-               
+
                for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
                        $line = $to_lines[$yi];
                        if ( ($this->ychanged[$yi] = empty($xhash[$this->_line_hash($line)])) )
@@ -745,7 +745,7 @@ class _DiffEngine
                        return $line;
                }
        }
-       
+
 
        /* Divide the Largest Common Subsequence (LCS) of the sequences
         * [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
@@ -782,12 +782,12 @@ class _DiffEngine
                else
                        for ($i = $ylim - 1; $i >= $yoff; $i--)
                                $ymatches[$this->yv[$i]][] = $i;
-       
+
                $this->lcs = 0;
                $this->seq[0]= $yoff - 1;
                $this->in_seq = array();
                $ymids[0] = array();
-       
+
                $numer = $xlim - $xoff + $nchunks - 1;
                $x = $xoff;
                for ($chunk = 0; $chunk < $nchunks; $chunk++) {
@@ -795,7 +795,7 @@ class _DiffEngine
                        if ($chunk > 0)
                                for ($i = 0; $i <= $this->lcs; $i++)
                                        $ymids[$i][$chunk-1] = $this->seq[$i];
-       
+
                        $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks);
                        for ( ; $x < $x1; $x++) {
                                $line = $flip ? $this->yv[$x] : $this->xv[$x];
@@ -827,7 +827,7 @@ class _DiffEngine
                        }
                        wfProfileOut( "$fname-chunk" );
                }
-       
+
                $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
                $ymid = $ymids[$this->lcs];
                for ($n = 0; $n < $nchunks - 1; $n++) {
@@ -836,7 +836,7 @@ class _DiffEngine
                        $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
                }
                $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
-       
+
                wfProfileOut( $fname );
                return array($this->lcs, $seps);
        }
@@ -844,7 +844,7 @@ class _DiffEngine
        function _lcs_pos ($ypos) {
                $fname = '_DiffEngine::_lcs_pos';
                wfProfileIn( $fname );
-               
+
                $end = $this->lcs;
                if ($end == 0 || $ypos > $this->seq[$end]) {
                        $this->seq[++$this->lcs] = $ypos;
@@ -861,9 +861,9 @@ class _DiffEngine
                        else
                                $end = $mid;
                }
-       
+
                USE_ASSERTS && assert($ypos != $this->seq[$end]);
-       
+
                $this->in_seq[$this->seq[$end]] = false;
                $this->seq[$end] = $ypos;
                $this->in_seq[$ypos] = 1;
@@ -885,7 +885,7 @@ class _DiffEngine
        function _compareseq ($xoff, $xlim, $yoff, $ylim) {
                $fname = '_DiffEngine::_compareseq';
                wfProfileIn( $fname );
-               
+
                // Slide down the bottom initial diagonal.
                while ($xoff < $xlim && $yoff < $ylim
                           && $this->xv[$xoff] == $this->yv[$yoff]) {
@@ -947,11 +947,11 @@ class _DiffEngine
                wfProfileIn( $fname );
                $i = 0;
                $j = 0;
-       
+
                USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
                $len = sizeof($lines);
                $other_len = sizeof($other_changed);
-       
+
                while (1) {
                        /*
                         * Scan forwards to find beginning of another run of changes.
@@ -966,30 +966,30 @@ class _DiffEngine
                         */
                        while ($j < $other_len && $other_changed[$j])
                                $j++;
-       
+
                        while ($i < $len && ! $changed[$i]) {
                                USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
                                $i++; $j++;
                                while ($j < $other_len && $other_changed[$j])
                                        $j++;
                        }
-                       
+
                        if ($i == $len)
                                break;
-                       
+
                        $start = $i;
-                       
+
                        // Find the end of this run of changes.
                        while (++$i < $len && $changed[$i])
                                continue;
-                       
+
                        do {
                                /*
                                 * Record the length of this run of changes, so that
                                 * we can later determine whether the run has grown.
                                 */
                                $runlength = $i - $start;
-                               
+
                                /*
                                 * Move the changed region back, so long as the
                                 * previous unchanged line matches the last changed one.
@@ -1005,14 +1005,14 @@ class _DiffEngine
                                                continue;
                                        USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
                                }
-       
+
                                /*
                                 * Set CORRESPONDING to the end of the changed run, at the last
                                 * point where it corresponds to a changed run in the other file.
                                 * CORRESPONDING == LEN means no such point has been found.
                                 */
                                $corresponding = $j < $other_len ? $i : $len;
-               
+
                                /*
                                 * Move the changed region forward, so long as the
                                 * first changed line matches the following unchanged one.
@@ -1025,7 +1025,7 @@ class _DiffEngine
                                        $changed[$i++] = 1;
                                        while ($i < $len && $changed[$i])
                                                $i++;
-               
+
                                        USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
                                        $j++;
                                        if ($j < $other_len && $other_changed[$j]) {
@@ -1035,7 +1035,7 @@ class _DiffEngine
                                        }
                                }
                        } while ($runlength != $i - $start);
-       
+
                        /*
                         * If possible, move the fully-merged run of changes
                         * back to a corresponding run in the other file.
@@ -1231,7 +1231,7 @@ class MappedDiff extends Diff
                                                $mapped_from_lines, $mapped_to_lines) {
                $fname = 'MappedDiff::MappedDiff';
                wfProfileIn( $fname );
-               
+
                assert(sizeof($from_lines) == sizeof($mapped_from_lines));
                assert(sizeof($to_lines) == sizeof($mapped_to_lines));
 
@@ -1497,7 +1497,7 @@ class WordLevelDiff extends MappedDiff
        function WordLevelDiff ($orig_lines, $closing_lines) {
                $fname = 'WordLevelDiff::WordLevelDiff';
                wfProfileIn( $fname );
-               
+
                list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
                list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
 
@@ -1649,7 +1649,7 @@ class TableDiffFormatter extends DiffFormatter
        function _changed( $orig, $closing ) {
                $fname = 'TableDiffFormatter::_changed';
                wfProfileIn( $fname );
-               
+
                $diff = new WordLevelDiff( $orig, $closing );
                $del = $diff->orig();
                $add = $diff->closing();
index 6b1a595..dd6e6ba 100644 (file)
@@ -154,10 +154,10 @@ class EditPage {
         */
        function edit() {
                global $wgOut, $wgUser, $wgRequest, $wgTitle;
-               
+
                if ( ! wfRunHooks( 'AlternateEdit', array( &$this  ) ) )
                        return;
-               
+
                $fname = 'EditPage::edit';
                wfProfileIn( $fname );
                wfDebug( "$fname: enter\n" );
@@ -238,11 +238,11 @@ class EditPage {
                }
 
                wfProfileIn( "$fname-business-end" );
-               
+
                $this->isConflict = false;
                // css / js subpages of user pages get a special treatment
                $this->isCssJsSubpage = $wgTitle->isCssJsSubpage();
-               
+
                /* Notice that we can't use isDeleted, because it returns true if article is ever deleted
                 * no matter it's current state
                 */
@@ -263,7 +263,7 @@ class EditPage {
                                }
                        }
                }
-               
+
                if(!$this->mTitle->getArticleID() && ('initial' == $this->formtype || $this->firsttime )) { # new article
                        $this->showIntro();
                }
@@ -283,7 +283,7 @@ class EditPage {
                                return;
                        }
                }
-               
+
                # First time through: get contents, set time for conflict
                # checking, etc.
                if ( 'initial' == $this->formtype || $this->firsttime ) {
@@ -340,7 +340,7 @@ class EditPage {
                        } else {
                                $this->preview = $request->getCheck( 'wpPreview' );
                                $this->diff = $request->getCheck( 'wpDiff' );
-                               
+
                                if( !$this->preview ) {
                                        if ( $this->tokenOk( $request ) ) {
                                                # Some browsers will not report any submit button
@@ -364,7 +364,7 @@ class EditPage {
                        if( !preg_match( '/^\d{14}$/', $this->starttime )) {
                                $this->starttime = null;
                        }
-       
+
                        $this->recreate  = $request->getCheck( 'wpRecreate' );
 
                        $this->minoredit = $request->getCheck( 'wpMinoredit' );
@@ -393,7 +393,7 @@ class EditPage {
 
                $this->live = $request->getCheck( 'live' );
                $this->editintro = $request->getText( 'editintro' );
-               
+
                wfProfileOut( $fname );
        }
 
@@ -443,7 +443,7 @@ class EditPage {
         */
        function attemptSave() {
                global $wgSpamRegex, $wgFilterCallback, $wgUser, $wgOut;
-               
+
                $fname = 'EditPage::attemptSave';
                wfProfileIn( $fname );
                wfProfileIn( "$fname-checks" );
@@ -514,9 +514,9 @@ class EditPage {
                        wfProfileOut( $fname );
                        return true;
                }
-               
+
                wfProfileOut( "$fname-checks" );
-               
+
                # If article is new, insert it.
                $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
                if ( 0 == $aid ) {
@@ -527,7 +527,7 @@ class EditPage {
                                wfProfileOut( $fname );
                                return;
                        }
-                       
+
                        # Don't save a new article if it's blank.
                        if ( ( '' == $this->textbox1 ) ) {
                                        $wgOut->redirect( $this->mTitle->getFullURL() );
@@ -538,7 +538,7 @@ class EditPage {
                        $isComment=($this->section=='new');
                        $this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
                                $this->minoredit, $this->watchthis, false, $isComment);
-                       
+
                        wfProfileOut( $fname );
                        return false;
                }
@@ -547,7 +547,7 @@ class EditPage {
 
                $this->mArticle->clear(); # Force reload of dates, etc.
                $this->mArticle->forUpdate( true ); # Lock the article
-               
+
                if( $this->mArticle->getTimestamp() != $this->edittime ) {
                        $this->isConflict = true;
                        if( $this->section == 'new' ) {
@@ -600,12 +600,12 @@ class EditPage {
                                }
                        }
                }
-               
+
                if ( $this->isConflict ) {
                        wfProfileOut( $fname );
                        return true;
                }
-               
+
                # All's well
                wfProfileIn( "$fname-sectionanchor" );
                $sectionanchor = '';
@@ -671,9 +671,9 @@ class EditPage {
                wfProfileIn( $fname );
 
                $sk =& $wgUser->getSkin();
-               
+
                wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
-               
+
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
 
                # Enabled article-related sidebar, toplinks, etc.
@@ -701,7 +701,7 @@ class EditPage {
                                                if( !empty( $matches[2] ) ) {
                                                        $this->summary = "/* ". trim($matches[2])." */ ";
                                                }
-                                       }                                       
+                                       }
                                }
                        } else {
                                $s = wfMsg( 'editing', $this->mTitle->getPrefixedText() );
@@ -896,7 +896,7 @@ END
 </textarea>
 
                " );
-               
+
                $wgOut->addWikiText( $copywarn );
 
                $wgOut->addHTML( "
@@ -962,7 +962,7 @@ END
 
                wfProfileOut( $fname );
        }
-       
+
        /**
         * Append preview output to $wgOut.
         * Includes category rendering if this is a category page.
@@ -1028,7 +1028,7 @@ END
                        'editform.wpTextbox1.value,' .
                        htmlspecialchars( '"' . $liveAction . '"' ) . ')"';
        }
-       
+
        function getLastDelete() {
                $dbr =& wfGetDB( DB_SLAVE );
                $fname = 'EditPage::getLastDelete';
@@ -1104,13 +1104,13 @@ END
                        }
 
                        $toparse = $this->textbox1;
-                       
+
                        # If we're adding a comment, we need to show the
                        # summary as the headline
                        if($this->section=="new" && $this->summary!="") {
                                $toparse="== {$this->summary} ==\n\n".$toparse;
                        }
-                       
+
                        if ( $this->mMetaData != "" ) $toparse .= "\n" . $this->mMetaData ;
 
                        $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ) ."\n\n",
@@ -1435,7 +1435,7 @@ END
                        ? $this->unmakesafe( $text )
                        : $text;
        }
-       
+
        /**
         * Filter an output field through a Unicode armoring process if it is
         * going to an old browser with known broken Unicode editing issues.
@@ -1451,7 +1451,7 @@ END
                        ? $codedText
                        : $this->makesafe( $codedText );
        }
-       
+
        /**
         * A number of web browsers are known to corrupt non-ASCII characters
         * in a UTF-8 text editing environment. To protect against this,
@@ -1468,7 +1468,7 @@ END
        function makesafe( $invalue ) {
                // Armor existing references for reversability.
                $invalue = strtr( $invalue, array( "&#x" => "&#x0" ) );
-               
+
                $bytesleft = 0;
                $result = "";
                $working = 0;
@@ -1497,7 +1497,7 @@ END
                }
                return $result;
        }
-       
+
        /**
         * Reverse the previously applied transliteration of non-ASCII characters
         * back to UTF-8. Used to protect data from corruption by broken web browsers
@@ -1517,7 +1517,7 @@ END
                                        $hexstring .= $invalue{$i};
                                        $i++;
                                } while( ctype_xdigit( $invalue{$i} ) && ( $i < strlen( $invalue ) ) );
-                               
+
                                // Do some sanity checks. These aren't needed for reversability,
                                // but should help keep the breakage down if the editor
                                // breaks one of the entities whilst editing.
@@ -1534,7 +1534,7 @@ END
                // reverse the transform that we made for reversability reasons.
                return strtr( $result, array( "&#x0" => "&#x" ) );
        }
-       
+
        function noCreatePermission() {
                global $wgOut;
                $wgOut->setPageTitle( wfMsg( 'nocreatetitle' ) );
index f013500..77de101 100644 (file)
@@ -50,7 +50,7 @@ class Exif {
         * @var array
         * @access private
         */
-       
+
        /**
         * Exif tags grouped by category, the tagname itself is the key and the type
         * is the value, in the case of more than one possible value type they are
@@ -79,14 +79,14 @@ class Exif {
         * Filtered and formatted Exif data, see FormatExif::getFormattedData()
         */
        var $mFormattedExifData;
-       
+
        /**#@-*/
-       
+
        /**#@+
         * @var string
         * @access private
         */
-       
+
        /**
         * The file being processed
         */
@@ -96,12 +96,12 @@ class Exif {
         * The basename of the file being processed
         */
        var $basename;
-       
+
        /**
         * The private log to log to
         */
        var $log = 'exif';
-       
+
        /**#@-*/
 
        /**
@@ -136,7 +136,7 @@ class Exif {
                                        'YResolution' => MW_EXIF_RATIONAL,                      # Image resolution in height direction
                                        'ResolutionUnit' => MW_EXIF_SHORT,                      # Unit of X and Y resolution #(p26)
                                ),
-                               
+
                                # Tags relating to recording offset
                                'offset' => array(
                                        'StripOffsets' => MW_EXIF_SHORT.','.MW_EXIF_LONG,                       # Image data location
@@ -145,7 +145,7 @@ class Exif {
                                        'JPEGInterchangeFormat' => MW_EXIF_SHORT.','.MW_EXIF_LONG,              # Offset to JPEG SOI
                                        'JPEGInterchangeFormatLength' => MW_EXIF_SHORT.','.MW_EXIF_LONG,        # Bytes of JPEG data
                                ),
-                       
+
                                # Tags relating to image data characteristics
                                'characteristics' => array(
                                        'TransferFunction' => MW_EXIF_SHORT,            # Transfer function
@@ -154,7 +154,7 @@ class Exif {
                                        'YCbCrCoefficients' => MW_EXIF_RATIONAL,        # Color space transformation matrix coefficients #p27
                                        'ReferenceBlackWhite' => MW_EXIF_RATIONAL       # Pair of black and white reference values
                                ),
-                       
+
                                # Other tags
                                'other' => array(
                                        'DateTime' => MW_EXIF_ASCII,            # File change date and time
@@ -166,7 +166,7 @@ class Exif {
                                        'Copyright' => MW_EXIF_ASCII,           # Copyright holder
                                ),
                        ),
-               
+
                        # Exif IFD Attribute Information (p30-31)
                        'exif' => array(
                                # Tags relating to version
@@ -176,12 +176,12 @@ class Exif {
                                        'ExifVersion' => MW_EXIF_UNDEFINED,     # Exif version
                                        'FlashpixVersion' => MW_EXIF_UNDEFINED, # Supported Flashpix version #p32
                                ),
-                               
+
                                # Tags relating to Image Data Characteristics
                                'characteristics' => array(
                                        'ColorSpace' => MW_EXIF_SHORT,          # Color space information #p32
                                ),
-               
+
                                # Tags relating to image configuration
                                'configuration' => array(
                                        'ComponentsConfiguration' => MW_EXIF_UNDEFINED,         # Meaning of each component #p33
@@ -189,18 +189,18 @@ class Exif {
                                        'PixelYDimension' => MW_EXIF_SHORT.','.MW_EXIF_LONG,    # Valid image width
                                        'PixelXDimension' => MW_EXIF_SHORT.','.MW_EXIF_LONG,    # Valind image height
                                ),
-                               
+
                                # Tags relating to related user information
                                'user' => array(
                                        'MakerNote' => MW_EXIF_UNDEFINED,                       # Manufacturer notes
                                        'UserComment' => MW_EXIF_UNDEFINED,                     # User comments #p34
                                ),
-               
+
                                # Tags relating to related file information
                                'related' => array(
                                        'RelatedSoundFile' => MW_EXIF_ASCII,                    # Related audio file
                                ),
-               
+
                                # Tags relating to date and time
                                'dateandtime' => array(
                                        'DateTimeOriginal' => MW_EXIF_ASCII,                    # Date and time of original data generation #p36
@@ -209,7 +209,7 @@ class Exif {
                                        'SubSecTimeOriginal' => MW_EXIF_ASCII,                  # DateTimeOriginal subseconds
                                        'SubSecTimeDigitized' => MW_EXIF_ASCII,                 # DateTimeDigitized subseconds
                                ),
-                               
+
                                # Tags relating to picture-taking conditions (p31)
                                'conditions' => array(
                                        'ExposureTime' => MW_EXIF_RATIONAL,                     # Exposure time
@@ -253,12 +253,12 @@ class Exif {
                                        'DeviceSettingDescription' => MW_EXIF_UNDEFINED,        # Desice settings description
                                        'SubjectDistanceRange' => MW_EXIF_SHORT,                # Subject distance range #p51
                                ),
-                               
+
                                'other' => array(
                                        'ImageUniqueID' => MW_EXIF_ASCII,       # Unique image ID
                                ),
                        ),
-               
+
                        # GPS Attribute Information (p52)
                        'gps' => array(
                                'GPSVersionID' => MW_EXIF_BYTE,                 # GPS tag version
@@ -297,9 +297,9 @@ class Exif {
 
                $this->file = $file;
                $this->basename = basename( $this->file );
-               
+
                $this->makeFlatExifTags();
-               
+
                $this->debugFile( $this->basename, __FUNCTION__, true );
                wfSuppressWarnings();
                $data = exif_read_data( $this->file );
@@ -310,13 +310,13 @@ class Exif {
                 * containing random gibberish.
                 */
                $this->mRawExifData = $data ? $data : array();
-               
+
                $this->makeFilteredData();
                $this->makeFormattedData();
-               
+
                $this->debugFile( __FUNCTION__, false );
        }
-       
+
        /**#@+
         * @access private
         */
@@ -326,7 +326,7 @@ class Exif {
        function makeFlatExifTags() {
                $this->extractTags( $this->mExifTags );
        }
-       
+
        /**
         * A recursing extractor function used by makeFlatExifTags()
         *
@@ -342,13 +342,13 @@ class Exif {
                        }
                }
        }
-       
+
        /**
         * Make $this->mFilteredExifData
         */
        function makeFilteredData() {
                $this->mFilteredExifData = $this->mRawExifData;
-               
+
                foreach( $this->mFilteredExifData as $k => $v ) {
                        if ( !in_array( $k, array_keys( $this->mFlatExifTags ) ) ) {
                                $this->debug( $v, __FUNCTION__, "'$k' is not a valid Exif tag" );
@@ -394,7 +394,7 @@ class Exif {
                return $this->mFormattedExifData;
        }
        /**#@-*/
-       
+
        /**
         * The version of the output format
         *
@@ -428,18 +428,18 @@ class Exif {
                        return false;
                }
        }
-       
+
        function isASCII( $in ) {
                if ( preg_match( "/[^\x0a\x20-\x7e]/", $in ) ) {
                        $this->debug( $in, __FUNCTION__, 'found a character not in our whitelist' );
                        return false;
                }
-               
+
                if ( preg_match( "/^\s*$/", $in ) ) {
                        $this->debug( $in, __FUNCTION__, 'input consisted solely of whitespace' );
                        return false;
                }
-               
+
                return true;
        }
 
@@ -462,7 +462,7 @@ class Exif {
                        return false;
                }
        }
-       
+
        function isRational( $in ) {
                if ( @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero
                        return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
@@ -562,7 +562,7 @@ class Exif {
                $class = ucfirst( __CLASS__ );
                if ( $type === 'array' )
                        $in = print_r( $in, true );
-       
+
                if ( $action === true )
                        wfDebugLog( $this->log, "$class::$fname: accepted: '$in' (type: $type)\n");
                elseif ( $action === false )
@@ -604,7 +604,7 @@ class FormatExif {
         * @access private
         */
        var $mExif;
-       
+
        /**
         * Constructor
         *
@@ -614,7 +614,7 @@ class FormatExif {
        function FormatExif( $exif ) {
                $this->mExif = $exif;
        }
-       
+
        /**
         * Numbers given by Exif user agents are often magical, that is they
         * should be replaced by a detailed explanation depending on their
@@ -625,12 +625,12 @@ class FormatExif {
         */
        function getFormattedData() {
                global $wgLang;
-               
+
                $tags =& $this->mExif;
 
                $resolutionunit = !isset( $tags['ResolutionUnit'] ) || $tags['ResolutionUnit'] == 2 ? 2 : 3;
                unset( $tags['ResolutionUnit'] );
-               
+
                foreach( $tags as $tag => $val ) {
                        switch( $tag ) {
                        case 'Compression':
@@ -643,7 +643,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'PhotometricInterpretation':
                                switch( $val ) {
                                case 2: case 6:
@@ -654,7 +654,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                       
+
                        case 'Orientation':
                                switch( $val ) {
                                case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
@@ -665,7 +665,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                       
+
                        case 'PlanarConfiguration':
                                switch( $val ) {
                                case 1: case 2:
@@ -676,10 +676,10 @@ class FormatExif {
                                        break;
                                }
                                break;
-                       
+
                        // TODO: YCbCrSubSampling
                        // TODO: YCbCrPositioning
-                       
+
                        case 'XResolution':
                        case 'YResolution':
                                switch( $resolutionunit ) {
@@ -694,12 +694,12 @@ class FormatExif {
                                                break;
                                }
                                break;
-                               
+
                        // TODO: YCbCrCoefficients  #p27 (see annex E)
                        case 'ExifVersion': case 'FlashpixVersion':
                                $tags[$tag] = "$val"/100;
                                break;
-                       
+
                        case 'ColorSpace':
                                switch( $val ) {
                                case 1: case 'FFFF.H':
@@ -710,7 +710,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                       
+
                        case 'ComponentsConfiguration':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3: case 4: case 5: case 6:
@@ -721,13 +721,13 @@ class FormatExif {
                                        break;
                                }
                                break;
-                       
+
                        case 'DateTime':
                        case 'DateTimeOriginal':
                        case 'DateTimeDigitized':
                                $tags[$tag] = $wgLang->timeanddate( wfTimestamp(TS_MW, $val) );
                                break;
-                       
+
                        case 'ExposureProgram':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
@@ -742,7 +742,7 @@ class FormatExif {
                        case 'SubjectDistance':
                                $tags[$tag] = $this->msg( $tag, '', $this->formatNum( $val ) );
                                break;
-       
+
                        case 'MeteringMode':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 255:
@@ -753,7 +753,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'LightSource':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3: case 4: case 9: case 10: case 11:
@@ -766,7 +766,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        // TODO: Flash
                        case 'FocalPlaneResolutionUnit':
                                switch( $val ) {
@@ -778,7 +778,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                                               
+
                        case 'SensingMethod':
                                switch( $val ) {
                                case 1: case 2: case 3: case 4: case 5: case 7: case 8:
@@ -789,7 +789,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'FileSource':
                                switch( $val ) {
                                case 3:
@@ -800,7 +800,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'SceneType':
                                switch( $val ) {
                                case 1:
@@ -811,7 +811,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'CustomRendered':
                                switch( $val ) {
                                case 0: case 1:
@@ -822,7 +822,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'ExposureMode':
                                switch( $val ) {
                                case 0: case 1: case 2:
@@ -833,7 +833,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'WhiteBalance':
                                switch( $val ) {
                                case 0: case 1:
@@ -844,7 +844,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'SceneCaptureType':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3:
@@ -855,7 +855,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-       
+
                        case 'GainControl':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3: case 4:
@@ -866,7 +866,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'Contrast':
                                switch( $val ) {
                                case 0: case 1: case 2:
@@ -877,7 +877,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'Saturation':
                                switch( $val ) {
                                case 0: case 1: case 2:
@@ -888,7 +888,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'Sharpness':
                                switch( $val ) {
                                case 0: case 1: case 2:
@@ -899,7 +899,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'SubjectDistanceRange':
                                switch( $val ) {
                                case 0: case 1: case 2: case 3:
@@ -910,7 +910,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSLatitudeRef':
                        case 'GPSDestLatitudeRef':
                                switch( $val ) {
@@ -922,7 +922,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSLongitudeRef':
                        case 'GPSDestLongitudeRef':
                                switch( $val ) {
@@ -934,7 +934,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSStatus':
                                switch( $val ) {
                                case 'A': case 'V':
@@ -945,7 +945,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSMeasureMode':
                                switch( $val ) {
                                case 2: case 3:
@@ -956,7 +956,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSSpeedRef':
                        case 'GPSDestDistanceRef':
                                switch( $val ) {
@@ -968,7 +968,7 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSTrackRef':
                        case 'GPSImgDirectionRef':
                        case 'GPSDestBearingRef':
@@ -981,11 +981,11 @@ class FormatExif {
                                        break;
                                }
                                break;
-                               
+
                        case 'GPSDateStamp':
                                $tags[$tag] = $wgLang->date( substr( $val, 0, 4 ) . substr( $val, 5, 2 ) . substr( $val, 8, 2 ) . '000000' );
                                break;
-       
+
                        // This is not in the Exif standard, just a special
                        // case for our purposes which enables wikis to wikify
                        // the make, model and software name to link to their articles.
@@ -994,23 +994,23 @@ class FormatExif {
                        case 'Software':
                                $tags[$tag] = $this->msg( $tag, '', $val );
                                break;
-                       
+
                        case 'ExposureTime':
                                // Show the pretty fraction as well as decimal version
                                $tags[$tag] = wfMsg( 'exif-exposuretime-format',
                                        $this->formatFraction( $val ), $this->formatNum( $val ) );
                                break;
-                       
+
                        case 'FNumber':
                                $tags[$tag] = wfMsg( 'exif-fnumber-format',
                                        $this->formatNum( $val ) );
                                break;
-                       
+
                        case 'FocalLength':
                                $tags[$tag] = wfMsg( 'exif-focallength-format',
                                        $this->formatNum( $val ) );
                                break;
-                       
+
                        default:
                                $tags[$tag] = $this->formatNum( $val );
                                break;
@@ -1032,7 +1032,7 @@ class FormatExif {
         */
        function msg( $tag, $val, $arg = null ) {
                global $wgContLang;
-               
+
                if ($val === '')
                        $val = 'value';
                return wfMsg( $wgContLang->lc( "exif-$tag-$val" ), $arg );
@@ -1053,7 +1053,7 @@ class FormatExif {
                else
                        return $num;
        }
-       
+
        /**
         * Format a rational number, reducing fractions
         *
@@ -1094,7 +1094,7 @@ class FormatExif {
                */
                while( $b != 0 ) {
                        $remainder = $a % $b;
-                       
+
                        // tail recursion...
                        $a = $b;
                        $b = $remainder;
index a927dd6..71a771b 100644 (file)
@@ -60,7 +60,7 @@ class WikiExporter {
                $this->sink    = new DumpOutput();
                $this->text    = $text;
        }
-       
+
        /**
         * Set the DumpOutput or DumpFilter object which will receive
         * various row objects and XML output for filtering. Filters
@@ -71,7 +71,7 @@ class WikiExporter {
        function setOutputSink( &$sink ) {
                $this->sink =& $sink;
        }
-       
+
        function openStream() {
                $output = $this->writer->openStream();
                $this->sink->writeOpenStream( $output );
@@ -90,7 +90,7 @@ class WikiExporter {
        function allPages() {
                return $this->dumpFrom( '' );
        }
-       
+
        /**
         * Dumps a series of page and revision records for those pages
         * in the database falling within the page_id range given.
@@ -105,7 +105,7 @@ class WikiExporter {
                }
                return $this->dumpFrom( $condition );
        }
-       
+
        /**
         * @param Title $title
         */
@@ -114,7 +114,7 @@ class WikiExporter {
                        'page_namespace=' . $title->getNamespace() .
                        ' AND page_title=' . $this->db->addQuotes( $title->getDbKey() ) );
        }
-       
+
        function pageByName( $name ) {
                $title = Title::newFromText( $name );
                if( is_null( $title ) ) {
@@ -123,24 +123,24 @@ class WikiExporter {
                        return $this->pageByTitle( $title );
                }
        }
-       
+
        function pagesByName( $names ) {
                foreach( $names as $name ) {
                        $this->pageByName( $name );
                }
        }
 
-       
+
        // -------------------- private implementation below --------------------
-       
+
        function dumpFrom( $cond = '' ) {
                $fname = 'WikiExporter::dumpFrom';
                wfProfileIn( $fname );
-               
+
                $page     = $this->db->tableName( 'page' );
                $revision = $this->db->tableName( 'revision' );
                $text     = $this->db->tableName( 'text' );
-               
+
                if( $this->history == MW_EXPORT_FULL ) {
                        $join = 'page_id=rev_page';
                } elseif( $this->history == MW_EXPORT_CURRENT ) {
@@ -150,7 +150,7 @@ class WikiExporter {
                        return new WikiError( "$fname given invalid history dump type." );
                }
                $where = ( $cond == '' ) ? '' : "$cond AND";
-               
+
                if( $this->buffer == MW_EXPORT_STREAM ) {
                        $prev = $this->db->bufferResults( false );
                }
@@ -179,14 +179,14 @@ class WikiExporter {
                $result = $this->db->query( $sql, $fname );
                $wrapper = $this->db->resultObject( $result );
                $this->outputStream( $wrapper );
-               
+
                if( $this->buffer == MW_EXPORT_STREAM ) {
                        $this->db->bufferResults( $prev );
                }
-               
+
                wfProfileOut( $fname );
        }
-       
+
        /**
         * Runs through a query result set dumping page and revision records.
         * The result set should be sorted/grouped by page to avoid duplicate
@@ -226,7 +226,7 @@ class WikiExporter {
 }
 
 class XmlDumpWriter {
-       
+
        /**
         * Returns the export schema version.
         * @return string
@@ -234,7 +234,7 @@ class XmlDumpWriter {
        function schemaVersion() {
                return "0.3";
        }
-       
+
        /**
         * Opens the XML output stream's root <mediawiki> element.
         * This does not include an xml directive, so is safe to include
@@ -259,7 +259,7 @@ class XmlDumpWriter {
                        "\n" .
                        $this->siteInfo();
        }
-       
+
        function siteInfo() {
                $info = array(
                        $this->sitename(),
@@ -271,29 +271,29 @@ class XmlDumpWriter {
                        implode( "\n    ", $info ) .
                        "\n  </siteinfo>\n";
        }
-       
+
        function sitename() {
                global $wgSitename;
                return wfElement( 'sitename', array(), $wgSitename );
        }
-       
+
        function generator() {
                global $wgVersion;
                return wfElement( 'generator', array(), "MediaWiki $wgVersion" );
        }
-       
+
        function homelink() {
                $page = Title::newFromText( wfMsgForContent( 'mainpage' ) );
                return wfElement( 'base', array(), $page->getFullUrl() );
        }
-       
+
        function caseSetting() {
                global $wgCapitalLinks;
                // "case-insensitive" option is reserved for future
                $sensitivity = $wgCapitalLinks ? 'first-letter' : 'case-sensitive';
                return wfElement( 'case', array(), $sensitivity );
        }
-       
+
        function namespaces() {
                global $wgContLang;
                $spaces = "  <namespaces>\n";
@@ -303,7 +303,7 @@ class XmlDumpWriter {
                $spaces .= "    </namespaces>";
                return $spaces;
        }
-       
+
        /**
         * Closes the output stream with the closing root element.
         * Call when finished dumping things.
@@ -312,7 +312,7 @@ class XmlDumpWriter {
                return "</mediawiki>\n";
        }
 
-       
+
        /**
         * Opens a <page> section on the output stream, with data
         * from the given database row.
@@ -332,7 +332,7 @@ class XmlDumpWriter {
                }
                return $out;
        }
-       
+
        /**
         * Closes a <page> section on the output stream.
         *
@@ -341,7 +341,7 @@ class XmlDumpWriter {
        function closePage() {
                return "  </page>\n";
        }
-       
+
        /**
         * Dumps a <revision> section on the output stream, with
         * data filled in from the given database row.
@@ -353,13 +353,13 @@ class XmlDumpWriter {
        function writeRevision( $row ) {
                $fname = 'WikiExporter::dumpRev';
                wfProfileIn( $fname );
-               
+
                $out  = "    <revision>\n";
                $out .= "      " . wfElement( 'id', null, strval( $row->rev_id ) ) . "\n";
-               
+
                $ts = wfTimestamp( TS_ISO_8601, $row->rev_timestamp );
                $out .= "      " . wfElement( 'timestamp', null, $ts ) . "\n";
-               
+
                $out .= "      <contributor>\n";
                if( $row->rev_user ) {
                        $out .= "        " . wfElementClean( 'username', null, strval( $row->rev_user_text ) ) . "\n";
@@ -368,14 +368,14 @@ class XmlDumpWriter {
                        $out .= "        " . wfElementClean( 'ip', null, strval( $row->rev_user_text ) ) . "\n";
                }
                $out .= "      </contributor>\n";
-               
+
                if( $row->rev_minor_edit ) {
                        $out .=  "      <minor/>\n";
                }
                if( $row->rev_comment != '' ) {
                        $out .= "      " . wfElementClean( 'comment', null, strval( $row->rev_comment ) ) . "\n";
                }
-               
+
                if( isset( $row->old_text ) ) {
                        // Raw text from the database may have invalid chars
                        $text = strval( Revision::getRevisionText( $row ) );
@@ -388,9 +388,9 @@ class XmlDumpWriter {
                                array( 'id' => $row->rev_text_id ),
                                "" ) . "\n";
                }
-               
+
                $out .= "    </revision>\n";
-               
+
                wfProfileOut( $fname );
                return $out;
        }
@@ -405,23 +405,23 @@ class DumpOutput {
        function writeOpenStream( $string ) {
                $this->write( $string );
        }
-       
+
        function writeCloseStream( $string ) {
                $this->write( $string );
        }
-       
+
        function writeOpenPage( $page, $string ) {
                $this->write( $string );
        }
-       
+
        function writeClosePage( $string ) {
                $this->write( $string );
        }
-       
+
        function writeRevision( $rev, $string ) {
                $this->write( $string );
        }
-       
+
        /**
         * Override to write to a different stream type.
         * @return bool
@@ -436,11 +436,11 @@ class DumpOutput {
  */
 class DumpFileOutput extends DumpOutput {
        var $handle;
-       
+
        function DumpFileOutput( $file ) {
                $this->handle = fopen( $file, "wt" );
        }
-       
+
        function write( $string ) {
                fputs( $this->handle, $string );
        }
@@ -499,35 +499,35 @@ class DumpFilter {
        function DumpFilter( &$sink ) {
                $this->sink =& $sink;
        }
-       
+
        function writeOpenStream( $string ) {
                $this->sink->writeOpenStream( $string );
        }
-       
+
        function writeCloseStream( $string ) {
                $this->sink->writeCloseStream( $string );
        }
-       
+
        function writeOpenPage( $page, $string ) {
                $this->sendingThisPage = $this->pass( $page, $string );
                if( $this->sendingThisPage ) {
                        $this->sink->writeOpenPage( $page, $string );
                }
        }
-       
+
        function writeClosePage( $string ) {
                if( $this->sendingThisPage ) {
                        $this->sink->writeClosePage( $string );
                        $this->sendingThisPage = false;
                }
        }
-       
+
        function writeRevision( $rev, $string ) {
                if( $this->sendingThisPage ) {
                        $this->sink->writeRevision( $rev, $string );
                }
        }
-       
+
        /**
         * Override for page-based filter types.
         * @return bool
@@ -552,10 +552,10 @@ class DumpNotalkFilter extends DumpFilter {
 class DumpNamespaceFilter extends DumpFilter {
        var $invert = false;
        var $namespaces = array();
-       
+
        function DumpNamespaceFilter( &$sink, $param ) {
                parent::DumpFilter( $sink );
-               
+
                $constants = array(
                        "NS_MAIN"           => NS_MAIN,
                        "NS_TALK"           => NS_TALK,
@@ -573,12 +573,12 @@ class DumpNamespaceFilter extends DumpFilter {
                        "NS_HELP_TALK"      => NS_HELP_TALK,
                        "NS_CATEGORY"       => NS_CATEGORY,
                        "NS_CATEGORY_TALK"  => NS_CATEGORY_TALK );
-               
+
                if( $param{0} == '!' ) {
                        $this->invert = true;
                        $param = substr( $param, 1 );
                }
-               
+
                foreach( explode( ',', $param ) as $key ) {
                        $key = trim( $key );
                        if( isset( $constants[$key] ) ) {
@@ -592,7 +592,7 @@ class DumpNamespaceFilter extends DumpFilter {
                        }
                }
        }
-       
+
        function pass( $page ) {
                $match = isset( $this->namespaces[$page->page_namespace] );
                return $this->invert xor $match;
@@ -605,12 +605,12 @@ class DumpNamespaceFilter extends DumpFilter {
  */
 class DumpLatestFilter extends DumpFilter {
        var $page, $pageString, $rev, $revString;
-       
+
        function writeOpenPage( $page, $string ) {
                $this->page = $page;
                $this->pageString = $string;
        }
-       
+
        function writeClosePage( $string ) {
                if( $this->rev ) {
                        $this->sink->writeOpenPage( $this->page, $this->pageString );
@@ -622,7 +622,7 @@ class DumpLatestFilter extends DumpFilter {
                $this->page = null;
                $this->pageString = null;
        }
-       
+
        function writeRevision( $rev, $string ) {
                if( $rev->rev_id == $this->page->page_latest ) {
                        $this->rev = $rev;
@@ -639,31 +639,31 @@ class DumpMultiWriter {
                $this->sinks = $sinks;
                $this->count = count( $sinks );
        }
-       
+
        function writeOpenStream( $string ) {
                for( $i = 0; $i < $this->count; $i++ ) {
                        $this->sinks[$i]->writeOpenStream( $string );
                }
        }
-       
+
        function writeCloseStream( $string ) {
                for( $i = 0; $i < $this->count; $i++ ) {
                        $this->sinks[$i]->writeCloseStream( $string );
                }
        }
-       
+
        function writeOpenPage( $page, $string ) {
                for( $i = 0; $i < $this->count; $i++ ) {
                        $this->sinks[$i]->writeOpenPage( $page, $string );
                }
        }
-       
+
        function writeClosePage( $string ) {
                for( $i = 0; $i < $this->count; $i++ ) {
                        $this->sinks[$i]->writeClosePage( $string );
                }
        }
-       
+
        function writeRevision( $rev, $string ) {
                for( $i = 0; $i < $this->count; $i++ ) {
                        $this->sinks[$i]->writeRevision( $rev, $string );
@@ -674,14 +674,14 @@ class DumpMultiWriter {
 function xmlsafe( $string ) {
        $fname = 'xmlsafe';
        wfProfileIn( $fname );
-       
+
        /**
         * The page may contain old data which has not been properly normalized.
         * Invalid UTF-8 sequences or forbidden control characters will make our
         * XML output invalid, so be sure to strip them out.
         */
        $string = UtfNormal::cleanUp( $string );
-       
+
        $string = htmlspecialchars( $string );
        wfProfileOut( $fname );
        return $string;
index 02f14c3..21f632e 100644 (file)
@@ -29,19 +29,19 @@ class ExternalEdit {
                $this->mCharset = $wgInputEncoding;
                $this->mMode = $mode;
        }
-       
+
        function edit() {
                global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang;
                $wgOut->disable();
                $name=$this->mTitle->getText();
                $pos=strrpos($name,".")+1;
                header ( "Content-type: application/x-external-editor; charset=".$this->mCharset );
-               
+
                # $type can be "Edit text", "Edit file" or "Diff text" at the moment
                # See the protocol specifications at [[m:Help:External editors/Tech]] for
                # details.
-               if(!isset($this->mMode)) {              
-                       $type="Edit text";              
+               if(!isset($this->mMode)) {
+                       $type="Edit text";
                        $url=$this->mTitle->getFullURL("action=edit&internaledit=true");
                        # *.wiki file extension is used by some editors for syntax
                        # highlighting, so we follow that convention
@@ -57,7 +57,7 @@ class ExternalEdit {
                        }
                        $extension=substr($name, $pos);
                }
-               $special=$wgLang->getNsText(NS_SPECIAL);                
+               $special=$wgLang->getNsText(NS_SPECIAL);
                $control = <<<CONTROL
 [Process]
 Type=$type
index e5b8dc8..2c1fe3b 100644 (file)
@@ -31,7 +31,7 @@ class ExternalStore {
                /* Preloaded modules might exist, especially ones serving multiple protocols */
                if (!class_exists($class)) {
                        if (!include_once($class.'.php'))
-                               return false;   
+                               return false;
                }
                $store=new $class();
                return $store->fetchFromURL($url);
index 38c5367..acafebe 100644 (file)
@@ -44,7 +44,7 @@ class ExternalStoreDB {
                }
                return $wgExternalLoadBalancers[$cluster];
        }
-       
+
        function &getSlave( $cluster ) {
                $lb =& $this->getLoadBalancer( $cluster );
                return $lb->getConnection( DB_SLAVE );
@@ -53,7 +53,7 @@ class ExternalStoreDB {
        function &getMaster( $cluster ) {
                $lb =& $this->getLoadBalancer( $cluster );
                return $lb->getConnection( DB_MASTER );
-       }               
+       }
 
        function getTable( &$db ) {
                $table = $db->getLBInfo( 'blobs table' );
@@ -62,7 +62,7 @@ class ExternalStoreDB {
                }
                return $table;
        }
-       
+
        function fetchFromURL($url) {
                global $wgExternalServers;
                #
@@ -84,7 +84,7 @@ class ExternalStoreDB {
                }
                return $ret;
        }
-       
+
        /**
         * Fetch a blob item out of the database; a cache of the last-loaded
         * blob will be kept so that multiple loads out of a multi-item blob
@@ -99,16 +99,16 @@ class ExternalStoreDB {
                        wfDebug( "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
                        return $wgExternalBlobCache[$cacheID];
                }
-               
+
                wfDebug( "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
-               
+
                $dbr =& $this->getSlave( $cluster );
                $ret = $dbr->selectField( $this->getTable( $dbr ), 'blob_text', array( 'blob_id' => $id ) );
                if( $itemID !== false ) {
                        // Unserialise object; caller extracts item
                        $ret = unserialize( $ret );
                }
-               
+
                $wgExternalBlobCache = array( $cacheID => &$ret );
                return $ret;
        }
index b89b24d..e0da06d 100644 (file)
@@ -41,7 +41,7 @@ class FeedItem {
        var $Date = '';
        var $Author = '';
        /**#@-*/
-       
+
        /**#@+
         * @todo document
         */
@@ -53,7 +53,7 @@ class FeedItem {
                $this->Author = $Author;
                $this->Comments = $Comments;
        }
-       
+
        /**
         * @static
         */
@@ -62,7 +62,7 @@ class FeedItem {
                $string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', '', $string );
                return htmlspecialchars( $string );
        }
-       
+
        function getTitle() { return $this->xmlEncode( $this->Title ); }
        function getUrl() { return $this->xmlEncode( $this->Url ); }
        function getDescription() { return $this->xmlEncode( $this->Description ); }
@@ -85,14 +85,14 @@ class ChannelFeed extends FeedItem {
         * Abstract function, override!
         * @abstract
         */
-       
+
        /**
         * Generate Header of the feed
         */
        function outHeader() {
                # print "<feed>";
        }
-       
+
        /**
         * Generate an item
         * @param $item
@@ -100,7 +100,7 @@ class ChannelFeed extends FeedItem {
        function outItem( $item ) {
                # print "<item>...</item>";
        }
-       
+
        /**
         * Generate Footer of the feed
         */
@@ -108,7 +108,7 @@ class ChannelFeed extends FeedItem {
                # print "</feed>";
        }
        /**#@-*/
-       
+
        /**
         * Setup and send HTTP headers. Don't send any content;
         * content might end up being cached and re-sent with
@@ -121,15 +121,15 @@ class ChannelFeed extends FeedItem {
         */
        function httpHeaders() {
                global $wgOut;
-               
+
                # We take over from $wgOut, excepting its cache header info
                $wgOut->disable();
                $mimetype = $this->contentType();
                header( "Content-type: $mimetype; charset=UTF-8" );
                $wgOut->sendCacheControl();
-               
+
        }
-       
+
        /**
         * Return an internet media type to be sent in the headers.
         *
@@ -142,7 +142,7 @@ class ChannelFeed extends FeedItem {
                $allowedctypes = array('application/xml','text/xml','application/rss+xml','application/atom+xml');
                return (in_array($ctype, $allowedctypes) ? $ctype : 'application/xml');
        }
-       
+
        /**
         * Output the initial XML headers with a stylesheet for legibility
         * if someone finds it in a browser.
@@ -150,7 +150,7 @@ class ChannelFeed extends FeedItem {
         */
        function outXmlHeader() {
                global $wgServer, $wgStylePath;
-               
+
                $this->httpHeaders();
                echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
                echo '<?xml-stylesheet type="text/css" href="' .
@@ -173,13 +173,13 @@ class RSSFeed extends ChannelFeed {
        function formatTime( $ts ) {
                return gmdate( 'D, d M Y H:i:s \G\M\T', wfTimestamp( TS_UNIX, $ts ) );
        }
-       
+
        /**
         * Ouput an RSS 2.0 header
         */
        function outHeader() {
                global $wgVersion;
-               
+
                $this->outXmlHeader();
                ?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
        <channel>
@@ -191,7 +191,7 @@ class RSSFeed extends ChannelFeed {
                <lastBuildDate><?php print $this->formatTime( wfTimestampNow() ) ?></lastBuildDate>
 <?php
        }
-       
+
        /**
         * Output an RSS 2.0 item
         * @param FeedItem item to be output
@@ -238,9 +238,9 @@ class AtomFeed extends ChannelFeed {
         */
        function outHeader() {
                global $wgVersion, $wgOut;
-               
+
                $this->outXmlHeader();
-               ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">     
+               ?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="<?php print $this->getLanguage() ?>">
                <id><?php print $this->getFeedId() ?></id>
                <title><?php print $this->getTitle() ?></title>
                <link rel="self" type="application/atom+xml" href="<?php print $this->getSelfUrl() ?>"/>
@@ -248,10 +248,10 @@ class AtomFeed extends ChannelFeed {
                <updated><?php print $this->formatTime( wfTimestampNow() ) ?>Z</updated>
                <subtitle><?php print $this->getDescription() ?></subtitle>
                <generator>MediaWiki <?php print $wgVersion ?></generator>
-               
+
 <?php
        }
-       
+
        /**
         * Atom 1.0 requires a unique, opaque IRI as a unique indentifier
         * for every feed we create. For now just use the URL, but who
@@ -264,7 +264,7 @@ class AtomFeed extends ChannelFeed {
        function getFeedId() {
                return $this->getSelfUrl();
        }
-       
+
        /**
         * Atom 1.0 requests a self-reference to the feed.
         * @return string
@@ -274,7 +274,7 @@ class AtomFeed extends ChannelFeed {
                global $wgRequest;
                return htmlspecialchars( $wgRequest->getFullRequestURL() );
        }
-       
+
        /**
         * @todo document
         */
@@ -288,7 +288,7 @@ class AtomFeed extends ChannelFeed {
                <?php if( $item->getDate() ) { ?>
                <updated><?php print $this->formatTime( $item->getDate() ) ?>Z</updated>
                <?php } ?>
-       
+
                <summary type="html"><?php print $item->getDescription() ?></summary>
                <?php if( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor() ?></name></author><?php }?>
        </entry>
@@ -297,7 +297,7 @@ class AtomFeed extends ChannelFeed {
        <?php if( $item->getComments() ) { ?><dc:comment><?php print $item->getComments() ?></dc:comment><?php }?>
       */
        }
-       
+
        /**
         * @todo document
         */
index 85202aa..9349499 100644 (file)
@@ -434,7 +434,7 @@ function wfMsgGetKey( $key, $useDB, $forContent = false, $transform = true ) {
 
        if ( is_object( $wgMessageCache ) )
                $transstat = $wgMessageCache->getTransform();
-       
+
        if( is_object( $wgMessageCache ) ) {
                if ( ! $transform )
                        $wgMessageCache->disableTransform();
@@ -463,7 +463,7 @@ function wfMsgGetKey( $key, $useDB, $forContent = false, $transform = true ) {
 
        if ( is_object( $wgMessageCache ) && ! $transform )
                $wgMessageCache->setTransform( $transstat );
-       
+
        return $message;
 }
 
@@ -490,7 +490,7 @@ function wfMsgReplaceArgs( $message, $args ) {
                        $replacementKeys['$' . ($n + 1)] = $param;
                $message = strtr( $message, $replacementKeys );
        }
-       
+
        return $message;
 }
 
@@ -1523,7 +1523,7 @@ function wfTempDir() {
 function wfMkdirParents( $fullDir, $mode ) {
        $parts = explode( '/', $fullDir );
        $path = '';
-       
+
        foreach ( $parts as $dir ) {
                $path .= $dir . '/';
                if ( !is_dir( $path ) ) {
@@ -1621,7 +1621,7 @@ function wfUrlProtocols() {
        $protocols = array();
        foreach ($wgUrlProtocols as $protocol)
                $protocols[] = preg_quote( $protocol, '/' );
-       
+
        return implode( '|', $protocols );
 }
 
@@ -1636,10 +1636,10 @@ function wfUrlProtocols() {
  */
 function wfIsWellFormedXml( $text ) {
        $parser = xml_parser_create( "UTF-8" );
-       
+
        # case folding violates XML standard, turn it off
        xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
-       
+
        if( !xml_parse( $parser, $text, true ) ) {
                $err = xml_error_string( xml_get_error_code( $parser ) );
                $position = xml_get_current_byte_index( $parser );
@@ -1677,7 +1677,7 @@ function wfIsWellFormedXmlFragment( $text ) {
 function wfShellExec( $cmd )
 {
        global $IP;
-       
+
        if ( php_uname( 's' ) == 'Linux' ) {
                $time = ini_get( 'max_execution_time' );
                $mem = ini_get( 'memory_limit' );
@@ -1712,7 +1712,7 @@ function wfShellExec( $cmd )
  */
 function wfUsePHP( $req_ver ) {
        $php_ver = PHP_VERSION;
-       
+
        if ( version_compare( $php_ver, (string)$req_ver, '<' ) )
                 wfDebugDieBacktrace( "PHP $req_ver required--this is only $php_ver" );
 }
index 54dfa0c..cc4a05d 100644 (file)
@@ -22,7 +22,7 @@ class Group {
        /** string $rights Contain rights values : "foo,bar,bla" */
        var $rights;
        /**#@-*/
-       
+
        /** Constructor */
        function Group() {
                $this->clear();
@@ -48,7 +48,7 @@ class Group {
 
                // be sure it's an integer
                $this->id = intval($this->id);
-               
+
                if($this->id) {
                        // By ID
                        $dbr =& wfGetDB( DB_SLAVE );
@@ -85,8 +85,8 @@ class Group {
                $this->description = $row->gr_description;
                $this->rights = $row->gr_rights;
                $this->dataLoaded = true;
-       }               
-       
+       }
+
        /** Initialise a new row in the database */
        function addToDatabase() {
                if ( Group::getStaticGroups() ) {
@@ -113,10 +113,10 @@ class Group {
                        wfDebugDieBacktrace( "Can't modify groups in static mode" );
                }
                if($this->id == 0) { return; }
-               
+
                $fname = 'Group::save';
                $dbw =& wfGetDB( DB_MASTER );
-               
+
                $dbw->update( 'groups',
                        array( /* SET */
                                'gr_name' => $this->name,
@@ -126,7 +126,7 @@ class Group {
                                'gr_id' => $this->id
                        ), $fname
                );
-       
+
                $wgMemc->set( Group::getCacheKey( $this->id ), $this, 3600 );
        }
 
@@ -139,7 +139,7 @@ class Group {
                        wfDebugDieBacktrace( "Can't modify groups in static mode" );
                }
                if($this->id == 0) { return; }
-               
+
                $fname = 'Group::delete';
                $dbw =& wfGetDB( DB_MASTER );
 
@@ -151,7 +151,7 @@ class Group {
 
                $wgMemc->delete( Group::getCacheKey( $this->id ) );
        }
-       
+
        /**
         * Get memcached key
         * @static
@@ -169,7 +169,7 @@ class Group {
        function newFromId($id) {
                global $wgMemc, $wgDBname;
                $fname = 'Group::newFromId';
-               
+
                $staticGroups =& Group::getStaticGroups();
                if ( $staticGroups ) {
                        if ( array_key_exists( $id, $staticGroups ) ) {
@@ -185,7 +185,7 @@ class Group {
                        wfDebug( "$fname loaded group $id from cache\n" );
                        return $group;
                }
-               
+
                $group = new Group();
                $group->id = $id;
                $group->loadFromDatabase();
@@ -204,7 +204,7 @@ class Group {
        /** @param string $name Group database name */
        function newFromName($name) {
                $fname = 'Group::newFromName';
-               
+
                $staticGroups =& Group::getStaticGroups();
                if ( $staticGroups ) {
                        $id = Group::idFromName( $name );
@@ -214,7 +214,7 @@ class Group {
                                return null;
                        }
                }
-               
+
                $g = new Group();
                $g->name = $name;
                $g->loadFromDatabase();
@@ -328,7 +328,7 @@ class Group {
                $this->loadFromDatabase();
                return $this->getMessage( $this->name );
        }
-       
+
        function getNameForContent() {
                $this->loadFromDatabase();
                return $this->getMessageForContent( $this->name );
@@ -338,13 +338,13 @@ class Group {
                $this->loadFromDatabase();
                $this->name = $name;
        }
-       
+
        function getId() { return $this->id; }
        function setId($id) {
                $this->id = intval($id);
                $this->dataLoaded = false;
        }
-       
+
        function getDescription() {
                return $this->description;
        }
index 3362fcc..f50cd28 100644 (file)
@@ -73,7 +73,7 @@ class HTMLForm {
                }
                return $this->fieldset( $this->mName.'-'.$varname, $s );
        }
-       
+
        /**
         * @access private
         * @param string $varname Name of the textareabox.
@@ -83,7 +83,7 @@ class HTMLForm {
        function textareabox ( $varname, $value='', $size=20 ) {
                if ( $this->mRequest->wasPosted() ) {
                        $value = $this->mRequest->getText( $varname, $value );
-               }       
+               }
                $value = htmlspecialchars( $value );
                return '<div><label>'.wfMsg( $this->mName.'-'.$varname ).
                       "<textarea name=\"{$varname}\" rows=\"5\" cols=\"{$size}\">$value</textarea></label></div>\n";
@@ -122,7 +122,7 @@ class HTMLForm {
 function HTMLSelectGroups($selectname, $selectmsg, $selected=array(), $multiple=false, $size=6, $reverse=false) {
        $groups = User::getAllGroups();
        $out = htmlspecialchars( wfMsg( $selectmsg ) );
-       
+
        if( $multiple ) {
                $attribs = array(
                        'name'    => $selectname . '[]',
@@ -132,7 +132,7 @@ function HTMLSelectGroups($selectname, $selectmsg, $selected=array(), $multiple=
                $attribs = array( 'name' => $selectname );
        }
        $out .= wfElement( 'select', $attribs, null );
-       
+
        foreach( $groups as $group ) {
                $attribs = array( 'value' => $group );
                if( $multiple ) {
@@ -160,13 +160,13 @@ function HTMLSelectRights($selected='') {
        global $wgAvailableRights;
        $out = '<select name="editgroup-getrights[]" multiple="multiple">';
        $groupRights = explode(',',$selected);
-       
+
        foreach($wgAvailableRights as $right) {
-       
+
                // check box when right exist
                if(in_array($right, $groupRights)) { $selected = 'selected="selected" '; }
                else { $selected = ''; }
-                                       
+
                $out .= '<option value="'.$right.'" '.$selected.'>'.$right."</option>\n";
        }
        $out .= "</select>\n";
index cf4abbe..3bf339b 100644 (file)
@@ -35,7 +35,7 @@ class HistoryBlob
         * Get item by hash
         */
        function getItem( $hash ) {}
-       
+
        # Set the "default text"
        # This concept is an odd property of the current DB schema, whereby each text item has a revision
        # associated with it. The default text is the text of the associated revision. There may, however,
@@ -188,7 +188,7 @@ class HistoryBlobStub {
        function HistoryBlobStub( $hash = '', $oldid = 0 ) {
                $this->mHash = $hash;
        }
-       
+
        /**
         * Sets the location (old_id) of the main object to which this object
         * points
@@ -237,7 +237,7 @@ class HistoryBlobStub {
                        if( !in_array( 'object', $flags ) ) {
                                return false;
                        }
-                       
+
                        if( in_array( 'gzip', $flags ) ) {
                                // This shouldn't happen, but a bug in the compress script
                                // may at times gzip-compress a HistoryBlob object row.
@@ -245,12 +245,12 @@ class HistoryBlobStub {
                        } else {
                                $obj = unserialize( $row->old_text );
                        }
-                       
+
                        if( !is_object( $obj ) ) {
                                // Correct for old double-serialization bug.
                                $obj = unserialize( $obj );
                        }
-                       
+
                        // Save this item for reference; if pulling many
                        // items in a row we'll likely use it again.
                        $obj->uncompress();
@@ -283,7 +283,7 @@ class HistoryBlobCurStub {
        function HistoryBlobCurStub( $curid = 0 ) {
                $this->mCurId = $curid;
        }
-       
+
        /**
         * Sets the location (cur_id) of the main object to which this object
         * points
index 90084fe..94f63c4 100644 (file)
@@ -31,7 +31,7 @@ if ( ! defined( 'MEDIAWIKI' ) )
  * in here than would normally be necessary.
  */
 function wfRunHooks($event, $args = null) {
-       
+
        global $wgHooks;
        $fname = 'wfRunHooks';
        wfProfileIn( $fname );
@@ -46,26 +46,26 @@ function wfRunHooks($event, $args = null) {
                wfProfileOut( $fname );
                return true;
        }
-       
+
        if (!is_array($wgHooks[$event])) {
                wfDebugDieBacktrace("Hooks array for event '$event' is not an array!\n");
                wfProfileOut( $fname );
                return false;
        }
-       
+
        foreach ($wgHooks[$event] as $index => $hook) {
-               
+
                $object = NULL;
                $method = NULL;
                $func = NULL;
                $data = NULL;
                $have_data = false;
-               
+
                /* $hook can be: a function, an object, an array of $function and $data,
                 * an array of just a function, an array of object and method, or an
                 * array of object, method, and data.
                 */
-               
+
                if (is_array($hook)) {
                        if (count($hook) < 1) {
                                wfDebugDieBacktrace("Empty array in hooks for " . $event . "\n");
@@ -97,16 +97,16 @@ function wfRunHooks($event, $args = null) {
                } else {
                        wfDebugDieBacktrace("Unknown datatype in hooks for " . $event . "\n");
                }
-               
+
                /* We put the first data element on, if needed. */
-               
+
                if ($have_data) {
                        $hook_args = array_merge(array($data), $args);
                } else {
                        $hook_args = $args;
                }
-               
-               
+
+
                if ( isset( $object ) ) {
                        $func = get_class( $object ) . '::' . $method;
                }
@@ -119,9 +119,9 @@ function wfRunHooks($event, $args = null) {
                        $retval = call_user_func_array($func, $hook_args);
                }
                wfProfileOut( $func );
-               
+
                /* String return is an error; false return means stop processing. */
-               
+
                if (is_string($retval)) {
                        global $wgOut;
                        $wgOut->fatalError($retval);
@@ -132,7 +132,7 @@ function wfRunHooks($event, $args = null) {
                        return false;
                }
        }
-       
+
        wfProfileOut( $fname );
        return true;
 }
index 59034b0..6b27f5e 100644 (file)
@@ -74,7 +74,7 @@ class Image
        function newFromTitle( $title ) {
                return new Image( $title );
        }
-       
+
        function Image( $title ) {
                if( !is_object( $title ) ) {
                        wfDebugDieBacktrace( 'Image constructor given bogus title.' );
@@ -96,7 +96,7 @@ class Image
         */
        function getCacheKeys( $shared = false ) {
                global $wgDBname, $wgUseSharedUploads, $wgSharedUploadDBname, $wgCacheSharedUploads;
-               
+
                $foundCached = false;
                $hashedName = md5($this->name);
                $keys = array( "$wgDBname:Image:$hashedName" );
@@ -105,7 +105,7 @@ class Image
                }
                return $keys;
        }
-       
+
        /**
         * Try to load image metadata from memcached. Returns true on success.
         */
@@ -206,7 +206,7 @@ class Image
                        $wgMemc->delete( $keys[0] );
                }
        }
-       
+
        /**
         * Load metadata from the file itself
         */
@@ -219,11 +219,11 @@ class Image
                $this->fileExists = file_exists( $this->imagePath );
                $this->fromSharedDirectory = false;
                $gis = array();
-               
+
                if (!$this->fileExists) wfDebug("$fname: ".$this->imagePath." not found locally!\n");
 
                # If the file is not found, and a shared upload directory is used, look for it there.
-               if (!$this->fileExists && $wgUseSharedUploads && $wgSharedUploadDirectory) {                    
+               if (!$this->fileExists && $wgUseSharedUploads && $wgSharedUploadDirectory) {
                        # In case we're on a wgCapitalLinks=false wiki, we
                        # capitalize the first letter of the filename before
                        # looking it up in the shared repository.
@@ -239,15 +239,15 @@ class Image
 
                if ( $this->fileExists ) {
                        $magic=& wfGetMimeMagic();
-               
+
                        $this->mime = $magic->guessMimeType($this->imagePath,true);
                        $this->type = $magic->getMediaType($this->imagePath,$this->mime);
-                       
+
                        # Get size in bytes
                        $this->size = filesize( $this->imagePath );
 
                        $magic=& wfGetMimeMagic();
-                       
+
                        # Height and width
                        if( $this->mime == 'image/svg' ) {
                                wfSuppressWarnings();
@@ -266,7 +266,7 @@ class Image
                                $gis = getimagesize( $this->imagePath );
                                wfRestoreWarnings();
                        }
-                       
+
                        wfDebug("$fname: ".$this->imagePath." loaded, ".$this->size." bytes, ".$this->mime.".\n");
                }
                else {
@@ -274,29 +274,29 @@ class Image
                        $gis[1]= 0; //height
                        $gis[2]= 0; //unknown
                        $gis[3]= ""; //width height string
-                       
+
                        $this->mime = NULL;
                        $this->type = MEDIATYPE_UNKNOWN;
                        wfDebug("$fname: ".$this->imagePath." NOT FOUND!\n");
                }
-               
+
                $this->width = $gis[0];
                $this->height = $gis[1];
-               
+
                #NOTE: $gis[2] contains a code for the image type. This is no longer used.
-               
+
                #NOTE: we have to set this flag early to avoid load() to be called
                # be some of the functions below. This may lead to recursion or other bad things!
                # as ther's only one thread of execution, this should be safe anyway.
                $this->dataLoaded = true;
-               
-               
+
+
                if ($this->fileExists && $wgShowEXIF) $this->metadata = serialize ( $this->retrieveExifData() ) ;
                else $this->metadata = serialize ( array() ) ;
-               
+
                if ( isset( $gis['bits'] ) )  $this->bits = $gis['bits'];
                else $this->bits = 0;
-               
+
                wfProfileOut( $fname );
        }
 
@@ -307,11 +307,11 @@ class Image
                global $wgUseSharedUploads, $wgSharedUploadDBname, $wgSharedUploadDBprefix, $wgContLang;
                $fname = 'Image::loadFromDB';
                wfProfileIn( $fname );
-               
+
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                $this->checkDBSchema($dbr);
-               
+
                $row = $dbr->selectRow( 'image',
                        array( 'img_size', 'img_width', 'img_height', 'img_bits',
                               'img_media_type', 'img_major_mime', 'img_minor_mime', 'img_metadata' ),
@@ -342,14 +342,14 @@ class Image
                                $this->imagePath = $this->getFullPath(true);
                                $this->name = $name;
                                $this->loadFromRow( $row );
-                               
+
                                // Check for rows from a previous schema, quietly upgrade them
                                if ( is_null($this->type) ) {
                                        $this->upgradeRow();
                                }
                        }
                }
-               
+
                if ( !$row ) {
                        $this->size = 0;
                        $this->width = 0;
@@ -375,19 +375,19 @@ class Image
                $this->height = $row->img_height;
                $this->bits = $row->img_bits;
                $this->type = $row->img_media_type;
-               
+
                $major= $row->img_major_mime;
                $minor= $row->img_minor_mime;
-               
+
                if (!$major) $this->mime = "unknown/unknown";
                else {
                        if (!$minor) $minor= "unknown";
                        $this->mime = $major.'/'.$minor;
                }
-               
+
                $this->metadata = $row->img_metadata;
                if ( $this->metadata == "" ) $this->metadata = serialize ( array() ) ;
-               
+
                $this->dataLoaded = true;
        }
 
@@ -431,9 +431,9 @@ class Image
                        // This avoids breaking replication in MySQL
                        $dbw->selectDB( $wgSharedUploadDBname );
                }
-               
+
                $this->checkDBSchema($dbw);
-               
+
                if (strpos($this->mime,'/')!==false) {
                        list($major,$minor)= explode('/',$this->mime,2);
                }
@@ -441,9 +441,9 @@ class Image
                        $major= $this->mime;
                        $minor= "unknown";
                }
-               
+
                wfDebug("$fname: upgrading ".$this->name." to 1.5 schema\n");
-               
+
                $dbw->update( 'image',
                        array(
                                'img_width' => $this->width,
@@ -460,7 +460,7 @@ class Image
                }
                wfProfileOut( $fname );
        }
-                               
+
        /**
         * Return the name of this image
         * @access public
@@ -484,7 +484,7 @@ class Image
        function getURL() {
                if ( !$this->url ) {
                        $this->load();
-                       if($this->fileExists) {                 
+                       if($this->fileExists) {
                                $this->url = Image::imageUrl( $this->name, $this->fromSharedDirectory );
                        } else {
                                $this->url = '';
@@ -492,7 +492,7 @@ class Image
                }
                return $this->url;
        }
-       
+
        function getViewURL() {
                if( $this->mustRender()) {
                        if( $this->canRender() ) {
@@ -555,7 +555,7 @@ class Image
                $this->load();
                return $this->mime;
        }
-       
+
        /**
         * Return the type of the media in the file.
         * Use the value returned by this function with the MEDIATYPE_xxx constants.
@@ -577,17 +577,17 @@ class Image
         */
        function canRender() {
                global $wgUseImageMagick;
-               
+
                if( $this->getWidth()<=0 || $this->getHeight()<=0 ) return false;
-       
+
                $mime= $this->getMimeType();
-               
+
                if (!$mime || $mime==='unknown' || $mime==='unknown/unknown') return false;
-               
+
                #if it's SVG, check if there's a converter enabled
                if ($mime === 'image/svg') {
                        global $wgSVGConverters, $wgSVGConverter;
-                       
+
                        if ($wgSVGConverter && isset( $wgSVGConverters[$wgSVGConverter])) {
                                wfDebug( "Image::canRender: SVG is ready!\n" );
                                return true;
@@ -595,12 +595,12 @@ class Image
                                wfDebug( "Image::canRender: SVG renderer missing\n" );
                        }
                }
-               
+
                #image formats available on ALL browsers
                if (  $mime === 'image/gif'
                   || $mime === 'image/png'
                   || $mime === 'image/jpeg' ) return true;
-               
+
                #image formats that can be converted to the above formats
                if ($wgUseImageMagick) {
                        #convertable by ImageMagick (there are more...)
@@ -622,10 +622,10 @@ class Image
                        if ( $mime === 'image/vnd.wap.wbmp'
                          || $mime === 'image/x-xbitmap' ) return true;
                }
-               
+
                return false;
        }
-       
+
 
        /**
         * Return true if the file is of a type that can't be directly
@@ -639,14 +639,14 @@ class Image
         */
        function mustRender() {
                $mime= $this->getMimeType();
-               
+
                if (  $mime === "image/gif"
                   || $mime === "image/png"
                   || $mime === "image/jpeg" ) return false;
-               
+
                return true;
        }
-       
+
        /**
         * Determines if this media file may be shown inline on a page.
         *
@@ -658,7 +658,7 @@ class Image
        function allowInlineDisplay() {
                return $this->canRender();
        }
-       
+
        /**
         * Determines if this media file is in a format that is unlikely to
         * contain viruses or malicious content. It uses the global
@@ -673,22 +673,22 @@ class Image
        function isSafeFile() {
                if ($this->allowInlineDisplay()) return true;
                if ($this->isTrustedFile()) return true;
-               
+
                global $wgTrustedMediaFormats;
-               
+
                $type= $this->getMediaType();
                $mime= $this->getMimeType();
                #wfDebug("Image::isSafeFile: type= $type, mime= $mime\n");
-               
+
                if (!$type || $type===MEDIATYPE_UNKNOWN) return false; #unknown type, not trusted
                if ( in_array( $type, $wgTrustedMediaFormats) ) return true;
-               
+
                if ($mime==="unknown/unknown") return false; #unknown type, not trusted
                if ( in_array( $mime, $wgTrustedMediaFormats) ) return true;
-               
+
                return false;
        }
-       
+
        /** Returns true if the file is flagged as trusted. Files flagged that way
        * can be linked to directly, even if that is not allowed for this type of
        * file normally.
@@ -727,7 +727,7 @@ class Image
         * Return the URL of an image, provided its name.
         *
         * @param string $name  Name of the image, without the leading "Image:"
-        * @param boolean $fromSharedDirectory  Should this be in $wgSharedUploadPath?  
+        * @param boolean $fromSharedDirectory  Should this be in $wgSharedUploadPath?
         * @return string URL of $name image
         * @access public
         * @static
@@ -740,7 +740,7 @@ class Image
                } else {
                        $base = $wgUploadBaseUrl;
                        $path = $wgUploadPath;
-               }                       
+               }
                $url = "{$base}{$path}" .  wfGetHashPath($name, $fromSharedDirectory) . "{$name}";
                return wfUrlencode( $url );
        }
@@ -782,7 +782,7 @@ class Image
                                $url.= '&r=1';
                        }
                } else {
-                       $name = $this->thumbName( $width );             
+                       $name = $this->thumbName( $width );
                        if($this->fromSharedDirectory) {
                                $base = '';
                                $path = $wgSharedUploadPath;
@@ -811,7 +811,7 @@ class Image
         */
        function thumbName( $width ) {
                $thumb = $width."px-".$this->name;
-               
+
                if( $this->mustRender() ) {
                        if( $this->canRender() ) {
                                # Rasterize to PNG (for SVG vector images, etc)
@@ -847,7 +847,7 @@ class Image
                if( is_null( $thumb ) ) return '';
                return $thumb->getUrl();
        }
-       
+
        /**
         * As createThumb, but returns a ThumbnailImage object. This can
         * provide access to the actual file, the real size of the thumb,
@@ -863,7 +863,7 @@ class Image
                        return $this->renderThumb( $width );
                }
                $this->load();
-               
+
                if ($this->canRender()) {
                        if ( $width > $this->width * $height / $this->height )
                                $width = floor( $this->width * $height / $this->height );
@@ -873,19 +873,19 @@ class Image
                        $thumb = $this->renderThumb( $width );
                }
                else $thumb= NULL; #not a bitmap or renderable image, don't try.
-               
+
                if( is_null( $thumb ) ) {
                        $thumb = $this->iconThumb();
                }
                return $thumb;
        }
-       
+
        /**
         * @return ThumbnailImage
         */
        function iconThumb() {
                global $wgStylePath, $wgStyleDirectory;
-               
+
                $try = array( 'fileicon-' . $this->extension . '.png', 'fileicon.png' );
                foreach( $try as $icon ) {
                        $path = '/common/images/icons/' . $icon;
@@ -896,7 +896,7 @@ class Image
                }
                return null;
        }
-               
+
        /**
         * Create a thumbnail of the image having the specified width.
         * The thumbnail will not be created if the width is larger than the
@@ -916,7 +916,7 @@ class Image
 
                $fname = 'Image::renderThumb';
                wfProfileIn( $fname );
-               
+
                $width = intval( $width );
 
                $this->load();
@@ -926,7 +926,7 @@ class Image
                        wfProfileOut( $fname );
                        return null;
                }
-               
+
                # Sanity check $width
                if( $width <= 0 || $this->width <= 0) {
                        # BZZZT
@@ -954,9 +954,9 @@ class Image
                        wfProfileOut( $fname );
                        return $thumb;
                }
-               
+
                $height = round( $this->height * $width / $this->width );
-               
+
                list( $isScriptUrl, $url ) = $this->thumbUrl( $width );
                if ( $isScriptUrl && $useScript ) {
                        // Use thumb.php to render the image
@@ -997,7 +997,7 @@ class Image
                                }
                        }
                }
-               
+
                $thumb = new ThumbnailImage( $url, $width, $height, $thumbPath );
                wfProfileOut( $fname );
                return $thumb;
@@ -1012,12 +1012,12 @@ class Image
        function reallyRenderThumb( $thumbPath, $width, $height ) {
                global $wgSVGConverters, $wgSVGConverter,
                        $wgUseImageMagick, $wgImageMagickConvertCommand;
-               
+
                $this->load();
-               
+
                if( $this->mime === "image/svg" ) {
                        #Right now we have only SVG
-                       
+
                        global $wgSVGConverters, $wgSVGConverter;
                        if( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
                                global $wgSVGConverterPath;
@@ -1047,7 +1047,7 @@ class Image
                        $cmd  =  $wgImageMagickConvertCommand .
                                " -quality 85 -background white -size {$width} ".
                                wfEscapeShellArg($this->imagePath) . " -resize {$width}x{$height} " .
-                               wfEscapeShellArg($thumbPath);                           
+                               wfEscapeShellArg($thumbPath);
                        wfDebug("reallyRenderThumb: running ImageMagick: $cmd\n");
                        wfProfileIn( 'convert' );
                        $conv = wfShellExec( $cmd );
@@ -1071,7 +1071,7 @@ class Image
                                return $err;
                        }
                        list( $loader, $colorStyle, $saveType ) = $typemap[$this->mime];
-                       
+
                        if( !function_exists( $loader ) ) {
                                $err = "Incomplete GD library configuration: missing function $loader";
                                wfDebug( "$err\n" );
@@ -1084,7 +1084,7 @@ class Image
                        } elseif( $colorStyle == 'bits' ) {
                                $truecolor = ( $this->bits > 8 );
                        }
-                       
+
                        $src_image = call_user_func( $loader, $this->imagePath );
                        if ( $truecolor ) {
                                $dst_image = imagecreatetruecolor( $width, $height );
@@ -1098,7 +1098,7 @@ class Image
                        imagedestroy( $dst_image );
                        imagedestroy( $src_image );
                }
-               
+
                #
                # Check for zero-sized thumbnails. Those can be generated when
                # no disk space is available or some other error occurs
@@ -1115,7 +1115,7 @@ class Image
                imageinterlace( $dst_image );
                imagejpeg( $dst_image, $thumbPath, 95 );
        }
-               
+
        /**
         * Get all thumbnail names previously generated for this image
         */
@@ -1127,7 +1127,7 @@ class Image
 
                        // This generates an error on failure, hence the @
                        $handle = @opendir( $dir );
-                       
+
                        if ( $handle ) {
                                while ( false !== ( $file = readdir($handle) ) ) {
                                        if ( $file{0} != '.' ) {
@@ -1139,7 +1139,7 @@ class Image
                } else {
                        $files = array();
                }
-               
+
                return $files;
        }
 
@@ -1181,18 +1181,18 @@ class Image
                        wfPurgeSquidServers( $urls );
                }
        }
-       
+
        function checkDBSchema(&$db) {
                # img_name must be unique
                if ( !$db->indexUnique( 'image', 'img_name' ) && !$db->indexExists('image','PRIMARY') ) {
                        wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
                }
-               
+
                #new fields must exist
                if ( !$db->fieldExists( 'image', 'img_media_type' )
                  || !$db->fieldExists( 'image', 'img_metadata' )
                  || !$db->fieldExists( 'image', 'img_width' ) ) {
-               
+
                        wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/update.php' );
                }
        }
@@ -1210,9 +1210,9 @@ class Image
        function nextHistoryLine() {
                $fname = 'Image::nextHistoryLine()';
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                $this->checkDBSchema($dbr);
-               
+
                if ( $this->historyLine == 0 ) {// called for the first time, return line from cur
                        $this->historyRes = $dbr->select( 'image',
                                array(
@@ -1259,7 +1259,7 @@ class Image
        function resetHistory() {
                $this->historyLine = 0;
        }
-       
+
        /**
        * Return the full filesystem path to the file. Note that this does
        * not mean that a file actually exists under that location.
@@ -1276,13 +1276,13 @@ class Image
        */
        function getFullPath( $fromSharedRepository = false ) {
                global $wgUploadDirectory, $wgSharedUploadDirectory;
-               
+
                $dir      = $fromSharedRepository ? $wgSharedUploadDirectory :
                                                    $wgUploadDirectory;
-               
+
                // $wgSharedUploadDirectory may be false, if thumb.php is used
                if ( $dir ) {
-                       $fullpath = $dir . wfGetHashPath($this->name, $fromSharedRepository) . $this->name;             
+                       $fullpath = $dir . wfGetHashPath($this->name, $fromSharedRepository) . $this->name;
                } else {
                        $fullpath = false;
                }
@@ -1298,7 +1298,7 @@ class Image
                global $wgHashedUploadDirectory, $wgHashedSharedUploadDirectory;
                return $shared ? $wgHashedSharedUploadDirectory : $wgHashedUploadDirectory;
        }
-       
+
        /**
         * Record an image upload in the upload log and the image table
         */
@@ -1331,7 +1331,7 @@ class Image
                        if ( $license != '' ) {
                                $filedesc = $desc == '' ? '' : '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n";
                                 $textdesc = $filedesc .
-                                        '== ' . wfMsgForContent ( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";       
+                                        '== ' . wfMsgForContent ( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";
                        } else {
                                $textdesc = $desc;
                        }
@@ -1347,7 +1347,7 @@ class Image
                        $major= $this->mime;
                        $minor= "unknown";
                }
-               
+
                # Test to see if the row exists using INSERT IGNORE
                # This avoids race conditions by locking the row until the commit, and also
                # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
@@ -1390,7 +1390,7 @@ class Image
                                        'oi_user_text' => 'img_user_text',
                                ), array( 'img_name' => $this->name ), $fname
                        );
-                       
+
                        # Update the current image row
                        $dbw->update( 'image',
                                array( /* SET */
@@ -1416,13 +1416,13 @@ class Image
                $minor = false;
                $watch = $watch || $wgUser->isWatched( $descTitle );
                $suppressRC = true; // There's already a log entry, so don't double the RC load
-               
+
                if( $descTitle->exists() ) {
                        // TODO: insert a null revision into the page history for this update.
                        if( $watch ) {
                                $wgUser->addWatch( $descTitle );
                        }
-                       
+
                        # Invalidate the cache for the description page
                        $descTitle->invalidateCache();
                        $purgeURLs[] = $descTitle->getInternalURL();
@@ -1430,16 +1430,16 @@ class Image
                        // New image; create the description page.
                        $article->insertNewArticle( $textdesc, $desc, $minor, $watch, $suppressRC );
                }
-               
+
                # Invalidate cache for all pages using this image
                $linksTo = $this->getLinksTo();
-               
+
                if ( $wgUseSquid ) {
                        $u = SquidUpdate::newFromTitles( $linksTo, $purgeURLs );
                        array_push( $wgPostCommitUpdateList, $u );
                }
                Title::touchArray( $linksTo );
-               
+
                $log = new LogPage( 'upload' );
                $log->addEntry( 'upload', $descTitle, $desc );
 
@@ -1455,7 +1455,7 @@ class Image
        function getLinksTo( $options = '' ) {
                $fname = 'Image::getLinksTo';
                wfProfileIn( $fname );
-               
+
                if ( $options ) {
                        $db =& wfGetDB( DB_MASTER );
                } else {
@@ -1467,7 +1467,7 @@ class Image
                $encName = $db->addQuotes( $this->name );
                $sql = "SELECT page_namespace,page_title,page_id FROM $page,$imagelinks WHERE page_id=il_from AND il_to=$encName $options";
                $res = $db->query( $sql, $fname );
-               
+
                $retVal = array();
                if ( $db->numRows( $res ) ) {
                        while ( $row = $db->fetchObject( $res ) ) {
@@ -1496,18 +1496,18 @@ class Image
                $exif = new Exif( $this->imagePath );
                return $exif->getFilteredData();
        }
-               
+
        function getExifData() {
                global $wgRequest;
                if ( $this->metadata === '0' )
                        return array();
-               
+
                $purge = $wgRequest->getVal( 'action' ) == 'purge';
                $ret = unserialize( $this->metadata );
 
                $oldver = isset( $ret['MEDIAWIKI_EXIF_VERSION'] ) ? $ret['MEDIAWIKI_EXIF_VERSION'] : 0;
                $newver = Exif::version();
-               
+
                if ( !count( $ret ) || $purge || $oldver != $newver ) {
                        $this->purgeMetadataCache();
                        $this->updateExifData( $newver );
@@ -1515,16 +1515,16 @@ class Image
                if ( isset( $ret['MEDIAWIKI_EXIF_VERSION'] ) )
                        unset( $ret['MEDIAWIKI_EXIF_VERSION'] );
                $format = new FormatExif( $ret );
-               
+
                return $format->getFormattedData();
        }
 
        function updateExifData( $version ) {
                $fname = 'Image:updateExifData';
-               
+
                if ( $this->getImagePath() === false ) # Not a local image
                        return;
-               
+
                # Get EXIF data from image
                $exif = $this->retrieveExifData();
                if ( count( $exif ) ) {
@@ -1533,19 +1533,19 @@ class Image
                } else {
                        $this->metadata = '0';
                }
-               
+
                # Update EXIF data in database
                $dbw =& wfGetDB( DB_MASTER );
-               
+
                $this->checkDBSchema($dbw);
-               
+
                $dbw->update( 'image',
                        array( 'img_metadata' => $this->metadata ),
                        array( 'img_name' => $this->name ),
                        $fname
                );
        }
-       
+
        /**
         * Returns true if the image does not come from the shared
         * image repository.
@@ -1571,7 +1571,7 @@ class Image
  */
 function wfImageDir( $fname ) {
        global $wgUploadDirectory, $wgHashedUploadDirectory;
-       
+
        if (!$wgHashedUploadDirectory) { return $wgUploadDirectory; }
 
        $hash = md5( $fname );
@@ -1643,15 +1643,15 @@ function wfImageArchiveDir( $fname , $subdir='archive', $shared=false ) {
        global $wgUploadDirectory, $wgHashedUploadDirectory,
               $wgSharedUploadDirectory, $wgHashedSharedUploadDirectory;
        $dir = $shared ? $wgSharedUploadDirectory : $wgUploadDirectory;
-       $hashdir = $shared ? $wgHashedSharedUploadDirectory : $wgHashedUploadDirectory; 
+       $hashdir = $shared ? $wgHashedSharedUploadDirectory : $wgHashedUploadDirectory;
        if (!$hashdir) { return $dir.'/'.$subdir; }
        $hash = md5( $fname );
        $oldumask = umask(0);
-       
+
        # Suppress warning messages here; if the file itself can't
        # be written we'll worry about it then.
        wfSuppressWarnings();
-       
+
        $archive = $dir.'/'.$subdir;
        if ( ! is_dir( $archive ) ) { mkdir( $archive, 0777 ); }
        $archive .= '/' . $hash{0};
@@ -1742,13 +1742,13 @@ function wfScaleSVGUnit( $length ) {
 function wfGetSVGsize( $filename ) {
        $width = 256;
        $height = 256;
-       
+
        // Read a chunk of the file
        $f = fopen( $filename, "rt" );
        if( !$f ) return false;
        $chunk = fread( $f, 4096 );
        fclose( $f );
-       
+
        // Uber-crappy hack! Run through a real XML parser.
        if( !preg_match( '/<svg\s*([^>]*)\s*>/s', $chunk, $matches ) ) {
                return false;
@@ -1760,7 +1760,7 @@ function wfGetSVGsize( $filename ) {
        if( preg_match( '/\bheight\s*=\s*("[^"]+"|\'[^\']+\')/s', $tag, $matches ) ) {
                $height = wfScaleSVGUnit( trim( substr( $matches[1], 1, -1 ) ) );
        }
-       
+
        return array( $width, $height, 'SVG',
                "width=\"$width\" height=\"$height\"" );
 }
@@ -1813,11 +1813,11 @@ class ThumbnailImage {
 
        /**
         * @return string The thumbnail URL
-        */     
+        */
        function getUrl() {
                return $this->url;
        }
-       
+
        /**
         * Return HTML <img ... /> tag for the thumbnail, will include
         * width and height attributes and a blank alt text (as required).
index e934091..a65b40d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 if ( ! defined( 'MEDIAWIKI' ) )
        die();
-       
+
 /**
  * @package MediaWiki
  */
@@ -120,7 +120,7 @@ class ImageGallery
                        } else {
                                $nb = '';
                        }
-                               
+
                        $textlink = $this->mShowFilename ?
                                $sk->makeKnownLinkObj( $nt, htmlspecialchars( $wgLang->truncate( $nt->getText(), 20, '...' ) ) ) . "<br />\n" :
                                '' ;
@@ -129,7 +129,7 @@ class ImageGallery
                        $thumb = $img->getThumbnail( 120, 120 );
                        $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
                        $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
-                       
+
                        # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
                        # in version 4.8.6 generated crackpot html in its absence, see:
                        # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
index 660e83d..8d58285 100644 (file)
@@ -126,7 +126,7 @@ class ImagePage extends Article {
                $r .= '|}';
                return $r;
        }
-       
+
        /**
         * Get a list of EXIF metadata items which should be displayed when
         * the metadata table is collapsed.
@@ -242,7 +242,7 @@ class ImagePage extends Article {
                                        $icon->toHtml() .
                                        '</a></div>' );
                                }
-                               
+
                                $showLink = true;
                        }
 
@@ -252,7 +252,7 @@ class ImagePage extends Article {
                                $info = wfMsg( 'fileinfo',
                                        ceil($this->img->getSize()/1024.0),
                                        $this->img->getMimeType() );
-       
+
                                if (!$this->img->isSafeFile()) {
                                        $warning = wfMsg( 'mediawarning' );
                                        $wgOut->addWikiText( <<<END
@@ -329,7 +329,7 @@ END
 
                $sk = $wgUser->getSkin();
                $wgOut->addHTML( '<br /><ul>' );
-               if( $wgUser->isAllowed( 'reupload' ) ) {        
+               if( $wgUser->isAllowed( 'reupload' ) ) {
                        $wgOut->addWikiText( "<li>\n<div>". wfMsg( 'uploadnewversion', $this->getUploadUrl() ) ."</div>\n</li>\n" );
                }
                $wgOut->addHTML( '<li>' );
@@ -470,7 +470,7 @@ END
        function doDelete()     {
                global $wgOut, $wgUser, $wgRequest, $wgUseSquid, $wgInternalServer;
                global $wgPostCommitUpdateList;
-               
+
                $fname = 'ImagePage::doDelete';
 
                $reason = $wgRequest->getVal( 'wpReason' );
index 5a5df29..a2cbcc9 100644 (file)
@@ -18,7 +18,7 @@ class Licenses {
         * @var string
         */
        var $msg;
-       
+
        /**
         * @var array
         */
@@ -29,7 +29,7 @@ class Licenses {
         */
        var $html;
        /**#@-*/
-       
+
        /**
         * Constrictor
         *
@@ -45,20 +45,20 @@ class Licenses {
                $tmp = $this->getLicenses();
                $this->makeHtml( $tmp );
        }
-       
+
        /**#@+
         * @access private
         */
        function makeLicenses() {
                $levels = array();
                $lines = explode( "\n", $this->msg );
-               
+
                foreach ( $lines as $line ) {
                        if ( strpos( $line, '*' ) !== 0 )
                                continue;
                        else {
                                list( $level, $line ) = $this->trimStars( $line );
-                               
+
                                if ( strpos( $line, '|' ) !== false ) {
                                        $obj = new License( $line );
                                        $this->stackItem( $this->licenses, $levels, $obj );
@@ -73,18 +73,18 @@ class Licenses {
                        }
                }
        }
-       
+
        function trimStars( $str ) {
                $i = $count = 0;
-               
+
                wfSuppressWarnings();
                while ($str[$i++] == '*')
                        ++$count;
                wfRestoreWarnings();
-       
+
                return array( $count, ltrim( $str, '* ' ) );
        }
-       
+
        function stackItem( &$list, $path, $item ) {
                $position =& $list;
                if ( $path )
@@ -122,14 +122,14 @@ class Licenses {
                $val = str_repeat( /* &nbsp */ "\xc2\xa0", $depth * 2 ) . $val;
                return str_repeat( "\t", $depth ) . wfElement( 'option', $attribs, $val ) . "\n";
        }
-       
+
        function msg( $str ) {
                $out = wfMsg( $str );
                return wfEmptyMsg( $str, $out ) ? $str : $out;
        }
-       
+
        /**#@-*/
-       
+
        /**
         *  Accessor for $this->licenses
         *
@@ -150,7 +150,7 @@ class License {
         * @var string
         */
        var $template;
-       
+
        /**
         * @var string
         */
@@ -163,7 +163,7 @@ class License {
         */
        function License( $str ) {
                list( $text, $template ) = explode( '|', strrev( $str ), 2 );
-               
+
                $this->template = strrev( $template );
                $this->text = strrev( $text );
        }
index 3c0eb1e..fed9359 100644 (file)
@@ -45,7 +45,7 @@ class LinkBatch {
        function setArray( $array ) {
                $this->data = $array;
        }
-       
+
        /**
         * Do the query and add the results to the LinkCache object
         * Return an array mapping PDBK to ID
index f262110..33447c3 100644 (file)
@@ -88,7 +88,7 @@ class LinkCache {
        function getPageLinks() { return $this->mPageLinks; }
        function getGoodLinks() { return $this->mGoodLinks; }
        function getBadLinks() { return array_keys( $this->mBadLinks ); }
-       
+
        /**
         * Add a title to the link cache, return the page_id or zero if non-existent
         * @param string $title Title to add
@@ -102,7 +102,7 @@ class LinkCache {
                        return 0;
                }
        }
-       
+
        /**
         * Add a title to the link cache, return the page_id or zero if non-existent
         * @param Title $nt Title to add
index c331ccc..bfe45eb 100644 (file)
@@ -174,7 +174,7 @@ class Linker {
                        }
 
                        $t = "<a href=\"{$u}\"{$style}>{$text}{$inside}</a>";
-                               
+
                        wfProfileOut( $fname );
                        return $t;
                } elseif ( $nt->isAlwaysKnown() ) {
@@ -238,7 +238,7 @@ class Linker {
                        wfProfileOut( $fname );
                        return $text;
                }
-               
+
                $u = $nt->escapeLocalURL( $query );
                if ( '' != $nt->getFragment() ) {
                        if( $nt->getPrefixedDbkey() == '' ) {
@@ -260,7 +260,7 @@ class Linker {
                $style = $this->getInternalLinkAttributesObj( $nt, $text );
 
                if ( $aprops !== '' ) $aprops = ' ' . $aprops;
-               
+
                list( $inside, $trail ) = Linker::splitTrail( $trail );
                $r = "<a href=\"{$u}\"{$style}{$aprops}>{$prefix}{$text}{$inside}</a>{$trail}";
                wfProfileOut( $fname );
@@ -291,7 +291,7 @@ class Linker {
                        $text = htmlspecialchars( $nt->getPrefixedText() );
                }
                $style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
-               
+
                list( $inside, $trail ) = Linker::splitTrail( $trail );
                $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
 
@@ -379,7 +379,7 @@ class Linker {
          $thumb = false, $manual_thumb = '' )
        {
                global $wgContLang, $wgUser, $wgThumbLimits;
-               
+
                $img   = new Image( $nt );
                if ( !$img->allowInlineDisplay() ) {
                        return $this->makeKnownLinkObj( $nt );
@@ -387,9 +387,9 @@ class Linker {
 
                $url   = $img->getViewURL();
                $prefix = $postfix = '';
-               
+
                wfDebug( "makeImageLinkObj: '$width'x'$height'\n" );
-               
+
                if ( 'center' == $align )
                {
                        $prefix  = '<div class="center">';
@@ -410,17 +410,17 @@ class Linker {
                                $align = $wgContLang->isRTL() ? 'left' : 'right';
                        }
 
-                       
+
                        if ( $width === false ) {
                                $wopt = $wgUser->getOption( 'thumbsize' );
 
                                if( !isset( $wgThumbLimits[$wopt] ) ) {
                                         $wopt = User::getDefaultOption( 'thumbsize' );
                                }
-                               
+
                                $width = min( $img->getWidth(), $wgThumbLimits[$wopt] );
                        }
-                       
+
                        return $prefix.$this->makeThumbLinkObj( $img, $label, $alt, $align, $width, $height, $framed, $manual_thumb ).$postfix;
                }
 
@@ -559,7 +559,7 @@ class Linker {
                $s .= '  <div class="thumbcaption" '.$textalign.'>'.$zoomicon.$label."</div></div></div>";
                return str_replace("\n", ' ', $s);
        }
-       
+
        /**
         * Pass a title object, not a title string
         */
@@ -590,7 +590,7 @@ class Linker {
                wfProfileOut( $fname );
                return $s;
        }
-       
+
        /** @todo document */
        function makeMediaLink( $name, /* wtf?! */ $url, $alt = '' ) {
                $nt = Title::makeTitleSafe( NS_IMAGE, $name );
@@ -614,7 +614,7 @@ class Linker {
                        ### HOTFIX. Instead of breaking, return empty string.
                        return $text;
                } else {
-                       $name = $title->getDBKey();     
+                       $name = $title->getDBKey();
                        $img  = new Image( $title );
                        if( $img->exists() ) {
                                $url  = $img->getURL();
@@ -629,7 +629,7 @@ class Linker {
                                $text = $alt;
                        }
                        $u = htmlspecialchars( $url );
-                       return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";                  
+                       return "<a href=\"{$u}\" class='$class' title=\"{$alt}\">{$text}</a>";
                }
        }
 
@@ -674,7 +674,7 @@ class Linker {
        function formatComment($comment, $title = NULL) {
                $fname = 'Linker::formatComment';
                wfProfileIn( $fname );
-               
+
                global $wgContLang;
                $comment = str_replace( "\n", " ", $comment );
                $comment = htmlspecialchars( $comment );
@@ -738,7 +738,7 @@ class Linker {
                wfProfileOut( $fname );
                return $comment;
        }
-       
+
        /**
         * Wrap a comment in standard punctuation and formatting if
         * it's non-empty, otherwise return empty string.
index 826c1c9..be61ebd 100644 (file)
@@ -39,7 +39,7 @@ class LinksUpdate {
                        $this->mOptions = array( 'FOR UPDATE' );
                }
                $this->mDb =& wfGetDB( DB_MASTER );
-                       
+
                if ( !is_object( $title ) ) {
                        wfDebugDieBacktrace( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
                                "Please see Article::editUpdates() for an invocation example.\n" );
@@ -53,7 +53,7 @@ class LinksUpdate {
                $this->mImages =& $this->mParserOutput->getImages();
                $this->mTemplates =& $this->mParserOutput->getTemplates();
                $this->mCategories =& $this->mParserOutput->getCategories();
-               
+
        }
 
        /**
@@ -91,13 +91,13 @@ class LinksUpdate {
                $existing = $this->getExistingCategories();
                $this->incrTableUpdate( 'categorylinks', 'cl', $this->getCategoryDeletions( $existing ),
                        $this->getCategoryInsertions( $existing ) );
-               
+
                # I think this works out to a set XOR operation, the idea is to invalidate all
                # categories which were added, deleted or changed
                # FIXME: surely there's a more appropriate place to put this update?
                $categoryUpdates = array_diff_assoc( $existing, $this->mCategories ) + array_diff_assoc( $this->mCategories, $existing );
                $this->invalidateCategories( $categoryUpdates );
-               
+
                wfProfileOut( $fname );
        }
 
@@ -112,7 +112,7 @@ class LinksUpdate {
 
                $existing = $this->getExistingCategories();
                $categoryUpdates = array_diff_assoc( $existing, $this->mCategories ) + array_diff_assoc( $this->mCategories, $existing );
-               
+
                $this->dumbTableUpdate( 'pagelinks',     $this->getLinkInsertions(),     'pl_from' );
                $this->dumbTableUpdate( 'imagelinks',    $this->getImageInsertions(),    'il_from' );
                $this->dumbTableUpdate( 'categorylinks', $this->getCategoryInsertions(), 'cl_from' );
@@ -120,7 +120,7 @@ class LinksUpdate {
 
                # Update the cache of all the category pages
                $this->invalidateCategories( $categoryUpdates );
-               
+
                wfProfileOut( $fname );
        }
 
@@ -134,7 +134,7 @@ class LinksUpdate {
                                ), $fname
                        );
                }
-       }       
+       }
 
        function dumbTableUpdate( $table, $insertions, $fromField ) {
                $fname = 'LinksUpdate::dumbTableUpdate';
@@ -308,7 +308,7 @@ class LinksUpdate {
        function getImageDeletions( $existing ) {
                return array_diff_key( $existing, $this->mImages );
        }
-       
+
        /**
         * Given an array of existing categories, returns those categories which are not in $this
         * and thus should be deleted.
index 13383a6..e5bdb26 100644 (file)
@@ -228,7 +228,7 @@ class LoadBalancer {
                                        $this->mErrorConnection = false;
                                        $this->mLastError = 'All servers busy';
                                }
-                               
+
                                if ( $i !== false && $this->isOpen( $i ) ) {
                                        # Wait for the session master pos for a short time
                                        if ( $this->mWaitForFile ) {
@@ -595,7 +595,7 @@ class LoadBalancer {
         */
        function getLagTimes() {
                global $wgDBname;
-               
+
                $expiry = 5;
                $requestRate = 10;
 
index d6df646..01695e0 100644 (file)
@@ -118,7 +118,7 @@ class LogPage {
                        'move'    => 'movelogpage'
                );
                wfRunHooks( 'LogPageLogName', array( &$typeText ) );
-               
+
                return str_replace( '_', ' ', wfMsg( $typeText[$type] ) );
        }
 
@@ -136,7 +136,7 @@ class LogPage {
                        'move'    => 'movelogpagetext'
                );
                wfRunHooks( 'LogPageLogHeader', array( &$headerText ) );
-               
+
                return wfMsg( $headerText[$type] );
        }
 
@@ -150,13 +150,13 @@ class LogPage {
                        'block/unblock'     => 'unblocklogentry',
                        'protect/protect'   => 'protectedarticle',
                        'protect/unprotect' => 'unprotectedarticle',
-                       
+
                        // TODO: This whole section should be moved to extensions/Makesysop/SpecialMakesysop.php
                        'rights/rights'     => 'bureaucratlogentry',
                        'rights/addgroup'   => 'addgrouplogentry',
                        'rights/rngroup'    => 'renamegrouplogentry',
                        'rights/chgroup'    => 'changegrouplogentry',
-                       
+
                        'delete/delete'     => 'deletedarticle',
                        'delete/restore'    => 'undeletedarticle',
                        'upload/upload'     => 'uploadedimage',
index 4102944..0217c24 100644 (file)
@@ -31,7 +31,7 @@ class MacBinary {
                $this->open( $filename );
                $this->loadHeader();
        }
-       
+
        /**
         * The file must be seekable, such as local filesystem.
         * Remote URLs probably won't work.
@@ -46,7 +46,7 @@ class MacBinary {
                $this->resourceLength = 0;
                $this->handle = fopen( $filename, 'rb' );
        }
-       
+
        /**
         * Does this appear to be a valid MacBinary archive?
         * @return bool
@@ -54,7 +54,7 @@ class MacBinary {
        function isValid() {
                return $this->valid;
        }
-       
+
        /**
         * Get length of data fork
         * @return int
@@ -62,7 +62,7 @@ class MacBinary {
        function dataForkLength() {
                return $this->dataLength;
        }
-       
+
        /**
         * Copy the data fork to an external file or resource.
         * @param resource $destination
@@ -72,21 +72,21 @@ class MacBinary {
                if( !$this->isValid() ) {
                        return false;
                }
-               
+
                // Data fork appears immediately after header
                fseek( $this->handle, 128 );
                return $this->copyBytesTo( $destination, $this->dataLength );
        }
-       
+
        /**
         *
         */
        function close() {
                fclose( $this->handle );
        }
-       
+
        // --------------------------------------------------------------
-       
+
        /**
         * Check if the given file appears to be MacBinary-encoded,
         * as Internet Explorer on Mac OS may provide for unknown types.
@@ -98,21 +98,21 @@ class MacBinary {
         */
        function loadHeader() {
                $fname = 'MacBinary::loadHeader';
-               
+
                fseek( $this->handle, 0 );
                $head = fread( $this->handle, 128 );
                $this->hexdump( $head );
-               
+
                if( strlen( $head ) < 128 ) {
                        wfDebug( "$fname: couldn't read full MacBinary header\n" );
                        return false;
                }
-               
+
                if( $head{0} != "\x00" || $head{74} != "\x00" ) {
                        wfDebug( "$fname: header bytes 0 and 74 not null\n" );
                        return false;
                }
-               
+
                $signature = substr( $head, 102, 4 );
                $a = unpack( "ncrc", substr( $head, 124, 2 ) );
                $storedCRC = $a['crc'];
@@ -139,34 +139,34 @@ class MacBinary {
                                return false;
                        }
                }
-               
+
                $nameLength = ord( $head{1} );
                if( $nameLength < 1 || $nameLength > 63 ) {
                        wfDebug( "$fname: invalid filename size $nameLength\n" );
                        return false;
                }
                $this->filename = substr( $head, 2, $nameLength );
-               
+
                $forks = unpack( "Ndata/Nresource", substr( $head, 83, 8 ) );
                $this->dataLength = $forks['data'];
                $this->resourceLength = $forks['resource'];
                $maxForkLength = 0x7fffff;
-               
+
                if( $this->dataLength < 0 || $this->dataLength > $maxForkLength ) {
                        wfDebug( "$fname: invalid data fork length $this->dataLength\n" );
                        return false;
                }
-               
+
                if( $this->resourceLength < 0 || $this->resourceLength > $maxForkLength ) {
                        wfDebug( "$fname: invalid resource fork size $this->resourceLength\n" );
                        return false;
                }
-               
+
                wfDebug( "$fname: appears to be MacBinary $this->version, data length $this->dataLength\n" );
                $this->valid = true;
                return true;
        }
-       
+
        /**
         * Calculate a 16-bit CRC value as for MacBinary headers.
         * Adapted from perl5 Convert::BinHex by Eryq,
@@ -225,7 +225,7 @@ class MacBinary {
                }
                return $crc;
        }
-       
+
        /**
         * @param resource $destination
         * @param int $bytesToCopy
@@ -240,7 +240,7 @@ class MacBinary {
                        fwrite( $destination, $buffer );
                }
        }
-       
+
        /**
         * Hex dump of the header for debugging
         * @access private
@@ -248,7 +248,7 @@ class MacBinary {
        function hexdump( $data ) {
                global $wgDebugLogFile;
                if( !$wgDebugLogFile ) return;
-               
+
                $width = 16;
                $at = 0;
                for( $remaining = strlen( $data ); $remaining > 0; $remaining -= $width ) {
index b9bd933..463f763 100644 (file)
@@ -123,7 +123,7 @@ class MagicWord {
         */
        var $mId, $mSynonyms, $mCaseSensitive, $mRegex;
        var $mRegexStart, $mBaseRegex, $mVariableRegex;
-       var $mModified; 
+       var $mModified;
        /**#@-*/
 
        function MagicWord($id = 0, $syn = '', $cs = false) {
@@ -143,7 +143,7 @@ class MagicWord {
         */
        function &get( $id ) {
                global $wgMagicWords;
-               
+
                if ( !is_array( $wgMagicWords ) ) {
                        wfDebugDieBacktrace( "Incorrect initialisation order, \$wgMagicWords does not exist\n" );
                }
@@ -154,14 +154,14 @@ class MagicWord {
                }
                return $wgMagicWords[$id];
        }
-       
+
        # Initialises this object with an ID
        function load( $id ) {
-               global $wgContLang;             
+               global $wgContLang;
                $this->mId = $id;
                $wgContLang->getMagic( $this );
        }
-       
+
        /**
         * Preliminary initialisation
         * @access private
@@ -180,7 +180,7 @@ class MagicWord {
                $this->mVariableStartToEndRegex = str_replace( "\\$1", "(.*?)",
                        "/^(?:{$this->mBaseRegex})$/{$case}" );
        }
-       
+
        /**
         * Gets a regex representing matching the word
         */
@@ -210,7 +210,7 @@ class MagicWord {
                }
                return $this->mBaseRegex;
        }
-               
+
        /**
         * Returns true if the text contains the word
         * @return bool
@@ -265,7 +265,7 @@ class MagicWord {
                $wgMagicFound = false;
                $text = preg_replace_callback( $this->getRegexStart(), 'pregRemoveAndRecord', $text );
                return $wgMagicFound;
-       }               
+       }
 
 
        /**
index 416b7c9..f682755 100644 (file)
@@ -21,11 +21,11 @@ class MathRenderer {
        var $html = '';
        var $mathml = '';
        var $conservativeness = 0;
-       
+
        function MathRenderer( $tex ) {
                $this->tex = $tex;
        }
-       
+
        function setOutputMode( $mode ) {
                $this->mode = $mode;
        }
@@ -34,12 +34,12 @@ class MathRenderer {
                global $wgTmpDirectory, $wgInputEncoding;
                global $wgTexvc;
                $fname = 'MathRenderer::render';
-       
+
                if( $this->mode == MW_MATH_SOURCE ) {
                        # No need to render or parse anything more!
                        return ('$ '.htmlspecialchars( $this->tex ).' $');
                }
-               
+
                if( !$this->_recall() ) {
                        # Ensure that the temp and output directories are available before continuing...
                        if( !file_exists( $wgTmpDirectory ) ) {
@@ -49,7 +49,7 @@ class MathRenderer {
                        } elseif( !is_dir( $wgTmpDirectory ) || !is_writable( $wgTmpDirectory ) ) {
                                return $this->_error( 'math_bad_tmpdir' );
                        }
-                       
+
                        if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) {
                                return $this->_error( 'math_notexvc' );
                        }
@@ -58,7 +58,7 @@ class MathRenderer {
                                        escapeshellarg( $wgTmpDirectory ).' '.
                                        escapeshellarg( $this->tex ).' '.
                                        escapeshellarg( $wgInputEncoding );
-                                       
+
                        if ( wfIsWindows() ) {
                                # Invoke it within cygwin sh, because texvc expects sh features in its default shell
                                $cmd = 'sh -c ' . wfEscapeShellArg( $cmd );
@@ -67,11 +67,11 @@ class MathRenderer {
                        wfDebug( "TeX: $cmd\n" );
                        $contents = `$cmd`;
                        wfDebug( "TeX output:\n $contents\n---\n" );
-               
+
                        if (strlen($contents) == 0) {
                                return $this->_error( 'math_unknown_error' );
                        }
-                       
+
                        $retval = substr ($contents, 0, 1);
                        if (($retval == 'C') || ($retval == 'M') || ($retval == 'L')) {
                                if ($retval == 'C')
@@ -81,9 +81,9 @@ class MathRenderer {
                                else
                                        $this->conservativeness = 0;
                                $outdata = substr ($contents, 33);
-               
+
                                $i = strpos($outdata, "\000");
-               
+
                                $this->html = substr($outdata, 0, $i);
                                $this->mathml = substr($outdata, $i+1);
                        } else if (($retval == 'c') || ($retval == 'm') || ($retval == 'l'))  {
@@ -112,16 +112,16 @@ class MathRenderer {
                                        default:  return $this->_error( 'math_unknown_error', $errbit );
                                }
                        }
-               
+
                        $this->hash = substr ($contents, 1, 32);
                        if (!preg_match("/^[a-f0-9]{32}$/", $this->hash)) {
                                return $this->_error( 'math_unknown_error' );
                        }
-               
+
                        if( !file_exists( "$wgTmpDirectory/{$this->hash}.png" ) ) {
                                return $this->_error( 'math_image_error' );
                        }
-                       
+
                        $hashpath = $this->_getHashPath();
                        if( !file_exists( $hashpath ) ) {
                                if( !@wfMkdirParents( $hashpath, 0755 ) ) {
@@ -130,17 +130,17 @@ class MathRenderer {
                        } elseif( !is_dir( $hashpath ) || !is_writable( $hashpath ) ) {
                                return $this->_error( 'math_bad_output' );
                        }
-                       
+
                        if( !rename( "$wgTmpDirectory/{$this->hash}.png", "$hashpath/{$this->hash}.png" ) ) {
                                return $this->_error( 'math_output_error' );
                        }
-                       
+
                        # Now save it back to the DB:
                        if ( !wfReadOnly() ) {
                                $outmd5_sql = pack('H32', $this->hash);
-                       
+
                                $md5_sql = pack('H32', $this->md5); # Binary packed, not hex
-                               
+
                                $dbw =& wfGetDB( DB_MASTER );
                                $dbw->replace( 'math', array( 'math_inputhash' ),
                                  array(
@@ -152,12 +152,12 @@ class MathRenderer {
                                  ), $fname, array( 'IGNORE' )
                                );
                        }
-                       
+
                }
-               
+
                return $this->_doRender();
        }
-       
+
        function _error( $msg, $append = '' ) {
                $mf   = htmlspecialchars( wfMsg( 'math_failure' ) );
                $munk = htmlspecialchars( wfMsg( 'math_unknown_error' ) );
@@ -165,7 +165,7 @@ class MathRenderer {
                $source = htmlspecialchars($this->tex);
                return "<strong class='error'>$mf ($errmsg$append): $source</strong>\n";
        }
-       
+
        function _recall() {
                global $wgMathDirectory;
                $fname = 'MathRenderer::_recall';
@@ -182,11 +182,11 @@ class MathRenderer {
                        # Tailing 0x20s can get dropped by the database, add it back on if necessary:
                        $xhash = unpack( 'H32md5', $rpage->math_outputhash . "                " );
                        $this->hash = $xhash ['md5'];
-                       
+
                        $this->conservativeness = $rpage->math_html_conservativeness;
                        $this->html = $rpage->math_html;
                        $this->mathml = $rpage->math_mathml;
-                       
+
                        if( file_exists( $this->_getHashPath() . "/{$this->hash}.png" ) ) {
                                return true;
                        }
@@ -209,9 +209,9 @@ class MathRenderer {
                                                        $hashpath . "/{$this->hash}.png" );
                                }
                        }
-                               
+
                }
-               
+
                # Missing from the database and/or the render cache
                return false;
        }
index 729a317..de8fd95 100755 (executable)
@@ -67,7 +67,7 @@ class MessageCache {
                if ( $wgLocalMessageCache === false ) {
                        return;
                }
-               
+
                $filename = "$wgLocalMessageCache/messages-$wgDBname";
 
                wfSuppressWarnings();
@@ -96,7 +96,7 @@ class MessageCache {
                if ( $wgLocalMessageCache === false ) {
                        return;
                }
-               
+
                $filename = "$wgLocalMessageCache/messages-$wgDBname";
                $oldUmask = umask( 0 );
                wfMkdirParents( $wgLocalMessageCache, 0777 );
@@ -228,7 +228,7 @@ class MessageCache {
         */
        function loadFromDB() {
                global $wgAllMessagesEn, $wgLang;
-               
+
                $fname = 'MessageCache::loadFromDB';
                $dbr =& wfGetDB( DB_SLAVE );
                if ( !$dbr ) {
@@ -261,7 +261,7 @@ class MessageCache {
                        if ( !array_key_exists( $uckey, $this->mCache ) ) {
                                $this->mCache[$uckey] = false;
                        }
-               }       
+               }
 
                $dbr->freeResult( $res );
        }
@@ -296,7 +296,7 @@ class MessageCache {
                if ( is_array( $this->mCache ) ) {
                        $this->mCache[$title] = $text;
                        $this->mMemc->set( $this->mMemcKey, $this->mCache, $this->mExpiry );
-                       
+
                        # Save to local cache
                        if ( $wgLocalMessageCache !== false ) {
                                $serialized = serialize( $this->mCache );
index d335928..0845b41 100644 (file)
@@ -76,25 +76,25 @@ if ($wgLoadFileinfoExtension) {
 * @package MediaWiki
 */
 class MimeMagic {
-       
+
        /**
        * Mapping of media types to arrays of mime types.
        * This is used by findMediaType and getMediaType, respectively
        */
        var $mMediaTypes= NULL;
-       
+
        /** Map of mime type aliases
        */
        var $mMimeTypeAliases= NULL;
-       
+
        /** map of mime types to file extensions (as a space seprarated list)
        */
        var $mMimeToExt= NULL;
-       
+
        /** map of file extensions types to mime types (as a space seprarated list)
        */
        var $mExtToMime= NULL;
-       
+
        /** Initializes the MimeMagic object. This is called by wfGetMimeMagic when instantiation
        * the global MimeMagic singleton object.
        *
@@ -104,116 +104,116 @@ class MimeMagic {
                /*
                *   --- load mime.types ---
                */
-               
+
                global $wgMimeTypeFile;
-               
+
                $types= MM_WELL_KNOWN_MIME_TYPES;
-               
+
                if ($wgMimeTypeFile) {
                        if (is_file($wgMimeTypeFile) and is_readable($wgMimeTypeFile)) {
                                wfDebug("MimeMagic::MimeMagic: loading mime types from $wgMimeTypeFile\n");
-                       
+
                                $types.= "\n";
                                $types.= file_get_contents($wgMimeTypeFile);
                        }
                        else wfDebug("MimeMagic::MimeMagic: can't load mime types from $wgMimeTypeFile\n");
                }
                else wfDebug("MimeMagic::MimeMagic: no mime types file defined, using build-ins only.\n");
-               
+
                $types= str_replace(array("\r\n","\n\r","\n\n","\r\r","\r"),"\n",$types);
                $types= str_replace("\t"," ",$types);
-               
+
                $this->mMimeToExt= array();
                $this->mToMime= array();
-               
+
                $lines= explode("\n",$types);
                foreach ($lines as $s) {
                        $s= trim($s);
                        if (empty($s)) continue;
                        if (strpos($s,'#')===0) continue;
-                       
+
                        $s= strtolower($s);
                        $i= strpos($s,' ');
-                       
+
                        if ($i===false) continue;
-                       
+
                        #print "processing MIME line $s<br>";
-                       
+
                        $mime= substr($s,0,$i);
                        $ext= trim(substr($s,$i+1));
-                       
+
                        if (empty($ext)) continue;
-                       
+
                        if (@$this->mMimeToExt[$mime]) $this->mMimeToExt[$mime] .= ' '.$ext;
                        else $this->mMimeToExt[$mime]= $ext;
-                       
+
                        $extensions= explode(' ',$ext);
-                       
+
                        foreach ($extensions as $e) {
                                $e= trim($e);
                                if (empty($e)) continue;
-                               
+
                                if (@$this->mExtToMime[$e]) $this->mExtToMime[$e] .= ' '.$mime;
                                else $this->mExtToMime[$e]= $mime;
                        }
                }
-       
+
                /*
                *   --- load mime.info ---
                */
-               
+
                global $wgMimeInfoFile;
-               
+
                $info= MM_WELL_KNOWN_MIME_INFO;
-               
+
                if ($wgMimeInfoFile) {
                        if (is_file($wgMimeInfoFile) and is_readable($wgMimeInfoFile)) {
                                wfDebug("MimeMagic::MimeMagic: loading mime info from $wgMimeInfoFile\n");
-                       
+
                                $info.= "\n";
                                $info.= file_get_contents($wgMimeInfoFile);
                        }
                        else wfDebug("MimeMagic::MimeMagic: can't load mime info from $wgMimeInfoFile\n");
                }
                else wfDebug("MimeMagic::MimeMagic: no mime info file defined, using build-ins only.\n");
-               
+
                $info= str_replace(array("\r\n","\n\r","\n\n","\r\r","\r"),"\n",$info);
                $info= str_replace("\t"," ",$info);
-               
+
                $this->mMimeTypeAliases= array();
                $this->mMediaTypes= array();
-               
+
                $lines= explode("\n",$info);
                foreach ($lines as $s) {
                        $s= trim($s);
                        if (empty($s)) continue;
                        if (strpos($s,'#')===0) continue;
-                       
+
                        $s= strtolower($s);
                        $i= strpos($s,' ');
-                       
+
                        if ($i===false) continue;
-                       
+
                        #print "processing MIME INFO line $s<br>";
-                       
+
                        $match= array();
                        if (preg_match('!\[\s*(\w+)\s*\]!',$s,$match)) {
                                $s= preg_replace('!\[\s*(\w+)\s*\]!','',$s);
                                $mtype= trim(strtoupper($match[1]));
                        }
                        else $mtype= MEDIATYPE_UNKNOWN;
-                       
+
                        $m= explode(' ',$s);
-                       
+
                        if (!isset($this->mMediaTypes[$mtype])) $this->mMediaTypes[$mtype]= array();
-                       
+
                        foreach ($m as $mime) {
                                $mime= trim($mime);
                                if (empty($mime)) continue;
-                               
+
                                $this->mMediaTypes[$mtype][]= $mime;
                        }
-                       
+
                        if (sizeof($m)>1) {
                                $main= $m[0];
                                for ($i=1; $i<sizeof($m); $i+= 1) {
@@ -222,70 +222,70 @@ class MimeMagic {
                                }
                        }
                }
-               
+
        }
-       
+
        /** returns a list of file extensions for a given mime type
        * as a space separated string.
        */
        function getExtensionsForType($mime) {
                $mime= strtolower($mime);
-               
+
                $r= @$this->mMimeToExt[$mime];
-               
+
                if (@!$r and isset($this->mMimeTypeAliases[$mime])) {
                        $mime= $this->mMimeTypeAliases[$mime];
                        $r= @$this->mMimeToExt[$mime];
                }
-               
+
                return $r;
        }
-       
+
        /** returns a list of mime types for a given file extension
        * as a space separated string.
        */
        function getTypesForExtension($ext) {
                $ext= strtolower($ext);
-               
+
                $r= @$this->mExtToMime[$ext];
                return $r;
        }
-       
+
        /** returns a single mime type for a given file extension.
        * This is always the first type from the list returned by getTypesForExtension($ext).
        */
        function guessTypesForExtension($ext) {
                $m= $this->getTypesForExtension( $ext );
                if( is_null($m) ) return NULL;
-               
+
                $m= trim( $m );
                $m= preg_replace('/\s.*$/','',$m);
-               
+
                return $m;
        }
-       
-       
+
+
        /** tests if the extension matches the given mime type.
        * returns true if a match was found, NULL if the mime type is unknown,
        * and false if the mime type is known but no matches where found.
        */
        function isMatchingExtension($extension,$mime) {
                $ext= $this->getExtensionsForType($mime);
-               
+
                if (!$ext) {
                        return NULL;  //unknown
                }
-               
+
                $ext= explode(' ',$ext);
-               
+
                $extension= strtolower($extension);
                if (in_array($extension,$ext)) {
                        return true;
                }
-               
+
                return false;
        }
-       
+
        /** returns true if the mime type is known to represent
        * an image format supported by the PHP GD library.
        */
@@ -300,10 +300,10 @@ class MimeMagic {
                        'image/x-photoshop',
                        'application/x-shockwave-flash',
                );
-               
+
                return in_array( $mime, $types );
        }
-       
+
        /**
         * Returns true if the extension represents a type which can
         * be reliably detected from its content. Use this to determine
@@ -324,8 +324,8 @@ class MimeMagic {
                );
                return in_array( strtolower( $extension ), $types );
        }
-       
-       
+
+
        /** mime type detection. This uses detectMimeType to detect the mim type of the file,
        * but applies additional checks to determine some well known file formats that may be missed
        * or misinterpreter by the default mime detection (namely xml based formats like XHTML or SVG).
@@ -338,13 +338,13 @@ class MimeMagic {
        function guessMimeType( $file, $useExt=true ) {
                $fname = 'MimeMagic::guessMimeType';
                $mime= $this->detectMimeType($file,$useExt);
-               
+
                // Read a chunk of the file
                $f = fopen( $file, "rt" );
                if( !$f ) return "unknown/unknown";
                $head = fread( $f, 1024 );
                fclose( $f );
-               
+
                $sub4 =  substr( $head, 0, 4 );
                if ( $sub4 == "\x01\x00\x09\x00" || $sub4 == "\xd7\xcd\xc6\x9a" ) {
                        // WMF kill kill kill
@@ -352,12 +352,12 @@ class MimeMagic {
                        // The former of the above two checks is theoretically prone to false positives
                        $mime = "application/x-msmetafile";
                }
-               
+
                if (strpos($mime,"text/")===0 || $mime==="application/xml") {
-                       
+
                        $xml_type= NULL;
                        $script_type= NULL;
-                       
+
                        /*
                        * look for XML formats (XHTML and SVG)
                        */
@@ -366,86 +366,86 @@ class MimeMagic {
                            $mime==="text/html" ||
                            $mime==="text/xml" ||
                            $mime==="application/xml") {
-                       
+
                                if (substr($head,0,5)=="<?xml") $xml_type= "ASCII";
                                elseif (substr($head,0,8)=="\xef\xbb\xbf<?xml") $xml_type= "UTF-8";
                                elseif (substr($head,0,10)=="\xfe\xff\x00<\x00?\x00x\x00m\x00l") $xml_type= "UTF-16BE";
                                elseif (substr($head,0,10)=="\xff\xfe<\x00?\x00x\x00m\x00l\x00") $xml_type= "UTF-16LE";
-                               
+
                                if ($xml_type) {
                                        if ($xml_type!=="UTF-8" && $xml_type!=="ASCII") $head= iconv($xml_type,"ASCII//IGNORE",$head);
-                                       
+
                                        $match= array();
                                        $doctype= "";
                                        $tag= "";
-                                       
+
                                        if (preg_match('%<!DOCTYPE\s+[\w-]+\s+PUBLIC\s+["'."'".'"](.*?)["'."'".'"].*>%sim',$head,$match)) $doctype= $match[1];
                                        if (preg_match('%<(\w+).*>%sim',$head,$match)) $tag= $match[1];
-                                       
+
                                        #print "<br>ANALYSING $file ($mime): doctype= $doctype; tag= $tag<br>";
-                                       
+
                                        if (strpos($doctype,"-//W3C//DTD SVG")===0) $mime= "image/svg";
                                        elseif ($tag==="svg") $mime= "image/svg";
                                        elseif (strpos($doctype,"-//W3C//DTD XHTML")===0) $mime= "text/html";
                                        elseif ($tag==="html") $mime= "text/html";
-                                       
+
                                        $test_more= false;
                                }
                        }
-                       
+
                        /*
                        * look for shell scripts
                        */
                        if (!$xml_type) {
                                $script_type= NULL;
-                               
+
                                #detect by shebang
                                if (substr($head,0,2)=="#!") $script_type= "ASCII";
                                elseif (substr($head,0,5)=="\xef\xbb\xbf#!") $script_type= "UTF-8";
                                elseif (substr($head,0,7)=="\xfe\xff\x00#\x00!") $script_type= "UTF-16BE";
                                elseif (substr($head,0,7)=="\xff\xfe#\x00!") $script_type= "UTF-16LE";
-                               
+
                                if ($script_type) {
                                        if ($script_type!=="UTF-8" && $script_type!=="ASCII") $head= iconv($script_type,"ASCII//IGNORE",$head);
-                                       
+
                                        $match= array();
                                        $prog= "";
-                                       
+
                                        if (preg_match('%/?([^\s]+/)(w+)%sim',$head,$match)) $script= $match[2];
-                                       
+
                                        $mime= "application/x-$prog";
                                }
                        }
-                       
+
                        /*
                        * look for PHP
                        */
                        if( !$xml_type && !$script_type ) {
-                       
+
                                if( ( strpos( $head, '<?php' ) !== false ) ||
                                    ( strpos( $head, '<? ' ) !== false ) ||
                                    ( strpos( $head, "<?\n" ) !== false ) ||
                                    ( strpos( $head, "<?\t" ) !== false ) ||
                                    ( strpos( $head, "<?=" ) !== false ) ||
-                               
+
                                    ( strpos( $head, "<\x00?\x00p\x00h\x00p" ) !== false ) ||
                                    ( strpos( $head, "<\x00?\x00 " ) !== false ) ||
                                    ( strpos( $head, "<\x00?\x00\n" ) !== false ) ||
                                    ( strpos( $head, "<\x00?\x00\t" ) !== false ) ||
                                    ( strpos( $head, "<\x00?\x00=" ) !== false ) ) {
-                               
+
                                        $mime= "application/x-php";
                                }
                        }
-                       
+
                }
-               
+
                if (isset($this->mMimeTypeAliases[$mime])) $mime= $this->mMimeTypeAliases[$mime];
-               
+
                wfDebug("$fname: final mime type of $file: $mime\n");
                return $mime;
        }
-       
+
        /** Internal mime type detection, please use guessMimeType() for application code instead.
        * Detection is done using an external program, if $wgMimeDetectorCommand is set.
        * Otherwise, the fileinfo extension and mime_content_type are tried (in this order), if they are available.
@@ -461,16 +461,16 @@ class MimeMagic {
        */
        function detectMimeType( $file, $useExt=true ) {
                $fname = 'MimeMagic::detectMimeType';
-               
+
                global $wgMimeDetectorCommand;
-       
+
                $m= NULL;
                if ($wgMimeDetectorCommand) {
                        $fn= wfEscapeShellArg($file);
                        $m= `$wgMimeDetectorCommand $fn`;
                }
                else if (function_exists("finfo_open") && function_exists("finfo_file")) {
-               
+
                        # This required the fileinfo extension by PECL,
                        # see http://pecl.php.net/package/fileinfo
                        # This must be compiled into PHP
@@ -480,18 +480,18 @@ class MimeMagic {
                        #
                        # If you may need to load the fileinfo extension at runtime, set
                        # $wgLoadFileinfoExtension in LocalSettings.php
-               
+
                        $mime_magic_resource = finfo_open(FILEINFO_MIME); /* return mime type ala mimetype extension */
-                       
+
                        if ($mime_magic_resource) {
                                $m= finfo_file($mime_magic_resource, $file);
-                               
+
                                finfo_close($mime_magic_resource);
                        }
                        else wfDebug("$fname: finfo_open failed on ".FILEINFO_MIME."!\n");
                }
                else if (function_exists("mime_content_type")) {
-                       
+
                        # NOTE: this function is available since PHP 4.3.0, but only if
                        # PHP was compiled with --with-mime-magic or, before 4.3.2, with --enable-mime-magic.
                        #
@@ -500,32 +500,32 @@ class MimeMagic {
                        #
                        # Also note that this has been DEPRECATED in favor of the fileinfo extension by PECL, see above.
                        # see http://www.php.net/manual/en/ref.mime-magic.php for details.
-                       
+
                        $m= mime_content_type($file);
                }
                else wfDebug("$fname: no magic mime detector found!\n");
-       
+
                if ($m) {
                        #normalize
                        $m= preg_replace('![;, ].*$!','',$m); #strip charset, etc
                        $m= trim($m);
                        $m= strtolower($m);
-                       
+
                        if (strpos($m,'unknown')!==false) $m= NULL;
                        else {
                                wfDebug("$fname: magic mime type of $file: $m\n");
                                return $m;
                        }
                }
-                       
+
                #if still not known, use getimagesize to find out the type of image
                #TODO: skip things that do not have a well-known image extension? Would that be safe?
                wfSuppressWarnings();
                $gis = getimagesize( $file );
                wfRestoreWarnings();
-               
+
                $notAnImage= false;
-               
+
                if ($gis && is_array($gis) && $gis[2]) {
                        switch ($gis[2]) {
                                case IMAGETYPE_GIF: $m= "image/gif"; break;
@@ -545,36 +545,36 @@ class MimeMagic {
                                case IMAGETYPE_WBMP: $m= "image/vnd.wap.wbmp"; break;
                                case IMAGETYPE_XBM: $m= "image/x-xbitmap"; break;
                        }
-                       
+
                        if ($m) {
                                wfDebug("$fname: image mime type of $file: $m\n");
                                return $m;
                        }
                        else $notAnImage= true;
                }
-       
+
                #if desired, look at extension as a fallback.
                if ($useExt) {
                        $i = strrpos( $file, '.' );
                        $e= strtolower( $i ? substr( $file, $i + 1 ) : '' );
-                       
+
                        $m= $this->guessTypesForExtension($e);
-                       
+
                        #TODO: if $notAnImage is set, do not trust the file extension if
                        # the results is one of the image types that should have been recognized
                        # by getimagesize
-                       
+
                        if ($m) {
                                wfDebug("$fname: extension mime type of $file: $m\n");
                                return $m;
                        }
                }
-               
-               #unknown type   
+
+               #unknown type
                wfDebug("$fname: failed to guess mime type for $file!\n");
                return "unknown/unknown";
        }
-       
+
        /**
        * Determine the media type code for a file, using its mime type, name and possibly
        * its contents.
@@ -593,48 +593,48 @@ class MimeMagic {
        */
        function getMediaType($path=NULL,$mime=NULL) {
                if( !$mime && !$path ) return MEDIATYPE_UNKNOWN;
-               
+
                #if mime type is unknown, guess it
                if( !$mime ) $mime= $this->guessMimeType($path,false);
 
                #special code for ogg - detect if it's video (theora),
                #else label it as sound.
                if( $mime=="application/ogg" && file_exists($path) ) {
-               
+
                        // Read a chunk of the file
                        $f = fopen( $path, "rt" );
                        if( !$f ) return MEDIATYPE_UNKNOWN;
                        $head = fread( $f, 256 );
                        fclose( $f );
-                       
+
                        $head= strtolower( $head );
-                       
+
                        #This is an UGLY HACK, file should be parsed correctly
                        if( strpos($head,'theora')!==false ) return MEDIATYPE_VIDEO;
                        elseif( strpos($head,'vorbis')!==false ) return MEDIATYPE_AUDIO;
                        elseif( strpos($head,'flac')!==false ) return MEDIATYPE_AUDIO;
                        elseif( strpos($head,'speex')!==false ) return MEDIATYPE_AUDIO;
                        else return MEDIATYPE_MULTIMEDIA;
-               }       
-       
+               }
+
                #check for entry for full mime type
                if( $mime ) {
                        $type= $this->findMediaType($mime);
                        if( $type!==MEDIATYPE_UNKNOWN ) return $type;
                }
-               
+
                #check for entry for file extension
                $e= NULL;
                if( $path ) {
                        $i = strrpos( $path, '.' );
                        $e= strtolower( $i ? substr( $path, $i + 1 ) : '' );
-                       
+
                        #TODO: look at multi-extension if this fails, parse from full path
-                       
+
                        $type= $this->findMediaType('.'.$e);
                        if( $type!==MEDIATYPE_UNKNOWN ) return $type;
                }
-               
+
                #check major mime type
                if( $mime ) {
                        $i= strpos($mime,'/');
@@ -644,12 +644,12 @@ class MimeMagic {
                                if( $type!==MEDIATYPE_UNKNOWN ) return $type;
                        }
                }
-               
+
                if( !$type ) $type= MEDIATYPE_UNKNOWN;
-               
+
                return $type;
        }
-       
+
        /** returns a media code matching the given mime type or file extension.
        * File extensions are represented by a string starting with a dot (.) to
        * distinguish them from mime types.
@@ -658,27 +658,27 @@ class MimeMagic {
        * @access private
        */
        function findMediaType($extMime) {
-               
+
                if (strpos($extMime,'.')===0) { #if it's an extension, look up the mime types
                        $m= $this->getTypesForExtension(substr($extMime,1));
                        if (!$m) return MEDIATYPE_UNKNOWN;
-                       
+
                        $m= explode(' ',$m);
                }
                else { #normalize mime type
                        if (isset($this->mMimeTypeAliases[$extMime])) {
                                $extMime= $this->mMimeTypeAliases[$extMime];
                        }
-                       
+
                        $m= array($extMime);
                }
-               
+
                foreach ($m as $mime) {
                        foreach ($this->mMediaTypes as $type => $codes) {
                                if (in_array($mime,$codes,true)) return $type;
                        }
                }
-               
+
                return MEDIATYPE_UNKNOWN;
        }
 }
index 1d89a45..4d0e783 100644 (file)
@@ -57,7 +57,7 @@ class OutputPage {
        function addHeader( $name, $val ) { array_push( $this->mHeaders, $name.': '.$val ) ; }
        function redirect( $url, $responsecode = '302' ) { $this->mRedirect = $url; $this->mRedirectCode = $responsecode; }
        function setStatusCode( $statusCode ) { $this->mStatusCode = $statusCode; }
-       
+
        # To add an http-equiv meta tag, precede the name with "http:"
        function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); }
        function addKeyword( $text ) { array_push( $this->mKeywords, $text ); }
@@ -168,7 +168,7 @@ class OutputPage {
                                $name .= ' - '.$taction;
                        }
                }
-               
+
                $this->setHTMLTitle( wfMsg( 'pagetitle', $name ) );
        }
        function getHTMLTitle() { return $this->mHTMLtitle; }
@@ -252,7 +252,7 @@ class OutputPage {
        function ParserOptions( $options = null ) {
                return wfSetVar( $this->mParserOptions, $options );
        }
-       
+
        /**
         * Set the revision ID which will be seen by the wiki text parser
         * for things such as embedded {{REVISIONID}} variable use.
@@ -293,7 +293,7 @@ class OutputPage {
                        $this->enableClientCache( false );
                }
        }
-       
+
        function addParserOutput( &$parserOutput ) {
                $this->addParserOutputNoText( $parserOutput );
                $this->addHTML( $parserOutput->getText() );
@@ -594,7 +594,7 @@ class OutputPage {
                $time = wfReportTime();
                return $time;
        }
-       
+
        /**
         * Produce a "user is blocked" page
         */
@@ -946,7 +946,7 @@ class OutputPage {
                        }
                        $ret .= "<meta $a=\"{$tag[0]}\" content=\"{$tag[1]}\" />\n";
                }
-               
+
                $p = $this->mRobotpolicy;
                if( $p !== '' && $p != 'index,follow' ) {
                        // http://www.robotstxt.org/wc/meta-user.html
index 3482d07..e8a6c07 100644 (file)
@@ -177,7 +177,7 @@ class PageHistory {
                $s = wfMsgWikiHtml( 'histlegend' );
                $s .= '<form action="' . $wgTitle->escapeLocalURL( '-' ) . '" method="get">';
                $prefixedkey = htmlspecialchars($wgTitle->getPrefixedDbKey());
-               
+
                // The following line is SUPPOSED to have double-quotes around the
                // $prefixedkey variable, because htmlspecialchars() doesn't escape
                // single-quotes.
@@ -190,7 +190,7 @@ class PageHistory {
                // consideration and cooperation.
                //
                $s .= "<input type='hidden' name='title' value=\"{$prefixedkey}\" />\n";
-               
+
                $s .= $this->submitButton();
                $s .= '<ul id="pagehistory">' . "\n";
                return $s;
index 90bb763..727c0a4 100644 (file)
@@ -175,7 +175,7 @@ class Parser
                 * First pass--just handle <nowiki> sections, pass the rest off
                 * to internalParse() which does all the real work.
                 */
-               
+
                global $wgUseTidy, $wgContLang;
                $fname = 'Parser::parse';
                wfProfileIn( $fname );
@@ -236,7 +236,7 @@ class Parser
                wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) );
 
                $text = Sanitizer::normalizeCharReferences( $text );
-               
+
                if ($wgUseTidy) {
                        $text = Parser::tidy($text);
                }
@@ -498,7 +498,7 @@ class Parser
                if ( !is_array( $state ) ) {
                        return $text;
                }
-               
+
                # Must expand in reverse order, otherwise nested tags will be corrupted
                foreach( array_reverse( $state, true ) as $tag => $contentDict ) {
                        if( $tag != 'nowiki' && $tag != 'html' ) {
@@ -683,7 +683,7 @@ class Parser
                        $fc = substr ( $x , 0 , 1 ) ;
                        if ( preg_match( '/^(:*)\{\|(.*)$/', $x, $matches ) ) {
                                $indent_level = strlen( $matches[1] );
-                               
+
                                $attributes = $this->unstripForHTML( $matches[2] );
 
                                $t[$k] = str_repeat( '<dl><dd>', $indent_level ) .
@@ -1522,7 +1522,7 @@ class Parser
                }
                return $retVal;
        }
-       
+
        /**
         * Render a forced-blue link inline; protect against double expansion of
         * URLs if we're in a mode that prepends full URL prefixes to internal links.
@@ -1543,7 +1543,7 @@ class Parser
                $link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
                return $this->armorLinks( $link ) . $trail;
        }
-       
+
        /**
         * Insert a NOPARSE hacky thing into any inline links in a chunk that's
         * going to go through further parsing steps before inline URL expansion.
@@ -2048,14 +2048,14 @@ class Parser
 
                        if ($lastOpeningBrace >= 0) {
                                $pos = strpos ($text, $openingBraceStack[$lastOpeningBrace]['braceEnd'], $i);
-                       
+
                                if (false !== $pos && (-1 == $nextPos || $pos < $nextPos)){
                                        $rule = null;
                                        $nextPos = $pos;
                                }
 
                                $pos = strpos ($text, '|', $i);
-                               
+
                                if (false !== $pos && (-1 == $nextPos || $pos < $nextPos)){
                                        $rule = null;
                                        $nextPos = $pos;
@@ -2116,7 +2116,7 @@ class Parser
                                                        $matchingCallback = $fn;
                                                }
                                        }
-                                       
+
                                        if ($matchingCount == 0) {
                                                $i += $count - 1;
                                                continue;
@@ -2130,7 +2130,7 @@ class Parser
 
                                        $pieceStart = $openingBraceStack[$lastOpeningBrace]['startAt'] - $matchingCount;
                                        $pieceEnd = $i + $matchingCount;
-                                       
+
                                        if( is_callable( $matchingCallback ) ) {
                                                $cbArgs = array (
                                                                                 'text' => substr($text, $pieceStart, $pieceEnd - $pieceStart),
@@ -2181,7 +2181,7 @@ class Parser
                                        }
                                        else
                                                $openingBraceStack[$lastOpeningBrace]['parts'][] = substr($text, $openingBraceStack[$lastOpeningBrace]['partStart'], $i - $openingBraceStack[$lastOpeningBrace]['partStart']);
-                                       
+
                                        $openingBraceStack[$lastOpeningBrace]['partStart'] = $i + 1;
                                }
                        }
@@ -2412,7 +2412,7 @@ class Parser
                        $mwLocalE =& MagicWord::get( MAG_LOCALURLE );
                        $mwFull =& MagicWord::get( MAG_FULLURL );
                        $mwFullE =& MagicWord::get( MAG_FULLURLE );
-                       
+
 
                        if ( $mwLocal->matchStartAndRemove( $part1 ) ) {
                                $func = 'getLocalURL';
@@ -2575,7 +2575,7 @@ class Parser
                        # Remove <noinclude> sections and <includeonly> tags
                        $text = preg_replace( '/<noinclude>.*?<\/noinclude>/s', '', $text );
                        $text = strtr( $text, array( '<includeonly>' => '' , '</includeonly>' => '' ) );
-                       
+
                        if( $this->mOutputType == OT_HTML ) {
                                # Strip <nowiki>, <pre>, etc.
                                $text = $this->strip( $text, $this->mStripState );
@@ -2642,7 +2642,7 @@ class Parser
                        return $text;
                }
        }
-       
+
        /**
         * Translude an interwiki link.
         */
@@ -3163,7 +3163,7 @@ class Parser
                global $wgLegalTitleChars;
                $tc = "[$wgLegalTitleChars]";
                $np = str_replace( array( '(', ')' ), array( '', '' ), $tc ); # No parens
-               
+
                $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii!
                $conpat = "/^({$np}+) \\(({$tc}+)\\)$/";
 
@@ -3195,7 +3195,7 @@ class Parser
 
                return $text;
        }
-       
+
        /**
         * Fetch the user's signature text, if any, and normalize to
         * validated, ready-to-insert wikitext.
@@ -3210,7 +3210,7 @@ class Parser
                if ( '' == $nick ) {
                        $nick = $name;
                }
-               
+
                if( $user->getOption( 'fancysig' ) ) {
                        // A wikitext signature.
                        $valid = $this->validateSig( $nick );
@@ -3222,7 +3222,7 @@ class Parser
                                return $nick;
                        }
                }
-               
+
                // Plain text linking to the user's homepage
                global $wgContLang;
                $page = $user->getUserPage();
@@ -3232,7 +3232,7 @@ class Parser
                        wfEscapeWikIText( $nick ) .
                        "]]";
        }
-       
+
        /**
         * We want to enforce two rules on wikitext sigs here:
         * 1) Expand any templates at save time (forced subst:)
@@ -3309,7 +3309,7 @@ class Parser
        function setHook( $tag, $callback ) {
                $oldVal = @$this->mTagHooks[$tag];
                $this->mTagHooks[$tag] = $callback;
-               
+
                return $oldVal;
        }
 
@@ -3646,7 +3646,7 @@ class Parser
        function disableCache() {
                $this->mOutput->mCacheTime = -1;
        }
-       
+
        /**
         * Callback from the Sanitizer for expanding items found in HTML attribute
         * values, so they can be safely tested and escaped.
@@ -3660,7 +3660,7 @@ class Parser
                $text = $this->unstripForHTML( $text );
                return $text;
        }
-       
+
        function unstripForHTML( $text ) {
                $text = $this->unstrip( $text, $this->mStripState );
                $text = $this->unstripNoWiki( $text, $this->mStripState );
@@ -3737,7 +3737,7 @@ class ParserOutput
 
        function addTemplate( $title, $id ) {
                $ns = $title->getNamespace();
-               $dbk = $title->getDBkey();      
+               $dbk = $title->getDBkey();
                if ( !isset( $this->mTemplates[$ns] ) ) {
                        $this->mTemplates[$ns] = array();
                }
index ecb5fd7..fbe6b91 100644 (file)
@@ -21,7 +21,7 @@ class ParserCache {
                }
                return $instance;
        }
-               
+
        /**
         * Setup a cache pathway with a given back-end storage mechanism.
         * May be a memcached client or a BagOStuff derivative.
index 1412ab9..00eedd2 100644 (file)
@@ -231,7 +231,7 @@ class element {
                        # Fix allowed HTML
                        $old_n = $n;
                        $ext = strtoupper($this->attrs['NAME']);
-                       
+
                        switch($ext) {
                                case 'B':
                                case 'STRONG':
@@ -307,7 +307,7 @@ class element {
                                # Comments are parsed out
                                $ret .= '';
                                break;
-                               
+
 
                        # Links
                        case 'LINK':
@@ -317,7 +317,7 @@ class element {
                        case 'LINKOPTION':
                                $ret .= $this->sub_makeXHTML($parser);
                                break;
-               
+
                        case 'TEMPLATE':
                                $parts = $this->sub_makeXHTML($parser);
                                $parts = explode('|', $parts);
@@ -331,7 +331,7 @@ class element {
                                        $ret .= $parser->mCurrentTemplateOptions["{$x}"];
                                break;
 
-                       # Internal use, not generated by wiki2xml parser                                
+                       # Internal use, not generated by wiki2xml parser
                        case 'IGNORE':
                                $ret .= $this->sub_makeXHTML($parser);
 
@@ -391,7 +391,7 @@ class element {
                                        $ret .= $this->sub_makeXHTML($parser, $type);
                                        $parser->mListType = $oldtype;
                                break;
-                       
+
                        # Something else entirely
                        default:
                                $ret .= '&lt;'.$n.'&gt;';
index 2915bbc..930c545 100755 (executable)
@@ -60,7 +60,7 @@ class ProfilerSimple extends Profiler {
                                $this->debug( "$message\n" );
                        }
                        $entry =& $this->mCollated[$functionname];
-                       
+
                        $elapsedcpu = $this->getCpuTime() - $octime;
                        $elapsedreal = $this->getTime() - $ortime;
 
@@ -69,11 +69,11 @@ class ProfilerSimple extends Profiler {
                        $entry['real'] += $elapsedreal;
                        $entry['real_sq'] += $elapsedreal*$elapsedreal;
                        $entry['count']++;
-                               
+
                }
        }
 
-       function getFunctionReport() {          
+       function getFunctionReport() {
                /* Implement in output subclasses */
        }
 
@@ -89,7 +89,7 @@ class ProfilerSimple extends Profiler {
                list($a,$b)=explode(" ",$time);
                return (float)($a+$b);
        }
-       
+
        function debug( $s ) {
                if (function_exists( 'wfDebug' ) ) {
                        wfDebug( $s );
index 82bc74d..c395228 100644 (file)
@@ -11,7 +11,7 @@ class ProfilerSimpleUDP extends ProfilerSimple {
                global $wgUDPProfilerHost;
                global $wgUDPProfilerPort;
                global $wgDBname;
-               
+
                $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
                $plength=0;
                $packet="";
index a929f94..014f678 100755 (executable)
@@ -44,7 +44,7 @@ if (!function_exists('memory_get_usage')) {
 class Profiler {
        var $mStack = array (), $mWorkStack = array (), $mCollated = array ();
        var $mCalls = array (), $mTotals = array ();
-       
+
        function Profiler()
        {
                // Push an entry for the pre-profile setup time onto the stack
@@ -55,7 +55,7 @@ class Profiler {
                } else {
                        $this->profileIn( '-total' );
                }
-                       
+
        }
 
        function profileIn($functionname) {
@@ -172,12 +172,12 @@ class Profiler {
                        trim( sprintf( "%7.3f", $delta * 1000.0 ) ),
                        $space, $fname );
        }
-       
+
        function micro2Float( $micro ) {
                list( $whole, $fractional ) = explode( ' ', $micro );
                return (float)$whole + (float)$fractional;
        }
-       
+
        function microDelta( $start, $end ) {
                return $this->micro2Float( $end ) -
                       $this->micro2Float( $start );
@@ -193,7 +193,7 @@ class Profiler {
                return $ru['ru_utime.tv_sec'].' '.$ru['ru_utime.tv_usec'] / 1e6;
        }
 
-       function getFunctionReport() {          
+       function getFunctionReport() {
                $width = 140;
                $nameWidth = $width - 65;
                $format =      "%-{$nameWidth}s %6d %13.3f %13.3f %13.3f%% %9d  (%13.3f -%13.3f) [%d]\n";
index 76fb94b..3f7a0fd 100644 (file)
 class ProtectionForm {
        var $mRestrictions = array();
        var $mReason = '';
-       
+
        function ProtectionForm( &$article ) {
                global $wgRequest, $wgUser;
                global $wgRestrictionTypes, $wgRestrictionLevels;
                $this->mArticle =& $article;
                $this->mTitle =& $article->mTitle;
-               
+
                if( $this->mTitle ) {
                        foreach( $wgRestrictionTypes as $action ) {
                                // Fixme: this form currently requires individual selections,
@@ -39,13 +39,13 @@ class ProtectionForm {
                                $this->mRestrictions[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
                        }
                }
-               
+
                // The form will be available in read-only to show levels.
                $this->disabled = !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $wgUser->isBlocked();
                $this->disabledAttrib = $this->disabled
                        ? array( 'disabled' => 'disabled' )
                        : array();
-               
+
                if( $wgRequest->wasPosted() ) {
                        $this->mReason = $wgRequest->getText( 'mwProtect-reason' );
                        foreach( $wgRestrictionTypes as $action ) {
@@ -56,10 +56,10 @@ class ProtectionForm {
                        }
                }
        }
-       
+
        function show() {
                global $wgOut;
-               
+
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
 
                if( is_null( $this->mTitle ) ||
@@ -68,50 +68,50 @@ class ProtectionForm {
                        $wgOut->fatalError( wfMsg( 'badarticleerror' ) );
                        return;
                }
-               
+
                if( $this->save() ) {
                        $wgOut->redirect( $this->mTitle->getFullUrl() );
                        return;
                }
-               
+
                $wgOut->setPageTitle( wfMsg( 'confirmprotect' ) );
                $wgOut->setSubtitle( wfMsg( 'protectsub', $this->mTitle->getPrefixedText() ) );
-               
+
                $wgOut->addWikiText(
                        wfMsg( $this->disabled ? "protect-viewtext" : "protect-text",
                                $this->mTitle->getPrefixedText() ) );
-               
+
                $wgOut->addHTML( $this->buildForm() );
-               
+
                $this->showLogExtract( $wgOut );
        }
-       
+
        function save() {
                global $wgRequest, $wgUser;
                if( !$wgRequest->wasPosted() ) {
                        return false;
                }
-               
+
                if( $this->disabled ) {
                        return false;
                }
-               
+
                $token = $wgRequest->getVal( 'wpEditToken' );
                if( !$wgUser->matchEditToken( $token ) ) {
                        $wgOut->fatalError( wfMsg( 'sessionfailure' ) );
                        return false;
                }
-               
+
                $ok = $this->mArticle->updateRestrictions( $this->mRestrictions, $this->mReason );
                if( !$ok ) {
                        $wgOut->fatalError( "Unknown error at restriction save time." );
                }
                return $ok;
        }
-       
+
        function buildForm() {
                global $wgUser;
-               
+
                $out = '';
                if( !$this->disabled ) {
                        $out .= $this->buildScript();
@@ -127,7 +127,7 @@ class ProtectionForm {
                                'name' => 'wpEditToken',
                                'value' => $wgUser->editToken() ) );
                }
-               
+
                $out .= "<table id='mwProtectSet'>";
                $out .= "<tbody>";
                $out .= "<tr>\n";
@@ -142,12 +142,12 @@ class ProtectionForm {
                        $out .= "</td>\n";
                }
                $out .= "</tr>\n";
-               
+
                // JavaScript will add another row with a value-chaining checkbox
-               
+
                $out .= "</tbody>\n";
                $out .= "</table>\n";
-               
+
                if( !$this->disabled ) {
                        $out .= "<table>\n";
                        $out .= "<tbody>\n";
@@ -158,10 +158,10 @@ class ProtectionForm {
                        $out .= "</form>\n";
                        $out .= $this->buildCleanupScript();
                }
-               
+
                return $out;
        }
-       
+
        function buildSelector( $action, $selected ) {
                global $wgRestrictionLevels;
                $id = 'mwProtect-level-' . $action;
@@ -171,7 +171,7 @@ class ProtectionForm {
                        'size' => count( $wgRestrictionLevels ),
                        'onchange' => 'protectLevelsUpdate(this)',
                        ) + $this->disabledAttrib;
-               
+
                $out = wfOpenElement( 'select', $attribs );
                foreach( $wgRestrictionLevels as $key ) {
                        $out .= $this->buildOption( $key, $selected );
@@ -179,7 +179,7 @@ class ProtectionForm {
                $out .= "</select>\n";
                return $out;
        }
-       
+
        function buildOption( $key, $selected ) {
                $text = ( $key == '' )
                        ? wfMsg( 'protect-default' )
@@ -191,7 +191,7 @@ class ProtectionForm {
                        array( 'value' => $key ) + $selectedAttrib,
                        $text );
        }
-       
+
        function buildReasonInput() {
                $id = 'mwProtect-reason';
                return wfElement( 'label', array(
@@ -204,25 +204,25 @@ class ProtectionForm {
                                'name' => $id,
                                'id' => $id ) );
        }
-       
+
        function buildSubmit() {
                return wfElement( 'input', array(
                        'type' => 'submit',
                        'value' => wfMsg( 'confirm' ) ) );
        }
-       
+
        function buildScript() {
                global $wgStylePath;
                return '<script type="text/javascript" src="' .
                        htmlspecialchars( $wgStylePath . "/common/protect.js" ) .
                        '"></script>';
        }
-       
+
        function buildCleanupScript() {
                return '<script type="text/javascript">protectInitialize("mwProtectSet","' .
                        wfEscapeJsString( wfMsg( 'protect-unchain' ) ) . '")</script>';
        }
-       
+
        /**
         * @param OutputPage $out
         * @access private
index dd7daa8..42e39a8 100644 (file)
@@ -122,7 +122,7 @@ function wfProxyCheck() {
        }
 
        $ip = wfGetIP();
-       
+
        # Get MemCached key
        $skip = false;
        if ( $wgUseMemCached ) {
@@ -179,17 +179,17 @@ function wfParseCIDR( $range ) {
 function wfIsLocallyBlockedProxy( $ip ) {
        global $wgProxyList;
        $fname = 'wfIsLocallyBlockedProxy';
-       
+
        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 ) ) {
                $ret = false;
        } elseif ( array_search( $ip, $wgProxyList ) !== false ) {
index 2fce868..a69fe5f 100644 (file)
@@ -129,7 +129,7 @@ class QueryPage {
         */
        function isCached() {
                global $wgMiserMode;
-               
+
                return $this->isExpensive() && $wgMiserMode;
        }
 
@@ -256,7 +256,7 @@ class QueryPage {
         */
        function doQuery( $offset, $limit, $shownavigation=true ) {
                global $wgUser, $wgOut, $wgContLang;
-               
+
                $sname = $this->getName();
                $fname = get_class($this) . '::doQuery';
                $sql = $this->getSQL();
@@ -345,7 +345,7 @@ class QueryPage {
         */
        function doFeed( $class = '' ) {
                global $wgFeedClasses;
-               
+
                if( isset($wgFeedClasses[$class]) ) {
                        $feed = new $wgFeedClasses[$class](
                                $this->feedTitle(),
index a75fe61..cf35416 100644 (file)
@@ -35,7 +35,7 @@ class RawPage {
                } else {
                        $this->mRequest = $request;
                }
-                       
+
                $ctype = $this->mRequest->getText( 'ctype' );
                $smaxage = $this->mRequest->getInt( 'smaxage', $wgSquidMaxage );
                $maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage );
@@ -43,7 +43,7 @@ class RawPage {
                $this->mOldId = $this->mRequest->getInt( 'oldid' );
                # special case for 'generated' raw things: user css/js
                $gen = $this->mRequest->getText( 'gen' );
-               
+
                if($gen == 'css') {
                        $this->mGen = $gen;
                        if($smaxage == '') $smaxage = $wgSquidMaxage;
@@ -64,7 +64,7 @@ class RawPage {
                        $this->mContentType = $ctype;
                }
        }
-       
+
        function view() {
                global $wgOut, $wgScript;
 
@@ -100,7 +100,7 @@ class RawPage {
                                'Raw pages must be accessed through the primary script entry point.' );
                        return;
                }
-               
+
                header( "Content-type: ".$this->mContentType.'; charset='.$this->mCharset );
                # allow the client to cache this for 24 hours
                header( 'Cache-Control: s-maxage='.$this->mSmaxage.', max-age='.$this->mMaxage );
@@ -121,11 +121,11 @@ class RawPage {
                } else {
                        return $this->getArticleText();
                }
-       }               
+       }
 
        function getArticleText() {
                global $wgParser;
-               
+
                if( $this->mTitle ) {
                        $text = '';
 
@@ -145,7 +145,7 @@ class RawPage {
 
                        return $this->parseArticleText( $text );
                }
-               
+
                # Bad title or page does not exist
                if( $this->mContentType == 'text/x-wiki' ) {
                        # Don't return a 404 response for CSS or JavaScript;
@@ -168,7 +168,7 @@ class RawPage {
                                $parser->Options( new ParserOptions() ); // We don't want this to be user-specific
                                $parser->Title( $wgTitle );
                                $parser->OutputType( OT_HTML );
-                               
+
                                return $parser->replaceVariables( $text );
                        } else
                                return $text;
index 8bfe10c..e82f629 100644 (file)
@@ -173,7 +173,7 @@ class RecentChange
                                socket_close( $conn );
                        }
                }
-               
+
                // E-mail notifications
                global $wgUseEnotif;
                if( $wgUseEnotif ) {
@@ -187,7 +187,7 @@ class RecentChange
                                $this->mAttribs['rc_minor'],
                                $this->mAttribs['rc_last_oldid'] );
                }
-               
+
        }
 
        # Marks a certain row as patrolled
index d2771bb..20e2a27 100644 (file)
@@ -527,7 +527,7 @@ class Sanitizer {
                if( trim( $text ) == '' ) {
                        return '';
                }
-               
+
                # Unquoted attribute
                # Since we quote this later, this can be anything distinguishable
                # from the end of the attribute
@@ -547,19 +547,19 @@ class Sanitizer {
                        if( !isset( $whitelist[$attribute] ) ) {
                                continue;
                        }
-                       
+
                        $raw   = Sanitizer::getTagAttributeCallback( $set );
                        $value = Sanitizer::normalizeAttributeValue( $raw );
-                       
+
                        # Strip javascript "expression" from stylesheets.
                        # http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp
                        if( $attribute == 'style' ) {
                                $stripped = Sanitizer::decodeCharReferences( $value );
-                               
+
                                // Remove any comments; IE gets token splitting wrong
                                $stripped = preg_replace( '!/\\*.*?\\*/!S', ' ', $stripped );
                                $value = htmlspecialchars( $stripped );
-                               
+
                                // ... and continue checks
                                $stripped = preg_replace( '!\\\\([0-9A-Fa-f]{1,6})[ \\n\\r\\t\\f]?!e',
                                        'codepointToUtf8(hexdec("$1"))', $stripped );
@@ -573,7 +573,7 @@ class Sanitizer {
 
                        if ( $attribute === 'id' )
                                $value = Sanitizer::escapeId( $value );
-                       
+
                        # Templates and links may be expanded in later parsing,
                        # creating invalid or dangerous output. Suppress this.
                        $value = strtr( $value, array(
@@ -584,13 +584,13 @@ class Sanitizer {
                                'RFC'  => '&#82;FC',
                                'PMID' => '&#80;MID',
                        ) );
-                       
+
                        # Stupid hack
                        $value = preg_replace_callback(
                                '/(' . wfUrlProtocols() . ')/',
                                array( 'Sanitizer', 'armorLinksCallback' ),
                                $value );
-                       
+
                        // If this attribute was previously set, override it.
                        // Output should only have one attribute of each name.
                        $attribs[$attribute] = "$attribute=\"$value\"";
@@ -620,12 +620,12 @@ class Sanitizer {
                        '%3A' => ':',
                        '%' => '.'
                );
-               
+
                $id = urlencode( Sanitizer::decodeCharReferences( strtr( $id, ' ', '_' ) ) );
 
                return str_replace( array_keys( $replace ), array_values( $replace ), $id );
        }
-       
+
        /**
         * Regex replace callback for armoring links against further processing.
         * @param array $matches
@@ -635,7 +635,7 @@ class Sanitizer {
        function armorLinksCallback( $matches ) {
                return str_replace( ':', '&#58;', $matches[1] );
        }
-       
+
        /**
         * Return an associative array of attribute names and values from
         * a partial tag string. Attribute names are forces to lowercase,
@@ -646,12 +646,12 @@ class Sanitizer {
         */
        function decodeTagAttributes( $text ) {
                $attribs = array();
-               
+
                if( trim( $text ) == '' ) {
                        return $attribs;
                }
 
-               $pairs = array();       
+               $pairs = array();
                if( !preg_match_all(
                        MW_ATTRIBS_REGEX,
                        $text,
@@ -667,7 +667,7 @@ class Sanitizer {
                }
                return $attribs;
        }
-       
+
        /**
         * Pick the appropriate attribute value from a match set from the
         * MW_ATTRIBS_REGEX matches.
@@ -697,7 +697,7 @@ class Sanitizer {
                        wfDebugDieBacktrace( "Tag conditions not met. This should never happen and is a bug." );
                }
        }
-       
+
        /**
         * Normalize whitespace and character references in an XML source-
         * encoded text for an attribute value.
@@ -717,7 +717,7 @@ class Sanitizer {
                                ' ',
                                Sanitizer::normalizeCharReferences( $text ) ) );
        }
-       
+
        /**
         * Ensure that any entities and character references are legal
         * for XML and XHTML specifically. Any stray bits will be
@@ -759,7 +759,7 @@ class Sanitizer {
                        return $ret;
                }
        }
-       
+
        /**
         * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD,
         * return the named entity reference as is. Otherwise, returns
@@ -776,7 +776,7 @@ class Sanitizer {
                        return "&amp;$name;";
                }
        }
-       
+
        function decCharReference( $codepoint ) {
                $point = intval( $codepoint );
                if( Sanitizer::validateCodepoint( $point ) ) {
@@ -785,7 +785,7 @@ class Sanitizer {
                        return null;
                }
        }
-       
+
        function hexCharReference( $codepoint ) {
                $point = hexdec( $codepoint );
                if( Sanitizer::validateCodepoint( $point ) ) {
@@ -794,7 +794,7 @@ class Sanitizer {
                        return null;
                }
        }
-       
+
        /**
         * Returns true if a given Unicode codepoint is a valid character in XML.
         * @param int $codepoint
@@ -823,7 +823,7 @@ class Sanitizer {
                        array( 'Sanitizer', 'decodeCharReferencesCallback' ),
                        $text );
        }
-       
+
        /**
         * @param string $matches
         * @return string
@@ -841,7 +841,7 @@ class Sanitizer {
                # Last case should be an ampersand by itself
                return $matches[0];
        }
-       
+
        /**
         * Return UTF-8 string for a codepoint if that is a valid
         * character reference, otherwise U+FFFD REPLACEMENT CHARACTER.
@@ -856,7 +856,7 @@ class Sanitizer {
                        return UTF8_REPLACEMENT;
                }
        }
-       
+
        /**
         * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD,
         * return the UTF-8 encoding of that character. Otherwise, returns
@@ -873,7 +873,7 @@ class Sanitizer {
                        return "&$name;";
                }
        }
-       
+
        /**
         * Fetch the whitelist of acceptable attributes for a given
         * element name.
@@ -890,7 +890,7 @@ class Sanitizer {
                        ? $list[$element]
                        : array();
        }
-       
+
        /**
         * @return array
         */
@@ -909,7 +909,7 @@ class Sanitizer {
                                    'height', # deprecated
                                    'bgcolor' # deprecated
                                    );
-               
+
                # Numbers refer to sections in HTML 4.01 standard describing the element.
                # See: http://www.w3.org/TR/html4/
                $whitelist = array (
@@ -917,7 +917,7 @@ class Sanitizer {
                        'div'        => $block,
                        'center'     => $common, # deprecated
                        'span'       => $block, # ??
-               
+
                        # 7.5.5
                        'h1'         => $block,
                        'h2'         => $block,
@@ -925,13 +925,13 @@ class Sanitizer {
                        'h4'         => $block,
                        'h5'         => $block,
                        'h6'         => $block,
-                       
+
                        # 7.5.6
                        # address
-                       
+
                        # 8.2.4
                        # bdo
-               
+
                        # 9.2.1
                        'em'         => $common,
                        'strong'     => $common,
@@ -943,64 +943,64 @@ class Sanitizer {
                        'var'        => $common,
                        # abbr
                        # acronym
-                       
+
                        # 9.2.2
                        'blockquote' => array_merge( $common, array( 'cite' ) ),
                        # q
-                       
+
                        # 9.2.3
                        'sub'        => $common,
                        'sup'        => $common,
-                       
+
                        # 9.3.1
                        'p'          => $block,
-                       
+
                        # 9.3.2
                        'br'         => array( 'id', 'class', 'title', 'style', 'clear' ),
-                       
+
                        # 9.3.4
                        'pre'        => array_merge( $common, array( 'width' ) ),
-                       
+
                        # 9.4
                        'ins'        => array_merge( $common, array( 'cite', 'datetime' ) ),
                        'del'        => array_merge( $common, array( 'cite', 'datetime' ) ),
-                       
+
                        # 10.2
                        'ul'         => array_merge( $common, array( 'type' ) ),
                        'ol'         => array_merge( $common, array( 'type', 'start' ) ),
                        'li'         => array_merge( $common, array( 'type', 'value' ) ),
-                       
+
                        # 10.3
                        'dl'         => $common,
                        'dd'         => $common,
                        'dt'         => $common,
-               
+
                        # 11.2.1
                        'table'      => array_merge( $common,
                                                                array( 'summary', 'width', 'border', 'frame',
                                                                                         'rules', 'cellspacing', 'cellpadding',
                                                                                         'align', 'bgcolor', 'frame', 'rules',
                                                                                         'border' ) ),
-                       
+
                        # 11.2.2
                        'caption'    => array_merge( $common, array( 'align' ) ),
-                       
+
                        # 11.2.3
                        'thead'      => array_merge( $common, $tablealign ),
                        'tfoot'      => array_merge( $common, $tablealign ),
                        'tbody'      => array_merge( $common, $tablealign ),
-                       
+
                        # 11.2.4
                        'colgroup'   => array_merge( $common, array( 'span', 'width' ), $tablealign ),
                        'col'        => array_merge( $common, array( 'span', 'width' ), $tablealign ),
-                       
+
                        # 11.2.5
                        'tr'         => array_merge( $common, array( 'bgcolor' ), $tablealign ),
-                       
+
                        # 11.2.6
                        'td'         => array_merge( $common, $tablecell, $tablealign ),
                        'th'         => array_merge( $common, $tablecell, $tablealign ),
-                       
+
                        # 15.2.1
                        'tt'         => $common,
                        'b'          => $common,
@@ -1010,14 +1010,14 @@ class Sanitizer {
                        'strike'     => $common,
                        's'          => $common,
                        'u'          => $common,
-               
+
                        # 15.2.2
                        'font'       => array_merge( $common, array( 'size', 'color', 'face' ) ),
                        # basefont
-                       
+
                        # 15.3
                        'hr'         => array_merge( $common, array( 'noshade', 'size', 'width' ) ),
-                       
+
                        # XHTML Ruby annotation text module, simple ruby only.
                        # http://www.w3c.org/TR/ruby/
                        'ruby'       => $common,
@@ -1029,7 +1029,7 @@ class Sanitizer {
                        );
                return $whitelist;
        }
-       
+
        /**
         * Take a fragment of (potentially invalid) HTML and return
         * a version with any tags removed, encoded suitably for literal
@@ -1041,17 +1041,17 @@ class Sanitizer {
        function stripAllTags( $text ) {
                # Actual <tags>
                $text = preg_replace( '/ < .*? > /x', '', $text );
-               
+
                # Normalize &entities and whitespace
                $text = Sanitizer::normalizeAttributeValue( $text );
-               
+
                # Will be placed into "double-quoted" attributes,
                # make sure remaining bits are safe.
                $text = str_replace(
                        array('<', '>', '"'),
                        array('&lt;', '&gt;', '&quot;'),
                        $text );
-               
+
                return $text;
        }
 
index 5423b47..73021d7 100644 (file)
@@ -80,7 +80,7 @@ class SearchEngine {
                if ( $title->exists() ) {
                        return $title;
                }
-               
+
                # Now try Word-Caps-Breaking-At-Word-Breaks, for hyphenated names etc
                $title = Title::newFromText( preg_replace_callback(
                        '/\b([\w\x80-\xff]+)\b/',
@@ -92,7 +92,7 @@ class SearchEngine {
                if ( $title->exists() ) {
                        return $title;
                }
-               
+
                global $wgCapitalLinks, $wgContLang;
                if( !$wgCapitalLinks ) {
                        // Catch differs-by-first-letter-case-only
index 01d278b..857aa14 100644 (file)
@@ -52,8 +52,8 @@ class SearchMySQL extends SearchEngine {
                $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
                return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
        }
-       
-       
+
+
        /**
         * Return a partial WHERE clause to exclude redirects, if so set
         * @return string
@@ -66,7 +66,7 @@ class SearchMySQL extends SearchEngine {
                        return 'AND page_is_redirect=0';
                }
        }
-       
+
        /**
         * Return a partial WHERE clause to limit the search to the given namespaces
         * @return string
@@ -79,7 +79,7 @@ class SearchMySQL extends SearchEngine {
                }
                return 'AND page_namespace IN (' . $namespaces . ')';
        }
-       
+
        /**
         * Return a LIMIT clause to limit results on the query.
         * @return string
@@ -98,7 +98,7 @@ class SearchMySQL extends SearchEngine {
        function queryRanking( $filteredTerm, $fulltext ) {
                return '';
        }
-       
+
        /**
         * Construct the full SQL query to do the search.
         * The guts shoulds be constructed in queryMain()
@@ -172,7 +172,7 @@ class SearchMySQL extends SearchEngine {
         */
     function updateTitle( $id, $title ) {
                $dbw =& wfGetDB( DB_MASTER );
-               
+
                $dbw->update( 'searchindex',
                        array( 'si_title' => $title ),
                        array( 'si_page'  => $id ),
@@ -187,15 +187,15 @@ class MySQLSearchResultSet extends SearchResultSet {
                $this->mResultSet = $resultSet;
                $this->mTerms = $terms;
        }
-       
+
        function termMatches() {
                return $this->mTerms;
        }
-       
+
        function numRows() {
                return $this->mResultSet->numRows();
        }
-       
+
        function next() {
                $row = $this->mResultSet->fetchObject();
                if( $row === false ) {
index 3e770fb..e600096 100644 (file)
@@ -31,7 +31,7 @@ require_once( 'SearchMySQL.php' );
  */
 class SearchMySQL4 extends SearchMySQL {
        var $strictMatching = true;
-       
+
        /** @todo document */
        function SearchMySQL4( &$db ) {
                $this->db =& $db;
@@ -66,7 +66,7 @@ class SearchMySQL4 extends SearchMySQL {
                } else {
                        wfDebug( "Can't understand search query '{$filteredText}'\n" );
                }
-               
+
                $searchon = $this->db->strencode( $searchon );
                $field = $this->getIndexField( $fulltext );
                return " MATCH($field) AGAINST('$searchon' IN BOOLEAN MODE) ";
index 90c900e..2cff2cb 100644 (file)
@@ -33,13 +33,13 @@ require_once( 'SearchEngine.php' );
  */
 class SearchTsearch2 extends SearchEngine {
        var $strictMatching = false;
-       
+
        function SearchTsearch2( &$db ) {
                $this->db =& $db;
                $this->db->setSchema('tsearch');
                $this->mRanking = true;
        }
-       
+
        function getIndexField( $fulltext ) {
                return $fulltext ? 'si_text' : 'si_title';
        }
@@ -72,7 +72,7 @@ class SearchTsearch2 extends SearchEngine {
                } else {
                        wfDebug( "Can't understand search query '{$this->filteredText}'\n" );
                }
-               
+
                $searchon = preg_replace('/(\s+)/','&',$searchon);
                $searchon = $this->db->strencode( $searchon );
                return $searchon;
@@ -86,7 +86,7 @@ class SearchTsearch2 extends SearchEngine {
                else
                        return "";
        }
-               
+
 
        function queryMain( $filteredTerm, $fulltext ) {
                $match = $this->parseQuery( $filteredTerm, $fulltext );
index 9601f09..1f222b3 100644 (file)
@@ -40,7 +40,7 @@ class SearchUpdate {
                require_once( 'SearchEngine.php' );
                $search = SearchEngine::create();
                $lc = $search->legalSearchChars() . '&#;';
-               
+
                if( $this->mText === false ) {
                        $search->updateTitle($this->mId,
                                Title::indexTitle( $this->mNamespace, $this->mTitle ));
index 500e953..8fd5d6b 100644 (file)
@@ -20,7 +20,7 @@ class SiteConfiguration {
        var $settings = array();
        var $localVHosts = array();
 
-       /** */  
+       /** */
        function get( $setting, $wiki, $suffix, $params = array() ) {
                if ( array_key_exists( $setting, $this->settings ) ) {
                        if ( array_key_exists( $wiki, $this->settings[$setting] ) ) {
@@ -117,5 +117,5 @@ class SiteConfiguration {
        }
 }
 }
-       
+
 ?>
index 5807e87..c811fbe 100644 (file)
@@ -59,7 +59,7 @@ class Skin extends Linker {
                global $wgValidSkinNames;
                return $wgValidSkinNames;
        }
-       
+
        /**
         * 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
@@ -71,7 +71,7 @@ class Skin extends Linker {
        function normalizeKey( $key ) {
                global $wgDefaultSkin;
                $skinNames = Skin::getSkinNames();
-               
+
                if( $key == '' ) {
                        // Don't return the default immediately;
                        // in a misconfiguration we need to fall back.
@@ -81,7 +81,7 @@ class Skin extends Linker {
                if( isset( $skinNames[$key] ) ) {
                        return $key;
                }
-               
+
                // Older versions of the software used a numeric setting
                // in the user preferences.
                $fallback = array(
@@ -92,7 +92,7 @@ class Skin extends Linker {
                if( isset( $fallback[$key] ) ){
                        $key = $fallback[$key];
                }
-               
+
                if( isset( $skinNames[$key] ) ) {
                        return $key;
                } else {
@@ -100,7 +100,7 @@ class Skin extends Linker {
                        return 'standard';
                }
        }
-       
+
        /**
         * Factory method for loading a skin of a given type
         * @param string $key 'monobook', 'standard', etc
@@ -109,10 +109,10 @@ class Skin extends Linker {
         */
        function &newFromKey( $key ) {
                $key = Skin::normalizeKey( $key );
-               
+
                $skinNames = Skin::getSkinNames();
                $skinName = $skinNames[$key];
-               
+
                global $IP;
 
                # Grab the skin class and initialise it. Each skin checks for PHPTal
@@ -159,7 +159,7 @@ class Skin extends Linker {
                $out->addLink( array( 'rel' => 'shortcut icon', 'href' => '/favicon.ico' ) );
 
                $this->addMetadataLinks($out);
-               
+
                $this->mRevisionId = $out->mRevisionId;
 
                wfProfileOut( $fname );
@@ -309,7 +309,7 @@ class Skin extends Linker {
                global $wgUser, $wgContLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss;
 
                $s = '';
-               
+
                if( $wgAllowUserCss && $wgUser->isLoggedIn() ) { # logged in
                        if($wgTitle->isCssSubpage() && $this->userCanPreview( $action ) ) {
                                $s .= $wgRequest->getText('wpTextbox1');
@@ -482,7 +482,7 @@ END;
                $embed = "<span dir='$dir'>";
                $pop = '</span>';
                $t = $embed . implode ( "$pop | $embed" , $wgOut->mCategoryLinks ) . $pop;
-               
+
                $msg = count( $wgOut->mCategoryLinks ) === 1 ? 'categories1' : 'categories';
                $s = $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Categories' ),
                        wfMsg( $msg ), 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) )
@@ -1076,7 +1076,7 @@ END;
                }
                return $s;
        }
-       
+
        /**
         * Return URL options for the 'edit page' link.
         * This may include an 'oldid' specifier, if the current page view is such.
@@ -1086,7 +1086,7 @@ END;
         */
        function editUrlOptions() {
                global $wgArticle;
-               
+
                if( $this->mRevisionId && ! $wgArticle->isCurrent() ) {
                        return "action=edit&oldid=" . intval( $this->mRevisionId );
                } else {
index c6159bd..156e455 100644 (file)
@@ -87,7 +87,7 @@ class SkinPHPTal extends SkinTemplate {
                        return new PHPTAL( $file . '.pt', $repository, $cache_dir );
                }
        }
-       
+
        /**
         * Output the string, or print error message if it's
         * an error object of the appropriate type.
@@ -116,19 +116,19 @@ class PHPTAL_version_bridge {
                        $this->tpl->setTemplateRepository( $repository );
                }
        }
-       
+
        function set( $name, $value ) {
                $this->tpl->$name = $value;
        }
-       
+
        function setRef($name, &$value) {
                $this->set( $name, $value );
        }
-       
+
        function setTranslator( &$t ) {
                $this->tpl->setTranslator( $t );
        }
-       
+
        function execute() {
                /*
                try {
index a018e84..34562ec 100644 (file)
@@ -538,12 +538,12 @@ class SkinTemplate extends Skin {
                        $classes[] = 'new';
                        $query = 'action=edit';
                }
-               
+
                $text = wfMsg( $message );
                if ( $text == "&lt;$message&gt;" ) {
                        $text = html_entity_decode($text);
                }
-               
+
                return array(
                        'class' => implode( ' ', $classes ),
                        'text' => $text,
@@ -700,7 +700,7 @@ class SkinTemplate extends Skin {
                                        );
                                }
                        }
-                       
+
                        wfRunHooks( 'SkinTemplateTabs', array( &$this , &$content_actions ) )   ;
                } else {
                        /* show special page tab */
@@ -738,7 +738,7 @@ class SkinTemplate extends Skin {
                }
 
                wfRunHooks( 'SkinTemplateContentActions', array( &$content_actions ) );
-               
+
                wfProfileOut( $fname );
                return $content_actions;
        }
@@ -811,7 +811,7 @@ class SkinTemplate extends Skin {
                                                'href' => $wgTitle->getLocalURL( "oldid=$revid" )
                                        );
                        }
-                       
+
                        wfRunHooks( 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array( &$this, &$nav_urls, &$oldid, &$revid ) );
                }
 
@@ -934,9 +934,9 @@ class SkinTemplate extends Skin {
 
                # If we use the site's dynamic CSS, throw that in, too
                if ( $wgUseSiteCss ) {
-                       $query = "action=raw&ctype=text/css&smaxage=$wgSquidMaxage";            
+                       $query = "action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
                        $sitecss .= '@import "' . $this->makeNSUrl('Common.css', $query, NS_MEDIAWIKI) . '";' . "\n";
-                       $sitecss .= '@import "' . $this->makeNSUrl(ucfirst($this->skinname) . '.css', $query, NS_MEDIAWIKI) . '";' . "\n";                      
+                       $sitecss .= '@import "' . $this->makeNSUrl(ucfirst($this->skinname) . '.css', $query, NS_MEDIAWIKI) . '";' . "\n";
                        $sitecss .= '@import "' . $this->makeUrl('-','action=raw&gen=css' . $siteargs) . '";' . "\n";
                }
 
index 4073245..8238a4a 100644 (file)
@@ -19,10 +19,10 @@ function wfSpecialAllmessages() {
 
        $fname = "wfSpecialAllMessages";
        wfProfileIn( $fname );
-       
+
        wfProfileIn( "$fname-setup");
        $ot = $wgRequest->getText( 'ot' );
-       
+
        $navText = wfMsg( 'allmessagestext' );
 
 
@@ -40,7 +40,7 @@ function wfSpecialAllmessages() {
 
        $wgMessageCache->enableTransform();
        wfProfileOut( "$fname-setup" );
-       
+
        wfProfileIn( "$fname-output" );
        if ($ot == 'php') {
                $navText .= makePhp($messages);
@@ -51,7 +51,7 @@ function wfSpecialAllmessages() {
                $wgOut->addHTML( makeHTMLText( $messages ) );
        }
        wfProfileOut( "$fname-output" );
-       
+
        wfProfileOut( $fname );
 }
 
@@ -90,7 +90,7 @@ function makeHTMLText( $messages ) {
        global $wgLang, $wgUser, $wgLanguageCode, $wgContLanguageCode;
        $fname = "makeHTMLText";
        wfProfileIn( $fname );
-       
+
        $sk =& $wgUser->getSkin();
        $talk = $wgLang->getNsText( NS_TALK );
        $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
@@ -104,7 +104,7 @@ function makeHTMLText( $messages ) {
        <tr>
                <th>" . wfMsgHtml('allmessagescurrent') . "</th>
        </tr>";
-       
+
        wfProfileIn( "$fname-check" );
        # This is a nasty hack to avoid doing independent existence checks
        # without sending the links and table through the slow wiki parser.
@@ -136,7 +136,7 @@ function makeHTMLText( $messages ) {
                $changed = ($m['statmsg'] != $m['msg']);
                $message = htmlspecialchars( $m['statmsg'] );
                $mw = htmlspecialchars( $m['msg'] );
-               
+
                #$pageLink = $sk->makeLinkObj( $titleObj, htmlspecialchars( $key ) );
                #$talkLink = $sk->makeLinkObj( $talkPage, htmlspecialchars( $talk ) );
                if( isset( $pageExists[NS_MEDIAWIKI][$title] ) ) {
index 8d43628..25275a6 100644 (file)
@@ -14,7 +14,7 @@ function wfSpecialAllpages( $par=NULL, $specialPage ) {
        # GET values
        $from = $wgRequest->getVal( 'from' );
        $namespace = $wgRequest->getInt( 'namespace' );
-       
+
        $namespaces = $wgContLang->getNamespaces();
 
        $indexPage = new SpecialAllpages();
@@ -26,7 +26,7 @@ function wfSpecialAllpages( $par=NULL, $specialPage ) {
                wfMsg( 'allinnamespace', $namespaces[$namespace] ) :
                wfMsg( 'allarticles' )
                );
-       
+
        if ( isset($par) ) {
                $indexPage->showChunk( $namespace, $par, $specialPage->including() );
        } elseif ( isset($from) ) {
@@ -57,7 +57,7 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
        $frombox = "<input type='text' size='20' name='from' id='nsfrom' value=\""
                    . htmlspecialchars ( $from ) . '"/>';
        $submitbutton = '<input type="submit" value="' . wfMsgHtml( 'allpagessubmit' ) . '" />';
-       
+
        $out = "<div class='namespaceoptions'><form method='get' action='{$wgScript}'>";
        $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />';
        $out .= "
@@ -100,14 +100,14 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) {
        global $wgMemc, $wgDBname;
        $key = "$wgDBname:allpages:ns:$namespace";
        $lines = $wgMemc->get( $key );
-       
+
        if( !is_array( $lines ) ) {
                $firstTitle = $dbr->selectField( 'page', 'page_title', $where, $fname, array( 'LIMIT' => 1 ) );
                $lastTitle = $firstTitle;
-               
+
                # This array is going to hold the page_titles in order.
                $lines = array( $firstTitle );
-               
+
                # If we are going to show n rows, we need n+1 queries to find the relevant titles.
                $done = false;
                for( $i = 0; !$done; ++$i ) {
@@ -146,7 +146,7 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) {
                }
                $wgMemc->add( $key, $lines, 3600 );
        }
-       
+
        // If there are only two or less sections, don't even display them.
        // Instead, display the first section directly.
        if( count( $lines ) <= 2 ) {
@@ -163,7 +163,7 @@ function showToplevel ( $namespace = NS_MAIN, $including = false ) {
        }
        $out .= '</table>';
        $nsForm = $this->namespaceForm ( $namespace, '', false );
-       
+
        # Is there more?
        if ( $including ) {
                $out2 = '';
@@ -214,7 +214,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
        global $wgOut, $wgUser, $wgContLang;
 
        $fname = 'indexShowChunk';
-       
+
        $sk = $wgUser->getSkin();
 
        $fromTitle = null;
@@ -228,7 +228,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
                        $namespace = $fromNS;
        }
        $fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
-       
+
        $dbr =& wfGetDB( DB_SLAVE );
        $res = $dbr->select( 'page',
                array( 'page_namespace', 'page_title', 'page_is_redirect' ),
index 1de0e05..d3381c7 100644 (file)
@@ -24,7 +24,7 @@ class AncientPagesPage extends QueryPage {
        function isExpensive() {
                return true;
        }
-       
+
        function isSyndicated() { return false; }
 
        function getSQL() {
@@ -41,7 +41,7 @@ class AncientPagesPage extends QueryPage {
                        WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
                          AND page_latest=rev_id";
        }
-       
+
        function sortDescending() {
                return false;
        }
index 2483684..c621ebe 100644 (file)
@@ -46,7 +46,7 @@ class IPBlockForm {
                $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
                $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' );
        }
-       
+
        function showForm( $err ) {
                global $wgOut, $wgUser, $wgRequest, $wgSysopUserBans;
 
@@ -94,7 +94,7 @@ class IPBlockForm {
                }
 
                $token = htmlspecialchars( $wgUser->editToken() );
-               
+
                $wgOut->addHTML( "
 <form id=\"blockip\" method=\"post\" action=\"{$action}\">
        <table border='0'>
@@ -143,7 +143,7 @@ class IPBlockForm {
 
        function doSubmit() {
                global $wgOut, $wgUser, $wgSysopUserBans, $wgSysopRangeBans;
-               
+
                $userId = 0;
                $this->BlockAddress = trim( $this->BlockAddress );
                $rxIP = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
@@ -164,7 +164,7 @@ class IPBlockForm {
                                }
                        } else {
                                # Username block
-                               if ( $wgSysopUserBans ) {       
+                               if ( $wgSysopUserBans ) {
                                        $userId = User::idFromName( $this->BlockAddress );
                                        if ( $userId == 0 ) {
                                                $this->showForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->BlockAddress ) ) );
@@ -196,23 +196,23 @@ class IPBlockForm {
                                $this->showForm( wfMsg( 'ipb_expiry_invalid' ) );
                                return;
                        }
-                       
+
                        $expiry = wfTimestamp( TS_MW, $expiry );
 
                }
-               
+
                # Create block
                # Note: for a user block, ipb_address is only for display purposes
 
                $ban = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
                        $this->BlockReason, wfTimestampNow(), 0, $expiry );
-               
+
                if (wfRunHooks('BlockIp', array(&$ban, &$wgUser))) {
-                       
+
                        $ban->insert();
-                       
+
                        wfRunHooks('BlockIpComplete', array($ban, $wgUser));
-                       
+
                        # Make log entry
                        $log = new LogPage( 'block' );
                        $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
index 59133ed..b452b14 100644 (file)
@@ -13,7 +13,7 @@ function wfSpecialBlockme()
        global $wgBlockOpenProxies, $wgOut, $wgProxyKey;
 
        $ip = wfGetIP();
-       
+
        if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $ip . $wgProxyKey ) ) {
                $wgOut->addWikiText( wfMsg( "disabled" ) );
                return;
index de5c3c8..47e70dc 100644 (file)
  */
 function wfSpecialBooksources( $par ) {
        global $wgRequest;
-       
+
        $isbn = $par;
        if( empty( $par ) ) {
                $isbn = $wgRequest->getVal( 'isbn' );
        }
        $isbn = preg_replace( '/[^0-9X]/', '', $isbn );
-       
+
        $bsl = new BookSourceList( $isbn );
        $bsl->show();
 }
@@ -45,24 +45,24 @@ class BookSourceList {
                        $this->showList();
                }
        }
-       
+
        function showList() {
                global $wgOut, $wgContLang;
                $fname = "BookSourceList::showList()";
-               
+
                # First, see if we have a custom list setup in
                # [[Wikipedia:Book sources]] or equivalent.
                $bstitle = Title::makeTitleSafe( NS_PROJECT, wfMsg( "booksources" ) );
                $bsarticle = new Article( $bstitle );
                if( $bsarticle->exists() ) {
                        $bstext = $bsarticle->getContent( false );
-                       if( $bstext ) { 
+                       if( $bstext ) {
                                $bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
                                $wgOut->addWikiText( $bstext );
                                return;
                        }
                }
-               
+
                # Otherwise, use the list of links in the default Language.php file.
                $s = wfMsgWikiHtml( 'booksourcetext' ) . "<ul>\n";
                $bs = $wgContLang->getBookstoreList() ;
@@ -88,11 +88,11 @@ class BookSourceList {
 
                $wgOut->addHTML( $s );
        }
-       
+
        function askForm() {
                global $wgOut, $wgTitle;
                $fname = "BookSourceList::askForm()";
-               
+
                $action = $wgTitle->escapeLocalUrl();
                $isbn = htmlspecialchars( wfMsg( "isbn" ) );
                $go = htmlspecialchars( wfMsg( "go" ) );
index a78319f..836bbe6 100644 (file)
@@ -21,7 +21,7 @@ class BrokenRedirectsPage extends PageQueryPage {
        function getName() {
                return 'BrokenRedirects';
        }
-       
+
        function isExpensive( ) { return true; }
        function isSyndicated() { return false; }
 
@@ -72,7 +72,7 @@ class BrokenRedirectsPage extends PageQueryPage {
                $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
                $edit = $skin->makeBrokenLinkObj( $fromObj , "(".wfMsg("qbedit").")" , 'redirect=no');
                $to   = $skin->makeBrokenLinkObj( $toObj );
-                               
+
                return "$from $edit &rarr; $to";
        }
 }
@@ -82,9 +82,9 @@ class BrokenRedirectsPage extends PageQueryPage {
  */
 function wfSpecialBrokenRedirects() {
        list( $limit, $offset ) = wfCheckLimits();
-       
+
        $sbr = new BrokenRedirectsPage();
-       
+
        return $sbr->doQuery( $offset, $limit );
 
 }
index ea7ef0e..32ec179 100644 (file)
@@ -43,7 +43,7 @@ class CategoriesPage extends QueryPage {
                           GROUP BY cl_to";
                return $s;
        }
-       
+
        function sortDescending() {
                return false;
        }
index ac6415e..a97ddd9 100644 (file)
@@ -35,7 +35,7 @@ class ConfirmationForm {
                }
        }
 
-       /** */  
+       /** */
        function confirmAndShow( $user ) {
                if( $user->confirmEmail() ) {
                        $this->showSuccess();
@@ -66,15 +66,15 @@ class ConfirmationForm {
        function showEmpty( $err ) {
                require_once( 'templates/Confirmemail.php' );
                global $wgOut, $wgUser;
-               
+
                $tpl = new ConfirmemailTemplate();
                $tpl->set( 'error', $err );
                $tpl->set( 'edittoken', $wgUser->editToken() );
-               
+
                $title = Title::makeTitle( NS_SPECIAL, 'Confirmemail' );
                $tpl->set( 'action', $title->getLocalUrl() );
-               
-               
+
+
                $wgOut->addTemplate( $tpl );
        }
 
@@ -93,7 +93,7 @@ class ConfirmationForm {
        /** */
        function showSuccess() {
                global $wgOut, $wgRequest, $wgUser;
-               
+
                if( $wgUser->isLoggedIn() ) {
                        $wgOut->addWikiText( wfMsg( 'confirmemail_loggedin' ) );
                } else {
index 26c62bd..c82eda3 100644 (file)
@@ -29,7 +29,7 @@ class DeadendPagesPage extends PageQueryPage {
        function isExpensive( ) {
                return 1;
        }
-       
+
        function isSyndicated() { return false; }
 
        /**
@@ -38,7 +38,7 @@ class DeadendPagesPage extends PageQueryPage {
        function sortDescending() {
                return false;
        }
-       
+
     /**
         * @return string an sqlquery
         */
index fd44a25..c926ae6 100644 (file)
@@ -20,14 +20,14 @@ class DisambiguationsPage extends PageQueryPage {
        function getName() {
                return 'Disambiguations';
        }
-       
+
        function isExpensive( ) { return true; }
        function isSyndicated() { return false; }
 
        function getPageHeader( ) {
                global $wgUser;
                $sk = $wgUser->getSkin();
-               
+
                #FIXME : probably need to add a backlink to the maintenance page.
                return '<p>'.wfMsg("disambiguationstext", $sk->makeKnownLink(wfMsgForContent('disambiguationspage')) )."</p><br />\n";
        }
@@ -35,7 +35,7 @@ class DisambiguationsPage extends PageQueryPage {
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
                extract( $dbr->tableNames( 'page', 'pagelinks' ) );
-               
+
                $dp = Title::newFromText(wfMsgForContent("disambiguationspage"));
                $id = $dp->getArticleId();
         $dns = $dp->getNamespace();
@@ -54,7 +54,7 @@ class DisambiguationsPage extends PageQueryPage {
        function getOrder() {
                return '';
        }
-       
+
        function formatResult( $skin, $result ) {
                $title = Title::newFromId( $result->value );
         $dp = Title::makeTitle( $result->namespace, $result->title );
@@ -62,7 +62,7 @@ class DisambiguationsPage extends PageQueryPage {
                $from = $skin->makeKnownLinkObj( $title,'');
                $edit = $skin->makeBrokenLinkObj( $title, "(".wfMsg("qbedit").")" , 'redirect=no');
                $to   = $skin->makeKnownLinkObj( $dp,'');
-               
+
                return "$from $edit => $to";
        }
 }
@@ -72,9 +72,9 @@ class DisambiguationsPage extends PageQueryPage {
  */
 function wfSpecialDisambiguations() {
        list( $limit, $offset ) = wfCheckLimits();
-       
+
        $sd = new DisambiguationsPage();
-       
+
        return $sd->doQuery( $offset, $limit );
 }
 ?>
index 080a906..9dea932 100644 (file)
@@ -20,7 +20,7 @@ class DoubleRedirectsPage extends PageQueryPage {
        function getName() {
                return 'DoubleRedirects';
        }
-       
+
        function isExpensive( ) { return true; }
        function isSyndicated() { return false; }
 
@@ -51,7 +51,7 @@ class DoubleRedirectsPage extends PageQueryPage {
        function getOrder() {
                return '';
        }
-       
+
        function formatResult( $skin, $result ) {
                $fname = 'DoubleRedirectsPage::formatResult';
                $titleA = Title::makeTitle( $result->namespace, $result->title );
@@ -82,7 +82,7 @@ class DoubleRedirectsPage extends PageQueryPage {
                if ( !$result ) {
                        return '';
                }
-               
+
                $titleB = Title::makeTitle( $result->nsb, $result->tb );
                $titleC = Title::makeTitle( $result->nsc, $result->tc );
 
@@ -90,7 +90,7 @@ class DoubleRedirectsPage extends PageQueryPage {
                $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
                $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
                $linkC = $skin->makeKnownLinkObj( $titleC );
-               
+
                return "$linkA $edit " . wfMsgHtml( 'doubleredirectsarrow' )
                        . " $linkB " . wfMsgHtml( 'doubleredirectsarrow' ) . " $linkC";
        }
@@ -101,9 +101,9 @@ class DoubleRedirectsPage extends PageQueryPage {
  */
 function wfSpecialDoubleRedirects() {
        list( $limit, $offset ) = wfCheckLimits();
-       
+
        $sdr = new DoubleRedirectsPage();
-       
+
        return $sdr->doQuery( $offset, $limit );
 
 }
index defc981..59899c9 100644 (file)
@@ -17,13 +17,13 @@ function wfSpecialEmailuser( $par ) {
                $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
                return;
        }
-       
+
        if( !$wgUser->canSendEmail() ) {
                wfDebug( "User can't send.\n" );
                $wgOut->errorpage( "mailnologin", "mailnologintext" );
                return;
        }
-       
+
        $action = $wgRequest->getVal( 'action' );
        $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
        if ( "" == $target ) {
@@ -31,14 +31,14 @@ function wfSpecialEmailuser( $par ) {
                $wgOut->errorpage( "notargettitle", "notargettext" );
                return;
        }
-       
+
        $nt = Title::newFromURL( $target );
        if ( is_null( $nt ) ) {
                wfDebug( "Target is invalid title.\n" );
                $wgOut->errorpage( "notargettitle", "notargettext" );
                return;
        }
-       
+
        $nu = User::newFromName( $nt->getText() );
        if( is_null( $nu ) || !$nu->canReceiveEmail() ) {
                wfDebug( "Target is invalid user or can't receive.\n" );
@@ -96,7 +96,7 @@ class EmailUserForm {
                $emm = wfMsg( "emailmessage" );
                $ems = wfMsg( "emailsend" );
                $encSubject = htmlspecialchars( $this->subject );
-               
+
                $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
                $action = $titleObj->escapeLocalURL( "target=" .
                        urlencode( $this->target->getName() ) . "&action=submit" );
@@ -128,15 +128,15 @@ class EmailUserForm {
 
        function doSubmit() {
                global $wgOut, $wgUser;
-       
+
                $to = new MailAddress( $this->target );
                $from = new MailAddress( $wgUser );
                $subject = $this->subject;
-               
+
                if( wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$this->text ) ) ) {
-                       
+
                        $mailResult = userMailer( $to, $from, $subject, $this->text );
-                       
+
                        if( WikiError::isError( $mailResult ) ) {
                                $wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
                        } else {
index f1b4662..fe9a1e3 100644 (file)
@@ -32,7 +32,7 @@ require_once( 'Export.php' );
 function wfSpecialExport( $page = '' ) {
        global $wgOut, $wgRequest;
        global $wgExportAllowHistory;
-       
+
        if( $wgRequest->getVal( 'action' ) == 'submit') {
                $page = $wgRequest->getText( 'pages' );
                if( $wgExportAllowHistory ) {
@@ -44,12 +44,12 @@ function wfSpecialExport( $page = '' ) {
                # 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 );
@@ -58,7 +58,7 @@ function wfSpecialExport( $page = '' ) {
                $exporter->closeStream();
                return;
        }
-       
+
        $wgOut->addWikiText( wfMsg( "exporttext" ) );
        $titleObj = Title::makeTitle( NS_SPECIAL, "Export" );
        $action = $titleObj->escapeLocalURL( 'action=submit' );
index 6820bc4..a16ddae 100644 (file)
@@ -12,7 +12,7 @@ require_once('Group.php');
 /** Entry point */
 function wfSpecialGroups() {
        global $wgRequest;
-       
+
        $form = new GroupsForm($wgRequest);
        $form->execute();
 }
@@ -26,14 +26,14 @@ class GroupsForm extends HTMLForm {
        var $mPosted, $mRequest, $mSaveprefs, $mChangeAllowed;
        var $mNewName, $mDescription, $mOldName, $mRights, $mId;
        var $mAdd, $mEdit;
-       
+
        /** Escaped local url name*/
        var $action, $location;
 
        /** Constructor*/
        function GroupsForm ( &$request ) {
                global $wgUser;
-               
+
                $this->mPosted = $request->wasPosted();
                $this->mRequest =& $request;
                $this->mName = 'groups';
@@ -75,7 +75,7 @@ class GroupsForm extends HTMLForm {
                } elseif ( $this->mEdit ) {
                        if ( $this->mPosted ) {
                                $wgOut->redirect( $this->location );
-                       } else {                        
+                       } else {
                                $this->switchForm();
                                $this->editGroupForm( $this->mId );
                        }
@@ -101,7 +101,7 @@ class GroupsForm extends HTMLForm {
                global $wgOut;
 
                $this->mNewName = trim($this->mNewName);
-       
+
                if ( $this->mNewName == '' ) {
                        $this->editGroupForm( $this->mGroupID, 'groups-noname' );
                        return false;
@@ -127,16 +127,16 @@ class GroupsForm extends HTMLForm {
                                return;
                        }
                }
-               
+
                // save stuff
                $g->setName($this->mNewName);
                $g->setDescription($this->mDescription);
                if( is_array( $this->mRights ) ) {
                        $g->setRights( implode(',',$this->mRights) );
                }
-               
+
                $g->save();
-               
+
                // Make the log entry
                $log = new LogPage( 'rights' );
                $dummyTitle = Title::makeTitle( 0, '' );
@@ -165,8 +165,8 @@ class GroupsForm extends HTMLForm {
         */
        function switchForm() {
                global $wgOut;
-               
-               // group selection              
+
+               // group selection
                $wgOut->addHTML( "<form name=\"ulgroup\" action=\"$this->action\" method=\"post\">\n" );
                $wgOut->addHTML( $this->fieldset( 'lookup-group',
                                HTMLSelectGroups('id', $this->mName.'-group-edit', array(0 => $this->mRequest->getVal('id')) ) .
@@ -241,10 +241,10 @@ class GroupsForm extends HTMLForm {
                $s .= "|}\n";
                $wgOut->addWikiText( $s );
        }
-               
+
        function showRecord() {
                global $wgOut;
-               
+
                $groups =& Group::getAllGroups();
                $rec = serialize( $groups );
                // Split it into lines
index feed860..6438e9c 100644 (file)
@@ -10,7 +10,7 @@
  */
 function wfSpecialImagelist() {
        global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMiserMode;
-       
+
        $sort = $wgRequest->getVal( 'sort' );
        $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
        $dbr =& wfGetDB( DB_SLAVE );
index dff0fc6..e0289af 100644 (file)
@@ -31,12 +31,12 @@ require_once( 'WikiError.php' );
  */
 function wfSpecialImport( $page = '' ) {
        global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources;
-       
+
        ###
 #      $wgOut->addWikiText( "Special:Import is not ready for this beta release, sorry." );
 #      return;
        ###
-       
+
        if( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit') {
                switch( $wgRequest->getVal( "source" ) ) {
                case "upload":
@@ -54,7 +54,7 @@ function wfSpecialImport( $page = '' ) {
                default:
                        $source = new WikiError( "Unknown import source type" );
                }
-               
+
                if( WikiError::isError( $source ) ) {
                        $wgOut->addWikiText( wfEscapeWikiText( $source->getMessage() ) );
                } else {
@@ -69,9 +69,9 @@ function wfSpecialImport( $page = '' ) {
                        }
                }
        }
-       
+
        $action = $wgTitle->escapeLocalUrl( 'action=submit' );
-       
+
        if( $wgUser->isAllowed( 'importupload' ) ) {
                $wgOut->addWikiText( wfMsg( "importtext" ) );
                $wgOut->addHTML( "
@@ -91,7 +91,7 @@ function wfSpecialImport( $page = '' ) {
                        $wgOut->addWikiText( wfMsg( 'importnosources' ) );
                }
        }
-       
+
        if( !empty( $wgImportSources ) ) {
                $wgOut->addHTML( "
 <fieldset>
@@ -128,56 +128,56 @@ class WikiRevision {
        var $text = "";
        var $comment = "";
        var $minor = false;
-       
+
        function setTitle( $text ) {
                $this->title = Title::newFromText( $text );
        }
-       
+
        function setTimestamp( $ts ) {
                # 2003-08-05T18:30:02Z
                $this->timestamp = wfTimestamp( TS_MW, $ts );
        }
-       
+
        function setUsername( $user ) {
                $this->user_text = $user;
        }
-       
+
        function setUserIP( $ip ) {
                $this->user_text = $ip;
        }
-       
+
        function setText( $text ) {
                $this->text = $text;
        }
-       
+
        function setComment( $text ) {
                $this->comment = $text;
        }
-       
+
        function setMinor( $minor ) {
                $this->minor = (bool)$minor;
        }
-       
+
        function getTitle() {
                return $this->title;
        }
-       
+
        function getTimestamp() {
                return $this->timestamp;
        }
-       
+
        function getUser() {
                return $this->user_text;
        }
-       
+
        function getText() {
                return $this->text;
        }
-       
+
        function getComment() {
                return $this->comment;
        }
-       
+
        function getMinor() {
                return $this->minor;
        }
@@ -185,7 +185,7 @@ class WikiRevision {
        function importOldRevision() {
                $fname = "WikiImporter::importOldRevision";
                $dbw =& wfGetDB( DB_MASTER );
-               
+
                # Sneak a single revision into place
                $user = User::newFromName( $this->getUser() );
                if( $user ) {
@@ -199,22 +199,22 @@ class WikiRevision {
                // avoid memory leak...?
                $linkCache =& LinkCache::singleton();
                $linkCache->clear();
-               
+
                $article = new Article( $this->title );
                $pageId = $article->getId();
                if( $pageId == 0 ) {
                        # must create the page...
                        $pageId = $article->insertOn( $dbw );
                }
-               
+
                # FIXME: Check for exact conflicts
                # FIXME: Use original rev_id optionally
                # FIXME: blah blah blah
-               
+
                #if( $numrows > 0 ) {
                #       return wfMsg( "importhistoryconflict" );
                #}
-               
+
                # Insert the row
                $revision = new Revision( array(
                        'page'       => $pageId,
@@ -227,7 +227,7 @@ class WikiRevision {
                        ) );
                $revId = $revision->insertOn( $dbw );
                $article->updateIfNewerOn( $dbw, $revision );
-               
+
                return true;
        }
 
@@ -243,32 +243,32 @@ class WikiImporter {
        var $mPageCallback = null;
        var $mRevisionCallback = null;
        var $lastfield;
-       
+
        function WikiImporter( $source ) {
                $this->setRevisionCallback( array( &$this, "importRevision" ) );
                $this->mSource = $source;
        }
-       
+
        function throwXmlError( $err ) {
                $this->debug( "FAILURE: $err" );
                wfDebug( "WikiImporter XML error: $err\n" );
        }
-       
+
        # --------------
-       
+
        function doImport() {
                if( empty( $this->mSource ) ) {
                        return new WikiErrorMsg( "importnotext" );
                }
-               
+
                $parser = xml_parser_create( "UTF-8" );
-               
+
                # case folding violates XML standard, turn it off
                xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
-               
+
                xml_set_object( $parser, $this );
                xml_set_element_handler( $parser, "in_start", "" );
-               
+
                $offset = 0; // for context extraction on error reporting
                do {
                        $chunk = $this->mSource->readChunk();
@@ -279,14 +279,14 @@ class WikiImporter {
                        $offset += strlen( $chunk );
                } while( $chunk !== false && !$this->mSource->atEnd() );
                xml_parser_free( $parser );
-               
+
                return true;
        }
-       
+
        function debug( $data ) {
                #wfDebug( "IMPORT: $data\n" );
        }
-       
+
        function notice( $data ) {
                global $wgCommandLineMode;
                if( $wgCommandLineMode ) {
@@ -296,7 +296,7 @@ class WikiImporter {
                        $wgOut->addHTML( "<li>$data</li>\n" );
                }
        }
-       
+
        /**
         * Sets the action to perform as each new page in the stream is reached.
         * @param callable $callback
@@ -307,7 +307,7 @@ class WikiImporter {
                $this->mPageCallback = $callback;
                return $previous;
        }
-       
+
        /**
         * Sets the action to perform as each page revision is reached.
         * @param callable $callback
@@ -318,7 +318,7 @@ class WikiImporter {
                $this->mRevisionCallback = $callback;
                return $previous;
        }
-       
+
        /**
         * Default per-revision callback, performs the import.
         * @param WikiRevision $revision
@@ -346,7 +346,7 @@ class WikiImporter {
                $this->debug( "-- Comment: " . $revision->comment );
                $this->debug( "-- Text: " . $revision->text );
        }
-       
+
        /**
         * Notify the callback function when a new <page> is reached.
         * @param Title $title
@@ -357,13 +357,13 @@ class WikiImporter {
                        call_user_func( $this->mPageCallback, $title );
                }
        }
-       
-       
+
+
        # XML parser callbacks from here out -- beware!
        function donothing( $parser, $x, $y="" ) {
                #$this->debug( "donothing" );
        }
-       
+
        function in_start( $parser, $name, $attribs ) {
                $this->debug( "in_start $name" );
                if( $name != "mediawiki" ) {
@@ -371,7 +371,7 @@ class WikiImporter {
                }
                xml_set_element_handler( $parser, "in_mediawiki", "out_mediawiki" );
        }
-       
+
        function in_mediawiki( $parser, $name, $attribs ) {
                $this->debug( "in_mediawiki $name" );
                if( $name == 'siteinfo' ) {
@@ -389,8 +389,8 @@ class WikiImporter {
                }
                xml_set_element_handler( $parser, "donothing", "donothing" );
        }
-       
-       
+
+
        function in_siteinfo( $parser, $name, $attribs ) {
                // no-ops for now
                $this->debug( "in_siteinfo $name" );
@@ -406,13 +406,13 @@ class WikiImporter {
                        return $this->throwXMLerror( "Element <$name> not allowed in <siteinfo>." );
                }
        }
-       
+
        function out_siteinfo( $parser, $name ) {
                if( $name == "siteinfo" ) {
                        xml_set_element_handler( $parser, "in_mediawiki", "out_mediawiki" );
                }
        }
-       
+
 
        function in_page( $parser, $name, $attribs ) {
                $this->debug( "in_page $name" );
@@ -435,18 +435,18 @@ class WikiImporter {
                        return $this->throwXMLerror( "Element <$name> not allowed in a <page>." );
                }
        }
-       
+
        function out_page( $parser, $name ) {
                $this->debug( "out_page $name" );
                if( $name != "page" ) {
                        return $this->throwXMLerror( "Expected </page>, got </$name>" );
                }
                xml_set_element_handler( $parser, "in_mediawiki", "out_mediawiki" );
-               
+
                $this->workTitle = NULL;
                $this->workRevision = NULL;
        }
-       
+
        function in_nothing( $parser, $name, $attribs ) {
                $this->debug( "in_nothing $name" );
                return $this->throwXMLerror( "No child elements allowed here; got <$name>" );
@@ -462,7 +462,7 @@ class WikiImporter {
                }
                xml_set_element_handler( $parser, "in_$this->parenttag", "out_$this->parenttag" );
                xml_set_character_data_handler( $parser, "donothing" );
-               
+
                switch( $this->appendfield ) {
                case "title":
                        $this->workTitle = $this->appenddata;
@@ -492,7 +492,7 @@ class WikiImporter {
                $this->appendfield = "";
                $this->appenddata = "";
        }
-       
+
        function in_revision( $parser, $name, $attribs ) {
                $this->debug( "in_revision $name" );
                switch( $name ) {
@@ -513,14 +513,14 @@ class WikiImporter {
                        return $this->throwXMLerror( "Element <$name> not allowed in a <revision>." );
                }
        }
-       
+
        function out_revision( $parser, $name ) {
                $this->debug( "out_revision $name" );
                if( $name != "revision" ) {
                        return $this->throwXMLerror( "Expected </revision>, got </$name>" );
                }
                xml_set_element_handler( $parser, "in_page", "out_page" );
-               
+
                $out = call_user_func_array( $this->mRevisionCallback,
                        array( &$this->workRevision, &$this ) );
                if( !empty( $out ) ) {
@@ -528,7 +528,7 @@ class WikiImporter {
                        $wgOut->addHTML( "<li>" . $out . "</li>\n" );
                }
        }
-       
+
        function in_contributor( $parser, $name, $attribs ) {
                $this->debug( "in_contributor $name" );
                switch( $name ) {
@@ -544,7 +544,7 @@ class WikiImporter {
                        $this->throwXMLerror( "Invalid tag <$name> in <contributor>" );
                }
        }
-       
+
        function out_contributor( $parser, $name ) {
                $this->debug( "out_contributor $name" );
                if( $name != "contributor" ) {
@@ -561,11 +561,11 @@ class ImportStringSource {
                $this->mString = $string;
                $this->mRead = false;
        }
-       
+
        function atEnd() {
                return $this->mRead;
        }
-       
+
        function readChunk() {
                if( $this->atEnd() ) {
                        return false;
@@ -581,15 +581,15 @@ class ImportStreamSource {
        function ImportStreamSource( $handle ) {
                $this->mHandle = $handle;
        }
-       
+
        function atEnd() {
                return feof( $this->mHandle );
        }
-       
+
        function readChunk() {
                return fread( $this->mHandle, 32768 );
        }
-       
+
        function newFromFile( $filename ) {
                $file = @fopen( $filename, 'rt' );
                if( !$file ) {
@@ -600,9 +600,9 @@ class ImportStreamSource {
 
        function newFromUpload( $fieldname = "xmlimport" ) {
                global $wgOut;
-               
+
                $upload =& $_FILES[$fieldname];
-               
+
                if( !isset( $upload ) ) {
                        return new WikiErrorMsg( 'importnofile' );
                }
@@ -616,7 +616,7 @@ class ImportStreamSource {
                        return new WikiErrorMsg( 'importnofile' );
                }
        }
-       
+
        function newFromURL( $url ) {
                # fopen-wrappers are normally turned off for security.
                ini_set( "allow_url_fopen", true );
@@ -624,7 +624,7 @@ class ImportStreamSource {
                ini_set( "allow_url_fopen", false );
                return $ret;
        }
-       
+
        function newFromInterwiki( $interwiki, $page ) {
                $base = Title::getInterwikiLink( $interwiki );
                if( empty( $base ) ) {
index 1cc467d..89c996d 100644 (file)
  */
 function wfSpecialIpblocklist() {
        global $wgUser, $wgOut, $wgRequest;
-       
+
        $ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) );
        $reason = $wgRequest->getText( 'wpUnblockReason' );
        $action = $wgRequest->getText( 'action' );
-       
+
        $ipu = new IPUnblockForm( $ip, $reason );
 
        if ( "success" == $action ) {
@@ -41,12 +41,12 @@ function wfSpecialIpblocklist() {
  */
 class IPUnblockForm {
        var $ip, $reason;
-       
+
        function IPUnblockForm( $ip, $reason ) {
                $this->ip = $ip;
                $this->reason = $reason;
        }
-       
+
        function showForm( $err ) {
                global $wgOut, $wgUser, $wgSysopUserBans;
 
@@ -64,7 +64,7 @@ class IPUnblockForm {
                        $wgOut->addWikitext( "<span class='error'>{$err}</span>\n" );
                }
                $token = htmlspecialchars( $wgUser->editToken() );
-               
+
                $wgOut->addHTML( "
 <form id=\"unblockip\" method=\"post\" action=\"{$action}\">
        <table border='0'>
@@ -91,7 +91,7 @@ class IPUnblockForm {
 </form>\n" );
 
        }
-       
+
        function doSubmit() {
                global $wgOut, $wgUser;
 
@@ -120,7 +120,7 @@ class IPUnblockForm {
 
        function showList( $msg ) {
                global $wgOut;
-               
+
                $wgOut->setPagetitle( wfMsg( "ipblocklist" ) );
                if ( "" != $msg ) {
                        $wgOut->setSubtitle( $msg );
@@ -128,12 +128,12 @@ class IPUnblockForm {
                global $wgRequest;
                list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset();
                $this->counter = 0;
-               
+
                $paging = '<p>' . wfViewPrevNext( $this->offset, $this->limit,
                        Title::makeTitle( NS_SPECIAL, 'Ipblocklist' ),
                        'ip=' . urlencode( $this->ip ) ) . "</p>\n";
                $wgOut->addHTML( $paging );
-               
+
                $search = $this->searchForm();
                $wgOut->addHTML( $search );
 
@@ -145,7 +145,7 @@ class IPUnblockForm {
                $wgOut->addHTML( "</ul>\n" );
                $wgOut->addHTML( $paging );
        }
-       
+
        function searchForm() {
                global $wgTitle;
                return
@@ -174,7 +174,7 @@ class IPUnblockForm {
         */
        function addRow( $block, $tag ) {
                global $wgOut, $wgUser, $wgLang;
-               
+
                if( $this->ip != '' ) {
                        if( $block->mAuto ) {
                                if( stristr( $block->mId, $this->ip ) == false ) {
@@ -186,7 +186,7 @@ class IPUnblockForm {
                                }
                        }
                }
-               
+
                // Loading blocks is fast; displaying them is slow.
                // Quick hack for paging.
                $this->counter++;
@@ -196,12 +196,12 @@ class IPUnblockForm {
                if( $this->counter - $this->offset > $this->limit ) {
                        return;
                }
-               
+
                $fname = 'IPUnblockForm-addRow';
                wfProfileIn( $fname );
-               
+
                static $sk=null, $msg=null;
-               
+
                if( is_null( $sk ) )
                        $sk = $wgUser->getSkin();
                if( is_null( $msg ) ) {
@@ -211,30 +211,30 @@ class IPUnblockForm {
                        }
                        $msg['blocklistline'] = wfMsg( 'blocklistline' );
                }
-       
+
                # Hide addresses blocked by User::spreadBlocks, for privacy
                $addr = $block->mAuto ? "#{$block->mId}" : $block->mAddress;
-       
+
                $name = $block->getByName();
                $ulink = $sk->makeKnownLinkObj( Title::makeTitle( NS_USER, $name ), $name );
                $formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
-               
+
                if ( $block->mExpiry === "" ) {
                        $formattedExpiry = $msg['infiniteblock'];
                } else {
                        $formattedExpiry = wfMsgReplaceArgs( $msg['expiringblock'],
                                array( $wgLang->timeanddate( $block->mExpiry, true ) ) );
                }
-               
+
                $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $ulink, $addr, $formattedExpiry ) );
-               
+
                $wgOut->addHTML( "<li>{$line}" );
-       
+
                if ( !$block->mAuto ) {
                        $titleObj = Title::makeTitle( NS_SPECIAL, "Contributions" );
                        $wgOut->addHTML( ' (' . $sk->makeKnownLinkObj($titleObj, $msg['contribslink'], "target={$block->mAddress}") . ')' );
                }
-       
+
                if ( $wgUser->isAllowed('block') ) {
                        $titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" );
                        $wgOut->addHTML( ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&ip=' . urlencode( $addr ) ) . ')' );
index e309a36..8bf491b 100644 (file)
@@ -22,31 +22,31 @@ class ListredirectsPage extends QueryPage {
        function isExpensive() { return( true ); }
        function isSyndicated() { return( false ); }
        function sortDescending() { return( false ); }
-       
+
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
                extract( $dbr->tableNames( 'page' ) );
                return( 'SELECT page_title AS title, page_namespace AS namespace, page_namespace AS value FROM ' . $page . ' WHERE page_is_redirect = 1' );
        }
-       
+
        function formatResult( $skin, $result ) {
                global $wgContLang;
-               
+
                # Make a link to the redirect itself
                $rd_title = Title::makeTitle( $result->namespace, $result->title );
                $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
-               
+
                # Find out where the redirect leads
                $rd_page = new Article( &$rd_title, 0 );
                $rd_text = $rd_page->getContent( true ); # Don't follow the redirect
-               
+
                # Make a link to the destination page
                $tp_title = Title::newFromRedirect( $rd_text );
                $tp_link = $skin->makeKnownLinkObj( $tp_title );
-               
+
                # Format the whole thing and return it
                return( $rd_link . ' &rarr; ' . $tp_link );
-               
+
        }
 
 }
index 52eac0f..9183ea5 100644 (file)
@@ -40,7 +40,7 @@ require_once('QueryPage.php');
 class ListUsersPage extends QueryPage {
        var $requestedGroup = '';
        var $requestedUser = '';
-       
+
        function getName() {
                return 'Listusers';
        }
@@ -77,7 +77,7 @@ class ListUsersPage extends QueryPage {
         */
        function getPageHeader( ) {
                global $wgScript;
-               
+
                // Various variables used for the form
                $action = htmlspecialchars( $wgScript );
                $title = Title::makeTitle( NS_SPECIAL, 'Listusers' );
@@ -90,10 +90,10 @@ class ListUsersPage extends QueryPage {
 
                // get all group names and IDs
                $groups = User::getAllGroups();
-               
+
                // we want a default empty group
                $out.= '<option value=""></option>';
-               
+
                // build the dropdown list menu using datas from the database
                foreach ( $groups as $group ) {
                        $selected = ($group == $this->requestedGroup);
@@ -110,14 +110,14 @@ class ListUsersPage extends QueryPage {
                // OK button, end of form.
                $out .= '<input type="submit" value="' . wfMsgHtml( 'allpagessubmit' ) . '" /></form>';
                // congratulations the form is now build
-               return $out;    
+               return $out;
        }
-       
+
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
                $user = $dbr->tableName( 'user' );
                $user_groups = $dbr->tableName( 'user_groups' );
-               
+
                // We need to get an 'atomic' list of users, so that we
                // don't break the list half-way through a user's group set
                // and so that lists by group will show all group memberships.
@@ -128,7 +128,7 @@ class ListUsersPage extends QueryPage {
                // For now we'll just grab the number of memberships, so
                // we can then do targetted checks on those who are in
                // non-default groups as we go down the list.
-               
+
                $userspace = NS_USER;
                $sql = "SELECT 'Listusers' as type, $userspace AS namespace, user_name AS title, " .
                        "user_name as value, user_id, COUNT(ug_group) as numgroups " .
@@ -136,17 +136,17 @@ class ListUsersPage extends QueryPage {
                        "LEFT JOIN $user_groups ON user_id=ug_user " .
                        $this->userQueryWhere( $dbr ) .
                        " GROUP BY user_name";
-               
+
                return $sql;
        }
-       
+
        function userQueryWhere( &$dbr ) {
                $conds = $this->userQueryConditions();
                return empty( $conds )
                        ? ""
                        : "WHERE " . $dbr->makeList( $conds, LIST_AND );
        }
-       
+
        function userQueryConditions() {
                $conds = array();
                if( $this->requestedGroup != '' ) {
@@ -157,7 +157,7 @@ class ListUsersPage extends QueryPage {
                }
                return $conds;
        }
-       
+
        function linkParameters() {
                $conds = array();
                if( $this->requestedGroup != '' ) {
@@ -168,16 +168,16 @@ class ListUsersPage extends QueryPage {
                }
                return $conds;
        }
-       
+
        function sortDescending() {
                return false;
        }
 
        function formatResult( $skin, $result ) {
-               
+
                $userPage = Title::makeTitle( $result->namespace, $result->title );
                $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
-               
+
                if( !isset( $result->numgroups ) || $result->numgroups > 0 ) {
                        $dbr =& wfGetDB( DB_SLAVE );
                        $result = $dbr->select( 'user_groups',
@@ -189,7 +189,7 @@ class ListUsersPage extends QueryPage {
                                $groups[] = User::getGroupName( $row->ug_group );
                        }
                        $dbr->freeResult( $result );
-                       
+
                        if( count( $groups ) > 0 ) {
                                $name .= ' (' .
                                        $skin->makeLink( wfMsgForContent( 'administrators' ),
@@ -199,7 +199,7 @@ class ListUsersPage extends QueryPage {
                }
 
                return $name;
-       }       
+       }
 }
 
 /**
@@ -213,7 +213,7 @@ function wfSpecialListusers( $par = null ) {
 
 
        $slu = new ListUsersPage();
-       
+
        /**
         * Get some parameters
         */
index d0be5d8..a07c1d8 100644 (file)
@@ -35,12 +35,12 @@ function wfSpecialLockdb() {
  */
 class DBLockForm {
        var $reason = '';
-       
+
        function DBLockForm() {
                global $wgRequest;
                $this->reason = $wgRequest->getText( 'wpLockReason' );
        }
-       
+
        function showForm( $err ) {
                global $wgOut, $wgUser;
 
index a143f14..b9f521a 100644 (file)
@@ -29,7 +29,7 @@ class LonelyPagesPage extends PageQueryPage {
                return true;
        }
        function isSyndicated() { return false; }
-       
+
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
                extract( $dbr->tableNames( 'page', 'pagelinks' ) );
index 9e5cd8c..99c8ed3 100644 (file)
@@ -24,16 +24,16 @@ class MIMEsearchPage extends QueryPage {
                $this->major = $major;
                $this->minor = $minor;
        }
-       
+
        function getName() { return 'MIMEsearch'; }
-       
+
        /**
         * Due to this page relying upon extra fields being passed in the SELECT it
         * will fail if it's set as expensive and misermode is on
         */
        function isExpensive() { return true; }
        function isSyndicated() { return false; }
-       
+
        function linkParameters() {
                $arr = array( $this->major, $this->minor );
                $mime = implode( '/', $arr );
@@ -45,13 +45,13 @@ class MIMEsearchPage extends QueryPage {
                $image = $dbr->tableName( 'image' );
                $major = $dbr->addQuotes( $this->major );
                $minor = $dbr->addQuotes( $this->minor );
-               
+
                return
                        "SELECT 'MIMEsearch' AS type,
                                " . NS_IMAGE . " AS namespace,
                                img_name AS title,
                                img_major_mime AS value,
-                               
+
                                img_size,
                                img_width,
                                img_height,
@@ -74,7 +74,7 @@ class MIMEsearchPage extends QueryPage {
                $dimensions = wfMsg( 'widthheight', $result->img_width, $result->img_height );
                $user = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
                $time = $wgLang->timeanddate( $result->img_timestamp );
-               
+
                return "($download) $plink .. $dimensions .. $bytes .. $user .. $time";
        }
 }
@@ -121,7 +121,7 @@ function wfSpecialMIMEsearch( $par = null ) {
        if ( $major == '' or $minor == '' or !wfSpecialMIMEsearchValidType( $major ) )
                return;
        $wpp = new MIMEsearchPage( $major, $minor );
-       
+
        list( $limit, $offset ) = wfCheckLimits();
        $wpp->doQuery( $offset, $limit );
 }
index c3bdd1f..75b66e7 100644 (file)
@@ -26,7 +26,7 @@ function wfSpecialMaintenance( $par=NULL ) {
                $wgOut->addWikiText( wfMsg( 'perfdisabled' ) );
                return;
        }
-       
+
        # Get parameters from the URL
        $submitmll = $wgRequest->getVal( 'submitmll' );
 
@@ -39,24 +39,24 @@ function wfSpecialMaintenance( $par=NULL ) {
        # Call the subfunction requested by the user
        switch( $subfunction ) {
        case 'disambiguations': return wfSpecialDisambiguations();
-       
+
        # doubleredirects & brokenredirects are old maintenance subpages.
        case 'doubleredirects': return wfSpecialDoubleRedirects();
        case 'brokenredirects': return wfSpecialBrokenRedirects();
-       
+
        case 'selflinks':       return wfSpecialSelfLinks()      ;
        case 'mispeelings':     return wfSpecialMispeelings()    ;
        case 'missinglanguagelinks': return wfSpecialMissingLanguageLinks();
        }
-       
+
        if ( !is_null( $submitmll ) ) return wfSpecialMissingLanguageLinks() ;
 
        $sk = $wgUser->getSkin();
 
        # Generate page output
-       
+
        $r = wfMsg('maintnancepagetext') ;
-       
+
        # Links to subfunctions
        $r .= "<ul>\n" ;
        $r .= "<li>".$sk->makeKnownLink( sns().':Disambiguations', wfMsg('disambiguations')) . "</li>\n";
@@ -78,7 +78,7 @@ function wfSpecialMaintenance( $par=NULL ) {
        $r .= htmlspecialchars(wfMsg('missinglanguagelinksbutton'), ENT_QUOTES);
        $r .= "\" />\n" ;
        $r .= "<select name=\"thelang\">\n" ;
-       
+
        $a = $wgContLang->getLanguageNames();
        $ak = array_keys ( $a ) ;
        foreach ( $ak AS $k ) {
@@ -109,7 +109,7 @@ function getMaintenancePageBacklink( $subfunction ) {
                $wgContLang->getNsText( NS_SPECIAL ) . ':Maintenance',
                wfMsg( 'maintenancebacklink' ) ) ;
        $t = wfMsg ( $subfunction ) ;
-       
+
        $s = '<table width="100%" border="0"><tr><td>';
        $s .= '<h2>'.$t.'</h2></td><td align="right">';
        $s .= "{$r}</td></tr></table>\n" ;
@@ -256,7 +256,7 @@ function wfSpecialMispeelings () {
  */
 function wfSpecialMissingLanguageLinks() {
        global $wgUser, $wgOut, $wgContLang, $wgRequest;
-       
+
        $fname = 'wfSpecialMissingLanguageLinks';
        $thelang = $wgRequest->getText( 'thelang' );
        if ( $thelang == 'w' ) $thelang = 'en' ; # Fix for international wikis
index d532f88..17dbb5d 100644 (file)
@@ -44,9 +44,9 @@ class MostcategoriesPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getPrefixedText() );
-               
+
                $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
-               
+
                $nl = wfMsg( 'ncategories', $result->value );
                $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ), $nl, 'article=' . $nt->getPrefixedURL() );
 
index bde9e2a..5a072a5 100644 (file)
@@ -42,9 +42,9 @@ class MostimagesPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getPrefixedText() );
-               
+
                $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
-               
+
                $nl = wfMsg( 'nlinks', $result->value );
                $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
 
index 04a79d1..28a209e 100644 (file)
@@ -34,7 +34,7 @@ class MostlinkedPage extends QueryPage {
                                pl_namespace AS namespace,
                                pl_title AS title,
                                COUNT(*) AS value,
-                               
+
                                page_namespace
                        FROM $pagelinks
                        LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title
@@ -47,7 +47,7 @@ class MostlinkedPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getPrefixedText() );
-               
+
                if ( $this->isCached() )
                        $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
                else {
@@ -55,7 +55,7 @@ class MostlinkedPage extends QueryPage {
                                ? $skin->makeBrokenLink( $nt->getPrefixedText(), $text )
                                : $skin->makeKnownLink( $nt->getPrefixedText(), $text );
                }
-               
+
                $nl = wfMsg( 'nlinks', $result->value );
                $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() );
 
index 505ea40..2f6f2b0 100644 (file)
@@ -38,7 +38,7 @@ class MostlinkedCategoriesPage extends QueryPage {
                        GROUP BY cl_to
                        ";
        }
-       
+
        function sortDescending() { return true; }
 
        /**
@@ -61,9 +61,9 @@ class MostlinkedCategoriesPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getText() );
-               
+
                $plink = $skin->makeLinkObj( $nt, htmlspecialchars( $text ) );
-               
+
                $nlinks = wfMsg( 'nlinks', $result->value );
                return "$plink ($nlinks)";
        }
index 8f7b4d0..6bc807e 100644 (file)
@@ -46,9 +46,9 @@ class MostrevisionsPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getPrefixedText() );
-               
+
                $plink = $skin->makeKnownLinkObj( $nt, $text );
-               
+
                $nl = wfMsg( 'nrevisions', $result->value );
                $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
 
index 6646ff5..bfc2af9 100644 (file)
@@ -42,7 +42,7 @@ function wfSpecialMovepage( $par = null ) {
 class MovePageForm {
        var $oldTitle, $newTitle, $reason; # Text input
        var $moveTalk, $deleteAndMove;
-               
+
        function MovePageForm( $par ) {
                global $wgRequest;
                $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
@@ -52,7 +52,7 @@ class MovePageForm {
                $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
                $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
        }
-       
+
        function showForm( $err ) {
                global $wgOut, $wgUser;
 
@@ -64,7 +64,7 @@ class MovePageForm {
                        return;
                }
                $oldTitle = $ot->getPrefixedText();
-               
+
                $encOldTitle = htmlspecialchars( $oldTitle );
                if( $this->newTitle == '' ) {
                        # Show the current title as a default
@@ -126,7 +126,7 @@ class MovePageForm {
                }
 
                $moveTalkChecked = $this->moveTalk ? ' checked="checked"' : '';
-               
+
                $wgOut->addHTML( "
 <form id=\"movepage\" method=\"post\" action=\"{$action}\">
        <table border='0'>
@@ -174,12 +174,12 @@ class MovePageForm {
        function doSubmit() {
                global $wgOut, $wgUser, $wgRequest;
                $fname = "MovePageForm::doSubmit";
-               
+
                if ( $wgUser->pingLimiter( 'move' ) ) {
                        $wgOut->rateLimited();
                        return;
                }
-               
+
                # Variables beginning with 'o' for old article 'n' for new article
 
                $ot = Title::newFromText( $this->oldTitle );
@@ -205,7 +205,7 @@ class MovePageForm {
                }
 
                wfRunHooks( 'SpecialMovepageAfterMove', array( &$this , &$ot , &$nt ) ) ;
-               
+
                # Move talk page if
                # (1) the checkbox says to,
                # (2) the namespaces are not themselves talk namespaces, and of course
@@ -213,7 +213,7 @@ class MovePageForm {
                if ( ( $wgRequest->getVal('wpMovetalk') == 1 ) &&
                     !$ot->isTalkPage() &&
                     !$nt->isTalkPage() ) {
-                       
+
                        $ott = $ot->getTalkPage();
                        $ntt = $nt->getTalkPage();
 
@@ -229,7 +229,7 @@ class MovePageForm {
                        # Stay silent on the subject of talk.
                        $talkmoved = '';
                }
-               
+
                # Give back result to user.
                $titleObj = Title::makeTitle( NS_SPECIAL, 'Movepage' );
                $success = $titleObj->getFullURL(
@@ -250,7 +250,7 @@ class MovePageForm {
                $talkmoved = $wgRequest->getVal('talkmoved');
 
                $text = wfMsg( 'pagemovedtext', $oldtitle, $newtitle );
-               
+
                # Temporarily disable raw html wikitext option out of XSS paranoia
                $marchingantofdoom = $wgRawHtml;
                $wgRawHtml = false;
index b388533..76ee47e 100644 (file)
@@ -17,7 +17,7 @@ require_once( 'QueryPage.php' );
  */
 class NewPagesPage extends QueryPage {
        var $namespace;
-       
+
        function NewPagesPage( $namespace = NS_MAIN ) {
                $this->namespace = $namespace;
        }
@@ -93,7 +93,7 @@ class NewPagesPage extends QueryPage {
 
                return $s;
        }
-       
+
        function feedItemDesc( $row ) {
                if( isset( $row->rev_id ) ) {
                        $revision = Revision::newFromId( $row->rev_id );
@@ -111,10 +111,10 @@ class NewPagesPage extends QueryPage {
  */
 function wfSpecialNewpages($par, $specialPage) {
        global $wgRequest, $wgContLang;
-       
+
        list( $limit, $offset ) = wfCheckLimits();
        $namespace = NS_MAIN;
-       
+
        if ( $par ) {
                $bits = preg_split( '/\s*,\s*/', trim( $par ) );
                foreach ( $bits as $bit ) {
index ce8cb4d..f9a5ed9 100644 (file)
@@ -345,7 +345,7 @@ class SpecialPage
        function getFile() { return $this->mFile; }
        function isListed() { return $this->mListed; }
        /**#@-*/
-       
+
        /**#@+
          * Accessor and mutator
          */
@@ -357,7 +357,7 @@ class SpecialPage
        function includable( $x = NULL ) { return wfSetVar( $this->mIncludable, $x ); }
        function including( $x = NULL ) { return wfSetVar( $this->mIncluding, $x ); }
        /**#@-*/
-       
+
        /**
         * Checks if the given user (identified by an object) can execute this
         * special page (as defined by $mRestriction)
index c1b6efa..cd01dda 100644 (file)
@@ -364,7 +364,7 @@ class PreferencesForm {
                        }
                }
        }
-       
+
        /**
         * @access private
         */
@@ -539,8 +539,8 @@ class PreferencesForm {
                                $wgUser->getID()
                        )
                );
-                               
-               
+
+
                if ($wgAllowRealName) {
                        $wgOut->addHTML(
                                $this->addRow(
@@ -568,7 +568,7 @@ class PreferencesForm {
                } else {
                        $invalidSig = '';
                }
-               
+
                $wgOut->addHTML(
                        $this->addRow(
                                '<label for="wpNick">' . wfMsg( 'yournick' ) . '</label>',
@@ -592,7 +592,7 @@ class PreferencesForm {
                        $languages[$wgContLanguageCode] = $wgContLanguageCode;
                }
                ksort( $languages );
-               
+
                /**
                 * If a bogus value is set, default to the content language.
                 * Otherwise, no default is selected and the user ends up
index 4861ea3..d8adcbe 100644 (file)
@@ -17,7 +17,7 @@ function wfSpecialPrefixIndex( $par=NULL, $specialPage ) {
        # GET values
        $from = $wgRequest->getVal( 'from' );
        $namespace = $wgRequest->getInt( 'namespace' );
-       
+
        $namespaces = $wgContLang->getNamespaces();
 
        $indexPage = new SpecialPrefixIndex();
@@ -30,7 +30,7 @@ function wfSpecialPrefixIndex( $par=NULL, $specialPage ) {
                wfMsg( 'allarticles' )
                );
 
-       
+
        if ( isset($par) ) {
                $indexPage->showChunk( $namespace, $par, $specialPage->including() );
        } elseif ( isset($from) ) {
@@ -55,7 +55,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
        global $wgOut, $wgUser, $wgContLang;
 
        $fname = 'indexShowChunk';
-       
+
        $sk = $wgUser->getSkin();
 
        $fromTitle = Title::newFromURL( $from );
@@ -64,7 +64,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
         }
 
        $fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
-       
+
        $dbr =& wfGetDB( DB_SLAVE );
 
        $res = $dbr->select( 'page',
@@ -85,7 +85,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
 
        $n = 0;
        $out = '<table style="background: inherit;" border="0" width="100%">';
-       
+
        $namespaces = $wgContLang->getFormattedNamespaces();
        while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
                $t = Title::makeTitle( $s->page_namespace, $s->page_title );
@@ -109,7 +109,7 @@ function showChunk( $namespace = NS_MAIN, $from, $including = false ) {
                $out .= '</tr>';
        }
        $out .= '</table>';
-       
+
        if ( $including ) {
                $out2 = '';
        } else {
index 634aed9..3346b7a 100644 (file)
@@ -175,7 +175,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) {
 
                        // Dump everything here
                        $nondefaults = array();
-               
+
                        wfAppendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults);
                        wfAppendToArrayIfNotDefault( 'limit', $limit , $defaults, $nondefaults);
                        wfAppendToArrayIfNotDefault( 'hideminor', $hideminor, $defaults, $nondefaults);
@@ -473,7 +473,7 @@ function rcNamespaceForm ( $namespace, $invert, $nondefaults ) {
                if ($key != 'namespace' && $key != 'invert')
                        $out .= wfElement('input', array( 'type' => 'hidden', 'name' => $key, 'value' => $value));
        }
-       
+
        $out .= '<input type="hidden" name="title" value="'.$t->getPrefixedText().'" />';
        $out .= "
 <div id='nsselect' class='recentchanges'>
index f2ea57e..b015083 100644 (file)
@@ -21,7 +21,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
        $days = $wgRequest->getInt( 'days' );
        $target = isset($par) ? $par : $wgRequest->getText( 'target' );
        $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
-       
+
        $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
        $sk = $wgUser->getSkin();
 
@@ -35,7 +35,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
                return;
        }
        $id = $nt->getArticleId();
-       
+
        $wgOut->setSubtitle( htmlspecialchars( wfMsg( 'rclsub', $nt->getPrefixedText() ) ) );
 
        if ( ! $days ) {
@@ -63,7 +63,7 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
        } else { $cmq = ''; }
 
        extract( $dbr->tableNames( 'recentchanges', 'categorylinks', 'pagelinks', 'revision', 'page' ) );
-       
+
        // If target is a Category, use categorylinks and invert from and to
        if( $nt->getNamespace() == NS_CATEGORY ) {
                $catkey = $dbr->addQuotes( $nt->getDBKey() );
@@ -137,7 +137,7 @@ ORDER BY rc_timestamp DESC
        $list = ChangesList::newFromUser( $wgUser );
        $s = $list->beginRecentChangesList();
        $count = $dbr->numRows( $res );
-       
+
        $counter = 1;
        while ( $limit ) {
                if ( 0 == $count ) { break; }
index fd4705e..61750b0 100644 (file)
@@ -34,7 +34,7 @@ require_once( 'Revision.php' );
  */
 function wfSpecialSearch( $par = '' ) {
        global $wgRequest, $wgUser;
-       
+
        $search = $wgRequest->getText( 'search', $par );
        $searchPage = new SpecialSearch( $wgRequest, $wgUser );
        if( $wgRequest->getVal( 'fulltext' ) ||
@@ -63,7 +63,7 @@ class SpecialSearch {
         */
        function SpecialSearch( &$request, &$user ) {
                list( $this->limit, $this->offset ) = $request->getLimitOffset( 20, 'searchlimit' );
-               
+
                if( $request->getCheck( 'searchx' ) ) {
                        $this->namespaces = $this->powerSearch( $request );
                } else {
@@ -72,7 +72,7 @@ class SpecialSearch {
 
                $this->searchRedirects = $request->getcheck( 'redirs' ) ? true : false;
        }
-       
+
        /**
         * If an exact title match can be found, jump straight ahead to
         * @param string $term
@@ -81,7 +81,7 @@ class SpecialSearch {
        function goResult( $term ) {
                global $wgOut;
                global $wgGoToEdit;
-               
+
                $this->setupPage( $term );
 
                # Try to go to page as entered.
@@ -99,7 +99,7 @@ class SpecialSearch {
                        $wgOut->redirect( $t->getFullURL() );
                        return;
                }
-               
+
                # No match, generate an edit URL
                $t = Title::newFromText( $term );
                if( is_null( $t ) ) {
@@ -118,7 +118,7 @@ class SpecialSearch {
 
                return $this->showResults( $term );
        }
-       
+
        /**
         * @param string $term
         * @access public
@@ -126,13 +126,13 @@ class SpecialSearch {
        function showResults( $term ) {
                $fname = 'SpecialSearch::showResults';
                wfProfileIn( $fname );
-               
+
                $this->setupPage( $term );
-               
+
                global $wgUser, $wgOut;
                $sk = $wgUser->getSkin();
                $wgOut->addWikiText( wfMsg( 'searchresulttext' ) );
-               
+
                #if ( !$this->parseQuery() ) {
                if( '' === trim( $term ) ) {
                        $wgOut->setSubtitle( '' );
@@ -140,7 +140,7 @@ class SpecialSearch {
                        wfProfileOut( $fname );
                        return;
                }
-               
+
                global $wgDisableTextSearch;
                if ( $wgDisableTextSearch ) {
                        global $wgForwardSearchUrl;
@@ -168,7 +168,7 @@ class SpecialSearch {
                $search->showRedirects = $this->searchRedirects;
                $titleMatches = $search->searchTitle( $term );
                $textMatches = $search->searchText( $term );
-               
+
                $num = ( $titleMatches ? $titleMatches->numRows() : 0 )
                        + ( $textMatches ? $textMatches->numRows() : 0);
                if ( $num >= $this->limit ) {
@@ -195,7 +195,7 @@ class SpecialSearch {
                                $wgOut->addWikiText( '==' . wfMsg( 'notitlematches' ) . "==\n" );
                        }
                }
-               
+
                if( $textMatches ) {
                        if( $textMatches->numRows() ) {
                                $wgOut->addWikiText( '==' . wfMsg( 'textmatches' ) . "==\n" );
@@ -205,7 +205,7 @@ class SpecialSearch {
                                $wgOut->addWikiText( '==' . wfMsg( 'notextmatches' ) . "==\n" );
                        }
                }
-               
+
                if ( $num == 0 ) {
                        $wgOut->addWikiText( wfMsg( 'nonefound' ) );
                }
@@ -215,10 +215,10 @@ class SpecialSearch {
                $wgOut->addHTML( $this->powerSearchBox( $term ) );
                wfProfileOut( $fname );
        }
-       
+
        #------------------------------------------------------------------
        # Private methods below this line
-       
+
        /**
         *
         */
@@ -229,7 +229,7 @@ class SpecialSearch {
                $wgOut->setArticleRelated( false );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
        }
-       
+
        /**
         * Extract default namespaces to search from the given user's
         * settings, returning a list of index numbers.
@@ -247,7 +247,7 @@ class SpecialSearch {
                }
                return $arr;
        }
-       
+
        /**
         * Extract "power search" namespace settings from the request object,
         * returning a list of index numbers to search.
@@ -265,7 +265,7 @@ class SpecialSearch {
                }
                return $arr;
        }
-       
+
        /**
         * Reconstruct the 'power search' options for links
         * @return array
@@ -280,7 +280,7 @@ class SpecialSearch {
                $opt['searchx'] = 1;
                return $opt;
        }
-       
+
        /**
         * @param SearchResultSet $matches
         * @param string $terms partial regexp for highlighting terms
@@ -288,11 +288,11 @@ class SpecialSearch {
        function showMatches( &$matches ) {
                $fname = 'SpecialSearch::showMatches';
                wfProfileIn( $fname );
-               
+
                global $wgContLang;
                $tm = $wgContLang->convertForSearchResult( $matches->termMatches() );
                $terms = implode( '|', $tm );
-               
+
                global $wgOut;
                $off = $this->offset + 1;
                $out = "<ol start='{$off}'>\n";
@@ -308,7 +308,7 @@ class SpecialSearch {
                wfProfileOut( $fname );
                return $out;
        }
-       
+
        /**
         * Format a single hit result
         * @param SearchResult $result
@@ -342,7 +342,7 @@ class SpecialSearch {
                $pat1 = "/(.*)($terms)(.{0,$max})/i";
 
                $lineno = 0;
-               
+
                $extract = '';
                wfProfileIn( "$fname-extract" );
                foreach ( $lines as $line ) {
@@ -375,7 +375,7 @@ class SpecialSearch {
                wfProfileOut( $fname );
                return "<li>{$link} ({$size}){$extract}</li>\n";
        }
-       
+
        function powerSearchBox( $term ) {
                $namespaces = '';
                foreach( SearchEngine::searchableNamespaces() as $ns => $name ) {
@@ -389,23 +389,23 @@ class SpecialSearch {
                        $namespaces .= " <label><input type='checkbox' value=\"1\" name=\"" .
                          "ns{$ns}\"{$checked} />{$name}</label>\n";
                }
-               
+
                $checked = $this->searchRedirects
                        ? ' checked="checked"'
                        : '';
                $redirect = "<input type='checkbox' value='1' name=\"redirs\"{$checked} />\n";
-               
+
                $searchField = '<input type="text" name="search" value="' .
                        htmlspecialchars( $term ) ."\" size=\"16\" />\n";
-               
+
                $searchButton = '<input type="submit" name="searchx" value="' .
                  htmlspecialchars( wfMsg('powersearch') ) . "\" />\n";
-               
+
                $ret = wfMsg( 'powersearchtext',
                        $namespaces, $redirect, $searchField,
                        '', '', '', '', '', # Dummy placeholders
                        $searchButton );
-               
+
                $title = Title::makeTitle( NS_SPECIAL, 'Search' );
                $action = $title->escapeLocalURL();
                return "<br /><br />\n<form id=\"powersearch\" method=\"get\" " .
index 3792766..e878a2a 100644 (file)
@@ -28,7 +28,7 @@ class ShortPagesPage extends QueryPage {
        function isExpensive() {
                return true;
        }
-       
+
        function isSyndicated() {
                return false;
        }
@@ -37,7 +37,7 @@ class ShortPagesPage extends QueryPage {
                $dbr =& wfGetDB( DB_SLAVE );
                $page = $dbr->tableName( 'page' );
                $name = $dbr->addQuotes( $this->getName() );
-               
+
                return
                        "SELECT $name as type,
                                page_namespace as namespace,
@@ -46,7 +46,7 @@ class ShortPagesPage extends QueryPage {
                        FROM $page FORCE INDEX (page_len)
                        WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
        }
-       
+
        function sortDescending() {
                return false;
        }
index f63677f..0b53db7 100644 (file)
  */
 function wfSpecialSpecialpages() {
        global $wgOut, $wgUser, $wgAvailableRights;
-       
+
        $wgOut->setRobotpolicy( 'index,nofollow' );
        $sk = $wgUser->getSkin();
-       
+
        # Get listable pages, in a 2-d array with the first dimension being user right
        $pages = SpecialPage::getPages();
 
@@ -47,7 +47,7 @@ function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
                # Yeah, that was pointless. Thanks for coming.
                return;
        }
-       
+
        /** Put them into a sortable array */
        $sortedPages = array();
        foreach ( $pages as $name => $page ) {
@@ -55,7 +55,7 @@ function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
                        $sortedPages[$page->getDescription()] = $page->getTitle();
                }
        }
-       
+
        /** Sort */
        if ( $wgSortSpecialPages ) {
                ksort( $sortedPages );
index e6684d0..57b7232 100644 (file)
@@ -46,13 +46,13 @@ function wfSpecialStatistics() {
                $res = $dbr->query( $sql, $fname );
                $userRow = $dbr->fetchObject( $res );
                $users = $userRow->total;
-       }       
+       } 
 
        $sql = "SELECT COUNT(*) AS total FROM $user_groups WHERE ug_group='sysop'";
        $res = $dbr->query( $sql, $fname );
        $row = $dbr->fetchObject( $res );
        $admins = $row->total;
-       
+
        if ($action == 'raw') {
                $wgOut->disable();
                header( 'Pragma: nocache' );
@@ -67,9 +67,9 @@ function wfSpecialStatistics() {
                        $wgLang->formatNum( $edits ),
                        $wgLang->formatNum( sprintf( '%.2f', $total ? $edits / $total : 0 ) ),
                        $wgLang->formatNum( sprintf( '%.2f', $edits ? $views / $edits : 0 ) ) );
-       
+
                $text .= "\n==" . wfMsg( 'userstats' ) . "==\n";
-       
+
                $text .= wfMsg( 'userstatstext',
                        $wgLang->formatNum( $users ),
                        $wgLang->formatNum( $admins ),
@@ -77,7 +77,7 @@ function wfSpecialStatistics() {
                        // should logically be after #admins, danm backwards compatability!
                        $wgLang->formatNum( sprintf( '%.2f', $admins / $users * 100 ) )
                );
-               
+
                $wgOut->addWikiText( $text );
        }
 }
index c809d24..f42a6f7 100755 (executable)
@@ -17,7 +17,7 @@ require_once( "QueryPage.php" );
  */
 class UncategorizedPagesPage extends PageQueryPage {
        var $requestedNamespace = NS_MAIN;
-       
+
        function getName() {
                return "Uncategorizedpages";
        }
@@ -30,7 +30,7 @@ class UncategorizedPagesPage extends PageQueryPage {
                return true;
        }
        function isSyndicated() { return false; }
-       
+
        function getSQL() {
                $dbr =& wfGetDB( DB_SLAVE );
                extract( $dbr->tableNames( 'page', 'categorylinks' ) );
index 657b4b5..36a047a 100644 (file)
@@ -91,7 +91,7 @@ class PageArchive {
         */
        function getTextFromRow( $row ) {
                $fname = 'PageArchive::getTextFromRow';
-               
+
                if( is_null( $row->ar_text_id ) ) {
                        // An old row from MediaWiki 1.4 or previous.
                        // Text is embedded in this row in classic compression format.
@@ -106,7 +106,7 @@ class PageArchive {
                        return Revision::getRevisionText( $text );
                }
        }
-               
+
 
        /**
         * Fetch (and decompress if necessary) the stored text of the most
@@ -225,7 +225,7 @@ class PageArchive {
                        );
                $revision = null;
                $newRevId = $previousRevId;
-               
+
                while( $row = $dbw->fetchObject( $result ) ) {
                        if( $row->ar_text_id ) {
                                // Revision was deleted in 1.5+; text is in
@@ -344,7 +344,7 @@ class UndeleteForm {
        }
 
        function execute() {
-               
+
                if( is_null( $this->mTargetObj ) ) {
                        return $this->showList();
                }
index a2fa848..f6fccfb 100644 (file)
@@ -17,7 +17,7 @@ class UnusedimagesPage extends QueryPage {
        function getName() {
                return 'Unusedimages';
        }
-       
+
        function sortDescending() {
                return false;
        }
@@ -26,10 +26,10 @@ class UnusedimagesPage extends QueryPage {
        function getSQL() {
                global $wgCountCategorizedImagesAsUsed;
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                if ( $wgCountCategorizedImagesAsUsed ) {
                        extract( $dbr->tableNames( 'page', 'image', 'imagelinks', 'categorylinks' ) );
-               
+
                        return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description
                                        FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from)
                                                LEFT JOIN '.$imagelinks.' AS P ON I.page_title = P.il_to)
@@ -37,16 +37,16 @@ class UnusedimagesPage extends QueryPage {
                                        WHERE I.page_namespace = '.NS_IMAGE.' AND L.cl_from IS NULL AND P.il_to IS NULL';
                } else {
                        extract( $dbr->tableNames( 'image','imagelinks' ) );
-               
+
                        return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
                        ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
                }
        }
-       
+
        function formatResult( $skin, $result ) {
                global $wgLang, $wgContLang;
                $title = Title::makeTitle( NS_IMAGE, $result->title );
-               
+
                $imageUrl = htmlspecialchars( Image::imageUrl( $result->title ) );
                $return =
                # The 'desc' linking to the image page
@@ -59,10 +59,10 @@ class UnusedimagesPage extends QueryPage {
                . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text)
                # If there is a description, show it
                . $skin->commentBlock( $wgContLang->convert( $result->img_description ) );
-               
+
                return $return;
        }
-       
+
        function getPageHeader() {
                return wfMsg( "unusedimagestext" );
        }
index 97a33ee..1111f1c 100644 (file)
@@ -38,7 +38,7 @@ class UnwatchedpagesPage extends QueryPage {
                        WHERE wl_title IS NULL AND page_is_redirect = 0
                        ";
        }
-       
+
        function sortDescending() { return false; }
 
        function formatResult( $skin, $result ) {
@@ -46,10 +46,10 @@ class UnwatchedpagesPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getPrefixedText() );
-               
+
                $plink = $skin->makeKnownLinkObj( $nt, htmlspecialchars( $text ) );
                $wlink = $skin->makeKnownLinkObj( $nt, wfMsgHtml( 'watch' ), 'action=watch' );
-               
+
                return $plink . ' (' . $wlink . ')';
        }
 }
@@ -59,10 +59,10 @@ class UnwatchedpagesPage extends QueryPage {
  */
 function wfSpecialUnwatchedpages() {
        global $wgUser, $wgOut;
-       
+
        if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
                return $wgOut->permissionRequired( 'unwatchedpages' );
-       
+
        list( $limit, $offset ) = wfCheckLimits();
 
        $wpp = new UnwatchedpagesPage();
index 0f738e5..9a72a9e 100644 (file)
@@ -201,7 +201,7 @@ class UploadForm {
                if( !$nt->userCanEdit() ) {
                        return $this->uploadError( wfMsgWikiHtml( 'protectedpage' ) );
                }
-               
+
                /**
                 * In some cases we may forbid overwriting of existing files.
                 */
@@ -232,7 +232,7 @@ class UploadForm {
                                return $this->uploadError( $veri->toString() );
                        }
                }
-               
+
                /**
                 * Provide an opportunity for extensions to add futher checks
                 */
@@ -247,7 +247,7 @@ class UploadForm {
                 */
                if ( ! $this->mIgnoreWarning ) {
                        $warning = '';
-                       
+
                        global $wgCapitalLinks;
                        if( $wgCapitalLinks ) {
                                $filtered = ucfirst( $filtered );
@@ -572,7 +572,7 @@ class UploadForm {
                $license = wfMsgHtml( 'license' );
                $nolicense = wfMsgHtml( 'nolicense' );
                $licenseshtml = $licenses->getHtml();
-               
+
                $ulb = wfMsgHtml( 'uploadbtn' );
 
 
@@ -584,7 +584,7 @@ class UploadForm {
                $watchChecked = $wgUser->getOption( 'watchdefault' )
                        ? 'checked="checked"'
                        : '';
-               
+
                $wgOut->addHTML( "
        <form id='upload' method='post' enctype='multipart/form-data' action=\"$action\">
                <table border='0'>
@@ -607,7 +607,7 @@ class UploadForm {
                        </td>
                </tr>
                <tr>" );
-       
+
        if ( $licenseshtml != '' ) {
                global $wgStylePath;
                $wgOut->addHTML( "
@@ -630,7 +630,7 @@ class UploadForm {
                $copystatus =  htmlspecialchars( $this->mUploadCopyStatus );
                $filesource = wfMsgHtml ( 'filesource' );
                $uploadsource = htmlspecialchars( $this->mUploadSource );
-               
+
                $wgOut->addHTML( "
                                <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>$filestatus:</label></td>
                                <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"$copystatus\" size='40' /></td>
@@ -642,8 +642,8 @@ class UploadForm {
                        <tr>
                ");
        }
-       
-       
+
+
        $wgOut->addHtml( "
                <td></td>
                <td>
@@ -660,7 +660,7 @@ class UploadForm {
                <td></td>
                <td align='left'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>
        </tr>
-       
+
        <tr>
                <td></td>
                <td align='left'>
@@ -669,7 +669,7 @@ class UploadForm {
        $wgOut->addHTML( "
                </td>
        </tr>
-               
+
        </table>
        </form>" );
        }
@@ -1022,7 +1022,7 @@ class UploadForm {
                        unlink( $this->mUploadTempName );
                }
        }
-       
+
        /**
         * Check if there's an overwrite conflict and, if so, if restrictions
         * forbid this user from performing the upload.
@@ -1037,7 +1037,7 @@ class UploadForm {
                        // But if it does, fall through to previous behavior
                        return false;
                }
-               
+
                $error = '';
                if( $img->exists() ) {
                        global $wgUser, $wgOut;
@@ -1052,12 +1052,12 @@ class UploadForm {
                                }
                        }
                }
-               
+
                if( $error ) {
                        $errorText = wfMsg( $error, wfEscapeWikiText( $img->getName() ) );
                        return new WikiError( $wgOut->parse( $errorText ) );
                }
-               
+
                // Rockin', go ahead and upload
                return true;
        }
index 507bbc2..461d26d 100644 (file)
@@ -49,7 +49,7 @@ class UploadFormMogile extends UploadForm {
                } else {
                        $this->mUploadOldVersion = '';
                }
-               
+
                if ( $this->mStashed ) {
                        if (!$mfs->rename($tempName,$this->mSavedFile)) {
                                $wgOut->fileRenameError($tempName, $this->mSavedFile );
@@ -89,7 +89,7 @@ class UploadFormMogile extends UploadForm {
                unlink($tempName);
                return $stash;
        }
-       
+
        /**
         * Stash a file in a temporary directory for later processing,
         * and save the necessary descriptive info into the session.
@@ -107,7 +107,7 @@ class UploadFormMogile extends UploadForm {
                        # Couldn't save the file.
                        return false;
                }
-               
+
                $key = mt_rand( 0, 0x7fffffff );
                $_SESSION['wsUploadData'][$key] = array(
                        'mUploadTempName' => $stash,
index 30a26dc..6a50536 100644 (file)
@@ -14,7 +14,7 @@ function wfSpecialUserlogin() {
        if( !$wgCommandLineMode && !isset( $_COOKIE[session_name()] )  ) {
                User::SetupSession();
        }
-       
+
        $form = new LoginForm( $wgRequest );
        $form->execute();
 }
@@ -28,7 +28,7 @@ class LoginForm {
        var $mName, $mPassword, $mRetype, $mReturnto, $mCookieCheck, $mPosted;
        var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
        var $mLoginattempt, $mRemember, $mEmail, $mDomain;
-       
+
        /**
         * Constructor
         * @param webrequest $request A webrequest object passed by reference
@@ -53,7 +53,7 @@ class LoginForm {
                $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
                $this->mAction = $request->getVal( 'action' );
                $this->mRemember = $request->getCheck( 'wpRemember' );
-               
+
                if( $wgEnableEmail ) {
                        $this->mEmail = $request->getText( 'wpEmail' );
                } else {
@@ -64,7 +64,7 @@ class LoginForm {
                } else {
                    $this->mRealName = '';
                }
-               
+
                if( !$wgAuth->validDomain( $this->mDomain ) ) {
                        $this->mDomain = 'invaliddomain';
                }
@@ -99,7 +99,7 @@ class LoginForm {
         */
        function addNewAccountMailPassword() {
                global $wgOut;
-               
+
                if ('' == $this->mEmail) {
                        $this->mainLoginForm( wfMsg( 'noemail', htmlspecialchars( $this->mName ) ) );
                        return;
@@ -113,11 +113,11 @@ class LoginForm {
 
                $u->saveSettings();
                $result = $this->mailPasswordInternal($u);
-               
+
                $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
-       
+
                if( WikiError::isError( $result ) ) {
                        $this->mainLoginForm( wfMsg( 'mailerror', $result->getMessage() ) );
                } else {
@@ -203,19 +203,19 @@ class LoginForm {
                        $this->mainLoginForm( wfMsg( 'badretype' ) );
                        return false;
                }
-               
+
                $name = trim( $this->mName );
                $u = User::newFromName( $name );
                if ( is_null( $u ) ) {
                        $this->mainLoginForm( wfMsg( 'noname' ) );
                        return false;
                }
-               
+
                if ( wfReadOnly() ) {
                        $wgOut->readOnlyPage();
                        return false;
                }
-               
+
                if ( 0 != $u->idForName() ) {
                        $this->mainLoginForm( wfMsg( 'userexists' ) );
                        return false;
@@ -237,7 +237,7 @@ class LoginForm {
                                return false;
                        }
                }
-               
+
                if( !wfRunHooks( 'AbortNewAccount', array( $u ) ) ) {
                        // Hook point to add extra creation throttles and blocks
                        wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
@@ -255,7 +255,7 @@ class LoginForm {
 
                return $this->initUser( $u );
        }
-       
+
        /**
         * Actually add a user to the database.
         * Give it a User object that has been initialised with a name.
@@ -270,12 +270,12 @@ class LoginForm {
                $u->setEmail( $this->mEmail );
                $u->setRealName( $this->mRealName );
                $u->setToken();
-               
+
                global $wgAuth;
                $wgAuth->initUser( $u );
 
                $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
-               
+
                return $u;
        }
 
@@ -337,7 +337,7 @@ class LoginForm {
                $wgUser->setCookies();
 
                $wgUser->saveSettings();
-               
+
                if( $this->hasSessionCookie() ) {
                        return $this->successfulLogin( wfMsg( 'loginsuccess', $wgUser->getName() ) );
                } else {
@@ -413,9 +413,9 @@ class LoginForm {
                global $wgOut;
 
                # Run any hooks; ignore results
-               
+
                wfRunHooks('UserLoginComplete', array(&$wgUser));
-               
+
                $wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
@@ -426,13 +426,13 @@ class LoginForm {
        /** */
        function userNotPrivilegedMessage() {
                global $wgOut;
-               
+
                $wgOut->setPageTitle( wfMsg( 'whitelistacctitle' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
 
                $wgOut->addWikiText( wfMsg( 'whitelistacctext' ) );
-               
+
                $wgOut->returnToMain( false );
        }
 
@@ -479,7 +479,7 @@ class LoginForm {
                $link .= '</a>';
 
                $template->set( 'link', wfMsgHtml( $linkmsg, $link ) );
-               
+
                $template->set( 'name', $this->mName );
                $template->set( 'password', $this->mPassword );
                $template->set( 'retype', $this->mRetype );
@@ -496,7 +496,7 @@ class LoginForm {
                $template->set( 'useemail', $wgEnableEmail );
                $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember  );
                $wgAuth->modifyUITemplate( $template );
-               
+
                $wgOut->setPageTitle( wfMsg( 'userlogin' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
@@ -510,7 +510,7 @@ class LoginForm {
                global $wgDisableCookieCheck;
                return ( $wgDisableCookieCheck ) ? true : ( isset( $_COOKIE[session_name()] ) );
        }
-       
+
        /**
         * @access private
         */
index 7f057a9..c3f0a5c 100644 (file)
@@ -12,15 +12,15 @@ function wfSpecialUserlogout() {
        global $wgUser, $wgOut;
 
        if (wfRunHooks('UserLogout', array(&$wgUser))) {
-               
+
                $wgUser->logout();
 
                wfRunHooks('UserLogoutComplete', array(&$wgUser));
-               
+
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->addHTML( wfMsg( 'logouttext' ) );
                $wgOut->returnToMain();
-               
+
        }
 }
 
index 0a9d9ed..d71b8c4 100644 (file)
@@ -33,7 +33,7 @@ class UserrightsForm extends HTMLForm {
                $this->mPosted = $request->wasPosted();
                $this->mRequest =& $request;
                $this->mName = 'userrights';
-               
+
                $titleObj = Title::makeTitle( NS_SPECIAL, 'Userrights' );
                $this->action = $titleObj->escapeLocalURL();
        }
@@ -84,12 +84,12 @@ class UserrightsForm extends HTMLForm {
                if($u->getID() == 0) {
                        $wgOut->addWikiText( wfMsg( 'nosuchusershort', htmlspecialchars( $username ) ) );
                        return;
-               }               
+               }
 
                $oldGroups = $u->getGroups();
                $newGroups = $oldGroups;
                $logcomment = ' ';
-               // remove then add groups               
+               // remove then add groups
                if(isset($removegroup)) {
                        $newGroups = array_diff($newGroups, $removegroup);
                        foreach( $removegroup as $group ) {
@@ -103,7 +103,7 @@ class UserrightsForm extends HTMLForm {
                        }
                }
                $newGroups = array_unique( $newGroups );
-               
+
                wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) );
                wfDebug( 'newGroups: ' . print_r( $newGroups, true ) );
 
@@ -122,7 +122,7 @@ class UserrightsForm extends HTMLForm {
         */
        function switchForm() {
                global $wgOut;
-               
+
                // user selection
                $wgOut->addHTML( "<form name=\"uluser\" action=\"$this->action\" method=\"post\">\n" );
                $wgOut->addHTML( $this->fieldset( 'lookup-user',
@@ -141,13 +141,13 @@ class UserrightsForm extends HTMLForm {
         */
        function editUserGroupsForm($username) {
                global $wgOut, $wgUser;
-               
+
                $user = User::newFromName($username);
                if( is_null( $user ) || $user->getID() == 0 ) {
                        $wgOut->addWikiText( wfMsg( 'nosuchusershort', wfEscapeWikiText( $username ) ) );
                        return;
                }
-               
+
                $groups = $user->getGroups();
 
                $wgOut->addHTML( "<form name=\"editGroup\" action=\"$this->action\" method=\"post\">\n".
index 5df1a6a..813d151 100644 (file)
@@ -77,7 +77,7 @@ class Validation {
                $db =& wfGetDB( DB_SLAVE );
 
                $topics = array();
-               
+
                # NOTE : This query returns only the topics to vote on
                $res = $db->select( 'validate', '*', array( 'val_page' => 0 ), 'SpecialValidate::getTopicList' );
                while( $topic = $db->fetchObject($res) ) {
@@ -88,7 +88,7 @@ class Validation {
                ksort( $topics );
                return $topics;
        }
-       
+
        # Merges one dataset into another
        function mergeInto( &$source, &$dest ) {
                $ret = false;
@@ -128,7 +128,7 @@ class Validation {
                        $this->setRevision( $article, $revision, $data );
                }
        }
-       
+
        # Clears all votes prior to the given revision
        function clearOldRevisions( &$article, $revision ) {
                $tmp = $this->voteCache;
@@ -139,11 +139,11 @@ class Validation {
                        }
                }
        }
-       
+
        # Updates the votes for the given revision from the FORM data
        function updateRevision( &$article, $revision ) {
                global $wgRequest;
-               
+
                if( isset( $this->voteCache[$this->getRevisionTimestamp( $revision )] ) ) {
                        $data = $this->voteCache[$this->getRevisionTimestamp( $revision )];
                } else {
@@ -151,16 +151,16 @@ class Validation {
                }
                $nv = $wgRequest->getArray( "re_v_{$revision}", array() );
                $nc = $wgRequest->getArray( "re_c_{$revision}", array() );
-               
+
                foreach( $nv as $x => $y ) {
                        $data[$x]->value = $y;
                        $data[$x]->comment = $nc[$x];
                }
                krsort( $data );
-               
+
                $this->setRevision( $article, $revision, $data );
        }
-       
+
        # Sets a specific revision to both cache and database
        function setRevision( &$article, $revision, &$data ) {
                global $wgUser;
@@ -184,7 +184,7 @@ class Validation {
                        }
                }
        }
-       
+
        # Returns a map identifying the current user
        function identifyUser( $user = "" ) {
                global $wgUser;
@@ -193,7 +193,7 @@ class Validation {
                        ? array( 'val_user' => 0, 'val_ip' => $user )
                        : array( 'val_user' => $user );
        }
-       
+
        # Deletes a specific vote set in both cache and database
        function deleteRevisionVote( &$article, $revision ) {
                $ts = $this->getRevisionTimestamp( $revision );
@@ -214,11 +214,11 @@ class Validation {
 
                unset( $this->voteCache[$ts] );
        }
-       
+
        # Reads the entire vote list for this user for the given article
        function getVoteList( $id, $user = "" ) {
                $db =& wfGetDB( DB_SLAVE );
-               
+
                # NOTE : This query gets the votes for a single user on a single page.
                # Assuming most people will use the "merge" feature,
                # this will be only a single entry.
@@ -237,23 +237,23 @@ class Validation {
 
                return $revisions;
        }
-       
+
        # Reads a partial vote list for this user for all articles
        function getAllVoteLists( $user , $offset , $limit ) {
                $db =& wfGetDB( DB_SLAVE );
                $a = $this->identifyUser($user) ;
                $b = array ( "ORDER BY" => "val_page,val_revision" , "OFFSET" => $offset , "LIMIT" => $limit ) ;
                $res = $db->select( 'validate', '*', $a , 'getAllVotesList' , $b );
-               
+
                $votes = array();
                while( $vote = $db->fetchObject($res) ) {
                        $votes[$vote->val_page][$vote->val_revision][$vote->val_type] = $vote;
                }
                $db->freeResult($res);
-               
+
                return $votes ;
        }
-       
+
        # This functions adds a topic to the database
        function addTopic( $topic, $limit ) {
                $db =& wfGetDB( DB_MASTER );
@@ -293,7 +293,7 @@ class Validation {
                $db->delete( 'validate', array( 'val_type' => $id ), 'SpecialValidate::deleteTopic' );
                unset( $this->topicList[$id] );
        }
-       
+
        # This function returns a link text to the page validation statistics
        function getStatisticsLink( &$article ) {
                global $wgUser;
@@ -335,7 +335,7 @@ class Validation {
 
 
        # HTML generation functions from this point on
-       
+
        # Returns the metadata string for a revision
        function getMetadata( $rev_id, &$article ) {
                global $wgUser;
@@ -357,7 +357,7 @@ class Validation {
                $metadata .= ': '. $sk->commentBlock( $x->rev_comment, $article->getTitle() );
                return $metadata;
        }
-       
+
        # Generates a link to the topic description
        function getTopicLink($s) {
                $t = Title::newFromText ( wfMsg ( 'val_topic_desc_page' ) ) ;
@@ -368,7 +368,7 @@ class Validation {
                $r .= "\">{$s}</a>" ;
                return $r ;
        }
-               
+
        # Generates HTML from a wiki text, e.g., a wfMsg
        function getParsedWiki ( $text ) {
                global $wgOut, $wgTitle, $wgParser ;
@@ -387,8 +387,8 @@ class Validation {
                                $data[$x]->comment = "";
                        }
                }
-               ksort( $data ) ;                
-       
+               ksort( $data ) ;
+
                # Generate form
                $table_class = $focus ? 'revisionform_focus' : 'revisionform_default';
                $ret = "<form method='post'><table class='{$table_class}'>\n";
@@ -405,7 +405,7 @@ class Validation {
                        $ret .= "<th>\n";
                        $ret .= $this->getTopicLink ( $this->topicList[$x]->val_comment ) ;
                        $ret .= "</th>\n";
-                       
+
                        $tlx = $this->topicList[$x];
                        $vote = "";
                        $max = $tlx->val_value;
@@ -428,9 +428,9 @@ class Validation {
                                if ( $a == 0 ) {
                                        $vote .= " &nbsp; ";
                                }
-                       }                       
+                       }
                        $ret .= "<td nowrap>{$vote}</td>\n";
-                       
+
                        $ret .= "<td width='100%'><input size='50' style='width:98%' maxlength='250' type='text' name='re_c{$idx}' value='{$y->comment}'/>";
                        $ret .= "</td></tr>\n";
                }
@@ -439,24 +439,24 @@ class Validation {
                $ret .= "<input type='checkbox' name='re_merge_{$revision}' value='1'{$checked} />" . $this->getParsedWiki( wfMsg( 'val_merge_old' ) ) . " \n";
                $ret .= "<input type='checkbox' name='re_clear_{$revision}' value='1'{$checked} />" . $this->getParsedWiki( wfMsg( 'val_clear_old' ) ) . " \n";
                $ret .= "<input type='submit' name='re_submit[{$revision}]' value=\"" . wfMsgHtml( "ok" ) . "\" />\n";
-               
+
                if( $focus ) $ret .= "<br/>\n<small>" . $this->getParsedWiki ( wfMsg( "val_form_note" ) ) . "</small>";
                $ret .= "</td></tr>\n";
                $ret .= "</table></form>\n\n";
                return $ret;
        }
-       
+
 
        # Generates the page from the validation tab
        function validatePageForm( &$article, $revision ) {
                global $wgOut, $wgRequest, $wgUser;
-               
+
                $ret = "";
                $this->page_id = $article->getID();
                $this->topicList = $this->getTopicList();
                if ( $this->getNoTopicsWarning() ) return "" ;
                $this->voteCache = $this->getVoteList( $article->getID() );
-               
+
                # Check for POST data
                $re = $wgRequest->getArray( 're_submit' );
                if ( isset( $re ) ) {
@@ -475,17 +475,17 @@ class Validation {
                } else {
                        $ret .= $this->getParsedWiki( wfMsg ('val_votepage_intro') );
                }
-               
+
                # Make sure the requested revision exists
                $rev = $this->getRevisionFromId($revision);
                $ts = $rev->rev_timestamp;
                if( !isset( $this->voteCache[$ts] ) ) {
                        $this->voteCache[$ts] = array();
                }
-               
+
                # Sort revisions list, newest first
                krsort( $this->voteCache );
-               
+
                # Output
                $title = $article->getTitle();
                $title = $title->getPrefixedText();
@@ -496,17 +496,17 @@ class Validation {
                }
                $ret .= $this->getStatisticsLink( $article );
                $ret .= "<p>" . $this->getUserRatingsLink( $wgUser->getID(), wfMsg( 'val_show_my_ratings' ) ) . "</p>";
-               return $ret ;   
+               return $ret ;
        }
-       
+
        # This function performs the "management" mode on Special:Validate
        function manageTopics() {
                global $wgRequest, $wgValidationMaxTopics;
                $this->topicList = $this->getTopicList();
-               
+
                $r = "" ; # Return value
                $iamsure = true ; # Sure by default, see checkbox below # $wgRequest->getVal( "iamsure", "0" ) == 1;
-               
+
                if( $iamsure && $wgRequest->getVal( "m_add", "--" ) != "--" ) {
                        if ( count ( $this->topicList ) >= $wgValidationMaxTopics ) { # Catching this in case someone tries a manually edited URL...
                                $ret .= "<p><b>" . wfMsg ( 'val_max_topics' , $wgValidationMaxTopics ) . "</b></p>" ;
@@ -525,7 +525,7 @@ class Validation {
                        $id = array_shift( $id );
                        $this->deleteTopic( $id );
                }
-               
+
                # FIXME: Wikitext this
                $r .= "<p>" . $this->getParsedWiki( wfMsg( 'val_warning' ) ) . "</p>\n";
                $r .= "<form method='post'>\n";
@@ -539,7 +539,7 @@ class Validation {
                        $r .= "<td><input type='submit' name='m_del[" . intval( $x ) . "]' value='" . htmlspecialchars( wfMsg( 'val_del' ) ) . "'/></td>\n";
                        $r .= "</tr>\n";
                }
-               
+
                # Add topic, or too-many-topics warning
                if ( count ( $this->topicList ) >= $wgValidationMaxTopics ) {
                        $r .= "<tr><td colspan='4' align='center'>" ;
@@ -555,17 +555,17 @@ class Validation {
                        $r .= '</td>' . "\n";
                        $r .= "</tr>" ;
                        }
-               
+
                $r .= "</table>\n";
 
-#              This is fot the checkbox "I am sure" for actions, which was found to be unituitive              
+#              This is fot the checkbox "I am sure" for actions, which was found to be unituitive
 #              $r .= '<p><input type="checkbox" name="iamsure" id="iamsure" value="1"/>';
 #              $r .= '<label for="iamsure">' . $this->getParsedWiki( wfMsg( 'val_iamsure' ) ) . "</label></p>\n";
 
                $r .= "</form>\n";
                return $r;
        }
-       
+
        # Generates an ID for both logged-in users and anons; $res is an object from an SQL query
        function make_user_id( &$res ) {
                return $res->val_user == 0 ? $res->val_ip : $res->val_user;
@@ -580,7 +580,7 @@ class Validation {
                $sk = $wgUser->getSkin();
                $title = $article->getTitle();
                $wgOut->setPageTitle( str_replace( '$1', $title->getPrefixedText(), wfMsg( 'val_validation_of' ) ) );
-               
+
                $data = array();
                $users = array();
                $topics = array();
@@ -594,20 +594,20 @@ class Validation {
                        $topics[$x->val_type] = true;
                }
                $db->freeResult($res);
-               
+
                # Sorting lists of topics and users
                ksort( $users );
                ksort( $topics );
-               
+
                $ts = $this->getRevisionTimestamp( $revision );
                $url = $this->getRevisionLink( $article, $revision, wfTimestamp( TS_DB, $ts ) );
 
                # Table headers
-               $ret = "" ;                     
+               $ret = "" ;
                $ret .= "<p><b>" . str_replace( '$1', $url, wfMsg( 'val_revision_of' ) ) . "</b></p>\n";
                $ret .= "<table>\n";
                $ret .= "<tr><th>" . $this->getParsedWiki ( wfMsg('val_details_th') ) . "</th>" ;
-               
+
                foreach( $topics as $t => $dummy ) {
                        $ret .= '<th>' . $sk->commentBlock( $this->topicList[$t]->val_comment, $article->getTitle() ) . '</th>';
                }
@@ -640,10 +640,10 @@ class Validation {
                $ret .= "</table>";
                $ret .= "<p>" . $this->getStatisticsLink( $article ) . "</p>";
                $ret .= "<p>" . $this->getUserRatingsLink( $wgUser->getID(), wfMsg( 'val_show_my_ratings' ) ) . "</p>";
-               
+
                return $ret;
        }
-       
+
        function showList( &$article ) {
                global $wgOut, $wgUser , $wgRequest;
                $this->page_id = $article->getID();
@@ -652,10 +652,10 @@ class Validation {
 
                $title = $article->getTitle();
                $wgOut->setPageTitle( wfMsg( 'val_validation_of', $title->getPrefixedText() ) );
-               
+
                $offset = $wgRequest->getVal ( "offset" , 0 ) ;
                $limit = $wgRequest->getVal ( "limit" , 25 ) ;
-               
+
                # Collecting statistic data
                # Unfortunately, it has to read all the data, though it will only display a part
                $db =& wfGetDB( DB_SLAVE );
@@ -683,7 +683,7 @@ class Validation {
 
                # Paging
                $statistics = array_slice ( $statistics , $offset , $limit ) ;
-               
+
                foreach( $statistics as $ts => $data ) {
                        $rev_id = $this->getRevisionId( $ts );
                        $revision_link = $this->getRevisionLink( $article, $rev_id, wfTimestamp( TS_DB, $ts ) );
@@ -710,7 +710,7 @@ class Validation {
 
                return $ret;
        }
-       
+
        function getRatingText( $value, $max ) {
                if( $max == 2 && $value == 1 ) {
                        $ret = wfMsg ( "val_no" ) . " ";
@@ -729,47 +729,47 @@ class Validation {
                $sk = $wgUser->getSkin();
                $r = array () ;
                $user = $wgRequest->getVal( "user" );
-               
+
                if ( $mode == "userstats" ) {
                        $nt = Title::newFromText( 'Special:Validate' );
                } else {
                        $nt = $wgTitle ;
                }
-               
+
                $base = "action=validate&mode={$mode}&" ;
                if ( $user != "" ) $base .= "user={$user}&" ;
                $base .= "limit={$limit}&offset=" ;
-               
+
                if ( $offset > 0 ) {
                        $o = $offset - $limit ;
                        $t = $offset-$limit+1 ;
                        $r[] = $sk->makeKnownLinkObj( $nt, "{$t} <<" , $base.$o );
                }
-               
+
                $s1 = $offset + 1 ;
                $s2 = $s1 + $lastcount - 1 ;
                $r[] = $s1 . " - " . $s2 ;
-               
+
                if ( $lastcount == $limit ) {
                        $o = $offset + $limit ;
                        $t = $offset+$limit+1 ;
                        $r[] = $sk->makeKnownLinkObj( $nt, ">> {$t}" , $base.$o );
                }
-               
+
                $r = implode ( " | " , $r ) ;
                return $r ;
        }
-       
-       function showUserStats( $user ) {               
+
+       function showUserStats( $user ) {
                global $wgOut, $wgUser, $wgRequest;
                $this->topicList = $this->getTopicList();
                if ( $this->getNoTopicsWarning() ) return "" ;
                $sk = $wgUser->getSkin();
-               
+
                $offset = $wgRequest->getVal( "offset" , 0 );
                $limit = $wgRequest->getVal( "limit" , 25 );
                $data = $this->getAllVoteLists( $user , $offset , $limit ) ;
-               
+
                if( $user == $wgUser->getID() ) {
                        $wgOut->setPageTitle ( wfMsg ( 'val_my_stats_title' ) );
                } elseif( !User::IsIP( $user ) ) {
@@ -777,10 +777,10 @@ class Validation {
                } else {
                        $wgOut->setPageTitle( wfMsg( 'val_user_stats_title', $user ) );
                }
-               
+
                $ret = "" ;
                $ret = "<table>\n";
-               
+
                $linecount = 0 ;
                $lastpage = -1 ;
                $lastrevision = -1 ;
@@ -824,14 +824,14 @@ class Validation {
                        $ret .= "</tr>";
                }
                $ret .= "</table>";
-               
-               
+
+
                $s = $this->navBar ( $offset , $limit , $linecount ) ;
                if ( $s != "" ) $ret = $s . "<br/>" . $ret . "<br/>" . $s ;
-               
+
                return $ret;
        }
-       
+
        function getNoTopicsWarning () {
                global $wgOut ;
                if ( !isset ( $this->topicList ) ) # Just making sure, shouldn't be necessary...
@@ -848,7 +848,7 @@ class Validation {
  */
 function wfSpecialValidate( $page = '' ) {
        global $wgOut, $wgRequest, $wgUseValidation, $wgUser;
-       
+
        if( !$wgUseValidation ) {
                $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
                return;
index 084df3f..679eed9 100644 (file)
@@ -24,7 +24,7 @@ class SpecialVersion {
         * @access private
         */
        var $langObj;
-       
+
        /**
         * Constructor
         */
@@ -39,7 +39,7 @@ class SpecialVersion {
         */
        function execute() {
                global $wgOut;
-               
+
                $wgOut->addWikiText(
                        $this->MediaWikiCredits() .
                        $this->extensionCredits() .
@@ -51,37 +51,37 @@ class SpecialVersion {
        /**#@+
         * @access private
         */
-       
+
        /**
         * @static
         */
        function MediaWikiCredits() {
                global $wgVersion;
-               
+
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                $ret =
                "__NOTOC__
                <div dir='ltr'>
                This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
                copyright (C) 2001-2006 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
                Tim Starling, Erik Möller, and others.
-               
+
                MediaWiki is free software; you can redistribute it and/or modify
                it under the terms of the GNU General Public License as published by
                the Free Software Foundation; either version 2 of the License, or
                (at your option) any later version.
-               
+
                MediaWiki is distributed in the hope that it will be useful,
                but WITHOUT ANY WARRANTY; without even the implied warranty of
                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                GNU General Public License for more details.
-               
+
                You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU General Public License]
                along with this program; if not, write to the Free Software
                Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                or [http://www.gnu.org/copyleft/gpl.html read it online]
-               
+
                * [http://www.mediawiki.org/ MediaWiki]: $wgVersion
                * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ")
                * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion() . "
@@ -92,7 +92,7 @@ class SpecialVersion {
 
        function extensionCredits() {
                global $wgExtensionCredits, $wgExtensionFunctions, $wgSkinExtensionFunction;
-               
+
                if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunction ) )
                        return '';
 
@@ -103,14 +103,14 @@ class SpecialVersion {
                        'other' => 'Other',
                );
                wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
-               
+
                $out = "\n* Extensions:\n";
                foreach ( $extensionTypes as $type => $text ) {
                        if ( count( @$wgExtensionCredits[$type] ) ) {
                                $out .= "** $text:\n";
-                               
+
                                usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
-                               
+
                                foreach ( $wgExtensionCredits[$type] as $extension ) {
                                        wfSuppressWarnings();
                                        $out .= $this->formatCredits(
@@ -174,7 +174,7 @@ class SpecialVersion {
                $ret = "* Hooks:\n";
                foreach ($myWgHooks as $hook => $hooks)
                        $ret .= "** $hook:" . $this->langObj->listToText( $hooks ) . "\n";
-               
+
                return $ret;
        }
 
@@ -185,7 +185,7 @@ class SpecialVersion {
                $ip =  str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
                return "<!-- visited from $ip -->\n";
        }
-       
+
        /**#@-*/
 }
 
index 4ac6666..b78e0ae 100644 (file)
@@ -40,7 +40,7 @@ class WantedCategoriesPage extends QueryPage {
                        GROUP BY cl_to
                        ";
        }
-       
+
        function sortDescending() { return true; }
 
        /**
@@ -63,11 +63,11 @@ class WantedCategoriesPage extends QueryPage {
 
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getText() );
-               
+
                $plink = $this->isCached() ?
                        $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ) :
                        $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) );
-               
+
                $nlinks = wfMsg( 'nlinks', $result->value );
                return "$plink ($nlinks)";
        }
index 7e5685c..742113e 100644 (file)
@@ -17,7 +17,7 @@ require_once 'QueryPage.php';
  */
 class WantedPagesPage extends QueryPage {
        var $nlinks;
-       
+
        function WantedPagesPage( $inc = false, $nlinks = true ) {
                $this->setListoutput( $inc );
                $this->nlinks = $nlinks;
@@ -63,8 +63,8 @@ class WantedPagesPage extends QueryPage {
                        // If there are no rows we get an error seeking.
                        $db->dataSeek( $res, 0 );
        }
-       
-       
+
+
        function formatResult( $skin, $result ) {
                global $wgContLang;
 
@@ -73,7 +73,7 @@ class WantedPagesPage extends QueryPage {
                $plink = $this->isCached() ?
                        $skin->makeLinkObj( $nt, $text ) :
                        $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
-               
+
                $nl = wfMsg( 'nlinks', $result->value );
                $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() );
 
@@ -86,7 +86,7 @@ class WantedPagesPage extends QueryPage {
  */
 function wfSpecialWantedpages( $par = null, $specialPage ) {
        $inc = $specialPage->including();
-       
+
        if ( $inc ) {
                @list( $limit, $nlinks ) = explode( '/', $par, 2 );
                $limit = (int)$limit;
index 82dd0fa..572e3f4 100644 (file)
@@ -210,8 +210,8 @@ function wfSpecialWatchlist( $par ) {
        } else {
                $andHideBotsOptional = "AND rc_this_oldid=page_latest";
        }
-               
-       
+
+
        # Show watchlist header
        $header = '';
        if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) {
@@ -226,7 +226,7 @@ function wfSpecialWatchlist( $par ) {
                $wgLang->formatNum( $npages ), '',
                $specialTitle->getFullUrl( 'edit=yes' ) );
        $wgOut->addWikiText( $header );
-       
+
        if ( $wgEnotifWatchlist && $wgShowUpdatedMarker ) {
                $wgOut->addHTML( '<form action="' .
                        $specialTitle->escapeLocalUrl() .
@@ -268,7 +268,7 @@ function wfSpecialWatchlist( $par ) {
                        $wgLang->formatNum( round($days*24) ) ) . '<br />' , false );
 
        $wgOut->addHTML( "\n" . wlCutoffLinks( $days, 'Watchlist', $nondefaults ) . "<br />\n" );
-       
+
        $sk = $wgUser->getSkin();
        $s = $sk->makeKnownLink(
                $wgContLang->specialPage( 'Watchlist' ),
@@ -283,7 +283,7 @@ function wfSpecialWatchlist( $par ) {
                  wfArrayToCGI( array('hideBots' => 1-$hideBots ), $nondefaults ) );
          $wgOut->addHTML( wfMsgHtml( "wlhideshowbots", "  $s" ) );
        }
-       
+
        if ( $numRows == 0 ) {
                $wgOut->addWikitext( "<br />" . wfMsg( 'watchnochange' ), false );
                $wgOut->addHTML( "</p>\n" );
index e664547..540ea50 100644 (file)
@@ -19,7 +19,7 @@ class WhatLinksHerePage {
        var $request, $par;
        var $limit, $from, $dir, $target;
        var $selfTitle, $skin;
-       
+
        function WhatLinksHerePage( &$request, $par = null ) {
                global $wgUser;
                $this->request =& $request;
@@ -29,7 +29,7 @@ class WhatLinksHerePage {
 
        function execute() {
                global $wgUser, $wgOut;
-               
+
                $this->limit = min( $this->request->getInt( 'limit', 50 ), 5000 );
                if ( $this->limit <= 0 ) {
                        $this->limit = 50;
@@ -39,7 +39,7 @@ class WhatLinksHerePage {
                if ( $this->dir != 'prev' ) {
                        $this->dir = 'next';
                }
-               
+
                $targetString = isset($this->par) ? $this->par : $this->request->getVal( 'target' );
 
                if (is_null($targetString)) {
@@ -77,7 +77,7 @@ class WhatLinksHerePage {
                $fname = 'WhatLinksHerePage::showIndirectLinks';
 
                $dbr =& wfGetDB( DB_READ );
-               
+
                extract( $dbr->tableNames( 'pagelinks', 'templatelinks', 'page' ) );
 
                // Some extra validation
@@ -86,20 +86,20 @@ class WhatLinksHerePage {
                        // Before start? No make sense
                        $dir = 'next';
                }
-               
+
                // Make the query
                $plConds = array(
                        'page_id=pl_from',
                        'pl_namespace' => $target->getNamespace(),
                        'pl_title' => $target->getDBkey(),
                );
-               
+
                $tlConds = array(
                        'page_id=tl_from',
                        'tl_namespace' => $target->getNamespace(),
                        'tl_title' => $target->getDBkey(),
                );
-                       
+
                if ( $from ) {
                        if ( 'prev' == $dir ) {
                                $offsetCond = "page_id < $from";
@@ -120,18 +120,18 @@ class WhatLinksHerePage {
                        $plConds[] = $offsetCond;
                }
                $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' );
-               
+
                $plRes = $dbr->select( array( 'pagelinks', 'page' ), $fields,
                        $plConds, $fname, $options );
                $tlRes = $dbr->select( array( 'templatelinks', 'page' ), $fields,
                        $tlConds, $fname, $options );
-               
+
                if ( !$dbr->numRows( $plRes ) && !$dbr->numRows( $tlRes ) ) {
                        if ( 0 == $level ) {
                                $wgOut->addWikiText( wfMsg( 'nolinkshere' ) );
                        }
                        return;
-               }               
+               }
 
                // Read the rows into an array and remove duplicates
                // templatelinks comes second so that the templatelinks row overwrites the
@@ -150,9 +150,9 @@ class WhatLinksHerePage {
                // Sort by key and then change the keys to 0-based indices
                ksort( $rows );
                $rows = array_values( $rows );
-               
+
                $numRows = count( $rows );
-               
+
                // Work out the start and end IDs, for prev/next links
                if ( $dir == 'prev' ) {
                        // Descending order
@@ -168,7 +168,7 @@ class WhatLinksHerePage {
                        }
                        // Assume that the ID specified in $from exists, so there must be another page
                        $nextId = $from;
-                       
+
                        // Reverse order ready for display
                        $rows = array_reverse( $rows );
                } else {
@@ -185,18 +185,18 @@ class WhatLinksHerePage {
                        }
                        $prevId = $from;
                }
-               
+
                if ( 0 == $level ) {
                        $wgOut->addWikiText( wfMsg( 'linkshere' ) );
                }
                $isredir = wfMsg( 'isredirect' );
                $istemplate = wfMsg( 'istemplate' );
-               
+
                if( $level == 0 ) {
                        $prevnext = $this->getPrevNext( $limit, $prevId, $nextId );
                        $wgOut->addHTML( $prevnext );
                }
-               
+
                $wgOut->addHTML( '<ul>' );
                foreach ( $rows as $row ) {
                        $nt = Title::makeTitle( $row->page_namespace, $row->page_title );
@@ -222,7 +222,7 @@ class WhatLinksHerePage {
                                // FIXME? Cultural assumption, hard-coded punctuation
                                $wgOut->addHTML( ' (' . implode( ', ', $props ) . ') ' );
                        }
-                       
+
                        if ( $row->page_is_redirect ) {
                                if ( $level < 2 ) {
                                        $this->showIndirectLinks( $level + 1, $nt, 500 );
@@ -231,7 +231,7 @@ class WhatLinksHerePage {
                        $wgOut->addHTML( "</li>\n" );
                }
                $wgOut->addHTML( "</ul>\n" );
-               
+
                if( $level == 0 ) {
                        $wgOut->addHTML( $prevnext );
                }
index 67617fe..ef6d620 100644 (file)
@@ -87,7 +87,7 @@ class SquidUpdate {
 
                $fname = 'SquidUpdate::purge';
                wfProfileIn( $fname );
-               
+
                $maxsocketspersquid = 8; //  socket cap per Squid
                $urlspersocket = 400; // 400 seems to be a good tradeoff, opening a socket takes a while
                $firsturl = $urlArr[0];
index e65b724..ce7650a 100644 (file)
@@ -24,16 +24,16 @@ does not.</p>
                        return;
                }
        }
-       
+
        header( 'Content-Length: ' . $stat['size'] );
-       
+
        $type = wfGetType( $fname );
        if ( $type and $type!="unknown/unknown") {
                header("Content-type: $type");
        } else {
                header('Content-type: application/x-wiki');
        }
-       
+
        readfile( $fname );
 }
 
@@ -45,14 +45,14 @@ function wfGetType( $filename ) {
        # used for thumbnails (thumb.php)
        if ($wgTrivialMimeDetection) {
                $ext= strtolower(strrchr($filename, '.'));
-               
+
                switch ($ext) {
                        case '.gif': return 'image/gif';
                        case '.png': return 'image/png';
                        case '.jpg': return 'image/jpeg';
                        case '.jpeg': return 'image/jpeg';
                }
-               
+
                return 'unknown/unknown';
        }
        else {
index 8cc9226..5951552 100644 (file)
@@ -869,7 +869,7 @@ class Title {
                        wfProfileOut( $fname );
                        return false;
                }
-               
+
                if( $this->mDbkeyform == '_' ) {
                        # FIXME: Is this necessary? Shouldn't be allowed anyway...
                        wfProfileOut( $fname );
@@ -911,7 +911,7 @@ class Title {
                        wfProfileOut( $fname );
                        return false;
                }
-               
+
                if( $action == 'create' ) {
                        if( (  $this->isTalkPage() && !$wgUser->isAllowed( 'createtalk' ) ) ||
                                ( !$this->isTalkPage() && !$wgUser->isAllowed( 'createpage' ) ) ) {
@@ -2057,7 +2057,7 @@ class Title {
                        $toucharr[] = $row->pl_from;
                }
                $dbw->freeResult( $res );
-               
+
                if( $this->getNamespace() == NS_CATEGORY ) {
                        // Categories show up in a separate set of links as well
                        $res = $dbw->select( 'categorylinks',
@@ -2069,7 +2069,7 @@ class Title {
                        }
                        $dbw->freeResult( $res );
                }
-               
+
                if (!count($toucharr))
                        return;
                $dbw->update( 'page', /* SET */ array( 'page_touched' => $dbw->timestamp() ),
index cbad4b6..54f442b 100644 (file)
@@ -202,7 +202,7 @@ class User {
                || strlen( $name ) > $wgMaxNameChars
                || $name != $wgContLang->ucfirst( $name ) )
                        return false;
-               
+
                // Ensure that the name can't be misresolved as a different title,
                // such as with extra namespace keys at the start.
                $parsed = Title::newFromText( $name );
@@ -323,7 +323,7 @@ class User {
                }
 
                $this->mRegistration = wfTimestamp( TS_MW );
-               
+
                wfProfileOut( $fname );
        }
 
@@ -654,7 +654,7 @@ class User {
                } else {
                        wfDebug( "User::loadFromSession() got from cache!\n" );
                }
-               
+
                if ( isset( $_SESSION['wsToken'] ) ) {
                        $passwordCorrect = $_SESSION['wsToken'] == $user->mToken;
                } else if ( isset( $_COOKIE["{$wgDBname}Token"] ) ) {
@@ -726,13 +726,13 @@ class User {
                                $this->mGroups[] = $row->ug_group;
                        }
                        $implicitGroups = array( '*', 'user' );
-                       
+
                        global $wgAutoConfirmAge;
                        $accountAge = time() - wfTimestampOrNull( TS_UNIX, $this->mRegistration );
                        if( $accountAge >= $wgAutoConfirmAge ) {
                                $implicitGroups[] = 'autoconfirmed';
                        }
-                       
+
                        $effectiveGroups = array_merge( $implicitGroups, $this->mGroups );
                        $this->mRights = $this->getGroupPermissions( $effectiveGroups );
                }
@@ -813,7 +813,7 @@ class User {
                        array( $field => $id ), $fname );
                return $ok !== false;
        }
-       
+
        /**
         * Add or update the
         * @param string $field
@@ -834,7 +834,7 @@ class User {
                wfDebug( "$fname: set on ($field, $id)\n" );
                return true;
        }
-       
+
        /**
         * Clear the new messages flag for the given user
         * @param string $field
@@ -854,7 +854,7 @@ class User {
                wfDebug( "$fname: killed on ($field, $id)\n" );
                return true;
        }
-       
+
        /**
         * Update the 'You have new messages!' status.
         * @param bool $val
@@ -863,12 +863,12 @@ class User {
                if( wfReadOnly() ) {
                        return;
                }
-               
+
                $this->loadFromDatabase();
                $this->mNewtalk = $val;
 
                $fname = 'User::setNewtalk';
-               
+
                if( $this->isAnon() ) {
                        $field = 'user_ip';
                        $id = $this->getName();
@@ -876,13 +876,13 @@ class User {
                        $field = 'user_id';
                        $id = $this->getId();
                }
-               
+
                if( $val ) {
                        $changed = $this->updateNewtalk( $field, $id );
                } else {
                        $changed = $this->deleteNewtalk( $field, $id );
                }
-               
+
                if( $changed ) {
                        if( $this->isAnon() ) {
                                // Anons have a separate memcached space, since
@@ -1152,7 +1152,7 @@ class User {
                        # get the user skin
                        $userSkin = $this->getOption( 'skin' );
                        $userSkin = $wgRequest->getVal('useskin', $userSkin);
-                       
+
                        $this->mSkin =& Skin::newFromKey( $userSkin );
                        wfProfileOut( $fname );
                }
@@ -1202,7 +1202,7 @@ class User {
                        $title->getText() == $this->getName() ) {
                        $this->setNewtalk( false );
                }
-               
+
                if( !$wgUseEnotif ) {
                        return;
                }
@@ -1491,7 +1491,7 @@ class User {
                // add in language specific options, if any
                $extra = $wgContLang->getExtraHashOptions();
                $confstr .= $extra;
-               
+
                // Give a chance for extensions to modify the hash, if they have
                // extra options or other effects on the parser cache.
                wfRunHooks( 'PageRenderingHash', array( &$confstr ) );
@@ -1840,7 +1840,7 @@ class User {
                        array_keys( $wgGroupPermissions ),
                        array( '*', 'user', 'autoconfirmed' ) );
        }
-       
+
 }
 
 ?>
index b887b1e..b14cf41 100644 (file)
@@ -49,7 +49,7 @@ class MailAddress {
                        $this->name = strval( $name );
                }
        }
-       
+
        /**
         * Return formatted and quoted address to insert into SMTP headers
         * @return string
@@ -83,7 +83,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) {
 
                $timestamp = time();
                $dest = $to->toString();
-               
+
                $headers['From'] = $from->toString();
                $headers['To'] = $dest;
                if ( $replyto ) {
@@ -126,7 +126,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) {
                }
 
                $dest = $to->toString();
-               
+
                $wgErrorString = '';
                set_error_handler( 'mailErrorHandler' );
                wfDebug( "Sending mail via internal mail() function to $dest\n" );
@@ -231,7 +231,7 @@ class EmailNotification {
                        if( $userCondition ) {
                                $dbr =& wfGetDB( DB_MASTER );
                                extract( $dbr->tableNames( 'watchlist' ) );
-                               
+
                                $res = $dbr->select( 'watchlist', array( 'wl_user' ),
                                        array(
                                                'wl_title' => $title->getDBkey(),
@@ -239,7 +239,7 @@ class EmailNotification {
                                                $userCondition,
                                                'wl_notificationtimestamp IS NULL',
                                        ), $fname );
-       
+
                                # if anyone is watching ... set up the email message text which is
                                # common for all receipients ...
                                if ( $dbr->numRows( $res ) > 0 ) {
@@ -248,13 +248,13 @@ class EmailNotification {
                                        $this->summary = $summary;
                                        $this->minorEdit = $minorEdit;
                                        $this->oldid = $oldid;
-       
+
                                        $this->composeCommonMailtext();
                                        $watchingUser = new User();
-       
+
                                        # ... now do for all watching users ... if the options fit
                                        for ($i = 1; $i <= $dbr->numRows( $res ); $i++) {
-       
+
                                                $wuser = $dbr->fetchObject( $res );
                                                $watchingUser->setID($wuser->wl_user);
                                                if ( ( $enotifwatchlistpage && $watchingUser->getOption('enotifwatchlistpages') ) ||
@@ -264,7 +264,7 @@ class EmailNotification {
                                                        # ... adjust remaining text and page edit time placeholders
                                                        # which needs to be personalized for each user
                                                        $this->composeAndSendPersonalisedMail( $watchingUser );
-       
+
                                                } # if the watching user has an email address in the preferences
                                        }
                                }
@@ -327,7 +327,7 @@ class EmailNotification {
                $pagetitle = $this->title->getPrefixedText();
                $keys['$PAGETITLE']          = $pagetitle;
                $keys['$PAGETITLE_URL']      = $this->title->getFullUrl();
-               
+
                $keys['$PAGEMINOREDIT']      = $medit;
                $keys['$PAGESUMMARY']        = $summary;
 
@@ -397,7 +397,7 @@ class EmailNotification {
                $body = str_replace( '$WATCHINGUSERNAME', $watchingUser->getName() , $this->body );
 
                $timecorrection = $watchingUser->getOption( 'timecorrection' );
-               
+
                # $PAGEEDITDATE is the time and date of the page change
                # expressed in terms of individual local time of the notification
                # recipient, i.e. watching user
index 89c0f2f..f0f5623 100644 (file)
@@ -66,7 +66,7 @@ class WatchedItem {
        function addWatch() {
                $fname = 'WatchedItem::addWatch';
                wfProfileIn( $fname );
-               
+
                // Use INSERT IGNORE to avoid overwriting the notification timestamp
                // if there's already an entry for this page
                $dbw =& wfGetDB( DB_MASTER );
@@ -144,7 +144,7 @@ class WatchedItem {
                WatchedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() );
                WatchedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() );
        }
-       
+
        /**
         * @static
         * @access private
@@ -172,7 +172,7 @@ class WatchedItem {
                        );
                }
                $dbw->freeResult( $res );
-               
+
                if( empty( $values ) ) {
                        // Nothing to do
                        return true;
index 2563b8f..03939de 100644 (file)
@@ -62,7 +62,7 @@ class WebRequest {
                }
                return $arr;
        }
-       
+
        /**
         * If magic_quotes_gpc option is on, run the global arrays
         * through fix_magic_quotes to strip out the stupid slashes.
@@ -80,7 +80,7 @@ class WebRequest {
                        $this->fix_magic_quotes( $_SERVER );
                }
        }
-       
+
        /**
         * Recursively normalizes UTF-8 strings in the given array.
         * @param array $data string or array
@@ -97,7 +97,7 @@ class WebRequest {
                }
                return $data;
        }
-       
+
        /**
         * Fetch a value from the given array or return $default if it's not set.
         *
@@ -144,7 +144,7 @@ class WebRequest {
                        return (string)$val;
                }
        }
-       
+
        /**
         * Fetch an array from the input or return $default if it's not set.
         * If source was scalar, will return an array with a single element.
@@ -174,7 +174,7 @@ class WebRequest {
        function getInt( $name, $default = 0 ) {
                return intval( $this->getVal( $name, $default ) );
        }
-       
+
        /**
         * Fetch an integer value from the input or return null if empty.
         * Guaranteed to return an integer or null; non-numeric input will
@@ -188,7 +188,7 @@ class WebRequest {
                        ? intval( $val )
                        : null;
        }
-       
+
        /**
         * Fetch a boolean value from the input or return $default if not set.
         * Guaranteed to return true or false, with normal PHP semantics for
@@ -200,7 +200,7 @@ class WebRequest {
        function getBool( $name, $default = false ) {
                return $this->getVal( $name, $default ) ? true : false;
        }
-       
+
        /**
         * Return true if the named value is set in the input, whatever that
         * value is (even "0"). Return false if the named value is not set.
@@ -214,7 +214,7 @@ class WebRequest {
                $val = $this->getVal( $name, NULL );
                return isset( $val );
        }
-       
+
        /**
         * Fetch a text string from the given array or return $default if it's not
         * set. \r is stripped from the text, and with some language modules there
@@ -231,13 +231,13 @@ class WebRequest {
                return str_replace( "\r\n", "\n",
                        $wgContLang->recodeInput( $val ) );
        }
-       
+
        /**
         * Extracts the given named values into an array.
         * If no arguments are given, returns all input values.
         * No transformation is performed on the values.
         */
-       function getValues() {  
+       function getValues() {
                $names = func_get_args();
                if ( count( $names ) == 0 ) {
                        $names = array_keys( $_REQUEST );
@@ -265,7 +265,7 @@ class WebRequest {
        function wasPosted() {
                return $_SERVER['REQUEST_METHOD'] == 'POST';
        }
-       
+
        /**
         * Returns true if there is a session cookie set.
         * This does not necessarily mean that the user is logged in!
@@ -275,7 +275,7 @@ class WebRequest {
        function checkSessionCookie() {
                return isset( $_COOKIE[ini_get('session.name')] );
        }
-       
+
        /**
         * Return the path portion of the request URI.
         * @return string
@@ -289,7 +289,7 @@ class WebRequest {
                        return preg_replace( '!^[^:]+://[^/]+/!', '/', $base );
                }
        }
-       
+
        /**
         * Return the request URI with the canonical service and hostname.
         * @return string
@@ -298,7 +298,7 @@ class WebRequest {
                global $wgServer;
                return $wgServer . $this->getRequestURL();
        }
-       
+
        /**
         * Take an arbitrary query and rewrite the present URL to include it
         * @param string $query Query string fragment; do not include initial '?'
@@ -312,12 +312,12 @@ class WebRequest {
                        $basequery .= '&' . urlencode( $var ) . '=' . urlencode( $val );
                }
                $basequery .= '&' . $query;
-               
+
                # Trim the extra &
                $basequery = substr( $basequery, 1 );
                return $wgTitle->getLocalURL( $basequery );
        }
-       
+
        /**
         * HTML-safe version of appendQuery().
         * @param string $query Query string fragment; do not include initial '?'
@@ -326,7 +326,7 @@ class WebRequest {
        function escapeAppendQuery( $query ) {
                return htmlspecialchars( $this->appendQuery( $query ) );
        }
-       
+
        /**
         * Check for limit and offset parameters on the input, and return sensible
         * defaults if not given. The limit must be positive and is capped at 5000.
@@ -338,7 +338,7 @@ class WebRequest {
         */
        function getLimitOffset( $deflimit = 50, $optionname = 'rclimit' ) {
                global $wgUser;
-       
+
                $limit = $this->getInt( 'limit', 0 );
                if( $limit < 0 ) $limit = 0;
                if( ( $limit == 0 ) && ( $optionname != '' ) ) {
@@ -346,13 +346,13 @@ class WebRequest {
                }
                if( $limit <= 0 ) $limit = $deflimit;
                if( $limit > 5000 ) $limit = 5000; # We have *some* limits...
-       
+
                $offset = $this->getInt( 'offset', 0 );
                if( $offset < 0 ) $offset = 0;
-       
+
                return array( $limit, $offset );
        }
-       
+
        /**
         * Return the path to the temporary file where PHP has stored the upload.
         * @param string $key
@@ -364,7 +364,7 @@ class WebRequest {
                }
                return $_FILES[$key]['tmp_name'];
        }
-       
+
        /**
         * Return the size of the upload, or 0.
         * @param string $key
@@ -376,7 +376,7 @@ class WebRequest {
                }
                return $_FILES[$key]['size'];
        }
-       
+
        /**
         * Return the upload error or 0
         * @param string $key
@@ -388,7 +388,7 @@ class WebRequest {
                }
                return $_FILES[$key]['error'];
        }
-       
+
        /**
         * Return the original filename of the uploaded file, as reported by
         * the submitting user agent. HTML-style character entities are
@@ -405,7 +405,7 @@ class WebRequest {
                        return NULL;
                }
                $name = $_FILES[$key]['name'];
-               
+
                # Safari sends filenames in HTML-encoded Unicode form D...
                # Horrid and evil! Let's try to make some kind of sense of it.
                $name = Sanitizer::decodeCharReferences( $name );
@@ -423,7 +423,7 @@ class WebRequest {
 class FauxRequest extends WebRequest {
        var $data = null;
        var $wasPosted = false;
-       
+
        function FauxRequest( $data, $wasPosted = false ) {
                if( is_array( $data ) ) {
                        $this->data = $data;
@@ -436,32 +436,32 @@ class FauxRequest extends WebRequest {
        function getVal( $name, $default = NULL ) {
                return $this->getGPCVal( $this->data, $name, $default );
        }
-       
+
        function getText( $name, $default = '' ) {
                # Override; don't recode since we're using internal data
                return $this->getVal( $name, $default );
        }
-       
-       function getValues() {  
+
+       function getValues() {
                return $this->data;
        }
 
        function wasPosted() {
                return $this->wasPosted;
        }
-       
+
        function checkSessionCookie() {
                return false;
        }
-       
+
        function getRequestURL() {
                wfDebugDieBacktrace( 'FauxRequest::getRequestURL() not implemented' );
        }
-       
+
        function appendQuery( $query ) {
                wfDebugDieBacktrace( 'FauxRequest::appendQuery() not implemented' );
        }
-       
+
 }
 
 ?>
index d1f1157..6bb7bae 100644 (file)
@@ -26,18 +26,18 @@ class MediaWikiType {
 
 #____________________________________________________________________________________
 #Action methods
-       
+
        function act_view ( $action ) {
                global $wgOut , $wgSquidMaxage , $wgArticle ;
                $wgOut->setSquidMaxage( $wgSquidMaxage );
                $wgArticle->view();
        }
-       
+
        function act_print ( $action ) {
                global $wgArticle ;
                $wgArticle->view () ;
        }
-       
+
        function act_dublincore ( $action ) {
                global $wgArticle , $wgEnableDublinCoreRdf ;
                if( !$wgEnableDublinCoreRdf ) {
@@ -47,7 +47,7 @@ class MediaWikiType {
                        wfDublinCoreRdf( $wgArticle );
                }
        }
-       
+
        function act_creativecommons ( $action ) {
                global $wgArticle , $wgEnableCreativeCommonsRdf ;
                if( !$wgEnableCreativeCommonsRdf ) {
@@ -57,13 +57,13 @@ class MediaWikiType {
                        wfCreativeCommonsRdf( $wgArticle );
                }
        }
-       
+
        function act_credits ( $action ) {
                global $wgArticle ;
                require_once( 'includes/Credits.php' );
                showCreditsPage( $wgArticle );
        }
-       
+
        function act_submit ( $action ) {
                global $wgCommandLineMode , $wgRequest ;
                if( !$wgCommandLineMode && !$wgRequest->checkSessionCookie() ) {
@@ -72,7 +72,7 @@ class MediaWikiType {
                }
                $this->act_edit ( $action ) ;
        }
-       
+
        function act_edit ( $action ) {
                global $wgRequest , $wgUseExternalEditor , $wgUser , $wgArticle ;
                $internal = $wgRequest->getVal( 'internaledit' );
@@ -91,7 +91,7 @@ class MediaWikiType {
                        $extedit->edit();
                }
        }
-       
+
        function act_history ( $action ) {
                global $wgTitle , $wgArticle , $wgSquidMaxage ;
                if ($_SERVER['REQUEST_URI'] == $wgTitle->getInternalURL('action=history')) {
@@ -101,23 +101,23 @@ class MediaWikiType {
                $history = new PageHistory( $wgArticle );
                $history->history();
        }
-       
+
        function act_raw ( $action ) {
                global $wgArticle ;
                require_once( 'includes/RawPage.php' );
                $raw = new RawPage( $wgArticle );
                $raw->view();
        }
-       
-       
+
+
        function action_unknown ( $action ) {
                global $wgArticle , $wgOut ;
                if (wfRunHooks('UnknownAction', array($action, $wgArticle))) {
                        $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
                }
        }
-       
-       
+
+
        function act_watch ( $action ) { $this->article_action ( $action ) ; }
        function act_unwatch ( $action ) { $this->article_action ( $action ) ; }
        function act_delete ( $action ) { $this->article_action ( $action ) ; }
@@ -136,7 +136,7 @@ class MediaWikiType {
                $wgArticle->$action() ;
        }
 
-       
+
 } ; # end of class MediaWikiType
 
 
@@ -145,7 +145,7 @@ $wgTheWiki = new MediaWikiType ;
 
 
 
-       
+
 #global $wgRequest , $wgOut , $wgTitle , $wgContLang ;
 #global $action , $title , $curid ;
 OutputPage::setEncodings(); # Not really used yet
@@ -282,7 +282,7 @@ foreach ( $wgDeferredUpdateList as $up ) {
        $up->doUpdate();
 }
 wfProfileOut( 'main-updates' );
-       
+
 
 #global $wgLoadBalancer , $wgOut , $wgPostCommitUpdateList ;
 wfProfileIn( 'main-cleanup' );
@@ -304,6 +304,6 @@ $wgLoadBalancer->closeAll();
 wfDebug( "Request ended normally\n" );
 
 
-       
+
 ?>
 
index ef8437f..38dbafb 100644 (file)
@@ -34,14 +34,14 @@ class WikiError {
        function WikiError( $message ) {
                $this->mMessage = $message;
        }
-       
+
        /**
         * @return string Plaintext error message to display
         */
        function getMessage() {
                return $this->mMessage;
        }
-       
+
        /**
         * In following PEAR_Error model this could be formatted differently,
         * but so far it's not.
@@ -50,7 +50,7 @@ class WikiError {
        function toString() {
                return $this->getMessage();
        }
-       
+
        /**
         * Returns true if the given object is a WikiError-descended
         * error object, false otherwise.
@@ -100,7 +100,7 @@ class WikiXmlError extends WikiError {
                wfDebug( "WikiXmlError: " . $this->getMessage() . "\n" );
        }
 
-       /** @return string */   
+       /** @return string */
        function getMessage() {
                return sprintf( '%s at line %d, col %d (byte %d%s): %s',
                        $this->mMessage,
@@ -110,7 +110,7 @@ class WikiXmlError extends WikiError {
                        $this->mContext,
                        xml_error_string( $this->mXmlError ) );
        }
-       
+
        function _extractContext( $context, $offset ) {
                if( is_null( $context ) ) {
                        return null;
index ff414c1..4ca4e1f 100644 (file)
@@ -101,7 +101,7 @@ class ZhClient {
         * @param string $text input text
         * @return array langcode => converted_string
         * @access public
-        */     
+        */
        function convertToAllVariants($text) {
                $len = strlen($text);
                $q = "CONV ALL $len\n$text";
index c38fff8..a68edf9 100644 (file)
@@ -190,12 +190,12 @@ function ctype_xdigit() {
  */
 function wf_ctype_parse_args( $fname, $args ) {
        $ret = null;
-       
+
        $cnt = count( $args );
-       
+
        if ( $cnt !== 1 )
                trigger_error( "$fname() expects exactly 1 parameter $cnt given", E_USER_WARNING );
-       
+
        $in = array_pop( $args );
 
        if ( is_int( $in ) ) {
@@ -208,7 +208,7 @@ function wf_ctype_parse_args( $fname, $args ) {
                else if ( $in < -128 )
                        return array( null, true );
        }
-       
+
        if ( is_string( $in ) )
                if ( $in === '' )
                        return array( null, true );
index d5d74a7..53a322d 100644 (file)
@@ -278,7 +278,7 @@ class CleanUpTest extends PHPUnit_TestCase {
                }
        }
 
-       /** @todo document */   
+       /** @todo document */
        function testChunkRegression() {
                # Check for regression against a chunking bug
                $text   = "\x46\x55\xb8" .
@@ -316,7 +316,7 @@ class CleanUpTest extends PHPUnit_TestCase {
                          "\xad" .              # bad tail
                          "\x7d" .
                          "\xd9\x95";
-       
+
                $expect = "\x4e\x30" .
                          "\xef\xbf\xbd" .
                          "\x3a" .
@@ -330,13 +330,13 @@ class CleanUpTest extends PHPUnit_TestCase {
                          "\xef\xbf\xbd" .
                          "\x7d" .
                          "\xd9\x95";
-               
+
                $this->assertEquals(
                        bin2hex( $expect ),
                        bin2hex( UtfNormal::cleanUp( $text ) ) );
        }
 
-       /** @todo document */   
+       /** @todo document */
        function testOverlongRegression() {
                $text   = "\x67" .
                          "\x1a" . # forbidden ascii
@@ -361,7 +361,7 @@ class CleanUpTest extends PHPUnit_TestCase {
                        bin2hex( UtfNormal::cleanUp( $text ) ) );
        }
 
-       /** @todo document */   
+       /** @todo document */
        function testSurrogateRegression() {
                $text   = "\xed\xb4\x96" . # surrogate 0xDD16
                          "\x83" . # bad tail
index 10d1c4a..539975a 100644 (file)
@@ -51,7 +51,7 @@ function donorm( $str ) {
        $str = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, $str );
        $str = str_replace( UTF8_FFFE, UTF8_REPLACEMENT, $str );
        $str = str_replace( UTF8_FFFF, UTF8_REPLACEMENT, $str );
-       
+
        # UnicodeString constructor fails if the string ends with a head byte.
        # Add a junk char at the end, we'll strip it off
        return rtrim( utf8_normalize( $str . "\x01", UNORM_NFC ), "\x01" );
@@ -64,7 +64,7 @@ function wfMsg($x) {
 function showDiffs( $a, $b ) {
        $ota = explode( "\n", str_replace( "\r\n", "\n", $a ) );
        $nta = explode( "\n", str_replace( "\r\n", "\n", $b ) );
-       
+
        $diffs =& new Diff( $ota, $nta );
        $formatter =& new TableDiffFormatter();
        $funky = $formatter->format( $diffs );
@@ -80,7 +80,7 @@ $n = 0;
 while( true ) {
        $n++;
        echo "$n\n";
-       
+
        $str = randomString( $size, true);
        $clean = UtfNormal::cleanUp( $str );
        $norm = donorm( $str );
@@ -97,8 +97,8 @@ while( true ) {
                showDiffs( $clean, $norm );
                die();
        }
-       
-       
+
+
        $str = '';
        $clean = '';
        $norm = '';
index e9f8311..c5e0e6c 100644 (file)
@@ -68,7 +68,7 @@ $exceptions = array(
        # Tests that should mark invalid characters due to using long
        # sequences beyond what is now considered legal.
        '2.1.5', '2.1.6', '2.2.4', '2.2.5', '2.2.6', '2.3.5',
-       
+
        # Literal 0xffff, which is illegal
        '2.2.3' );
 
@@ -127,15 +127,15 @@ function testLine( $test, $line, &$total, &$success, &$failed ) {
        if( $len == 0 ) {
                $len = strlen( substr( $stripped, 0, strpos( $stripped, '|' ) ) );
        }
-       
+
        global $columns;
        $ok = $same ^ ($test >= 3 );
 
        global $exceptions;
        $ok ^= in_array( $test, $exceptions );
-       
+
        $ok &= ($columns == $len);
-       
+
        $total++;
        if( $ok ) {
                $success++;
index 816633a..02fa268 100644 (file)
@@ -134,7 +134,7 @@ class UtfNormal {
                                $string );
                        $string = str_replace( UTF8_FFFE, UTF8_REPLACEMENT, $string );
                        $string = str_replace( UTF8_FFFF, UTF8_REPLACEMENT, $string );
-                       
+
                        # UnicodeString constructor fails if the string ends with a
                        # head byte. Add a junk char at the end, we'll strip it off.
                        return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" );
@@ -162,7 +162,7 @@ class UtfNormal {
                else
                        return UtfNormal::NFC( $string );
        }
-       
+
        /**
         * Convert a UTF-8 string to normal form D, canonical decomposition.
         * Fast return for pure ASCII strings.
@@ -178,7 +178,7 @@ class UtfNormal {
                else
                        return $string;
        }
-       
+
        /**
         * Convert a UTF-8 string to normal form KC, compatibility composition.
         * This may cause irreversible information loss, use judiciously.
@@ -195,7 +195,7 @@ class UtfNormal {
                else
                        return $string;
        }
-       
+
        /**
         * Convert a UTF-8 string to normal form KD, compatibility decomposition.
         * This may cause irreversible information loss, use judiciously.
@@ -212,7 +212,7 @@ class UtfNormal {
                else
                        return $string;
        }
-       
+
        /**
         * Load the basic composition data if necessary
         * @access private
@@ -223,7 +223,7 @@ class UtfNormal {
                        require_once( 'UtfNormalData.inc' );
                }
        }
-       
+
        /**
         * Returns true if the string is _definitely_ in NFC.
         * Returns false if not or uncertain.
@@ -234,7 +234,7 @@ class UtfNormal {
                # ASCII is always valid NFC!
                # If it's pure ASCII, let it through.
                if( !preg_match( '/[\x80-\xff]/', $string ) ) return true;
-               
+
                UtfNormal::loadData();
                global $utfCheckNFC, $utfCombiningClass;
                $len = strlen( $string );
@@ -273,18 +273,18 @@ class UtfNormal {
        function quickIsNFCVerify( &$string ) {
                # Screen out some characters that eg won't be allowed in XML
                $string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, $string );
-               
+
                # ASCII is always valid NFC!
                # If we're only ever given plain ASCII, we can avoid the overhead
                # of initializing the decomposition tables by skipping out early.
                if( !preg_match( '/[\x80-\xff]/', $string ) ) return true;
-               
+
                static $checkit = null, $tailBytes = null, $utfCheckOrCombining = null;
                if( !isset( $checkit ) ) {
                        # Load/build some scary lookup tables...
                        UtfNormal::loadData();
                        global $utfCheckNFC, $utfCombiningClass;
-                       
+
                        $utfCheckOrCombining = array_merge( $utfCheckNFC, $utfCombiningClass );
 
                        # Head bytes for sequences which we should do further validity checks
@@ -292,7 +292,7 @@ class UtfNormal {
                                        array( 0xc0, 0xc1, 0xe0, 0xed, 0xef,
                                                   0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
                                                   0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff ) ) );
-                       
+
                        # Each UTF-8 head byte is followed by a certain
                        # number of tail bytes.
                        $tailBytes = array();
@@ -315,7 +315,7 @@ class UtfNormal {
                                $tailBytes[chr($n)] = $remaining;
                        }
                }
-               
+
                # Chop the text into pure-ASCII and non-ASCII areas;
                # large ASCII parts can be handled much more quickly.
                # Don't chop up Unicode areas for punctuation, though,
@@ -323,30 +323,30 @@ class UtfNormal {
                preg_match_all(
                        '/([\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*)/',
                        $string, $matches );
-               
+
                $looksNormal = true;
                $base = 0;
                $replace = array();
                foreach( $matches[1] as $str ) {
                        $chunk = strlen( $str );
-                       
+
                        if( $str{0} < "\x80" ) {
                                # ASCII chunk: guaranteed to be valid UTF-8
                                # and in normal form C, so skip over it.
                                $base += $chunk;
                                continue;
                        }
-                       
+
                        # We'll have to examine the chunk byte by byte to ensure
                        # that it consists of valid UTF-8 sequences, and to see
                        # if any of them might not be normalized.
                        #
                        # Since PHP is not the fastest language on earth, some of
                        # this code is a little ugly with inner loop optimizations.
-                       
+
                        $head = '';
                        $len = $chunk + 1; # Counting down is faster. I'm *so* sorry.
-                       
+
                        for( $i = -1; --$len; ) {
                                if( $remaining = $tailBytes[$c = $str{++$i}] ) {
                                        # UTF-8 head byte!
@@ -386,7 +386,7 @@ class UtfNormal {
                                                        # 0xed is relatively frequent in Korean, which
                                                        # abuts the surrogate area, so we're doing
                                                        # this check separately to speed things up.
-                                                       
+
                                                        if( $sequence >= UTF8_SURROGATE_FIRST ) {
                                                                # Surrogates are legal only in UTF-16 code.
                                                                # They are totally forbidden here in UTF-8
@@ -410,16 +410,16 @@ class UtfNormal {
                                                               ($n  < 0xc2 && $sequence <= UTF8_OVERLONG_A)
                                                                || ($n == 0xe0 && $sequence <= UTF8_OVERLONG_B)
                                                                || ($n == 0xf0 && $sequence <= UTF8_OVERLONG_C)
-                                                               
+
                                                                # U+FFFE and U+FFFF are explicitly forbidden in Unicode.
                                                                || ($n == 0xef &&
                                                                           ($sequence == UTF8_FFFE)
                                                                        || ($sequence == UTF8_FFFF) )
-                                                               
+
                                                                # Unicode has been limited to 21 bits; longer
                                                                # sequences are not allowed.
                                                                || ($n >= 0xf0 && $sequence > UTF8_MAX) ) {
-                                                               
+
                                                                $replace[] = array( UTF8_REPLACEMENT,
                                                                                    $base + $i + 1 - strlen( $sequence ),
                                                                                    strlen( $sequence ) );
@@ -428,14 +428,14 @@ class UtfNormal {
                                                        }
                                                }
                                        }
-                                       
+
                                        if( isset( $utfCheckOrCombining[$sequence] ) ) {
                                                # If it's NO or MAYBE, we'll have to rip
                                                # the string apart and put it back together.
                                                # That's going to be mighty slow.
                                                $looksNormal = false;
                                        }
-                                       
+
                                        # The sequence is legal!
                                        $head = '';
                                } elseif( $c < "\x80" ) {
@@ -479,7 +479,7 @@ class UtfNormal {
                }
                return $looksNormal;
        }
-       
+
        # These take a string and run the normalization on them, without
        # checking for validity or any optimization etc. Input must be
        # VALID UTF-8!
@@ -491,7 +491,7 @@ class UtfNormal {
        function NFC( $string ) {
                return UtfNormal::fastCompose( UtfNormal::NFD( $string ) );
        }
-       
+
        /**
         * @param string $string
         * @return string
@@ -503,7 +503,7 @@ class UtfNormal {
                return UtfNormal::fastCombiningSort(
                        UtfNormal::fastDecompose( $string, $utfCanonicalDecomp ) );
        }
-       
+
        /**
         * @param string $string
         * @return string
@@ -512,7 +512,7 @@ class UtfNormal {
        function NFKC( $string ) {
                return UtfNormal::fastCompose( UtfNormal::NFKD( $string ) );
        }
-       
+
        /**
         * @param string $string
         * @return string
@@ -526,8 +526,8 @@ class UtfNormal {
                return UtfNormal::fastCombiningSort(
                        UtfNormal::fastDecompose( $string, $utfCompatibilityDecomp ) );
        }
-       
-       
+
+
        /**
         * Perform decomposition of a UTF-8 string into either D or KD form
         * (depending on which decomposition map is passed to us).
@@ -724,7 +724,7 @@ class UtfNormal {
                                                $hangulPoint = UNICODE_HANGUL_FIRST +
                                                        UNICODE_HANGUL_TCOUNT *
                                                        (UNICODE_HANGUL_VCOUNT * $lIndex + $vIndex);
-                                               
+
                                                # Hardcode the limited-range UTF-8 conversion:
                                                $startChar = chr( $hangulPoint >> 12 & 0x0f | 0xe0 ) .
                                                                         chr( $hangulPoint >>  6 & 0x3f | 0x80 ) .
@@ -739,7 +739,7 @@ class UtfNormal {
                                                # $tIndex = utf8ToCodepoint( $c ) - UNICODE_HANGUL_TBASE;
                                                $tIndex = ord( $c{2} ) - 0xa7;
                                                if( $tIndex < 0 ) $tIndex = ord( $c{2} ) - 0x80 + (0x11c0 - 0x11a7);
-                                               
+
                                                # Increment the code point by $tIndex, without
                                                # the function overhead of decoding and recoding UTF-8
                                                #
@@ -754,7 +754,7 @@ class UtfNormal {
                                                        $startChar{1} = chr( $mid );
                                                }
                                                $startChar{2} = chr( $tail );
-                                               
+
                                                # If there's another jamo char after this, *don't* try to merge it.
                                                $lastHangul = 1;
                                                continue;
@@ -771,7 +771,7 @@ class UtfNormal {
                $out .= $startChar . $combining;
                return $out;
        }
-       
+
        /**
         * This is just used for the benchmark, comparing how long it takes to
         * interate through a string without really doing anything of substance.
index 39c64a0..ea4ea5e 100644 (file)
@@ -96,10 +96,10 @@ function benchmarkForm( &$u, &$data, $form ) {
        #$delta = (benchTime() - $start) / BENCH_CYCLES;
        sort( $deltas );
        $delta = $deltas[0]; # Take shortest time
-       
+
        $rate = intval( strlen( $data ) / $delta );
        $same = (0 == strcmp( $data, $out ) );
-       
+
        printf( " %20s %6.1fms %8d bytes/s (%s)\n", $form, $delta*1000.0, $rate, ($same ? 'no change' : 'changed' ) );
        return $out;
 }
index 06fbd7b..2c91df1 100644 (file)
@@ -95,13 +95,13 @@ while( false !== ($line = fgets( $in ) ) ) {
        $name = $columns[1];
        $canonicalCombiningClass = $columns[3];
        $decompositionMapping = $columns[5];
-       
+
        $source = codepointToUtf8( hexdec( $codepoint ) );
 
        if( $canonicalCombiningClass != 0 ) {
                $combiningClass[$source] = intval( $canonicalCombiningClass );
        }
-       
+
        if( $decompositionMapping === '' ) continue;
        if( preg_match( '/^<(.+)> (.*)$/', $decompositionMapping, $matches ) ) {
                # Compatibility decomposition
@@ -114,7 +114,7 @@ while( false !== ($line = fgets( $in ) ) ) {
        }
        $total++;
        $dest = hexSequenceToUtf8( $decompositionMapping );
-       
+
        $compatibilityDecomp[$source] = $dest;
        if( $canonical ) {
                $canonicalDecomp[$source] = $dest;
index d0c80d7..5735594 100644 (file)
@@ -32,7 +32,7 @@ if( defined( 'PRETTY_UTF8' ) ) {
                return preg_replace( '/([\x00-\xff])/e',
                        'sprintf("%02X", ord("$1"))',
                        $string );
-       }       
+       }
 } else {
        /**
         * @ignore
@@ -41,7 +41,7 @@ if( defined( 'PRETTY_UTF8' ) ) {
                return trim( preg_replace( '/(.)/use',
                        'sprintf("%04X ", utf8ToCodepoint("$1"))',
                        $string ) );
-       }       
+       }
 }
 
 if( isset( $_SERVER['argv'] ) && in_array( '--icu', $_SERVER['argv'] ) ) {
@@ -80,10 +80,10 @@ while( false !== ( $line = fgets( $in ) ) ) {
                print "Part {$matches[1]}: $comment";
                continue;
        }
-       
+
        $columns = array_map( "hexSequenceToUtf8", explode( ";", $data ) );
        array_unshift( $columns, '' );
-       
+
        $testedChars[$columns[1]] = true;
        $total++;
        if( testNormals( $normalizer, $columns, $comment ) ) {
@@ -159,7 +159,7 @@ function testNormals( &$u, $c, $comment, $reportFailure = false ) {
        $result = testNFKC( $u, $c, $comment, $reportFailure ) && $result;
        $result = testNFKD( $u, $c, $comment, $reportFailure ) && $result;
        $result = testCleanUp( $u, $c, $comment, $reportFailure ) && $result;
-       
+
        global $verbose;
        if( $verbose && !$result && !$reportFailure ) {
                print $comment;
index 9a1aecd..eba92da 100644 (file)
@@ -184,7 +184,7 @@ class UsercreateTemplate extends QuickTemplate {
        <?php } ?>
        </table>
        <?php
-               
+
                if( $this->data['useemail'] ) {
                        echo '<div id="login-emailforlost">';
                        $this->msgHtml( 'emailforlost' );
index e5c4141..854ccd8 100644 (file)
@@ -2518,11 +2518,11 @@ class Language {
 
                if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
                $datePreference = $this->dateFormat( $format );
-               
+
                $sep = ($datePreference == MW_DATE_ISO)
                        ? ':'
                        : $this->timeSeparator( $format );
-               
+
                $t = substr( $ts, 8, 2 ) . $sep . substr( $ts, 10, 2 );
 
                if ( $datePreference == MW_DATE_ISO ) {
@@ -2530,7 +2530,7 @@ class Language {
                }
                return $t;
        }
-       
+
        /**
         * Default separator character between hours, minutes, and seconds.
         * Will be used by Language::time() for non-ISO formats.
@@ -2540,7 +2540,7 @@ class Language {
        function timeSeparator( $format ) {
                return ':';
        }
-       
+
        /**
         * String to insert between the time and the date in a combined
         * string. Should include any relevant whitespace.
@@ -2549,7 +2549,7 @@ class Language {
        function timeDateSeparator( $format ) {
                return ', ';
        }
-       
+
        /**
         * Return true if the time should display before the date.
         * @return bool
@@ -2562,7 +2562,7 @@ class Language {
        function formatMonth( $month, $format ) {
                return $this->getMonthName( $month );
        }
-       
+
        function formatDay( $day, $format ) {
                return $this->formatNum( 0 + $day );
        }
@@ -2751,7 +2751,7 @@ class Language {
                $raw = $this->getMagicWords();
 
                wfRunHooks( 'LanguageGetMagic', array( &$raw ) );
-               
+
                if( !isset( $raw[$mw->mId] ) ) {
                        # Fall back to English if local list is incomplete
                        $raw =& Language::getMagicWords();
index 09570a5..9e6680e 100644 (file)
@@ -553,7 +553,7 @@ class LanguageBe extends LanguageUtf8 {
                global $wgMagicWordsBe;
                return $wgMagicWordsBe;
        }
-       
+
        function getDateFormats() {
                return $wgDateFormatsBe = array(
                        MW_DATE_DEFAULT => MW_DATE_DEFAULT,
index eccbe0b..fdc51a9 100644 (file)
@@ -644,7 +644,7 @@ $2 Показване на пренасочвания &nbsp; Търсене на
                        <input type="hidden" name="domains" value="{{SERVER}}" />
                        <input type="hidden" name="num" value="50" />
                        <input type="hidden" name="ie" value="$2" />
-       
+
                        <input type="hidden" name="oe" value="$2" />
                        <input type="text" name="q" size="31" maxlength="255" value="$1" />
                        <input type="submit" name="btnG" value="Google Search" />
@@ -1870,7 +1870,7 @@ class LanguageBg extends LanguageUtf8 {
                global $wgBookstoreListBg;
                return $wgBookstoreListBg;
        }
-       
+
        /**
        * Exports $wgNamespaceNamesBg
        * @return array
@@ -1924,7 +1924,7 @@ class LanguageBg extends LanguageUtf8 {
                global $wgMagicWordsBg;
                return $wgMagicWordsBg;
        }
-       
+
 
        /**
         * Translation table for numbers
index aec825a..e094f2c 100644 (file)
@@ -618,7 +618,7 @@ An eur merket eo hini ar servijer (UTC).
 'filename'     => 'Anv&nbsp;',
 'filedesc'     => 'Deskrivadur&nbsp;',
 'filestatus'   => 'Statud ar gwirioù aozer',
-'filesource'   => 'Mammenn',   
+'filesource'   => 'Mammenn',
 'copyrightpage' => "{{ns:4}}:Gwirioù aozer (Copyright)",
 'copyrightpagename' => "aotre {{SITENAME}}",
 'uploadedfiles' => "Restroù eilet",
@@ -1199,7 +1199,7 @@ class LanguageBr extends LanguageUtf8 {
                ',' => "\xc2\xa0", // @bug 2749
                '.' => ','
        );
-       
+
        function formatNum( $number, $year = false ) {
                return $year ? $number : strtr($this->commafy($number), $this->digitTransTable );
        }
@@ -1212,7 +1212,7 @@ class LanguageBr extends LanguageUtf8 {
                        return parent::getMessage( $key );
                }
        }
-       
+
 }
 
 ?>
index faf4d49..c8dc831 100644 (file)
@@ -1784,7 +1784,7 @@ class LanguageCs extends LanguageUtf8 {
        function formatMonth( $month, $format ) {
                return intval( $month ) . '.';
        }
-       
+
        function formatDay( $day, $format ) {
                return intval( $day ) . '.';
        }
index 9f66f5e..f74c12a 100644 (file)
@@ -1241,11 +1241,11 @@ class LanguageDe extends LanguageUtf8 {
                global $wgSkinNamesDe;
                return $wgSkinNamesDe;
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function formatDay( $day, $format ) {
                return parent::formatDay( $day, $format ) . '.';
        }
index 6a04d7f..ac4a020 100644 (file)
@@ -1941,17 +1941,17 @@ class LanguageEl extends LanguageUtf8 {
                global $wgNamespaceNamesEl;
                return $wgNamespaceNamesEl;
        }
-       
+
        function getMessage( $key ) {
                global $wgAllMessagesEl;
 
                return isset( $wgAllMessagesEl[$key] ) ? $wgAllMessagesEl[$key] : parent::getMessage( $key );
        }
-       
+
        function fallback8bitEncoding() {
                return 'iso-8859-7';
        }
-       
+
        function formatNum( $number, $year = false ) {
                return $year ? $number : strtr($this->commafy( $number ), '.,', ',.' );
        }
index d390240..4a6a873 100644 (file)
@@ -925,7 +925,7 @@ class LanguageEo extends LanguageUtf8 {
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function formatDay( $day, $format ) {
                return parent::formatDay( $day, $format ) . '.';
        }
index 86c1b82..621ae23 100644 (file)
@@ -1939,15 +1939,15 @@ class LanguageEs extends LanguageUtf8 {
                global $wgSkinNamesEs;
                return $wgSkinNamesEs;
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function timeDateSeparator( $format ) {
                return ' ';
        }
-       
+
 
        function getMessage( $key ) {
                global $wgAllMessagesEs;
index e548d5f..864256b 100644 (file)
@@ -1181,11 +1181,11 @@ class LanguageFr extends LanguageUtf8 {
                global $wgSkinNamesFr;
                return $wgSkinNamesFr;
        }
-       
+
        function timeBeforeDate( $format ) {
                return false;
        }
-       
+
        function timeDateSeparator( $format ) {
                return " à ";
        }
index f615df5..0727c4e 100644 (file)
@@ -1008,7 +1008,7 @@ class LanguageFy extends LanguageUtf8 {
                } else {
                        $sep = '.';
                }
-               
+
                $t = substr( $ts, 8, 2 ) . $sep . substr( $ts, 10, 2 );
 
                if ( $datePreference == MW_DATE_ISO ) {
@@ -1016,7 +1016,7 @@ class LanguageFy extends LanguageUtf8 {
                }
                return $t;
        }
-       
+
        function getMessage( $key ) {
                global $wgAllMessagesFy;
                if( isset( $wgAllMessagesFy[$key] ) ) {
index 8a03dd6..81d54bd 100644 (file)
@@ -1818,7 +1818,7 @@ Potvrdite namjeru vraćanja ovog članka.',
 #--------------------------------------------------------------------------
 
 class LanguageHr extends LanguageUtf8 {
-       
+
        function getNamespaces() {
                global $wgNamespaceNamesHr;
                return $wgNamespaceNamesHr;
@@ -1837,7 +1837,7 @@ class LanguageHr extends LanguageUtf8 {
                global $wgSkinNamesHr;
                return $wgSkinNamesHr;
        }
-       
+
        function date( $ts, $adj = false, $format = true, $timecorrection = false ) {
                if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
 
index 4ddfe8c..84e7e29 100644 (file)
@@ -714,7 +714,7 @@ class LanguageIt extends LanguageUtf8 {
                global $wgQuickbarSettingsIt;
                return $wgQuickbarSettingsIt;
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
index d8d2a8d..a2ee757 100644 (file)
@@ -1863,29 +1863,29 @@ class LanguageJa extends LanguageUtf8 {
                global $wgDateFormatsJa;
                return $wgDateFormatsJa;
        }
-       
+
        function date( $ts, $adj = false, $format = true, $tc = false ) {
                global $wgWeekdayAbbreviationsJa;
-               
+
                if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
                $datePreference = $this->dateFormat( $format );
-               
+
                if( $datePreference == MW_DATE_ISO ) {
                        $d = substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .
                                        substr($ts, 6, 2);
                        return $d;
                }
-               
+
                $year = (int)substr( $ts, 0, 4 );
                $month = (int)substr( $ts, 4, 2 );
                $mday = (int)substr( $ts, 6, 2 );
                $hour = (int)substr( $ts, 8, 2 );
                $minute = (int)substr( $ts, 10, 2 );
                $second = (int)substr( $ts, 12, 2 );
-               
+
                $time = mktime( $hour, $minute, $second, $month, $mday, $year );
                $date = getdate( $time );
-               
+
                $d = $year . "年" .
                                $this->getMonthAbbreviation( $month ) .
                                $mday . "日 (" .
@@ -1896,12 +1896,12 @@ class LanguageJa extends LanguageUtf8 {
        function time( $ts, $adj = false, $format = true, $tc = false ) {
                if ( $adj ) { $ts = $this->userAdjust( $ts, $tc ); }
                $datePreference = $this->dateFormat( $format );
-               
+
                $t = substr( $ts, 8, 2 ) . ":" . substr( $ts, 10, 2 );
                if ( $datePreference == MW_DATE_ISO ) {
                        $t .= ':' . substr( $ts, 12, 2 );
                }
-               
+
                return $t;
        }
 
index 8c3a8e0..d73f08f 100644 (file)
@@ -809,7 +809,7 @@ class LanguageKo extends LanguageUtf8 {
                global $wgSkinNamesKo;
                return $wgSkinNamesKo;
        }
-       
+
        function getDateFormats() {
                return false;
        }
index 463b233..289bff0 100644 (file)
@@ -870,19 +870,19 @@ class LanguageLi extends LanguageUtf8 {
                global $wgSkinNamesLi;
                return $wgSkinNamesLi;
        }
-       
+
        function timeBeforeDate( $format ) {
                return false;
        }
-       
+
        function timeDateSeparator( $format ) {
                return ' ';
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function getMessage( $key ) {
                global $wgAllMessagesLi;
                if( isset( $wgAllMessagesLi[$key] ) ) {
index 686fe5b..d55cdd7 100644 (file)
@@ -1255,7 +1255,7 @@ class LanguageNds extends LanguageUtf8 {
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function formatDay( $day, $format ) {
                return parent::formatDay( $day, $format ) . '.';
        }
index bc2ebf1..1c5c0e0 100644 (file)
@@ -767,15 +767,15 @@ class LanguageNl extends LanguageUtf8 {
        function timeBeforeDate( $format ) {
                return false;
        }
-       
+
        function timeDateSeparator( $format ) {
                return ' ';
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function getMessage( $key ) {
                global $wgAllMessagesNl;
                if( isset( $wgAllMessagesNl[$key] ) ) {
index 902cffe..422813d 100644 (file)
@@ -951,15 +951,15 @@ class LanguageNo extends LanguageUtf8 {
                global $wgSkinNamesNo;
                return $wgSkinNamesNo;
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function formatDay( $day, $format ) {
                return parent::formatDay( $day, $format ) . '.';
        }
-       
+
        function timeanddate( $ts, $adj = false, $format = false, $timecorrection = false ) {
                $format = $this->dateFormat( $format );
                if( $format == MW_DATE_ISO ) {
index b7e00c6..e700500 100644 (file)
@@ -845,11 +845,11 @@ class LanguageOc extends LanguageUtf8{
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
-       
+
        function timeBeforeDate( $format ) {
                return false;
        }
-       
+
        function timeDateSeparator( $format ) {
                return " à ";
        }
index fea7f65..5dfa937 100644 (file)
@@ -968,7 +968,7 @@ class LanguagePl extends LanguageUtf8 {
                global $wgMonthNamesGenEn;
                return wfMsg( $wgMonthNamesGenEn[$key-1] );
        }
-       
+
        function formatMonth( $month, $format ) {
                return $this->getMonthAbbreviation( $month );
        }
index f2dd765..edb5c33 100644 (file)
@@ -1965,7 +1965,7 @@ class LanguagePt extends LanguageUtf8 {
                global $wgNamespaceNamesPt;
                return $wgNamespaceNamesPt;
        }
-       
+
        /**
        * Exports $wgQuickbarSettingsPt
        * @return array
index 491b686..ec161ae 100644 (file)
@@ -1680,7 +1680,7 @@ class LanguageSr extends LanguageUtf8 {
                global $wgMagicWordsSr;
                return $wgMagicWordsSr;
        }
-       
+
        function formatNum( $number, $year = false ) {
                return $year ? $number : strtr($this->commafy($number), '.,', ',.' );
        }
index 1cec1e5..5687069 100644 (file)
@@ -41,7 +41,7 @@ class LanguageUtf8 extends Language {
        # or compiled and character mapping arrays otherwise.
        # In case of language-specific character mismatch
        # it should be dealt with in Language classes.
-       
+
        function ucfirst( $str ) {
                return $this->uc( $str, true );
        }
index 20432a4..5bbf4d9 100644 (file)
@@ -541,7 +541,7 @@ Tìm trong :<br />
 $1<br />
 $2 gồm cả trang đổi hướng &nbsp; Tìm $3 $9",
 'searchdisabled' => "<p>Công cụ tìm kiếm hiện bị khóa. Chức năng này sẽ được mở lại khi có điều kiện lắp thêm máy chủ. Hiện tại có thể tìm với Google:</p>",
-"blanknamespace" => "(Chính)",        
+"blanknamespace" => "(Chính)",
 
 # Preferences page
 #
@@ -644,8 +644,8 @@ Sau khi truyền hình lên:
 *Thông tin tải lên và xóa bỏ được ghi trong [[{{ns:4}}:Nhật trình tải lên|nhật trình tải lên]].
 *Để cho hình vào bài, xem [[{{ns:4}}:Cú pháp hình ảnh|cú pháp hình ảnh]].
 *Người khác có thể sửa hoặc xóa những thông tin bạn tải lên, và bạn có thể bị cấm tải lên nếu lạm dụng hệ thống.",
-"uploadlog"  => "Nhật trình tải lên",            
-"uploadlogpage" => "Nhật_trình_tải_lên", 
+"uploadlog"  => "Nhật trình tải lên",
+"uploadlogpage" => "Nhật_trình_tải_lên",
 "uploadlogpagetext" => "Danh sách các tệp tin đã tải lên, theo giờ máy chủ (UTC).
 <ul>
 </ul>",
index 52e1745..5eabcb2 100644 (file)
@@ -921,7 +921,7 @@ class LanguageZh_cn extends LanguageUtf8 {
                global $wgSkinNamesZh_cn;
                return $wgSkinNamesZh_cn;
        }
-       
+
        function getDateFormats() {
                return false;
        }
index e278f52..ac398d3 100644 (file)
        'sa' => 'संस्कृत',        # Sanskrit
        'sc' => 'Sardu',                # Sardinian
        'scn' => 'Sicilianu',   # Sicilian
-       'sco' => 'Scots',       # Scots 
+       'sco' => 'Scots',       # Scots
        'sd' => 'सिनधि',      # Sindhi
        'se' => 'Sámegiella',  # Northern Sami
        'sg' => 'Sängö',              # Sango, possible alternative is Sangho
index c9ab211..861ad96 100644 (file)
@@ -13,22 +13,22 @@ class FiveUpgrade {
        function FiveUpgrade() {
                global $wgDatabase;
                $this->conversionTables = $this->prepareWindows1252();
-               
+
                $this->dbw =& $this->newConnection();
                $this->dbr =& $this->streamConnection();
-               
+
                $this->cleanupSwaps = array();
                $this->emailAuth = false; # don't preauthenticate emails
                $this->maxLag    = 10; # if slaves are lagged more than 10 secs, wait
        }
-       
+
        function doing( $step ) {
                return is_null( $this->step ) || $step == $this->step;
        }
-       
+
        function upgrade( $step ) {
                $this->step = $step;
-               
+
                $tables = array(
                        'page',
                        'links',
@@ -49,13 +49,13 @@ class FiveUpgrade {
                                $this->$method();
                        }
                }
-               
+
                if( $this->doing( 'cleanup' ) ) {
                        $this->upgradeCleanup();
                }
        }
-       
-       
+
+
        /**
         * Open a connection to the master server with the admin rights.
         * @return Database
@@ -67,7 +67,7 @@ class FiveUpgrade {
                $db =& new Database( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
                return $db;
        }
-       
+
        /**
         * Open a second connection to the master server, with buffering off.
         * This will let us stream large datasets in and write in chunks on the
@@ -83,7 +83,7 @@ class FiveUpgrade {
                $db->query( "SET net_write_timeout=$timeout" );
                return $db;
        }
-       
+
        /**
         * Prepare a conversion array for converting Windows Code Page 1252 to
         * UTF-8. This should provide proper conversion of text that was miscoded
@@ -137,7 +137,7 @@ class FiveUpgrade {
                }
                return $pairs;
        }
-       
+
        /**
         * Convert from 8-bit Windows-1252 to UTF-8 if necessary.
         * @param string $text
@@ -152,7 +152,7 @@ class FiveUpgrade {
                                ? strtr( $text, $this->conversionTables )
                                : $text );
        }
-       
+
        /**
         * Dump timestamp and message to output
         * @param string $message
@@ -163,7 +163,7 @@ class FiveUpgrade {
                echo $wgDBname . ' ' . wfTimestamp( TS_DB ) . ': ' . $message . "\n";
                flush();
        }
-       
+
        /**
         * Initialize the chunked-insert system.
         * Rows will be inserted in chunks of the given number, rather
@@ -188,7 +188,7 @@ class FiveUpgrade {
                $this->chunkTable = $table;
                $this->chunkFunction = $fname;
        }
-       
+
        /**
         * Chunked inserts: perform an insert if we've reached the chunk limit.
         * Prints a progress report with estimated completion time.
@@ -202,22 +202,22 @@ class FiveUpgrade {
        function addChunk( &$chunk, $key = null ) {
                if( count( $chunk ) >= $this->chunkSize ) {
                        $this->insertChunk( $chunk );
-               
+
                        $this->chunkCount += count( $chunk );
                        $now = wfTime();
                        $delta = $now - $this->chunkStartTime;
                        $rate = $this->chunkCount / $delta;
-                       
+
                        if( is_null( $key ) ) {
                                $completed = $this->chunkCount;
                        } else {
                                $completed = $key;
                        }
                        $portion = $completed / $this->chunkFinal;
-                       
+
                        $estimatedTotalTime = $delta / $portion;
                        $eta = $this->chunkStartTime + $estimatedTotalTime;
-                       
+
                        printf( "%s: %6.2f%% done on %s; ETA %s [%d/%d] %.2f/sec\n",
                                wfTimestamp( TS_DB, intval( $now ) ),
                                $portion * 100.0,
@@ -227,11 +227,11 @@ class FiveUpgrade {
                                $this->chunkFinal,
                                $rate );
                        flush();
-                       
+
                        $chunk = array();
                }
        }
-       
+
        /**
         * Chunked inserts: perform an insert unconditionally, at the end, and log.
         * @param array &$chunk -- This will be emptied if an insert is done.
@@ -244,7 +244,7 @@ class FiveUpgrade {
                }
                $this->log( "100.00% done on $this->chunkTable (last chunk $n rows)." );
        }
-       
+
        /**
         * Chunked inserts: perform an insert.
         * @param array &$chunk -- This will be emptied if an insert is done.
@@ -255,8 +255,8 @@ class FiveUpgrade {
                wfWaitForSlaves( $this->maxLag );
                $this->dbw->insert( $this->chunkTable, $chunk, $this->chunkFunction, $this->chunkOptions );
        }
-       
-       
+
+
        /**
         * Copy and transcode a table to table_temp.
         * @param string $name Base name of the source table
@@ -272,21 +272,21 @@ class FiveUpgrade {
         */
        function copyTable( $name, $tabledef, $fields, $callback = null ) {
                $fname = 'FiveUpgrade::copyTable';
-               
+
                $name_temp = $name . '_temp';
                $this->log( "Migrating $name table to $name_temp..." );
 
                $table      = $this->dbw->tableName( $name );
                $table_temp = $this->dbw->tableName( $name_temp );
-               
+
                // Create temporary table; we're going to copy everything in there,
                // then at the end rename the final tables into place.
                $def = str_replace( '$1', $table_temp, $tabledef );
                $this->dbw->query( $def, $fname );
-               
+
                $numRecords = $this->dbw->selectField( $name, 'COUNT(*)', '', $fname );
                $this->setChunkScale( 100, $numRecords, $name_temp, $fname );
-               
+
                // Pull all records from the second, streaming database connection.
                $sourceFields = array_keys( array_filter( $fields,
                        create_function( '$x', 'return $x !== MW_UPGRADE_NULL;' ) ) );
@@ -294,7 +294,7 @@ class FiveUpgrade {
                        $sourceFields,
                        '',
                        $fname );
-               
+
                $add = array();
                while( $row = $this->dbr->fetchObject( $result ) ) {
                        $copy = array();
@@ -317,25 +317,25 @@ class FiveUpgrade {
                }
                $this->lastChunk( $add );
                $this->dbr->freeResult( $result );
-               
+
                $this->log( "Done converting $name." );
                $this->cleanupSwaps[] = $name;
        }
-       
+
        function upgradePage() {
                $fname = "FiveUpgrade::upgradePage";
                $chunksize = 100;
-               
+
                if( $this->dbw->tableExists( 'page' ) ) {
                        $this->log( 'Page table already exists; aborting.' );
                        die( -1 );
                }
-               
+
                $this->log( "Checking cur table for unique title index and applying if necessary" );
                checkDupes( true );
 
                $this->log( "...converting from cur/old to page/revision/text DB structure." );
-               
+
                extract( $this->dbw->tableNames( 'cur', 'old', 'page', 'revision', 'text' ) );
 
                $this->log( "Creating page and revision tables..." );
@@ -396,7 +396,7 @@ class FiveUpgrade {
 
                $maxcur = $this->dbw->selectField( 'cur', 'max(cur_id)', '', $fname );
                $this->log( "Last cur entry is $maxcur" );
-               
+
                /**
                 * Copy placeholder records for each page's current version into old
                 * Don't do any conversion here; text records are converted at runtime
@@ -425,7 +425,7 @@ class FiveUpgrade {
                }
                $this->lastChunk( $add );
                $this->dbr->freeResult( $result );
-               
+
                /**
                 * Copy revision metadata from old into revision.
                 * We'll also do UTF-8 conversion of usernames and comments.
@@ -435,7 +435,7 @@ class FiveUpgrade {
                #$countold = $this->dbw->selectField( 'old', 'count(old_id)', '', $fname );
                $countold = $this->dbw->selectField( 'old', 'max(old_id)', '', $fname );
                $this->setChunkScale( $chunksize, $countold, 'revision', $fname );
-               
+
                $this->log( "......Setting up revision table." );
                $result = $this->dbr->query(
                        "SELECT old_id, cur_id, old_comment, old_user, old_user_text,
@@ -458,7 +458,7 @@ class FiveUpgrade {
                }
                $this->lastChunk( $add );
                $this->dbr->freeResult( $result );
-               
+
 
                /**
                 * Copy page metadata from cur into page.
@@ -491,15 +491,15 @@ class FiveUpgrade {
                }
                $this->lastChunk( $add );
                $this->dbr->freeResult( $result );
-               
+
                $this->log( "...done with cur/old -> page/revision." );
        }
-       
+
        function upgradeLinks() {
                $fname = 'FiveUpgrade::upgradeLinks';
                $chunksize = 200;
                extract( $this->dbw->tableNames( 'links', 'brokenlinks', 'pagelinks', 'cur' ) );
-               
+
                $this->log( 'Checking for interwiki table change in case of bogus items...' );
                if( $this->dbw->fieldExists( 'interwiki', 'iw_trans' ) ) {
                        $this->log( 'interwiki has iw_trans.' );
@@ -508,7 +508,7 @@ class FiveUpgrade {
                        dbsource( 'maintenance/archives/patch-interwiki-trans.sql', $this->dbw );
                        $this->log( 'added iw_trans.' );
                }
-               
+
                $this->log( 'Creating pagelinks table...' );
                $this->dbw->query( "
 CREATE TABLE $pagelinks (
@@ -547,7 +547,7 @@ CREATE TABLE $pagelinks (
                } else {
                        $this->log( 'no links!' );
                }
-               
+
                $this->log( 'Importing brokenlinks -> pagelinks' );
                $nbrokenlinks = $this->dbw->selectField( 'brokenlinks', 'count(*)', '', $fname );
                if( $nbrokenlinks ) {
@@ -573,10 +573,10 @@ CREATE TABLE $pagelinks (
                } else {
                        $this->log( 'no brokenlinks!' );
                }
-               
+
                $this->log( 'Done with links.' );
        }
-       
+
        function upgradeUser() {
                // Apply unique index, if necessary:
                $duper = new UserDupes( $this->dbw );
@@ -588,7 +588,7 @@ CREATE TABLE $pagelinks (
                                $this->log( "WARNING: Duplicate user accounts, may explode!" );
                        }
                }
-               
+
                $tabledef = <<<END
 CREATE TABLE $1 (
   user_id int(5) unsigned NOT NULL auto_increment,
@@ -626,14 +626,14 @@ END;
                $this->copyTable( 'user', $tabledef, $fields,
                        array( &$this, 'userCallback' ) );
        }
-       
+
        function userCallback( $row, $copy ) {
                $now = $this->dbw->timestamp();
                $copy['user_touched'] = $now;
                $copy['user_email_authenticated'] = $this->emailAuth ? $now : null;
                return $copy;
        }
-       
+
        function upgradeImage() {
                $tabledef = <<<END
 CREATE TABLE $1 (
@@ -673,13 +673,13 @@ END;
                $this->copyTable( 'image', $tabledef, $fields,
                        array( &$this, 'imageCallback' ) );
        }
-       
+
        function imageCallback( $row, $copy ) {
                global $options;
                if( !isset( $options['noimage'] ) ) {
                        // Fill in the new image info fields
                        $info = $this->imageInfo( $row->img_name );
-                       
+
                        $copy['img_width'     ] = $info['width'];
                        $copy['img_height'    ] = $info['height'];
                        $copy['img_metadata'  ] = ""; // loaded on-demand
@@ -688,13 +688,13 @@ END;
                        $copy['img_major_mime'] = $info['major'];
                        $copy['img_minor_mime'] = $info['minor'];
                }
-               
+
                // If doing UTF8 conversion the file must be renamed
                $this->renameFile( $row->img_name, 'wfImageDir' );
-               
+
                return $copy;
        }
-       
+
        function imageInfo( $name, $subdirCallback='wfImageDir', $basename = null ) {
                if( is_null( $basename ) ) $basename = $name;
                $dir = call_user_func( $subdirCallback, $basename );
@@ -706,13 +706,13 @@ END;
                        'media'  => '',
                        'major'  => '',
                        'minor'  => '' );
-               
+
                $magic =& wfGetMimeMagic();
                $mime = $magic->guessMimeType( $filename, true );
                list( $info['major'], $info['minor'] ) = explode( '/', $mime );
-               
+
                $info['media'] = $magic->getMediaType( $filename, $mime );
-               
+
                # Height and width
                $gis = false;
                if( $mime == 'image/svg' ) {
@@ -729,10 +729,10 @@ END;
                if( isset( $gis['bits'] ) ) {
                        $info['bits'] = $gis['bits'];
                }
-               
+
                return $info;
        }
-       
+
 
        /**
         * Truncate a table.
@@ -743,7 +743,7 @@ END;
                $tableName = $this->db->tableName( $table );
                $this->db->query( 'TRUNCATE $tableName' );
        }
-       
+
        /**
         * Rename a given image or archived image file to the converted filename,
         * leaving a symlink for URL compatibility.
@@ -758,12 +758,12 @@ END;
                        // No need to rename; another field triggered this row.
                        return false;
                }
-               
+
                if( is_null( $basename ) ) $basename = $oldname;
                $ubasename = $this->conv( $basename );
                $oldpath = call_user_func( $subdirCallback, $basename ) . '/' . $oldname;
                $newpath = call_user_func( $subdirCallback, $ubasename ) . '/' . $newname;
-               
+
                $this->log( "$oldpath -> $newpath" );
                if( rename( $oldpath, $newpath ) ) {
                        $relpath = $this->relativize( $newpath, dirname( $oldpath ) );
@@ -776,7 +776,7 @@ END;
                        return false;
                }
        }
-       
+
        /**
         * Generate a relative path name to the given file.
         * Assumes Unix-style paths, separators, and semantics.
@@ -790,25 +790,25 @@ END;
        function relativize( $path, $from ) {
                $pieces  = explode( '/', dirname( $path ) );
                $against = explode( '/', $from );
-               
+
                // Trim off common prefix
                while( count( $pieces ) && count( $against )
                        && $pieces[0] == $against[0] ) {
                        array_shift( $pieces );
                        array_shift( $against );
                }
-               
+
                // relative dots to bump us to the parent
                while( count( $against ) ) {
                        array_unshift( $pieces, '..' );
                        array_shift( $against );
                }
-               
+
                array_push( $pieces, basename( $path ) );
-               
+
                return implode( '/', $pieces );
        }
-       
+
        function upgradeOldImage() {
                $tabledef = <<<END
 CREATE TABLE $1 (
@@ -847,7 +847,7 @@ END;
                $this->copyTable( 'oldimage', $tabledef, $fields,
                        array( &$this, 'oldimageCallback' ) );
        }
-       
+
        function oldimageCallback( $row, $copy ) {
                global $options;
                if( !isset( $options['noimage'] ) ) {
@@ -857,20 +857,20 @@ END;
                        $copy['oi_height'] = $info['height'];
                        $copy['oi_bits'  ] = $info['bits'  ];
                }
-               
+
                // If doing UTF8 conversion the file must be renamed
                $this->renameFile( $row->oi_archive_name, 'wfImageArchiveDir', $row->oi_name );
-               
+
                return $copy;
        }
-       
+
 
        function upgradeWatchlist() {
                $fname = 'FiveUpgrade::upgradeWatchlist';
                $chunksize = 100;
-               
+
                extract( $this->dbw->tableNames( 'watchlist', 'watchlist_temp' ) );
-               
+
                $this->log( 'Migrating watchlist table to watchlist_temp...' );
                $this->dbw->query(
 "CREATE TABLE $watchlist_temp (
@@ -896,7 +896,7 @@ END;
                // Fix encoding for Latin-1 upgrades, add some fields,
                // and double article to article+talk pairs
                $numwatched = $this->dbw->selectField( 'watchlist', 'count(*)', '', $fname );
-               
+
                $this->setChunkScale( $chunksize, $numwatched * 2, 'watchlist_temp', $fname );
                $result = $this->dbr->select( 'watchlist',
                        array(
@@ -905,7 +905,7 @@ END;
                                'wl_title' ),
                        '',
                        $fname );
-               
+
                $add = array();
                while( $row = $this->dbr->fetchObject( $result ) ) {
                        $now = $this->dbw->timestamp();
@@ -915,7 +915,7 @@ END;
                                'wl_title'     =>           $this->conv( $row->wl_title ),
                                'wl_notificationtimestamp' =>            '0' );
                        $this->addChunk( $add );
-                       
+
                        $add[] = array(
                                'wl_user'      =>                        $row->wl_user,
                                'wl_namespace' =>    Namespace::getTalk( $row->wl_namespace ),
@@ -925,7 +925,7 @@ END;
                }
                $this->lastChunk( $add );
                $this->dbr->freeResult( $result );
-               
+
                $this->log( 'Done converting watchlist.' );
                $this->cleanupSwaps[] = 'watchlist';
        }
@@ -1010,7 +1010,7 @@ END;
                        'ar_text_id'    => MW_UPGRADE_NULL );
                $this->copyTable( 'archive', $tabledef, $fields );
        }
-       
+
        function upgradeImagelinks() {
                global $wgUseLatin1;
                if( $wgUseLatin1 ) {
@@ -1059,7 +1059,7 @@ END;
                        $this->copyTable( 'categorylinks', $tabledef, $fields );
                }
        }
-       
+
        function upgradeIpblocks() {
                global $wgUseLatin1;
                if( $wgUseLatin1 ) {
@@ -1092,7 +1092,7 @@ END;
                        $this->copyTable( 'ipblocks', $tabledef, $fields );
                }
        }
-       
+
        function upgradeRecentchanges() {
                // There's a format change in the namespace field
                $tabledef = <<<END
@@ -1156,7 +1156,7 @@ END;
                        'rc_ip'             => MW_UPGRADE_COPY );
                $this->copyTable( 'recentchanges', $tabledef, $fields );
        }
-       
+
        function upgradeQuerycache() {
                // There's a format change in the namespace field
                $tabledef = <<<END
@@ -1182,7 +1182,7 @@ END;
                        'qc_title'     => MW_UPGRADE_ENCODE );
                $this->copyTable( 'querycache', $tabledef, $fields );
        }
-       
+
        /**
         * Rename all our temporary tables into final place.
         * We've left things in place so a read-only wiki can continue running
@@ -1190,12 +1190,12 @@ END;
         */
        function upgradeCleanup() {
                $this->renameTable( 'old', 'text' );
-               
+
                foreach( $this->cleanupSwaps as $table ) {
                        $this->swap( $table );
                }
        }
-       
+
        function renameTable( $from, $to ) {
                $this->log( "Renaming $from to $to..." );
 
@@ -1203,12 +1203,12 @@ END;
                $totable   = $this->dbw->tableName( $to );
                $this->dbw->query( "ALTER TABLE $fromtable RENAME TO $totable" );
        }
-       
+
        function swap( $base ) {
                $this->renameTable( $base, "{$base}_old" );
                $this->renameTable( "{$base}_temp", $base );
        }
-       
+
 }
 
 ?>
\ No newline at end of file
index ee33180..e75e350 100755 (executable)
@@ -28,7 +28,7 @@ function initialiseMessages( $overwrite = false, $messageArray = false ) {
        } else {
                $sortedArray = $wgAllMessagesEn;
        }
-       
+
        ksort( $sortedArray );
        $messages=array();
 
@@ -84,7 +84,7 @@ function initialiseMessagesReal( $overwrite = false, $messageArray = false ) {
        $wgUser = new User;
        $wgUser->setLoaded( true ); # Don't load from DB
        $wgUser->setName( 'MediaWiki default' );
-       
+
        # Don't try to draw messages from the database we're initialising
        $wgMessageCache->disable();
        $wgMessageCache->disableTransform();
@@ -96,10 +96,10 @@ function initialiseMessagesReal( $overwrite = false, $messageArray = false ) {
        # default messages won't be overwritte
        $username = 'MediaWiki default';
 
-       
+
        print "Initialising \"MediaWiki\" namespace...\n";
 
-       
+
        $dbr =& wfGetDB( DB_SLAVE );
        $dbw =& wfGetDB( DB_MASTER );
        $page = $dbr->tableName( 'page' );
@@ -115,7 +115,7 @@ function initialiseMessagesReal( $overwrite = false, $messageArray = false ) {
        } else {
                $sortedArray = $wgAllMessagesEn;
        }
-       
+
        ksort( $sortedArray );
 
        # SELECT all existing messages
@@ -153,7 +153,7 @@ function initialiseMessagesReal( $overwrite = false, $messageArray = false ) {
                while ($row = $dbr->fetchObject($res))
                        $rows[] = $row;
        }
-       
+
        # Read the results into an array
        # Decide whether or not each one needs to be overwritten
        $existingTitles = array();
@@ -170,7 +170,7 @@ function initialiseMessagesReal( $overwrite = false, $messageArray = false ) {
        $arr = array();
        $talk = $wgContLang->getNsText( NS_TALK );
        $mwtalk = $wgContLang->getNsText( NS_MEDIAWIKI_TALK );
-       
+
        # Merge these into a single transaction for speed
        $dbw->begin();
 
index b0019f5..060ff6c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-$wgNoDBParam = true;   
-       
+$wgNoDBParam = true;
+
 require_once( "commandLine.inc" );
 require_once( "rebuildInterwiki.inc" );
 require_once( "languages/Names.php" );
@@ -28,7 +28,7 @@ function addWiki( $lang, $site, $dbName )
        $dbw->query( "SET table_type=Innodb" );
        $dbw->query( "CREATE DATABASE $dbName" );
        $dbw->selectDB( $dbName );
-       
+
        print "Initialising tables\n";
        dbsource( "$maintenance/tables.sql", $dbw );
        dbsource( "$IP/extensions/OAI/update_table.sql", $dbw );
@@ -159,14 +159,14 @@ See the [http://www.wikipedia.org Wikipedia portal] for other language Wikipedia
 [[zh:]]
 [[zu:]]
 ", '', false, false );
-       
+
        print "Adding to dblists\n";
 
        # Add to dblist
        $file = fopen( "$common/all.dblist", "a" );
        fwrite( $file, "$dbName\n" );
        fclose( $file );
-       
+
        # Update the sublists
        system("cd $common && ./refresh-dblist");
 
index 65394ef..0b5ccfa 100644 (file)
@@ -50,7 +50,7 @@ while( $row = $dbw->fetchObject( $result ) ) {
                echo "$wgDBname $pageId [[$name]] can't find latest rev time?!\n";
                continue;
        }
-       
+
        $revision = Revision::loadFromTimestamp( $dbw, $title, $latestTime );
        if( is_null( $revision ) ) {
                echo "$wgDBname $pageId [[$name]] latest time $latestTime, can't find revision id\n";
index ee213e2..3326180 100644 (file)
@@ -69,7 +69,7 @@ if ( $row ) {
 */
        fwrite( $logfile, "**Revision IDs: " );
        fwrite( $sqlfile, "UPDATE $revision SET rev_user=$uid, rev_user_text='$eDest' WHERE rev_id IN (\n" );
-       
+
        for ( $first=true; $row; $row = $dbr->fetchObject( $res ) ) {
                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
                $fullTitle = $title->getPrefixedDbKey();
@@ -79,7 +79,7 @@ if ( $row ) {
 
                print "$fullTitle\n";
                $url = $title->getFullUrl( "oldid={$row->rev_id}" );
-               
+
                # Output
                fwrite( $sqlfile, "      " );
                if ( $first ) {
index d67b5d8..a8705da 100644 (file)
@@ -36,23 +36,23 @@ class BackupDumper {
        var $endId      = 0;
        var $sink       = null; // Output filters
        var $stubText   = false; // include rev_text_id instead of text; for 2-pass dump
-       
+
        function BackupDumper( $args ) {
                $this->stderr = fopen( "php://stderr", "wt" );
-               
+
                // Built-in output and filter plugins
                $this->registerOutput( 'file', 'DumpFileOutput' );
                $this->registerOutput( 'gzip', 'DumpGZipOutput' );
                $this->registerOutput( 'bzip2', 'DumpBZip2Output' );
                $this->registerOutput( '7zip', 'Dump7ZipOutput' );
-               
+
                $this->registerFilter( 'latest', 'DumpLatestFilter' );
                $this->registerFilter( 'notalk', 'DumpNotalkFilter' );
                $this->registerFilter( 'namespace', 'DumpNamespaceFilter' );
-               
+
                $this->sink = $this->processArgs( $args );
        }
-       
+
        /**
         * @param string $name
         * @param string $class name of output filter plugin class
@@ -60,7 +60,7 @@ class BackupDumper {
        function registerOutput( $name, $class ) {
                $this->outputTypes[$name] = $class;
        }
-       
+
        /**
         * @param string $name
         * @param string $class name of filter plugin class
@@ -68,7 +68,7 @@ class BackupDumper {
        function registerFilter( $name, $class ) {
                $this->filterTypes[$name] = $class;
        }
-       
+
        /**
         * Load a plugin and register it
         * @param string $class Name of plugin class; must have a static 'register'
@@ -82,7 +82,7 @@ class BackupDumper {
                $register = array( $class, 'register' );
                call_user_func_array( $register, array( &$this ) );
        }
-       
+
        /**
         * @param array $args
         * @return array
@@ -118,54 +118,54 @@ class BackupDumper {
                                        }
                                        $type = $this->filterTypes[$val];
                                        $filter = new $type( $sink, $param );
-                                       
+
                                        // references are lame in php...
                                        unset( $sink );
                                        $sink = $filter;
-                                       
+
                                        break;
                                default:
                                        $this->processOption( $opt, $val, $param );
                                }
                        }
                }
-               
+
                if( is_null( $sink ) ) {
                        $sink = new DumpOutput();
                }
                $sinks[] = $sink;
-               
+
                if( count( $sinks ) > 1 ) {
                        return new DumpMultiWriter( $sinks );
                } else {
                        return $sink;
                }
        }
-       
+
        function processOption( $opt, $val, $param ) {
                // extension point for subclasses to add options
        }
-       
+
        function dump( $history, $text = MW_EXPORT_TEXT ) {
                # This shouldn't happen if on console... ;)
                header( 'Content-type: text/html; charset=UTF-8' );
-               
+
                # Notice messages will foul up your XML output even if they're
                # relatively harmless.
                ini_set( 'display_errors', false );
-               
+
                $this->startTime = wfTime();
-               
+
                $dbr =& wfGetDB( DB_SLAVE );
                $this->maxCount = $dbr->selectField( 'page', 'MAX(page_id)', '', 'BackupDumper::dump' );
                $this->startTime = wfTime();
-               
+
                $db =& $this->backupDb();
                $exporter = new WikiExporter( $db, $history, MW_EXPORT_STREAM, $text );
-               
+
                $wrapper = new ExportProgressFilter( $this->sink, $this );
                $exporter->setOutputSink( $wrapper );
-               
+
                if( !$this->skipHeader )
                        $exporter->openStream();
 
@@ -181,10 +181,10 @@ class BackupDumper {
 
                if( !$this->skipFooter )
                        $exporter->closeStream();
-               
+
                $this->report( true );
        }
-       
+
        function &backupDb() {
                global $wgDBadminuser, $wgDBadminpassword;
                global $wgDBname;
@@ -194,7 +194,7 @@ class BackupDumper {
                $db->query( "SET net_write_timeout=$timeout" );
                return $db;
        }
-       
+
        function backupServer() {
                global $wgDBserver;
                return $this->server
@@ -206,17 +206,17 @@ class BackupDumper {
                $this->pageCount++;
                $this->report();
        }
-       
+
        function revCount() {
                $this->revCount++;
        }
-       
+
        function report( $final = false ) {
                if( $final xor ( $this->pageCount % $this->reportingInterval == 0 ) ) {
                        $this->showReport();
                }
        }
-       
+
        function showReport() {
                if( $this->reporting ) {
                        $delta = wfTime() - $this->startTime;
@@ -236,7 +236,7 @@ class BackupDumper {
                        $this->progress( "$now: $wgDBname $this->pageCount, ETA $etats ($rate pages/sec $revrate revs/sec)" );
                }
        }
-       
+
        function progress( $string ) {
                fwrite( $this->stderr, $string . "\n" );
        }
@@ -252,7 +252,7 @@ class ExportProgressFilter extends DumpFilter {
                parent::writeClosePage( $string );
                $this->progress->reportPage();
        }
-       
+
        function writeRevision( $rev, $string ) {
                parent::writeRevision( $rev, $string );
                $this->progress->revCount();
index f40bc89..f5645c1 100644 (file)
@@ -21,12 +21,12 @@ class BaseDump {
        var $atPageEnd = false;
        var $lastPage = 0;
        var $lastRev = 0;
-       
+
        function BaseDump( $infile ) {
                $this->reader = new XMLReader();
                $this->reader->open( $infile );
        }
-       
+
        /**
         * Attempts to fetch the text of a particular page revision
         * from the dump stream. May return null if the page is
@@ -59,13 +59,13 @@ class BaseDump {
                        return null;
                }
        }
-       
+
        function debug( $str ) {
                wfDebug( $str . "\n" );
                //global $dumper;
                //$dumper->progress( $str );
        }
-       
+
        /**
         * @access private
         */
@@ -80,7 +80,7 @@ class BaseDump {
                        $this->atEnd = true;
                }
        }
-       
+
        /**
         * @access private
         */
@@ -93,7 +93,7 @@ class BaseDump {
                        $this->atPageEnd = true;
                }
        }
-       
+
        /**
         * @access private
         */
@@ -101,7 +101,7 @@ class BaseDump {
                $this->skipTo( 'text' );
                return strval( $this->nodeContents() );
        }
-       
+
        /**
         * @access private
         */
@@ -122,7 +122,7 @@ class BaseDump {
                }
                return $this->close();
        }
-       
+
        /**
         * Shouldn't something like this be built-in to XMLReader?
         * Fetches text contents of the current element, assuming
@@ -151,7 +151,7 @@ class BaseDump {
                }
                return $this->close();
        }
-       
+
        /**
         * @access private
         */
index 526feb7..9bb0bab 100644 (file)
 class ChangePassword {
        var $dbw;
        var $user, $password;
-       
+
        function ChangePassword( $user, $password ) {
                $this->user = User::newFromName( $user );
                $this->password = $password;
-               
+
                $this->dbw =& wfGetDB( DB_MASTER );
        }
 
        function main() {
                $fname = 'ChangePassword::main';
-               
+
                $this->dbw->update( 'user',
                        array(
                                'user_password' => wfEncryptPassword( $this->user->getID(), $this->password )
index e8790da..a3d9dbb 100644 (file)
@@ -12,9 +12,9 @@ class checkUsernames {
        function main() {
                global $wgDBname;
                $fname = 'checkUsernames::main';
-               
+
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                $res = $dbr->select( 'user',
                        array( 'user_id', 'user_name' ),
                        null,
index fbfabf5..f128357 100644 (file)
@@ -37,23 +37,23 @@ require_once( 'FiveUpgrade.inc' );
 class CapsCleanup extends FiveUpgrade {
        function CapsCleanup( $dryrun = false, $namespace=0 ) {
                parent::FiveUpgrade();
-               
+
                $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
                $this->dryrun = $dryrun;
                $this->namespace = intval( $namespace );
        }
-       
+
        function cleanup() {
                global $wgCapitalLinks;
                if( $wgCapitalLinks ) {
                        echo "\$wgCapitalLinks is on -- no need for caps links cleanup.\n";
                        return false;
                }
-               
+
                $this->runTable( 'page', 'WHERE page_namespace=' . $this->namespace,
                        array( &$this, 'processPage' ) );
        }
-       
+
        function init( $count, $table ) {
                $this->processed = 0;
                $this->updated = 0;
@@ -61,7 +61,7 @@ class CapsCleanup extends FiveUpgrade {
                $this->startTime = wfTime();
                $this->table = $table;
        }
-       
+
        function progress( $updated ) {
                $this->updated += $updated;
                $this->processed++;
@@ -70,12 +70,12 @@ class CapsCleanup extends FiveUpgrade {
                }
                $portion = $this->processed / $this->count;
                $updateRate = $this->updated / $this->processed;
-               
+
                $now = wfTime();
                $delta = $now - $this->startTime;
                $estimatedTotalTime = $delta / $portion;
                $eta = $this->startTime + $estimatedTotalTime;
-               
+
                printf( "%s: %6.2f%% done on %s; ETA %s [%d/%d] %.2f/sec <%.2f%% updated>\n",
                        wfTimestamp( TS_DB, intval( $now ) ),
                        $portion * 100.0,
@@ -87,28 +87,28 @@ class CapsCleanup extends FiveUpgrade {
                        $updateRate * 100.0 );
                flush();
        }
-       
+
        function runTable( $table, $where, $callback ) {
                $fname = 'CapsCleanup::buildTable';
-               
+
                $count = $this->dbw->selectField( $table, 'count(*)', '', $fname );
                $this->init( $count, 'page' );
                $this->log( "Processing $table..." );
-               
+
                $tableName = $this->dbr->tableName( $table );
                $sql = "SELECT * FROM $tableName $where";
                $result = $this->dbr->query( $sql, $fname );
-               
+
                while( $row = $this->dbr->fetchObject( $result ) ) {
                        $updated = call_user_func( $callback, $row );
                }
                $this->log( "Finished $table... $this->updated of $this->processed rows updated" );
                $this->dbr->freeResult( $result );
        }
-       
+
        function processPage( $row ) {
                global $wgContLang;
-               
+
                $current = Title::makeTitle( $row->page_namespace, $row->page_title );
                $display = $current->getPrefixedText();
                $upper = $row->page_title;
@@ -117,14 +117,14 @@ class CapsCleanup extends FiveUpgrade {
                        $this->log( "\"$display\" already lowercase." );
                        return $this->progress( 0 );
                }
-               
+
                $target = Title::makeTitle( $row->page_namespace, $lower );
                $targetDisplay = $target->getPrefixedText();
                if( $target->exists() ) {
                        $this->log( "\"$display\" skipped; \"$targetDisplay\" already exists" );
                        return $this->progress( 0 );
                }
-               
+
                if( $this->dryrun ) {
                        $this->log( "\"$display\" -> \"$targetDisplay\": DRY RUN, NOT MOVED" );
                        $ok = true;
@@ -134,7 +134,7 @@ class CapsCleanup extends FiveUpgrade {
                }
                if( $ok === true ) {
                        $this->progress( 1 );
-                       
+
                        if( $row->page_namespace == $this->namespace ) {
                                $talk = $target->getTalkPage();
                                $xrow = $row;
index 33c5448..237a8a9 100644 (file)
@@ -49,12 +49,12 @@ END
                while( $row = $dbw->fetchObject( $res ) ) {
                        $ns = intval( $row->cur_namespace );
                        $title = $dbw->addQuotes( $row->cur_title );
-                       
+
                        # Get the first responding ID; that'll be the one we keep.
                        $id = $dbw->selectField( 'cur', 'cur_id', array(
                                'cur_namespace' => $row->cur_namespace,
                                'cur_title'     => $row->cur_title ) );
-                       
+
                        echo "$ns:$row->cur_title (canonical ID $id)\n";
                        if( $id != $row->id ) {
                                echo "  ** minimum ID $row->id; ";
@@ -74,7 +74,7 @@ END
                                        }
                                }
                        }
-                       
+
                        if( $fixthem ) {
                                $dbw->query( <<<END
 INSERT
index 6beb509..7c0d7dd 100644 (file)
@@ -37,17 +37,17 @@ require_once( 'FiveUpgrade.inc' );
 class TitleCleanup extends FiveUpgrade {
        function TitleCleanup( $dryrun = false ) {
                parent::FiveUpgrade();
-               
+
                $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
                $this->dryrun = $dryrun;
        }
-       
+
        function cleanup() {
                $this->runTable( 'page',
                        '', //'WHERE page_namespace=0',
                        array( &$this, 'processPage' ) );
        }
-       
+
        function init( $count, $table ) {
                $this->processed = 0;
                $this->updated = 0;
@@ -55,7 +55,7 @@ class TitleCleanup extends FiveUpgrade {
                $this->startTime = wfTime();
                $this->table = $table;
        }
-       
+
        function progress( $updated ) {
                $this->updated += $updated;
                $this->processed++;
@@ -64,12 +64,12 @@ class TitleCleanup extends FiveUpgrade {
                }
                $portion = $this->processed / $this->count;
                $updateRate = $this->updated / $this->processed;
-               
+
                $now = wfTime();
                $delta = $now - $this->startTime;
                $estimatedTotalTime = $delta / $portion;
                $eta = $this->startTime + $estimatedTotalTime;
-               
+
                global $wgDBname;
                printf( "%s %s: %6.2f%% done on %s; ETA %s [%d/%d] %.2f/sec <%.2f%% updated>\n",
                        $wgDBname,
@@ -83,50 +83,50 @@ class TitleCleanup extends FiveUpgrade {
                        $updateRate * 100.0 );
                flush();
        }
-       
+
        function runTable( $table, $where, $callback ) {
                $fname = 'CapsCleanup::buildTable';
-               
+
                $count = $this->dbw->selectField( $table, 'count(*)', '', $fname );
                $this->init( $count, 'page' );
                $this->log( "Processing $table..." );
-               
+
                $tableName = $this->dbr->tableName( $table );
                $sql = "SELECT * FROM $tableName $where";
                $result = $this->dbr->query( $sql, $fname );
-               
+
                while( $row = $this->dbr->fetchObject( $result ) ) {
                        $updated = call_user_func( $callback, $row );
                }
                $this->log( "Finished $table... $this->updated of $this->processed rows updated" );
                $this->dbr->freeResult( $result );
        }
-       
+
        function processPage( $row ) {
                global $wgContLang;
-               
+
                $current = Title::makeTitle( $row->page_namespace, $row->page_title );
                $display = $current->getPrefixedText();
-               
+
                $verified = UtfNormal::cleanUp( $display );
-               
+
                $title = Title::newFromText( $verified );
-               
+
                if( is_null( $title ) ) {
                        $this->log( "page $row->page_id ($display) is illegal." );
                        $this->moveIllegalPage( $row );
                        return $this->progress( 1 );
                }
-               
+
                if( !$title->equals( $current ) ) {
                        $this->log( "page $row->page_id ($display) doesn't match self." );
                        $this->moveInconsistentPage( $row, $title );
                        return $this->progress( 1 );
                }
-               
+
                $this->progress( 0 );
        }
-       
+
        function moveIllegalPage( $row ) {
                $legal = 'A-Za-z0-9_/\\\\-';
                $legalized = preg_replace_callback( "!([^$legal])!",
@@ -135,7 +135,7 @@ class TitleCleanup extends FiveUpgrade {
                if( $legalized == '.' ) $legalized = '(dot)';
                if( $legalized == '_' ) $legalized = '(space)';
                $legalized = 'Broken/' . $legalized;
-               
+
                $title = Title::newFromText( $legalized );
                if( is_null( $title ) ) {
                        $clean = 'Broken/id:' . $row->page_id;
@@ -146,7 +146,7 @@ class TitleCleanup extends FiveUpgrade {
                        $this->log( "Legalized for '$legalized' exists; using '$clean'" );
                        $title = Title::newFromText( $clean );
                }
-               
+
                $dest = $title->getDbKey();
                if( $this->dryrun ) {
                        $this->log( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')" );
@@ -159,7 +159,7 @@ class TitleCleanup extends FiveUpgrade {
                                'cleanupTitles::moveInconsistentPage' );
                }
        }
-       
+
        function moveInconsistentPage( $row, $title ) {
                if( $title->exists() || $title->getInterwiki() ) {
                        if( $title->getInterwiki() ) {
@@ -197,7 +197,7 @@ class TitleCleanup extends FiveUpgrade {
                        $linkCache->clear();
                }
        }
-       
+
        function hexChar( $matches ) {
                return sprintf( "\\x%02x", ord( $matches[1] ) );
        }
index 42cc918..62c7ae6 100644 (file)
@@ -100,7 +100,7 @@ if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
 
                # If not, work out the language and site the old way
                if ( is_null( $site ) || is_null( $lang ) ) {
-                       if ( !$db ) {   
+                       if ( !$db ) {
                                $lang = 'aa';
                        } else {
                                $lang = $db;
@@ -151,7 +151,7 @@ if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
        require_once( $IP.'/includes/Defines.php' );
        require_once( $settingsFile );
        ini_set( 'include_path', ".$sep$IP$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" );
-       
+
        if ( is_readable( $IP.'/AdminSettings.php' ) ) {
                require_once( $IP.'/AdminSettings.php' );
        }
index 88066e9..f0d2c43 100644 (file)
@@ -12,12 +12,12 @@ function convertLinks() {
                print "Links table already ok on PostgreSQL.\n";
                return;
        }
-       
+
        print "Converting links table to ID-ID...\n";
-       
+
        global $wgLang, $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
        global $noKeys, $logPerformance, $fh;
-       
+
        $numRows = $tuplesAdded = $numBadLinks = $curRowsRead = 0; #counters etc
        $totalTuplesInserted = 0; # total tuples INSERTed into links_temp
 
@@ -42,7 +42,7 @@ function convertLinks() {
        $logPerformance = false; # output performance data to a file
        $perfLogFilename = "convLinksPerf.txt";
        #--------------------------------------------------------------------
-       
+
        $dbw =& wfGetDB( DB_MASTER );
        extract( $dbw->tableNames( 'cur', 'links', 'links_temp', 'links_backup' ) );
 
@@ -51,7 +51,7 @@ function convertLinks() {
                print "Schema already converted\n";
                return;
        }
-       
+
        $res = $dbw->query( "SELECT COUNT(*) AS count FROM $links" );
        $row = $dbw->fetchObject($res);
        $numRows = $row->count;
@@ -67,7 +67,7 @@ function convertLinks() {
                print "Loading IDs from $cur table...\n";
                performanceLog ( "Reading $numRows rows from cur table...\n" );
                performanceLog ( "rows read vs seconds elapsed:\n" );
-               
+
                $dbw->bufferResults( false );
                $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" );
                $ids = array();
@@ -82,7 +82,7 @@ function convertLinks() {
                        if ($reportCurReadProgress) {
                                if (($curRowsRead % $curReadReportInterval) == 0) {
                                        performanceLog( $curRowsRead . " " . (getMicroTime() - $baseTime) . "\n" );
-                                       print "\t$curRowsRead rows of $cur table read.\n";      
+                                       print "\t$curRowsRead rows of $cur table read.\n";
                                }
                        }
                }
@@ -100,7 +100,7 @@ function convertLinks() {
                print "Processing $numRows rows from $links table...\n";
                performanceLog( "Processing $numRows rows from $links table...\n" );
                performanceLog( "rows inserted vs seconds elapsed:\n" );
-               
+
                for ($rowOffset = $initialRowOffset; $rowOffset < $numRows; $rowOffset += $linksConvInsertInterval) {
                        $sqlRead = "SELECT * FROM $links ";
                        $sqlRead = $dbw->limitResult($sqlRead, $linksConvInsertInterval,$rowOffset);
@@ -110,7 +110,7 @@ function convertLinks() {
                        } else {
                                $sqlWrite = array("INSERT IGNORE INTO $links_temp (l_from,l_to) VALUES ");
                        }
-                       
+
                        $tuplesAdded = 0; # no tuples added to INSERT yet
                        while ( $row = $dbw->fetchObject($res) ) {
                                $fromTitle = $row->l_from;
@@ -121,7 +121,7 @@ function convertLinks() {
                                                $sqlWrite[] = ",";
                                        }
                                        $sqlWrite[] = "($from,$to)";
-                                       $tuplesAdded++;                         
+                                       $tuplesAdded++;
                                } else { # invalid title
                                        $numBadLinks++;
                                }
@@ -156,12 +156,12 @@ function convertLinks() {
                print "Dropping backup links table if it exists...";
                $dbConn->query( "DROP TABLE IF EXISTS $links_backup", DB_MASTER);
                print " done.\n";
-               
+
                # Swap in the new table, and move old links table to links_backup
                print "Swapping tables '$links' to '$links_backup'; '$links_temp' to '$links'...";
                $dbConn->query( "RENAME TABLE links TO $links_backup, $links_temp TO $links", DB_MASTER );
                print " done.\n\n";
-               
+
                $dbConn->close();
                print "Conversion complete. The old table remains at $links_backup;\n";
                print "delete at your leisure.\n";
@@ -177,17 +177,17 @@ function createTempTable() {
        global $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname;
        global $noKeys;
        $dbConn = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
-       
+
        if (!($dbConn->isOpen())) {
                print "Opening connection to database failed.\n";
                return;
        }
        $links_temp = $dbConn->tableName( 'links_temp' );
-       
+
        print "Dropping temporary links table if it exists...";
        $dbConn->query( "DROP TABLE IF EXISTS $links_temp");
        print " done.\n";
-       
+
        print "Creating temporary links table...";
        if ( $noKeys ) {
                $dbConn->query( "CREATE TABLE $links_temp ( " .
index 69b63e3..c4bba45 100644 (file)
@@ -32,7 +32,7 @@ class UtfUpdater {
 
        /**
         * @param string $string A string to be converted to UTF-8
-        */     
+        */
        function toUtf8( $string ) {
                if( function_exists( 'iconv' ) ) {
                        # There are likely to be Windows code page 1252 chars in there.
@@ -53,7 +53,7 @@ class UtfUpdater {
                $tableName = $this->db->tableName( $table );
                $this->db->query( 'TRUNCATE $tableName' );
        }
-       
+
        /**
         * @param string $table Table to be converted
         * @param string $key Primary key, to identify fields in the UPDATE. If NULL, all fields will be used to match.
@@ -107,7 +107,7 @@ class UtfUpdater {
                                $keyCond,
                                $fname );
                        if( ++$n % 100 == 0 ) echo "$n\n";
-                       
+
                        if( is_callable( $callback ) ) {
                                call_user_func( $callback, $s );
                        }
@@ -115,7 +115,7 @@ class UtfUpdater {
                echo "$n done.\n";
                $this->db->freeResult( $res );
        }
-       
+
        /**
         * @param object $row
         * @access private
@@ -123,7 +123,7 @@ class UtfUpdater {
        function imageRenameCallback( $row ) {
                $this->renameFile( $row->img_name, 'wfImageDir' );
        }
-       
+
        /**
         * @param object $row
         * @access private
@@ -131,7 +131,7 @@ class UtfUpdater {
        function oldimageRenameCallback( $row ) {
                $this->renameFile( $row->oi_archive_name, 'wfImageArchiveDir' );
        }
-       
+
        /**
         * Rename a given image or archived image file to the converted filename,
         * leaving a symlink for URL compatibility.
@@ -146,10 +146,10 @@ class UtfUpdater {
                        // No need to rename; another field triggered this row.
                        return;
                }
-               
+
                $oldpath = call_user_func( $subdirCallback, $oldname ) . '/' . $oldname;
                $newpath = call_user_func( $subdirCallback, $newname ) . '/' . $newname;
-               
+
                echo "Renaming $oldpath to $newpath... ";
                if( rename( $oldpath, $newpath ) ) {
                        echo "ok\n";
@@ -163,7 +163,7 @@ class UtfUpdater {
                        echo " rename failed!\n";
                }
        }
-       
+
        /**
         * Lock tables.
         * @param array $tables An array of table to be locked.
@@ -180,14 +180,14 @@ class UtfUpdater {
 
        /**
         * @todo document
-        */     
+        */
        function updateAll() {
                $this->lockTables( array(
                        'objectcache', 'searchindex', 'querycache',
                        'ipblocks', 'user', 'page', 'revision', 'recentchanges',
                        'brokenlinks', 'categorylinks', 'imagelinks', 'watchlist',
                        'image', 'oldimage', 'archive' ) );
-               
+
                # These are safe to clear out:
                $this->clearTable( 'objectcache' );
 
@@ -204,15 +204,15 @@ class UtfUpdater {
                        array( 'page_title' ), 'page_touched' );
                $this->convertTable( 'revision', 'rev_id',
                        array( 'rev_user_text', 'rev_comment' ) );
-               
+
                $this->convertTable( 'recentchanges', 'rc_id',
                        array( 'rc_user_text', 'rc_title', 'rc_comment' ) );
-               
+
                $this->convertTable( 'pagelinks', 'pl_title' );
                $this->convertTable( 'categorylinks', 'cl_to' );
                $this->convertTable( 'imagelinks', 'il_to' );
                $this->convertTable( 'watchlist', 'wl_title' );
-               
+
                # We'll also need to change the files.
                $this->convertTable( 'image', 'img_name',
                        array( 'img_name', 'img_description', 'img_user_text' ),
@@ -222,14 +222,14 @@ class UtfUpdater {
                        array( 'oi_name', 'oi_archive_name', 'oi_description', 'oi_user_text' ),
                        null,
                        array( &$this, 'oldimageRenameCallback' ) );
-               
+
                # Don't change the ar_text entries; use $wgLegacyEncoding to read them at runtime
                $this->convertTable( 'archive', null,
                        array( 'ar_title', 'ar_comment', 'ar_user_text' ) );
                echo "Not converting text table: be sure to set \$wgLegacyEncoding!\n";
-               
+
                $this->db->query( 'UNLOCK TABLES' );
        }
-       
+
 }
 ?>
index a1c5be2..e8cac01 100644 (file)
@@ -12,15 +12,15 @@ class DeleteImageCache {
                $this->sleep = $sleep;
                $this->report = $report;
        }
-       
+
        function main() {
                global $wgMemc, $wgDBname;
                $fname = 'DeleteImageCache::main';
 
                ini_set( 'display_errors', false );
-               
+
                $dbr =& wfGetDB( DB_SLAVE );
-               
+
                $res = $dbr->select( 'image',
                        array( 'img_name' ),
                        array( "img_timestamp < {$this->until}" ),
@@ -35,14 +35,14 @@ class DeleteImageCache {
                                printf("%s: %13s done (%s)\n", $wgDBname, "$i/$total", wfPercent( $i / $total * 100 ));
                        $md5 = md5( $row->img_name );
                        $wgMemc->delete( "$wgDBname:Image:$md5" );
-                       
+
                        if ($this->sleep != 0)
                                usleep( $this->sleep );
 
                        ++$i;
                }
        }
-       
+
        function getImageCount() {
                $fname = 'DeleteImageCache::getImageCount';
 
index b034f51..2bc35d4 100644 (file)
@@ -121,7 +121,7 @@ if ( isset($args[0]) ) {
 
        // Load datas from MediaWiki
        $testMessages = getMediawikiMessages($lang);
-       $testLanguage = $lang;          
+       $testLanguage = $lang;
 } else {
        usage();
        die();
index 13a8a66..d81d7c1 100644 (file)
@@ -16,13 +16,13 @@ class DumpHTML {
 
        # Show interlanguage links?
        var $interwiki = true;
-       
+
        # Depth of HTML directory tree
        var $depth = 3;
 
        # Directory that commons images are copied into
        var $sharedStaticPath;
-       
+
        # Relative path to image directory
        var $imageRel = 'upload';
 
@@ -41,7 +41,7 @@ class DumpHTML {
 
        # List of raw pages used in the current article
        var $rawPages;
-       
+
        function DumpHTML( $settings ) {
                foreach ( $settings as $var => $value ) {
                        $this->$var = $value;
@@ -54,9 +54,9 @@ class DumpHTML {
         */
        function doArticles( $start, $end = false ) {
                $fname = 'DumpHTML::doArticles';
-               
+
                $this->setupGlobals();
-               
+
                if ( $end === false ) {
                        $dbr =& wfGetDB( DB_SLAVE );
                        $end = $dbr->selectField( 'page', 'max(page_id)', false, $fname );
@@ -65,7 +65,7 @@ class DumpHTML {
                $mainPageObj = Title::newMainPage();
                $mainPage = $mainPageObj->getPrefixedDBkey();
 
-               
+
                for ($id = $start; $id <= $end; $id++) {
                        wfWaitForSlaves( 20 );
                        if ( !($id % REPORTING_INTERVAL) ) {
@@ -83,7 +83,7 @@ class DumpHTML {
                        }
                }
                print "\n";
-       }       
+       }
 
        function doSpecials() {
                $this->doMainPage();
@@ -116,9 +116,9 @@ class DumpHTML {
 
        function doImageDescriptions() {
                global $wgSharedUploadDirectory;
-               
+
                $fname = 'DumpHTML::doImageDescriptions';
-               
+
                $this->setupGlobals();
 
                /**
@@ -151,7 +151,7 @@ class DumpHTML {
                 */
                print "Writing description pages for commons images\n";
                $i = 0;
-               for ( $hash = 0; $hash < 256; $hash++ ) {                               
+               for ( $hash = 0; $hash < 256; $hash++ ) {
                        $dir = sprintf( "%01x/%02x", intval( $hash / 16 ), $hash );
                        $paths = array_merge( glob( "{$this->sharedStaticPath}/$dir/*" ),
                                glob( "{$this->sharedStaticPath}/thumb/$dir/*" ) );
@@ -268,7 +268,7 @@ class DumpHTML {
                        print("Can't open file $fullName for writing\n");
                        return;
                }
-               
+
                fwrite( $file, $text );
                fclose( $file );
        }
@@ -282,7 +282,7 @@ class DumpHTML {
                global $wgRightsUrl, $wgRightsText, $wgCopyrightIcon;
 
                static $oldLogo = NULL;
-               
+
                if ( !$this->setupDone ) {
                        $wgHooks['GetLocalURL'][] =& $this;
                        $wgHooks['GetFullURL'][] =& $this;
@@ -292,7 +292,7 @@ class DumpHTML {
                if ( is_null( $currentDepth ) ) {
                        $currentDepth = $this->depth;
                }
-               
+
                if ( $this->alternateScriptPath ) {
                        if ( $currentDepth == 0 ) {
                                $wgScriptPath = '.';
@@ -339,7 +339,7 @@ class DumpHTML {
                $wgThumbnailScriptPath = $wgSharedThumbnailScriptPath = false;
                $wgEnableParserCache = false;
                $wgMathPath = "$wgScriptPath/math";
-               
+
                if ( !empty( $wgRightsText ) ) {
                        $wgRightsUrl = "$wgScriptPath/COPYING.html";
                }
@@ -356,14 +356,14 @@ class DumpHTML {
        /** Reads the content of a title object, executes the skin and captures the result */
        function getArticleHTML( &$title ) {
                global $wgOut, $wgTitle, $wgArticle, $wgUser;
-               
+
                $linkCache =& LinkCache::singleton();
                $linkCache->clear();
                $wgTitle = $title;
                if ( is_null( $wgTitle ) ) {
                        return false;
                }
-               
+
                $ns = $wgTitle->getNamespace();
                if ( $ns == NS_SPECIAL ) {
                        $wgOut = new OutputPage;
@@ -383,7 +383,7 @@ class DumpHTML {
                        } else {
                                $wgOut = new OutputPage;
                                $wgOut->setParserOptions( new ParserOptions );
-               
+
                                $wgArticle->view();
                        }
                }
@@ -419,7 +419,7 @@ ENDTEXT;
                global $wgOutputEncoding, $wgDumpImages;
                $parser = xml_parser_create( $wgOutputEncoding );
                xml_set_element_handler( $parser, 'wfDumpStartTagHandler', 'wfDumpEndTagHandler' );
-               
+
                $wgDumpImages = array();
                xml_parse( $parser, $text );
                xml_parser_free( $parser );
@@ -508,7 +508,7 @@ ENDTEXT;
                        return true;
                }
        }
-       
+
        function onGetLocalURL( &$title, &$url, $query ) {
                global $wgArticlePath;
 
@@ -537,7 +537,7 @@ ENDTEXT;
                if ( $url === false ) {
                        $url = str_replace( '$1', wfUrlencode( $this->getHashedFilename( $title ) ), $wgArticlePath );
                }
-               
+
                return false;
        }
 
@@ -580,7 +580,7 @@ ENDTEXT;
 
                return $friendlyName;
        }
-       
+
        /**
         * Get a relative directory for putting a title into
         */
index 7eaa058..5e04231 100644 (file)
@@ -51,7 +51,7 @@ if ( !empty( $options['e'] ) ) {
        $end = $options['e'];
 } else {
        $dbr =& wfGetDB( DB_SLAVE );
-       $end = $dbr->selectField( 'page', 'max(page_id)', false );      
+       $end = $dbr->selectField( 'page', 'max(page_id)', false );
 }
 
 if ( !empty( $options['d'] ) ) {
@@ -89,7 +89,7 @@ if ( $options['special'] ) {
                $wgHTMLDump->doCategories();
                $wgHTMLDump->doSpecials();
        }
-       
+
        /*
        if ( $end - $start > CHUNK_SIZE * 2 ) {
                // Split the problem into smaller chunks, run them in different PHP instances
index 58dd9ad..aa1d5b9 100644 (file)
@@ -15,7 +15,7 @@ function dumpReplayLog( $start ) {
        $recentchanges = $dbw->tableName( 'recentchanges' );
        $result =& $dbw->safeQuery( "SELECT * FROM $recentchanges WHERE rc_timestamp >= "
                . $dbw->timestamp( $start ) . ' ORDER BY rc_timestamp');
-       
+
        global $wgInputEncoding;
        echo '<' . '?xml version="1.0" encoding="' . $wgInputEncoding . '" ?' . ">\n";
        echo "<wikilog version='experimental'>\n";
@@ -35,10 +35,10 @@ function dumpReplayEntry( $row ) {
        case RC_NEW:
                # Edit
                $dbr =& wfGetDB( DB_MASTER );
-               
+
                $out = "  <edit>\n";
                $out .= "    <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n";
-               
+
                # Get previous edit timestamp
                if( $row->rc_last_oldid ) {
                        $s = $dbr->selectRow( 'old',
@@ -48,7 +48,7 @@ function dumpReplayEntry( $row ) {
                } else {
                        $out .= "    <newpage/>\n";
                }
-               
+
                if( $row->rc_this_oldid ) {
                        $s = $dbr->selectRow( 'old', array( 'old_id as id','old_timestamp as timestamp',
                                'old_user as user', 'old_user_text as user_text', 'old_comment as comment',
index c81abba..5a3e11a 100644 (file)
@@ -32,33 +32,33 @@ require_once( 'maintenance/backup.inc' );
 
 class TextPassDumper extends BackupDumper {
        var $prefetch = null;
-       
+
        function dump() {
                # This shouldn't happen if on console... ;)
                header( 'Content-type: text/html; charset=UTF-8' );
-               
+
                # Notice messages will foul up your XML output even if they're
                # relatively harmless.
 //             ini_set( 'display_errors', false );
-               
+
                $this->startTime = wfTime();
-               
+
                $this->db =& $this->backupDb();
                $this->maxCount = $this->db->selectField( 'page', 'MAX(page_id)', '', 'BackupDumper::dump' );
                $this->startTime = wfTime();
-               
+
                $this->egress = new ExportProgressFilter( $this->sink, $this );
 
                $input = fopen( "php://stdin", "rt" );
                $result = $this->readDump( $input );
-               
+
                if( WikiError::isError( $result ) ) {
                        $this->progress( $result->getMessage() );
                }
-               
+
                $this->report( true );
        }
-       
+
        function processOption( $opt, $val, $param ) {
                if( $opt == 'prefetch' ) {
                        require_once 'maintenance/backupPrefetch.inc';
@@ -78,7 +78,7 @@ class TextPassDumper extends BackupDumper {
                        $this->prefetch = new BaseDump( $filename );
                }
        }
-       
+
        function readDump( $input ) {
                $this->buffer = "";
                $this->openElement = false;
@@ -87,13 +87,13 @@ class TextPassDumper extends BackupDumper {
                $this->lastName = "";
                $this->thisPage = 0;
                $this->thisRev = 0;
-               
+
                $parser = xml_parser_create( "UTF-8" );
                xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
-               
+
                xml_set_element_handler( $parser, array( &$this, 'startElement' ), array( &$this, 'endElement' ) );
                xml_set_character_data_handler( $parser, array( &$this, 'characterData' ) );
-               
+
                $offset = 0; // for context extraction on error reporting
                $bufferSize = 512 * 1024;
                do {
@@ -106,7 +106,7 @@ class TextPassDumper extends BackupDumper {
                } while( $chunk !== false && !feof( $input ) );
                xml_parser_free( $parser );
        }
-       
+
        function getText( $id ) {
                if( isset( $this->prefetch ) ) {
                        $text = $this->prefetch->prefetch( $this->thisPage, $this->thisRev );
@@ -123,11 +123,11 @@ class TextPassDumper extends BackupDumper {
                $normalized = UtfNormal::cleanUp( $stripped );
                return $normalized;
        }
-       
+
        function startElement( $parser, $name, $attribs ) {
                $this->clearOpenElement( null );
                $this->lastName = $name;
-               
+
                if( $name == 'revision' ) {
                        $this->state = $name;
                        $this->egress->writeOpenPage( null, $this->buffer );
@@ -140,7 +140,7 @@ class TextPassDumper extends BackupDumper {
                                $this->atStart = false;
                        }
                }
-               
+
                if( $name == "text" && isset( $attribs['id'] ) ) {
                        $text = $this->getText( $attribs['id'] );
                        $this->openElement = array( $name, array( 'xml:space' => 'preserve' ) );
@@ -151,14 +151,14 @@ class TextPassDumper extends BackupDumper {
                        $this->openElement = array( $name, $attribs );
                }
        }
-       
+
        function endElement( $parser, $name ) {
                if( $this->openElement ) {
                        $this->clearOpenElement( "" );
                } else {
                        $this->buffer .= "</$name>";
                }
-               
+
                if( $name == 'revision' ) {
                        $this->egress->writeRevision( null, $this->buffer );
                        $this->buffer = "";
@@ -172,7 +172,7 @@ class TextPassDumper extends BackupDumper {
                        $this->buffer = "";
                }
        }
-       
+
        function characterData( $parser, $data ) {
                $this->clearOpenElement( null );
                if( $this->lastName == "id" ) {
@@ -184,7 +184,7 @@ class TextPassDumper extends BackupDumper {
                }
                $this->buffer .= htmlspecialchars( $data );
        }
-       
+
        function clearOpenElement( $style ) {
                if( $this->openElement ) {
                        $this->buffer .= wfElement( $this->openElement[0], $this->openElement[1], $style );
index 4b84f9d..441ca2b 100644 (file)
@@ -28,7 +28,7 @@ if ( isset( $args[0] ) ) {
 function desyncFixPage( $pageID ) {
        global $numServers;
        $fname = 'desyncFixPage';
-       
+
        # Check for a corrupted page_latest
        $dbw =& wfGetDB( DB_MASTER );
        $realLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ), $fname );
@@ -44,7 +44,7 @@ function desyncFixPage( $pageID ) {
        if ( $i == $numServers ) {
                return;
        }
-       
+
        # Find the missing revision
        $res = $dbw->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), $fname );
        $masterIDs = array();
@@ -52,7 +52,7 @@ function desyncFixPage( $pageID ) {
                $masterIDs[] = $row->rev_id;
        }
        $dbw->freeResult( $res );
-       
+
        $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), $fname );
        $slaveIDs = array();
        while ( $row = $db->fetchObject( $res ) ) {
index e6652ee..09dc148 100644 (file)
@@ -35,7 +35,7 @@ class GenerateSitemap {
         * @var int
         */
        var $size_limit;
-       
+
        /**
         * The path to prepend to the filename
         *
@@ -49,14 +49,14 @@ class GenerateSitemap {
         * @var string
         */
        var $path;
-       
+
        /**
         * Whether or not to use compression
         *
         * @var bool
         */
        var $compress;
-       
+
        /**
         * The number of entries to save in each sitemap file
         *
@@ -113,14 +113,14 @@ class GenerateSitemap {
         * @var object
         */
        var $dbr;
-       
+
        /**
         * A resource pointing to the sitemap index file
         *
         * @var resource
         */
        var $findex;
-       
+
 
        /**
         * A resource pointing to a sitemap file
@@ -146,7 +146,7 @@ class GenerateSitemap {
         */
        function GenerateSitemap( $fspath, $path, $compress ) {
                global $wgDBname, $wgScriptPath;
-               
+
                $this->url_limit = 50000;
                $this->size_limit = pow( 2, 20 ) * 10;
                $this->fspath = isset( $fspath ) ? $fspath : '';
@@ -165,7 +165,7 @@ class GenerateSitemap {
         */
        function generateNamespaces() {
                $fname = 'GenerateSitemap::generateNamespaces';
-               
+
                $res = $this->dbr->select( 'page',
                        array( 'page_namespace' ),
                        array(),
@@ -235,14 +235,14 @@ class GenerateSitemap {
                global $wgDBname, $wgContLang;
 
                fwrite( $this->findex, $this->openIndex() );
-               
+
                foreach ( $this->namespaces as $namespace ) {
                        $res = $this->getPageRes( $namespace );
                        $this->file = false;
                        $this->generateLimit( $namespace );
                        $length = $this->limit[0];
                        $i = $smcount = 0;
-                       
+
                        $fns = $wgContLang->getFormattedNsText( $namespace );
                        $this->debug( "$namespace ($fns)" );
                        while ( $row = $this->dbr->fetchObject( $res ) ) {
@@ -282,7 +282,7 @@ class GenerateSitemap {
        function open( $file, $flags ) {
                return $this->compress ? gzopen( $file, $flags ) : fopen( $file, $flags );
        }
-       
+
        /**
         * gzwrite() / fwrite() wrapper
         */
@@ -315,9 +315,9 @@ class GenerateSitemap {
         */
        function sitemapFilename( $namespace, $count ) {
                global $wgDBname;
-               
+
                $ext = $this->compress ? '.gz' : '';
-               
+
                return "sitemap-$wgDBname-NS_$namespace-$count.xml$ext";
        }
 
@@ -431,7 +431,7 @@ class GenerateSitemap {
         */
        function generateLimit( $namespace ) {
                $title = Title::makeTitle( $namespace, str_repeat( "\xf0\xa8\xae\x81", 63 ) . "\xe5\x96\x83" );
-               
+
                $this->limit = array(
                        strlen( $this->openFile() ),
                        strlen( $this->fileEntry( $title->getFullUrl(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ),
index 0ebc513..5e4773e 100644 (file)
@@ -41,13 +41,13 @@ require_once( 'LogPage.php' );
  */
 class LogImporter {
        var $dummy = false;
-       
+
        function LogImporter( $type ) {
                $this->type = $type;
                $this->db =& wfGetDB( DB_MASTER );
                $this->actions = $this->setupActions();
        }
-       
+
        function setupActions() {
                $actions = array();
                foreach( LogPage::validActions( $this->type ) as $action ) {
@@ -56,11 +56,11 @@ class LogImporter {
                }
                return $actions;
        }
-       
+
        function makeLineRegexp( $type, $action ) {
                $linkRegexp = '(?:\[\[)?([^|\]]+?)(?:\|[^\]]+?)?(?:\]\])?';
                $linkRegexp2 = '\[\[([^|\]]+?)(?:\|[^\]]+?)?\]\]';
-               
+
                $text = LogPage::actionText( $type, $action );
                $text = preg_quote( $text, '/' );
                $text = str_replace( '\$1', $linkRegexp, $text );
@@ -69,7 +69,7 @@ class LogImporter {
                $text = "/$text/";
                return $text;
        }
-       
+
        function importText( $text ) {
                if( $this->dummy ) {
                        print $text;
@@ -82,7 +82,7 @@ class LogImporter {
                        }
                }
        }
-       
+
        function fixDate( $date ) {
                # Yuck! Parsing multilingual date formats??!!!!???!!??!
                # 01:55, 23 Aug 2004 - won't take in strtotimr
@@ -96,7 +96,7 @@ class LogImporter {
                $timestamp = wfTimestamp( TS_MW, $n );
                return $timestamp;
        }
-       
+
        function importLine( $line ) {
                foreach( $this->actions as $action => $regexp ) {
                        if( preg_match( $regexp, $line, $matches ) ) {
@@ -111,7 +111,7 @@ class LogImporter {
                                } else {
                                        $comment = '';
                                }
-                               
+
                                $insert = array(
                                        'log_type' => $this->type,
                                        'log_action' => preg_replace( '!^.*/!', '', $action ),
index 00bb662..221e5f9 100644 (file)
@@ -14,7 +14,7 @@ require_once( "importLogs.inc" );
 
 foreach( LogPage::validTypes() as $type ) {
        if( $type == '' ) continue;
-       
+
        $page = LogPage::logName( $type );
        $log = new Article( Title::makeTitleSafe( NS_PROJECT, $page ) );
        $text = $log->getContentWithoutUsingSoManyDamnGlobals();
index fa76b04..3a4fde8 100644 (file)
@@ -66,24 +66,24 @@ require_once( "rebuildtextindex.inc" );
  */
 class Phase2Importer {
        var $olddb, $titleCache;
-       
+
        function Phase2Importer( $database ) {
                $this->olddb = $database;
                $this->titleCache = new TitleCache;
        }
-       
+
        function importAll() {
                $this->importCurData();
                $this->fixCurTitles();
-               
+
                $this->importOldData();
                $this->fixOldTitles();
-               
+
                $this->importUserData();
                $this->fixUserOptions();
-               
+
                $this->importWatchlists();
-               
+
                $this->importLinkData();
 
                /*
@@ -91,21 +91,21 @@ class Phase2Importer {
                rebuildRecentChangesTablePass1();
                rebuildRecentChangesTablePass2();
                */
-               
+
                print "Rebuilding search index:\n";
                dropTextIndex();
                rebuildTextIndex();
                createTextIndex();
-               
+
                initialiseMessages();
        }
-       
+
        # Simple import functions; for the most part these are pretty straightforward.
        # MySQL copies everything over to the new database and tweaks a few things.
        function importCurData() {
                print "Clearing pages from default install, if any...\n";
                wfQuery( "DELETE FROM cur", DB_MASTER );
-               
+
                print "Importing current revision data...\n";
                wfQuery( "INSERT INTO cur (cur_id,cur_namespace,cur_title,cur_text,cur_comment,
                        cur_user,cur_user_text,cur_timestamp,cur_restrictions,cur_counter,
@@ -156,7 +156,7 @@ class Phase2Importer {
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
-               
+
                while( $row = wfFetchObject( $res ) ) {
                        $id = intval( $row->user_id );
                        $list = explode( "\n", $row->user_watch );
@@ -176,7 +176,7 @@ class Phase2Importer {
                }
                wfFreeResult( $res );
        }
-       
+
        function importLinkData() {
                # MUST BE CALLED BEFORE! fixCurTitles()
                print "Clearing links from default install, if any...\n";
@@ -190,7 +190,7 @@ class Phase2Importer {
                                        WHERE linked_to=cur_title", DB_MASTER );
                $n = mysql_affected_rows();
                print "$n rows imported.\n";
-               
+
                print "Importing broken links...";
                wfQuery( "INSERT INTO brokenlinks (bl_from, bl_to)
                                        SELECT DISTINCT cur_id,unlinked_to
@@ -204,18 +204,18 @@ class Phase2Importer {
        function fixCurTitles() {
                $this->fixTitles( "cur" );
        }
-       
+
        function fixOldTitles() {
                $this->fixTitles( "old" );
        }
-       
+
        function fixTitles( $table ) {
                print "Fixing titles in $table...";
                $res = wfQuery( "SELECT DISTINCT {$table}_title AS title FROM $table", DB_MASTER );
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
-               
+
                while( $row = wfFetchObject( $res ) ) {
                        $xt = wfStrencode( $row->title );
                        $title = $this->titleCache->fetch( $row->title );
@@ -238,19 +238,19 @@ class Phase2Importer {
        {
                $s = urldecode( $in );
                $a = explode( "\n", $s );
-       
+
                foreach ( $a as $l ) {
                        if ( preg_match( "/^([A-Za-z0-9_]+)=(.*)/", $l, $m ) ) {
                                $ops[$m[1]] = $m[2];
                        }
                }
                $nops = array();
-       
+
                $q = strtolower( $ops["quickBar"] );
                if ( $q == "none" ) { $q = 0; }
                else { $q = 1; } # Default to left
                $nops["quickbar"] = $q;
-       
+
                if ( $ops["markupNewTopics"] == "inverse" ) {
                        $nops["highlightbroken"] = 1;
                }
@@ -260,15 +260,15 @@ class Phase2Importer {
                else if ( "colo" == $sk ) { $sk = 2; }
                else { $sk = 0; }
                $nops["skin"] = $sk;
-       
+
                $u = strtolower( $ops["underlineLinks"] );
                if ( "yes" == $u || "on" == $u ) { $nops["underline"] = 1; }
                else { $nops["underline"] = 0; }
-       
+
                $t = ( (int) ($ops["hourDiff"]) );
                if ( $t < -23 || $t > 23 ) { $t = 0; }
                if ( 0 != $t ) { $nops["timecorrection"] = $t; }
-       
+
                $j = strtolower( $ops["justify"] );
                if ( "yes" == $j || "on" == $j ) { $nops["justify"] = 1; }
                $n = strtolower( $ops["numberHeadings"] );
@@ -279,7 +279,7 @@ class Phase2Importer {
                if ( "yes" == $r || "on" == $r ) { $nops["rememberpassword"] = 1; }
                $s = strtolower( $ops["showHover"] );
                if ( "yes" == $s || "on" == $s ) { $nops["hover"] = 1; }
-       
+
                $c = $ops["cols"];
                if ( $c < 20 || $c > 200 ) { $nops["cols"] = 80; }
                else { $nops["cols"] = $c; }
@@ -293,7 +293,7 @@ class Phase2Importer {
                if ( $r < 10 || $r > 1000 ) { $nops["rclimit"] = 50; }
                else { $nops["rclimit"] = $r; }
                $nops["rcdays"] = 3;
-       
+
                $a = array();
                foreach ( $nops as $oname => $oval ) {
                        array_push( $a, "$oname=$oval" );
@@ -308,7 +308,7 @@ class Phase2Importer {
                $total = wfNumRows( $res );
                $n = 0;
                print " ($total total)\n";
-               
+
                while( $row = wfFetchObject( $res ) ) {
                        $id = intval( $row->user_id );
                        $option = wfStrencode( $this->rewriteUserOptions( $row->user_options ) );
@@ -319,7 +319,7 @@ class Phase2Importer {
                }
                wfFreeResult( $res );
        }
-       
+
 }
 
 /**
@@ -329,14 +329,14 @@ class Phase2Importer {
  */
 class TitleCache {
        var $hash = array();
-       
+
        function &fetch( $dbkey ) {
                if( !isset( $hash[$dbkey] ) ) {
                        $hash[$dbkey] = Title::newFromDBkey( $dbkey );
                }
                return $hash[$dbkey];
        }
-       
+
 }
 
 #
index 46eed2b..778a2ef 100644 (file)
@@ -56,7 +56,7 @@ importPages();
 function importPages()
 {
        global $wgRootDirectory;
-       
+
        $gt = '>';
        echo <<<END
 <?xml version="1.0" encoding="UTF-8" ?$gt
@@ -121,16 +121,16 @@ function useModFilename( $title ) {
 function fetchPage( $title )
 {
        global $FS,$FS1,$FS2,$FS3, $wgRootDirectory;
-       
+
        $fname = $wgRootDirectory . "/page/" . useModFilename( $title ) . ".db";
        if( !file_exists( $fname ) ) {
                die( "Couldn't open file '$fname' for page '$title'.\n" );
        }
-       
+
        $page = splitHash( $FS1, file_get_contents( $fname ) );
        $section = splitHash( $FS2, $page["text_default"] );
        $text = splitHash( $FS3, $section["data"] );
-       
+
        return array2object( array( "text" => $text["text"] , "summary" => $text["summary"] ,
                "minor" => $text["minor"] , "ts" => $section["ts"] ,
                "username" => $section["username"] , "host" => $section["host"] ) );
@@ -139,13 +139,13 @@ function fetchPage( $title )
 function fetchKeptPages( $title )
 {
        global $FS,$FS1,$FS2,$FS3, $wgRootDirectory, $wgTimezoneCorrection;
-       
+
        $fname = $wgRootDirectory . "/keep/" . useModFilename( $title ) . ".kp";
        if( !file_exists( $fname ) ) return array();
-       
+
        $keptlist = explode( $FS1, file_get_contents( $fname ) );
        array_shift( $keptlist ); # Drop the junk at beginning of file
-       
+
        $revisions = array();
        foreach( $keptlist as $rev ) {
                $section = splitHash( $FS2, $rev );
@@ -197,12 +197,12 @@ function checkUserCache( $name, $host )
 function importPage( $title )
 {
        global $usercache;
-       
+
        echo "\n<!-- Importing page " . xmlCommentSafe( $title ) . " -->\n";
        $page = fetchPage( $title );
 
        $newtitle = xmlsafe( str_replace( '_', ' ', recodeText( $title ) ) );
-       
+
        $munged = mungeFormat( $page->text );
        if( $munged != $page->text ) {
                /**
@@ -235,7 +235,7 @@ END;
        if(count( $revisions ) == 0 ) {
                return $sql;
        }
-       
+
        foreach( $revisions as $rev ) {
                $text      = xmlsafe( recodeText( $rev->text ) );
                $minor     = ($rev->minor ? '<minor/>' : '');
@@ -243,7 +243,7 @@ END;
                $username  = xmlsafe( recodeText( $username ) );
                $timestamp = xmlsafe( timestamp2ISO8601( $rev->ts ) );
                $comment   = xmlsafe( recodeText( $rev->summary ) );
-               
+
                $xml .= <<<END
                <revision>
                        <timestamp>$timestamp</timestamp>
@@ -303,7 +303,7 @@ function xmlsafe( $string ) {
         * XML output invalid, so be sure to strip them out.
         */
        $string = UtfNormal::cleanUp( $string );
-       
+
        $string = htmlspecialchars( $string );
        return $string;
 }
@@ -331,7 +331,7 @@ function mungeFormat( $text ) {
        $staged = preg_replace_callback(
                '/(<nowiki>.*?<\\/nowiki>|(?:http|https|ftp):\\S+|\[\[[^]\\n]+]])/s',
                'nowikiPlaceholder', $text );
-       
+
        # This is probably not  100% correct, I'm just
        # glancing at the UseModWiki code.
        $upper   = "[A-Z]";
@@ -340,10 +340,10 @@ function mungeFormat( $text ) {
        $camel   = "(?:$upper+$lower+$upper+$any*)";
        $subpage = "(?:\\/$any+)";
        $substart = "(?:\\/$upper$any*)";
-       
+
        $munged = preg_replace( "/(?!\\[\\[)($camel$subpage*|$substart$subpage*)\\b(?!\\]\\]|>)/",
                '[[$1]]', $staged );
-       
+
        $final = preg_replace( '/' . preg_quote( placeholder() ) . '/es',
                'array_shift( $nowiki )', $munged );
        return $final;
index fef2f2a..62ec8d4 100644 (file)
@@ -120,7 +120,7 @@ function applyPot($langcode) {
        $pot = LOCALE_OUTPUT_DIR.'/wfMsg.pot';
        $dest = $langdir.'/messages.po';
 
-       // Merge template and generate file to get final .po    
+       // Merge template and generate file to get final .po
        exec(MSGMERGE_BIN.MSGMERGE_OPTIONS." $from $pot -o $dest ");
        // delete no more needed file
 //     unlink($from);
index e5b32f3..00cb8e1 100644 (file)
@@ -43,6 +43,6 @@ class languages {
                }
        }
 
-       function getList() { return $this->list; }      
+       function getList() { return $this->list; }
 }
 ?>
index 1f7b3b6..93b6ec1 100755 (executable)
@@ -77,7 +77,7 @@ do {
 
        $line = readconsole( '> ' );
        if ($line === false) exit;
-       
+
        $args = explode( ' ', $line );
        $command = array_shift( $args );
 
index 0144f90..1e995b0 100644 (file)
@@ -39,7 +39,7 @@ class NamespaceConflictChecker {
        function NamespaceConflictChecker( &$db ) {
                $this->db =& $db;
        }
-       
+
        function checkAll( $fix, $suffix = '' ) {
                global $wgContLang;
                $spaces = $wgContLang->getNamespaces();
@@ -49,21 +49,21 @@ class NamespaceConflictChecker {
                }
                return $ok;
        }
-       
+
        function checkNamespace( $ns, $name, $fix, $suffix = '' ) {
                echo "Checking namespace $ns: \"$name\"\n";
                if( $name == '' ) {
                        echo "... skipping article namespace\n";
                        return true;
                }
-               
+
                $conflicts = $this->getConflicts( $ns, $name );
                $count = count( $conflicts );
                if( $count == 0 ) {
                        echo "... no conflicts detected!\n";
                        return true;
                }
-               
+
                echo "... $count conflicts detected:\n";
                $ok = true;
                foreach( $conflicts as $row ) {
@@ -75,14 +75,14 @@ class NamespaceConflictChecker {
                }
                return $ok;
        }
-       
+
        function getConflicts( $ns, $name ) {
                $page  = $this->newSchema() ? 'page' : 'cur';
                $table = $this->db->tableName( $page );
-               
+
                $prefix     = $this->db->strencode( $name );
                $likeprefix = str_replace( '_', '\\_', $prefix);
-               
+
                $sql = "SELECT {$page}_id                                  AS id,
                               {$page}_title                               AS oldtitle,
                               $ns                                         AS namespace,
@@ -90,18 +90,18 @@ class NamespaceConflictChecker {
                          FROM {$table}
                         WHERE {$page}_namespace=0
                           AND {$page}_title LIKE '$likeprefix:%'";
-               
+
                $result = $this->db->query( $sql, 'NamespaceConflictChecker::getConflicts' );
-               
+
                $set = array();
                while( $row = $this->db->fetchObject( $result ) ) {
                        $set[] = $row;
                }
                $this->db->freeResult( $result );
-               
+
                return $set;
        }
-       
+
        function reportConflict( $row, $suffix ) {
                $newTitle = Title::makeTitle( $row->namespace, $row->title );
                printf( "... %d (0,\"%s\") -> (%d,\"%s\") [[%s]]\n",
@@ -110,7 +110,7 @@ class NamespaceConflictChecker {
                        $row->namespace,
                        $row->title,
                        $newTitle->getPrefixedText() );
-               
+
                $id = $newTitle->getArticleId();
                if( $id ) {
                        echo "...  *** cannot resolve automatically; page exists with ID $id ***\n";
@@ -119,7 +119,7 @@ class NamespaceConflictChecker {
                        return true;
                }
        }
-       
+
        function resolveConflict( $row, $resolvable, $suffix ) {
                if( !$resolvable ) {
                        $row->title .= $suffix;
@@ -134,7 +134,7 @@ class NamespaceConflictChecker {
                }
                return true;
        }
-       
+
        function resolveConflictOn( $row, $table ) {
                $fname = 'NamespaceConflictChecker::resolveConflictOn';
                echo "... resolving on $table... ";
@@ -151,7 +151,7 @@ class NamespaceConflictChecker {
                echo "ok.\n";
                return true;
        }
-       
+
        function newSchema() {
                return class_exists( 'Revision' );
        }
index f093e7e..2df2dd2 100755 (executable)
@@ -44,11 +44,11 @@ function checkOrphans( $fix ) {
        $dbw =& wfGetDB( DB_MASTER );
        $page = $dbw->tableName( 'page' );
        $revision = $dbw->tableName( 'revision' );
-       
+
        if( $fix ) {
                $dbw->query( "LOCK TABLES $page WRITE, $revision WRITE" );
        }
-       
+
        echo "Checking for orphan revision table entries... (this may take a while on a large wiki)\n";
        $result = $dbw->query( "
                SELECT *
@@ -80,7 +80,7 @@ function checkOrphans( $fix ) {
        } else {
                echo "No orphans! Yay!\n";
        }
-       
+
        if( $fix ) {
                $dbw->query( "UNLOCK TABLES" );
        }
@@ -95,11 +95,11 @@ function checkWidows( $fix ) {
        $dbw =& wfGetDB( DB_MASTER );
        $page = $dbw->tableName( 'page' );
        $revision = $dbw->tableName( 'revision' );
-       
+
        if( $fix ) {
                $dbw->query( "LOCK TABLES $page WRITE, $revision WRITE" );
        }
-       
+
        echo "\nChecking for childless page table entries... (this may take a while on a large wiki)\n";
        $result = $dbw->query( "
                SELECT *
@@ -127,7 +127,7 @@ function checkWidows( $fix ) {
        } else {
                echo "No childless pages! Yay!\n";
        }
-       
+
        if( $fix ) {
                $dbw->query( "UNLOCK TABLES" );
        }
@@ -139,11 +139,11 @@ function checkSeparation( $fix ) {
        $page     = $dbw->tableName( 'page' );
        $revision = $dbw->tableName( 'revision' );
        $text     = $dbw->tableName( 'text' );
-       
+
        if( $fix ) {
                $dbw->query( "LOCK TABLES $page WRITE, $revision WRITE, $text WRITE" );
        }
-       
+
        echo "\nChecking for pages whose page_latest links are incorrect... (this may take a while on a large wiki)\n";
        $result = $dbw->query( "
                SELECT *
@@ -189,7 +189,7 @@ function checkSeparation( $fix ) {
                        echo "wtf\n";
                }
        }
-       
+
        if( $found ) {
                echo "Found $found pages with incorrect latest revision.\n";
        } else {
@@ -198,7 +198,7 @@ function checkSeparation( $fix ) {
        if( !$fix && $found > 0 ) {
                echo "Run again with --fix to remove these entries automatically.\n";
        }
-       
+
        if( $fix ) {
                $dbw->query( "UNLOCK TABLES" );
        }
index c52ad69..56464cd 100644 (file)
@@ -84,7 +84,7 @@ foreach( $hosts as $host ) {
        foreach( $databases as $db ) {
                print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
        }
-       
+
 /*
        print "\n-- wikisql\n\n";
        foreach ( $databases as $db ) {
@@ -106,7 +106,7 @@ GRANT SELECT ON `$db`.`brokenlinks` TO 'wikisql'@'$host' IDENTIFIED BY '$wikisql
 
 EOS;
        }*/
-       
+
        print "\n-- wikiadmin\n\n";
        print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
        print "GRANT ALL PRIVILEGES ON `boardvote`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
index 62ce971..c58c8aa 100644 (file)
@@ -60,11 +60,11 @@ class ParserTest {
         */
        function ParserTest() {
                global $options;
-               
+
                # Only colorize output if stdout is a terminal.
                $this->lightcolor = false;
                $this->color = !wfIsWindows() && posix_isatty(1);
-               
+
                if( isset( $options['color'] ) ) {
                        switch( $options['color'] ) {
                        case 'no':
@@ -79,9 +79,9 @@ class ParserTest {
                                break;
                        }
                }
-               
+
                $this->showDiffs = !isset( $options['quick'] );
-               
+
                $this->quiet = isset( $options['quiet'] );
 
                if (isset($options['regex'])) {
@@ -104,7 +104,7 @@ class ParserTest {
                        return $s;
                }
        }
-       
+
        /**
         * Run a series of tests listed in the given text file.
         * Each test consists of a brief description, wikitext input,
@@ -122,7 +122,7 @@ class ParserTest {
                if( !$infile ) {
                        die( "Couldn't open parserTests.txt\n" );
                }
-               
+
                $data = array();
                $section = null;
                $success = 0;
@@ -257,16 +257,16 @@ class ParserTest {
 
                        $result = $this->tidy($result);
                }
-               
+
                $this->teardownGlobals();
-               
+
                if( $result === $out && $this->wellFormed( $out ) ) {
                        return $this->showSuccess( $desc );
                } else {
                        return $this->showFailure( $desc, $result, $out );
                }
        }
-       
+
        /**
         * Set up the global variables for a consistent environment for each test.
         * Ideally this should replace the global configuration entirely.
@@ -283,7 +283,7 @@ class ParserTest {
                if( !isset( $this->uploadDir ) ) {
                        $this->uploadDir = $this->setupUploadDir();
                }
-               
+
                $settings = array(
                        'wgServer' => 'http://localhost',
                        'wgScript' => '/index.php',
@@ -297,7 +297,7 @@ class ParserTest {
                        'wgContLanguageCode' => 'en',
                        'wgDBprefix' => 'parsertest',
                        'wgDefaultUserOptions' => array(),
-                       
+
                        'wgLang' => new LanguageUtf8(),
                        'wgContLang' => new LanguageUtf8(),
                        'wgNamespacesWithSubpages' => array( 0 => preg_match('/\\bsubpage\\b/i', $opts)),
@@ -316,11 +316,11 @@ class ParserTest {
                $GLOBALS['wgLoadBalancer']->loadMasterPos();
                $GLOBALS['wgMessageCache']->initialise( new BagOStuff(), false, 0, $GLOBALS['wgDBname'] );
                $this->setupDatabase();
-               
+
                global $wgUser;
                $wgUser = new User();
        }
-       
+
        # List of temporary tables to create, without prefix
        # Some of these probably aren't necessary
        function listTables() {
@@ -334,7 +334,7 @@ class ParserTest {
                        'objectcache'
                );
        }
-       
+
        /**
         * Set up a temporary set of wiki tables to work with for the tests.
         * Currently this will only be done once per run, and any changes to
@@ -425,11 +425,11 @@ class ParserTest {
                                'img_major_mime'  => "image",
                                'img_minor_mime'  => "jpeg",
                                ) );
-                       
+
                        $setupDB = true;
                }
        }
-       
+
        /**
         * Create a dummy uploads directory which will contain a couple
         * of files in order to pass existence tests.
@@ -438,23 +438,23 @@ class ParserTest {
         */
        function setupUploadDir() {
                global $IP;
-               
+
                $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images";
                mkdir( $dir );
                mkdir( $dir . '/3' );
                mkdir( $dir . '/3/3a' );
-               
+
                $img = "$IP/skins/monobook/headbg.jpg";
                $h = fopen($img, 'r');
                $c = fread($h, filesize($img));
                fclose($h);
-               
+
                $f = fopen( $dir . '/3/3a/Foobar.jpg', 'wb' );
                fwrite( $f, $c );
                fclose( $f );
                return $dir;
        }
-       
+
        /**
         * Restore default values and perform any necessary clean-up
         * after each test runs.
@@ -470,7 +470,7 @@ class ParserTest {
                        unset( $this->uploadDir );
                }
        }
-       
+
        /**
         * Remove the dummy uploads directory
         * @access private
@@ -488,7 +488,7 @@ class ParserTest {
                @rmdir( "$dir/thumb" );
                rmdir( "$dir" );
        }
-       
+
        /**
         * "Running test $desc..."
         * @access private
@@ -496,7 +496,7 @@ class ParserTest {
        function showTesting( $desc ) {
                print "Running test $desc... ";
        }
-       
+
        /**
         * Print a happy success message.
         *
@@ -510,7 +510,7 @@ class ParserTest {
                }
                return true;
        }
-       
+
        /**
         * Print a failure message and provide some explanatory output
         * about what went wrong if so configured.
@@ -536,7 +536,7 @@ class ParserTest {
                }
                return false;
        }
-       
+
        /**
         * Run given strings through a diff and return the (colorized) output.
         * Requires writable /tmp directory and a 'diff' command in the PATH.
@@ -550,20 +550,20 @@ class ParserTest {
         */
        function quickDiff( $input, $output, $inFileTail='expected', $outFileTail='actual' ) {
                $prefix = wfTempDir() . "/mwParser-" . mt_rand();
-               
+
                $infile = "$prefix-$inFileTail";
                $this->dumpToFile( $input, $infile );
-               
+
                $outfile = "$prefix-$outFileTail";
                $this->dumpToFile( $output, $outfile );
-               
+
                $diff = `diff -au $infile $outfile`;
                unlink( $infile );
                unlink( $outfile );
-               
+
                return $this->colorDiff( $diff );
        }
-       
+
        /**
         * Write the given string to a file, adding a final newline.
         *
@@ -576,7 +576,7 @@ class ParserTest {
                fwrite( $file, $data . "\n" );
                fclose( $file );
        }
-       
+
        /**
         * Return ANSI terminal escape code for changing text attribs/color,
         * or empty string if color output is disabled.
@@ -592,7 +592,7 @@ class ParserTest {
                        return $this->color ? "\x1b[{$color}m" : '';
                }
        }
-       
+
        /**
         * Return ANSI terminal escape code for restoring default text attributes,
         * or empty string if color output is disabled.
@@ -603,7 +603,7 @@ class ParserTest {
        function termReset() {
                return $this->color ? "\x1b[0m" : '';
        }
-       
+
        /**
         * Colorize unified diff output if set for ANSI color output.
         * Subtractions are colored blue, additions red.
@@ -661,7 +661,7 @@ class ParserTest {
                }
                return $text;
        }
-       
+
        /**
         * Hack up a private DOCTYPE with HTML's standard entity declarations.
         * PHP 4 seemed to know these if you gave it an HTML doctype, but
@@ -678,19 +678,19 @@ class ParserTest {
                $out .= "]>\n";
                return $out;
        }
-       
+
        function wellFormed( $text ) {
                $html =
                        $this->hackDocType() .
                        '<html>' .
                        $text .
                        '</html>';
-               
+
                $parser = xml_parser_create( "UTF-8" );
-               
+
                # case folding violates XML standard, turn it off
                xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
-               
+
                if( !xml_parse( $parser, $html, true ) ) {
                        $err = xml_error_string( xml_get_error_code( $parser ) );
                        $position = xml_get_current_byte_index( $parser );
@@ -702,7 +702,7 @@ class ParserTest {
                xml_parser_free( $parser );
                return true;
        }
-       
+
        function extractFragment( $text, $position ) {
                $start = max( 0, $position - 10 );
                $before = $position - $start;
@@ -726,7 +726,7 @@ class ParserTest {
                        $this->termColor( 0 );
                return "$display\n$caret";
        }
-       
+
 }
 
 ?>
index 90c039c..56d1e6b 100644 (file)
@@ -16,7 +16,7 @@ $wgHooks['ParserTestParser'][] = 'wfParserTestSetup';
 function wfParserTestSetup( &$parser ) {
        $parser->setHook( 'tag', 'wfParserTestHook' );
 }
-       
+
 function wfParserTestHook( $in, $argv ) {
        if ( count( $argv ) )
                return "<pre>\n" . print_r( $argv, true ) . '</pre>';
index c3093c6..a2342c8 100644 (file)
@@ -49,7 +49,7 @@ function get_numbers ( $filename )
                }
        return $r ;
        }
-       
+
 /** Make shades for pref. language(s) */
 function getshades ( $l )
        {
@@ -60,7 +60,7 @@ function getshades ( $l )
                $y = explode ( ";" , $x ) ;
                if ( count ( $y ) == 2 ) $weight = array_pop ( explode ( "=" , $y[1] ) ) ;
                else $weight = "1.0" ;
-               
+
                $lang = array_shift ( $y ) ;
                $lang = explode ( "-" , $lang ) ;
                $lang = trim ( strtolower ( array_shift ( $lang ) ) ) ;
@@ -109,7 +109,7 @@ foreach ( $t AS $x )
        }
 if ( $count != 0 ) $l .= "</tr>" ;
 $l .= "</table>" ;
-       
+
 print "<html><head></head><body>" ;
 print $l ;
 print "</body></html>" ;
index 0def198..5e9f66c 100644 (file)
@@ -38,16 +38,16 @@ require_once( 'FiveUpgrade.inc' );
 class ImageBuilder extends FiveUpgrade {
        function ImageBuilder( $dryrun = false ) {
                parent::FiveUpgrade();
-               
+
                $this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
                $this->dryrun = $dryrun;
        }
-       
+
        function build() {
                $this->buildImage();
                $this->buildOldImage();
        }
-       
+
        function init( $count, $table ) {
                $this->processed = 0;
                $this->updated = 0;
@@ -55,7 +55,7 @@ class ImageBuilder extends FiveUpgrade {
                $this->startTime = wfTime();
                $this->table = $table;
        }
-       
+
        function progress( $updated ) {
                $this->updated += $updated;
                $this->processed++;
@@ -64,12 +64,12 @@ class ImageBuilder extends FiveUpgrade {
                }
                $portion = $this->processed / $this->count;
                $updateRate = $this->updated / $this->processed;
-               
+
                $now = wfTime();
                $delta = $now - $this->startTime;
                $estimatedTotalTime = $delta / $portion;
                $eta = $this->startTime + $estimatedTotalTime;
-               
+
                printf( "%s: %6.2f%% done on %s; ETA %s [%d/%d] %.2f/sec <%.2f%% updated>\n",
                        wfTimestamp( TS_DB, intval( $now ) ),
                        $portion * 100.0,
@@ -81,18 +81,18 @@ class ImageBuilder extends FiveUpgrade {
                        $updateRate * 100.0 );
                flush();
        }
-       
+
        function buildTable( $table, $key, $callback ) {
                $fname = 'ImageBuilder::buildTable';
-               
+
                $count = $this->dbw->selectField( $table, 'count(*)', '', $fname );
                $this->init( $count, $table );
                $this->log( "Processing $table..." );
-               
+
                $tableName = $this->dbr->tableName( $table );
                $sql = "SELECT * FROM $tableName";
                $result = $this->dbr->query( $sql, $fname );
-               
+
                while( $row = $this->dbr->fetchObject( $result ) ) {
                        $update = call_user_func( $callback, $row );
                        if( is_array( $update ) ) {
@@ -110,18 +110,18 @@ class ImageBuilder extends FiveUpgrade {
                $this->log( "Finished $table... $this->updated of $this->processed rows updated" );
                $this->dbr->freeResult( $result );
        }
-       
+
        function buildImage() {
                $callback = array( &$this, 'imageCallback' );
                $this->buildTable( 'image', 'img_name', $callback );
        }
-       
+
        function imageCallback( $row ) {
                if( $row->img_width ) {
                        // Already processed
                        return null;
                }
-               
+
                // Fill in the new image info fields
                $info = $this->imageInfo( $row->img_name );
 
@@ -137,18 +137,18 @@ class ImageBuilder extends FiveUpgrade {
                        'img_major_mime' => $info['major'],
                        'img_minor_mime' => $info['minor'] );
        }
-       
-       
+
+
        function buildOldImage() {
                $this->buildTable( 'oldimage', 'oi_archive_name',
                        array( &$this, 'oldimageCallback' ) );
        }
-       
+
        function oldimageCallback( $row ) {
                if( $row->oi_width ) {
                        return null;
                }
-               
+
                // Fill in the new image info fields
                $info = $this->imageInfo( $row->oi_archive_name, 'wfImageArchiveDir', $row->oi_name );
                return array(
@@ -156,7 +156,7 @@ class ImageBuilder extends FiveUpgrade {
                        'oi_height' => $info['height'],
                        'oi_bits'   => $info['bits'  ] );
        }
-       
+
        function crawlMissing() {
                global $wgUploadDirectory, $wgHashedUploadDirectory;
                if( $wgHashedUploadDirectory ) {
@@ -175,7 +175,7 @@ class ImageBuilder extends FiveUpgrade {
                        $this->crawlDirectory( $wgUploadDirectory );
                }
        }
-       
+
        function crawlDirectory( $dir ) {
                if( !file_exists( $dir ) ) {
                        return $this->log( "no directory, skipping $dir" );
@@ -190,7 +190,7 @@ class ImageBuilder extends FiveUpgrade {
                if( $source === false ) {
                        return $this->log( "couldn't open dir, skipping $dir" );
                }
-               
+
                $this->log( "crawling $dir" );
                while( false !== ( $filename = readdir( $source ) ) ) {
                        $fullpath = $dir . DIRECTORY_SEPARATOR . $filename;
@@ -205,14 +205,14 @@ class ImageBuilder extends FiveUpgrade {
                }
                closedir( $source );
        }
-       
+
        function checkMissingImage( $filename, $fullpath ) {
                $fname = 'ImageBuilder::checkMissingImage';
                $row = $this->dbw->selectRow( 'image',
                        array( 'img_name' ),
                        array( 'img_name' => $filename ),
                        $fname );
-               
+
                if( $row ) {
                        // already known, move on
                        return;
@@ -220,14 +220,14 @@ class ImageBuilder extends FiveUpgrade {
                        $this->addMissingImage( $filename, $fullpath );
                }
        }
-       
+
        function addMissingImage( $filename, $fullpath ) {
                $fname = 'ImageBuilder::addMissingImage';
-               
+
                $size = filesize( $fullpath );
                $info = $this->imageInfo( $filename );
                $timestamp = $this->dbw->timestamp( filemtime( $fullpath ) );
-               
+
                global $wgContLang;
                $altname = $wgContLang->checkTitleEncoding( $filename );
                if( $altname != $filename ) {
@@ -238,12 +238,12 @@ class ImageBuilder extends FiveUpgrade {
                                $filename = $this->renameFile( $filename );
                        }
                }
-               
+
                if( $filename == '' ) {
                        $this->log( "Empty filename for $fullpath" );
                        return;
                }
-               
+
                $fields = array(
                        'img_name'       => $filename,
                        'img_size'       => $size,
index 48db503..d2c2297 100644 (file)
@@ -50,7 +50,7 @@ function getRebuildInterwikiSQL() {
 
        # List of all database names
        $dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) );
-       
+
        # Special-case hostnames
        $specials = array(
                'sourceswiki' => 'sources.wikipedia.org',
@@ -116,13 +116,13 @@ function getRebuildInterwikiSQL() {
                        } else {
                                $local = 0;
                        }
-                       
+
                        if ( empty( $reserved[$prefix] ) ) {
                                $iwArray[$prefix] = array( "iw_prefix" => $prefix, "iw_url" => $url, "iw_local" => $local );
                        }
                }
        }
-       
+
        $sql = "-- Generated by rebuildInterwiki.php";
 
 
@@ -130,14 +130,14 @@ function getRebuildInterwikiSQL() {
                if ( isset( $specials[$db] ) ) {
                        # Special wiki
                        # Has interwiki links and interlanguage links to wikipedia
-                       
+
                        $host = $specials[$db];
                        $sql .= "\n--$host\n\n";
                        $sql .= "USE $db;\n" .
                                        "TRUNCATE TABLE interwiki;\n" .
                                        "INSERT INTO interwiki (iw_prefix, iw_url, iw_local) VALUES \n";
                        $first = true;
-                       
+
                        # Intermap links
                        foreach ( $iwArray as $iwEntry ) {
                                $sql .= makeLink( $iwEntry, $first, $db );
@@ -147,7 +147,7 @@ function getRebuildInterwikiSQL() {
                        foreach ( $sites as $targetSite ) {
                                $sql .= makeLink( array( $targetSite->lateral, $targetSite->getURL( 'en' ), 1 ), $first, $db );
                        }
-                       
+
                        # Interlanguage links to wikipedia
                        $sql .= makeLanguageLinks( $sites['wiki'], $first, $db );
 
@@ -155,7 +155,7 @@ function getRebuildInterwikiSQL() {
                        foreach ( $extraLinks as $link ) {
                                $sql .= makeLink( $link, $first, $db );
                        }
-                       
+
                        $sql .= ";\n";
                } else {
                        # Find out which site this DB belongs to
@@ -174,7 +174,7 @@ function getRebuildInterwikiSQL() {
                        $lang = $matches[1];
                        $host = "$lang." . $site->url;
                        $sql .= "\n--$host\n\n";
-                       
+
                        $sql .= "USE $db;\n" .
                                        "TRUNCATE TABLE interwiki;\n" .
                                        "INSERT INTO interwiki (iw_prefix,iw_url,iw_local) VALUES\n";
@@ -206,7 +206,7 @@ function getRebuildInterwikiSQL() {
                        if ( $site->suffix == "wiki" ) {
                                $sql .= makeLink( array("w", "http://en.wikipedia.org/wiki/$1", 1), $first, $db );
                        }
-                       
+
                        # Extra links
                        foreach ( $extraLinks as $link ){
                                        $sql .= makeLink( $link, $first, $db );
index 42888eb..19e081a 100644 (file)
@@ -18,7 +18,7 @@ chdir( $oldCwd );
 $sql = getRebuildInterwikiSQL();
 
 # Output
-if ( isset( $options['o'] ) ) {        
+if ( isset( $options['o'] ) ) {
        # To file specified with -o
        $file = fopen( $options['o'], "w" );
        fwrite( $file, $sql );
index ed742e4..26f334e 100644 (file)
@@ -17,7 +17,7 @@ function rebuildRecentChangesTablePass1()
        $dbw->delete( 'recentchanges', '*' );
 
        print( "Loading from page and revision tables...\n" );
-       
+
        global $wgRCMaxAge;
        $cutoff = time() - $wgRCMaxAge;
        $dbw->insertSelect( 'recentchanges', array( 'page', 'revision' ),
index 7506f8f..093c271 100644 (file)
@@ -15,13 +15,13 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false ) {
        $dbr =& wfGetDB( DB_SLAVE );
        $dbw =& wfGetDB( DB_MASTER );
        $start = intval( $start );
-       
+
        # Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
        $wgUser->setOption('math', MW_MATH_SOURCE);
 
        # Don't generate extension images (e.g. Timeline)
        $wgParser->mTagHooks = array();
-       
+
        # Don't generate thumbnail images
        $wgUseImageResize = false;
 
@@ -36,7 +36,7 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false ) {
                );
                $num = $dbr->numRows( $res );
                print "$num new articles...\n";
-               
+
                $i = 0;
                while ( $row = $dbr->fetchObject( $res ) ) {
                        if ( !( ++$i % REPORTING_INTERVAL ) ) {
@@ -52,24 +52,24 @@ function refreshLinks( $start, $newOnly = false, $maxLag = false ) {
                print("Starting from page_id $start of $end.\n");
 
                for ($id = $start; $id <= $end; $id++) {
-                       
+
                        if ( !($id % REPORTING_INTERVAL) ) {
                                print "$id\n";
                                wfWaitForSlaves( $maxLag );
                        }
                        fixLinksFromArticle( $id );
                }
-               
+
 
        }
 }
 
 function fixLinksFromArticle( $id ) {
        global $wgTitle, $wgArticle, $wgOut, $wgParser;
-       
+
        $wgTitle = Title::newFromID( $id );
        $dbw =& wfGetDB( DB_MASTER );
-       
+
        if ( is_null( $wgTitle ) ) {
                return;
        }
@@ -89,11 +89,11 @@ function fixLinksFromArticle( $id ) {
 
 function deleteLinksFromNonexistent( $maxLag = 0 ) {
        $fname = 'deleteLinksFromNonexistent';
-       
+
        wfWaitForSlaves( $maxLag );
 
        $dbw =& wfGetDB( DB_WRITE );
-       
+
        $linksTables = array(
                'pagelinks' => 'pl_from',
                'imagelinks' => 'il_from',
@@ -115,7 +115,7 @@ function deleteLinksFromNonexistent( $maxLag = 0 ) {
 
                $pTable = $dbw->tableName( $table );
                $sql = "DELETE $pTable FROM $pTable LEFT JOIN $page ON page_id=$field WHERE page_id IS NULL";
-               
+
                print "Deleting $table from non-existent articles...";
                $dbw->query( $sql, $fname );
                print " fixed " .$dbw->affectedRows() . " row(s)\n";
index 0297c5a..0323304 100644 (file)
@@ -20,7 +20,7 @@ function CountEdits( $user_id ) {
        $sql = 'SELECT COUNT(rev_id) AS count FROM ' . $dbw->tableName( 'revision' ) . ' WHERE rev_user = ' . $user_id;
        $res = $dbw->query( $sql );
        $row = $dbw->fetchObject( $res );
-       return( $row->count );  
+       return( $row->count );
 }
 
 # Return an array containing all valid user IDs
index 2a8678f..efd45b3 100644 (file)
@@ -76,7 +76,7 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
 {
        $fname = 'compressWithConcat';
        $loadStyle = LS_CHUNKED;
-       
+
        $dbr =& wfGetDB( DB_SLAVE );
        $dbw =& wfGetDB( DB_MASTER );
 
@@ -107,7 +107,7 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
        $conds = array(
                "old_flags NOT LIKE '%object%' " .
                " AND (old_flags NOT LIKE '%external%' OR old_text NOT LIKE 'DB://%/%/%')");
-       
+
        if ( $beginDate ) {
                $conds[] = "rev_timestamp>'" . $beginDate . "'";
        }
@@ -124,7 +124,7 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
                $fields = array( 'rev_id', 'rev_text_id' );
                $revLoadOptions = array();
        }
-       
+
        # Don't work with current revisions
        $tables[] = 'page';
        $conds[] = 'page_id=rev_page AND rev_id != page_latest';
@@ -156,7 +156,7 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
                while ( $revRow = $dbw->fetchObject( $revRes ) ) {
                        $revs[] = $revRow;
                }
-               
+
                if ( count( $revs ) < 2) {
                        # No revisions matching, no further processing
                        print "\n";
@@ -177,11 +177,11 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
                        $dbw->begin();
                        $usedChunk = false;
                        $primaryOldid = $revs[$i]->rev_text_id;
-                       
+
                        # Get the text of each revision and add it to the object
                        for ( $j = 0; $j < $thisChunkSize && $chunk->isHappy( $maxChunkFactor, $factorThreshold ); $j++ ) {
                                $oldid = $revs[$i + $j]->rev_text_id;
-                               
+
                                # Get text
                                if ( $loadStyle == LS_INDIVIDUAL ) {
                                        $textRow = $dbw->selectRow( 'text',
@@ -221,7 +221,7 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh
                                }
                        }
                        $thisChunkSize = $j;
-                       
+
                        # If we couldn't actually use any stubs because the pages were too small, do nothing
                        if ( $usedChunk ) {
                                if ( $extdb != "" ) {
index 153fbd8..5833418 100644 (file)
@@ -70,7 +70,7 @@ function resolveStub( $id, $stubText, $flags ) {
 
        $dbr =& wfGetDB( DB_SLAVE );
        $dbw =& wfGetDB( DB_MASTER );
-       
+
        if ( get_class( $stub ) !== 'historyblobstub' ) {
                print "Error, invalid stub object\n";
                return;
index 735b3d1..f4de60e 100644 (file)
@@ -103,7 +103,7 @@ class csvStatsOutput extends statsOutput {
 
 function redundant(&$arr) {
        global $wgAllMessagesEn;
-       
+
        $redundant = 0;
        foreach(array_keys($arr) as $key) {
                if ( @$wgAllMessagesEn[$key] === null )
index 635285c..07cdf9d 100644 (file)
@@ -16,7 +16,7 @@ function updateSearchIndex( $start, $end, $maxLockTime, $quiet ) {
 
        $dbw =& wfGetDB( DB_MASTER );
        $recentchanges = $dbw->tableName( 'recentchanges' );
-       
+
        output( "Updating searchindex between $start and $end\n" );
 
        # Select entries from recentchanges which are on top and between the specified times
@@ -68,7 +68,7 @@ function updateSearchIndex( $start, $end, $maxLockTime, $quiet ) {
                        }
                }
        }
-       
+
        # Unlock searchindex
        if ( $maxLockTime ) {
                unlockSearchindex();
index c12e9fd..bb681d6 100644 (file)
@@ -161,7 +161,7 @@ function do_index_update() {
 
 function do_image_index_update() {
        global $wgDatabase;
-       
+
        $meta = $wgDatabase->fieldInfo( "image", "img_major_mime" );
        if( $meta->multiple_key == 0 ) {
                echo "Updating indexes to 20050912: ";
@@ -662,7 +662,7 @@ function do_watchlist_null() {
        # and update old broken items.
        global $wgDatabase;
        $info = $wgDatabase->fieldInfo( 'watchlist', 'wl_notificationtimestamp' );
-       
+
        if( $info->not_null ) {
                echo "Making wl_notificationtimestamp nullable... ";
                dbsource( 'maintenance/archives/patch-watchlist-null.sql', $wgDatabase );
@@ -684,14 +684,14 @@ function do_page_random_update() {
        $page = $wgDatabase->tableName( 'page' );
        $wgDatabase->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", 'do_page_random_update' );
        $rows = $wgDatabase->affectedRows();
-       
+
        echo "changed $rows rows\n";
 }
 
 function do_templatelinks_update() {
        global $wgDatabase, $wgLoadBalancer;
        $fname = 'do_templatelinks_update';
-       
+
        if ( $wgDatabase->tableExists( 'templatelinks' ) ) {
                echo "...templatelinks table already exists\n";
                return;
@@ -720,7 +720,7 @@ function do_templatelinks_update() {
                                        'tl_title' => $row->pl_title,
                                ), $fname
                        );
-                               
+
                }
                $wgDatabase->freeResult( $res );
        } else {
@@ -775,12 +775,12 @@ function do_all_updates() {
 
        do_pagelinks_update(); flush();
        do_templatelinks_update(); flush(); // after pagelinks
-       
+
        do_drop_img_type(); flush();
 
        do_user_unique_update(); flush();
        do_user_groups_update(); flush();
-       
+
        do_watchlist_null(); flush();
 
        //do_image_index_update(); flush();
index ad8e9b6..efe0118 100644 (file)
@@ -25,11 +25,11 @@ class UserDupes {
        var $reassigned;
        var $trimmed;
        var $failed;
-       
+
        function UserDupes( &$database ) {
                $this->db =& $database;
        }
-       
+
        /**
         * Check if this database's user table has already had a unique
         * user_name index applied.
@@ -42,13 +42,13 @@ class UserDupes {
                        echo "WARNING: doesn't seem to have user_name index at all!\n";
                        return false;
                }
-               
+
                # Confusingly, 'Non_unique' is 0 for *unique* indexes,
                # and 1 for *non-unique* indexes. Pass the crack, MySQL,
                # it's obviously some good stuff!
                return ( $info->Non_unique == 0 );
        }
-       
+
        /**
         * Checks the database for duplicate user account records
         * and remove them in preparation for application of a unique
@@ -63,7 +63,7 @@ class UserDupes {
        function clearDupes() {
                return $this->checkDupes( true );
        }
-       
+
        /**
         * Checks the database for duplicate user account records
         * in preparation for application of a unique index on the
@@ -80,18 +80,18 @@ class UserDupes {
         */
        function checkDupes( $doDelete = false ) {
                global $wgDBname;
-               
+
                if( $this->hasUniqueIndex() ) {
                        echo "$wgDBname already has a unique index on its user table.\n";
                        return true;
                }
-               
+
                $this->lock();
-               
+
                echo "Checking for duplicate accounts...\n";
                $dupes = $this->getDupes();
                $count = count( $dupes );
-               
+
                echo "Found $count accounts with duplicate records on $wgDBname.\n";
                $this->trimmed    = 0;
                $this->reassigned = 0;
@@ -99,11 +99,11 @@ class UserDupes {
                foreach( $dupes as $name ) {
                        $this->examine( $name, $doDelete );
                }
-               
+
                $this->unlock();
-               
+
                echo "\n";
-               
+
                if( $this->reassigned > 0 ) {
                        if( $doDelete ) {
                                echo "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n";
@@ -111,7 +111,7 @@ class UserDupes {
                                echo "$this->reassigned duplicate accounts need to have edits reassigned.\n";
                        }
                }
-               
+
                if( $this->trimmed > 0 ) {
                        if( $doDelete ) {
                                echo "$this->trimmed duplicate user records were deleted from $wgDBname.\n";
@@ -119,12 +119,12 @@ class UserDupes {
                                echo "$this->trimmed duplicate user accounts were found on $wgDBname which can be removed safely.\n";
                        }
                }
-               
+
                if( $this->failed > 0 ) {
                        echo "Something terribly awry; $this->failed duplicate accounts were not removed.\n";
                        return false;
                }
-               
+
                if( $this->trimmed == 0 || $doDelete ) {
                        echo "It is now safe to apply the unique index on user_name.\n";
                        return true;
@@ -133,7 +133,7 @@ class UserDupes {
                        return false;
                }
        }
-       
+
        /**
         * We don't want anybody to mess with our stuff...
         * @access private
@@ -147,14 +147,14 @@ class UserDupes {
                }
                $names = array_map( array( $this, 'lockTable' ), $set );
                $tables = implode( ',', $names );
-               
+
                $result = $this->db->query( "LOCK TABLES $tables", $fname );
        }
-       
+
        function lockTable( $table ) {
                return $this->db->tableName( $table ) . ' WRITE';
        }
-       
+
        /**
         * @return bool
         * @access private
@@ -162,7 +162,7 @@ class UserDupes {
        function newSchema() {
                return class_exists( 'Revision' );
        }
-       
+
        /**
         * @access private
         */
@@ -170,7 +170,7 @@ class UserDupes {
                $fname = 'UserDupes::unlock';
                $result = $this->db->query( "UNLOCK TABLES", $fname );
        }
-       
+
        /**
         * Grab usernames for which multiple records are present in the database.
         * @return array
@@ -184,16 +184,16 @@ class UserDupes {
                            FROM $user
                        GROUP BY user_name
                          HAVING n > 1", $fname );
-               
+
                $list = array();
                while( $row = $this->db->fetchObject( $result ) ) {
                        $list[] = $row->user_name;
                }
                $this->db->freeResult( $result );
-               
+
                return $list;
        }
-       
+
        /**
         * Examine user records for the given name. Try to see which record
         * will be the one that actually gets used, then check remaining records
@@ -208,11 +208,11 @@ class UserDupes {
                        array( 'user_id' ),
                        array( 'user_name' => $name ),
                        $fname );
-               
+
                $firstRow = $this->db->fetchObject( $result );
                $firstId  = $firstRow->user_id;
                echo "Record that will be used for '$name' is user_id=$firstId\n";
-               
+
                while( $row = $this->db->fetchObject( $result ) ) {
                        $dupeId = $row->user_id;
                        echo "... dupe id $dupeId: ";
@@ -244,7 +244,7 @@ class UserDupes {
                }
                $this->db->freeResult( $result );
        }
-       
+
        /**
         * Count the number of edits attributed to this user.
         * Does not currently check log table or other things
@@ -261,7 +261,7 @@ class UserDupes {
                                $this->editCountOn( 'old', 'old_user', $userid );
                }
        }
-       
+
        /**
         * Count the number of hits on a given table for this account.
         * @param string $table
@@ -278,7 +278,7 @@ class UserDupes {
                        array( $field => $userid ),
                        $fname ) );
        }
-       
+
        /**
         * @param int $from
         * @param int $to
@@ -292,7 +292,7 @@ class UserDupes {
                        $this->reassignEditsOn( $table, $field, $from, $to );
                }
        }
-       
+
        /**
         * @param string $table
         * @param string $field
@@ -309,7 +309,7 @@ class UserDupes {
                        $fname );
                echo "ok. ";
        }
-       
+
        /**
         * Remove a user account line.
         * @param int $userid
@@ -321,7 +321,7 @@ class UserDupes {
                $this->db->delete( 'user', array( 'user_id' => $userid ), $fname );
                echo " ok";
        }
-       
+
 }
 
 
index 734f6d1..ebe3fb4 100644 (file)
@@ -30,7 +30,7 @@ class SkinCologneBlue extends Skin {
                $s = "";
                $qb = $this->qbSetting();
                $mainPageObj = Title::newMainPage();
-               
+
                $s .= "\n<div id='content'>\n<div id='topbar'>" .
                  "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
 
@@ -97,7 +97,7 @@ class SkinCologneBlue extends Skin {
                if ( 0 != $qb ) { $s .= $this->quickBar(); }
                return $s;
        }
-       
+
        function doGetUserStyles() {
                global $wgOut, $wgStyleSheetPath;
                $s = parent::doGetUserStyles();
@@ -122,7 +122,7 @@ class SkinCologneBlue extends Skin {
                }
                return $s;
        }
-       
+
        function sysLinks() {
                global $wgUser, $wgContLang, $wgTitle;
                $li = $wgContLang->specialPage("Userlogin");
@@ -134,7 +134,7 @@ class SkinCologneBlue extends Skin {
                } else {
                        $q = "returnto={$rt}";
                }
-               
+
                $s = "" .
                  $this->makeKnownLink( wfMsgForContent( "mainpage" ), wfMsg( "mainpage" ) )
                  . " | " .
@@ -198,7 +198,7 @@ class SkinCologneBlue extends Skin {
                                        htmlspecialchars( $link['text'] ) . '</a>' . $sep;
                        }
                }
-               
+
                if ( $wgOut->isArticle() ) {
                        $s .= $this->menuHead( "qbedit" );
                        $s .= "<strong>" . $this->editThisPage() . "</strong>";
@@ -236,7 +236,7 @@ class SkinCologneBlue extends Skin {
                          . $this->historyLink()
                          . $sep . $this->whatLinksHere()
                          . $sep . $this->watchPageLinksLink();
-                       
+
                        if( $tns == NS_USER || $tns == NS_USER_TALK ) {
                                $id=User::idFromName($wgTitle->getText());
                                if ($id != 0) {
@@ -263,7 +263,7 @@ class SkinCologneBlue extends Skin {
                          . $sep . $tl
                          . $sep . $this->specialLink( "watchlist" )
                          . $sep . $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, "Contributions" ),
-                               wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )            
+                               wfMsg( "mycontris" ), "target=" . wfUrlencode($wgUser->getName() ) )
                          . $sep . $this->specialLink( "preferences" )
                          . $sep . $this->specialLink( "userlogout" );
                } else {
@@ -283,7 +283,7 @@ class SkinCologneBlue extends Skin {
                        $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
                              .wfMsg( "sitesupport" )."</a>";
                }
-               
+
                $s .= $sep . $this->makeKnownLinkObj(
                        Title::makeTitle( NS_SPECIAL, 'Specialpages' ),
                        wfMsg( 'moredotdotdot' ) );
index fb8014e..0e2d269 100644 (file)
@@ -43,7 +43,7 @@ class SkinNostalgia extends Skin {
 
                $ol = $this->otherLanguages();
                if($ol) $s .= "<br />" . $ol;
-               
+
                $cat = $this->getCategoryLinks();
                if($cat) $s .= "<br />" . $cat;
 
index 9e20e1a..1c3447d 100644 (file)
@@ -40,7 +40,7 @@ class SkinStandard extends Skin {
                if ( 3 == $this->qbSetting() ) { # Floating left
                        $s .= "<style type='text/css'>\n" .
                          "@import '{$wgStylePath}/common/quickbar.css';\n</style>\n";
-               } else if ( 4 == $this->qbSetting() ) { # Floating right        
+               } else if ( 4 == $this->qbSetting() ) { # Floating right
                        $s .= "<style type='text/css'>\n" .
                          "@import '{$wgStylePath}/common/quickbar-right.css';\n</style>\n";
                }
@@ -68,7 +68,7 @@ class SkinStandard extends Skin {
                } else if ( 4 == $qb) {
                        $s .= "#quickbar { border-right: 1px solid gray; }\n" .
                          "#article { margin-right: 152px; margin-left: 4px; }\n";
-               }       
+               }
                return $s;
        }
 
@@ -151,7 +151,7 @@ class SkinStandard extends Skin {
                $s .= "\n" . $this->logoText() . "\n<hr class='sep' />";
 
                $sep = "\n<br />";
-               
+
                # Use the first heading from the Monobook sidebar as the "browse" section
                $bar = $this->buildSidebar();
                $browseLinks = reset( $bar );
index 2fca0bb..5451cd3 100644 (file)
@@ -50,7 +50,7 @@ class SkinHTMLDump extends SkinTemplate {
                        $this->mTitle->getSubjectPage(),
                        $nskey,
                        !$this->mTitle->isTalkPage() );
-               
+
                $content_actions['talk'] = $this->tabAction(
                        $this->mTitle->getTalkPage(),
                        'talk',
@@ -73,11 +73,11 @@ class SkinHTMLDump extends SkinTemplate {
                if ( !isset( $nt ) ) {
                        return "<!-- ERROR -->{$prefix}{$text}{$trail}";
                }
-               
+
                if ( $nt->getNamespace() == NS_CATEGORY ) {
                        return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
                }
-               
+
                if ( $text == '' ) {
                        $text = $nt->getPrefixedText();
                }
index 953fd43..bd67856 100644 (file)
@@ -6,11 +6,11 @@ require_once( '../includes/Article.php' );
 
 class ArticleTest extends PHPUnit_TestCase {
        var $saveGlobals = array();
-       
+
        function ArticleTest( $name ) {
                $this->PHPUnit_TestCase( $name );
        }
-       
+
        function setUp() {
                $globalSet = array(
                        'wgLegacyEncoding' => false,
@@ -23,13 +23,13 @@ class ArticleTest extends PHPUnit_TestCase {
                        $GLOBALS[$var] = $data;
                }
        }
-       
+
        function tearDown() {
                foreach( $this->saveGlobals as $var => $data ) {
                        $GLOBALS[$var] = $data;
                }
        }
-       
+
        function testGetRevisionText() {
                $row = new stdClass;
                $row->old_flags = '';
@@ -38,7 +38,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        'This is a bunch of revision text.',
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testGetRevisionTextGzip() {
                $row = new stdClass;
                $row->old_flags = 'gzip';
@@ -47,7 +47,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        'This is a bunch of revision text.',
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testGetRevisionTextUtf8Native() {
                $row = new stdClass;
                $row->old_flags = 'utf-8';
@@ -57,7 +57,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        "Wiki est l'\xc3\xa9cole superieur !",
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testGetRevisionTextUtf8Legacy() {
                $row = new stdClass;
                $row->old_flags = '';
@@ -67,7 +67,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        "Wiki est l'\xc3\xa9cole superieur !",
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testGetRevisionTextUtf8NativeGzip() {
                $row = new stdClass;
                $row->old_flags = 'gzip,utf-8';
@@ -77,7 +77,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        "Wiki est l'\xc3\xa9cole superieur !",
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testGetRevisionTextUtf8LegacyGzip() {
                $row = new stdClass;
                $row->old_flags = 'gzip';
@@ -87,7 +87,7 @@ class ArticleTest extends PHPUnit_TestCase {
                        "Wiki est l'\xc3\xa9cole superieur !",
                        Revision::getRevisionText( $row ) );
        }
-       
+
        function testCompressRevisionTextUtf8() {
                $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
                $row->old_flags = Revision::compressRevisionText( $row->old_text );
@@ -114,7 +114,7 @@ class ArticleTest extends PHPUnit_TestCase {
                $this->assertEquals( "Wiki est l'\xe9cole superieur !",
                        Revision::getRevisionText( $row ), "getRevisionText" );
        }
-       
+
        function testCompressRevisionTextUtf8Gzip() {
                $GLOBALS['wgCompressRevisions'] = true;
                $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
index 8a16cb2..a721c98 100644 (file)
@@ -7,25 +7,25 @@ require_once( '../includes/GlobalFunctions.php' );
 
 class DatabaseTest extends PHPUnit_TestCase {
        var $db;
-       
+
        function DatabaseTest( $name ) {
                $this->PHPUnit_TestCase( $name );
        }
-       
+
        function setUp() {
                $this->db =& new Database();
        }
-       
+
        function tearDown() {
                unset( $this->db );
        }
-       
+
        function testAddQuotesNull() {
                $this->assertEquals(
                        'NULL',
                        $this->db->addQuotes( NULL ) );
        }
-       
+
        function testAddQuotesInt() {
                # returning just "1234" should be ok too, though...
                # maybe
@@ -33,7 +33,7 @@ class DatabaseTest extends PHPUnit_TestCase {
                        "'1234'",
                        $this->db->addQuotes( 1234 ) );
        }
-       
+
        function testAddQuotesFloat() {
                # returning just "1234.5678" would be ok too, though
                $this->assertEquals(
@@ -46,7 +46,7 @@ class DatabaseTest extends PHPUnit_TestCase {
                        "'string'",
                        $this->db->addQuotes( 'string' ) );
        }
-       
+
        function testAddQuotesStringQuote() {
                $this->assertEquals(
                        "'string\'s cause trouble'",
@@ -60,7 +60,7 @@ class DatabaseTest extends PHPUnit_TestCase {
                        "SELECT * FROM interwiki",
                        $sql);
        }
-       
+
        function testFillPreparedQuestion() {
                $sql = $this->db->fillPrepared(
                        'SELECT * FROM cur WHERE cur_namespace=? AND cur_title=?',
@@ -69,7 +69,7 @@ class DatabaseTest extends PHPUnit_TestCase {
                        "SELECT * FROM cur WHERE cur_namespace='4' AND cur_title='Snicker\'s_paradox'",
                        $sql);
        }
-       
+
        function testFillPreparedBang() {
                $sql = $this->db->fillPrepared(
                        'SELECT user_id FROM ! WHERE user_name=?',
index b0ed0f5..a3aed8b 100644 (file)
@@ -9,7 +9,7 @@ class GlobalTest extends PHPUnit_TestCase {
        function GlobalTest( $name ) {
                $this->PHPUnit_TestCase( $name );
        }
-       
+
        function setUp() {
                $this->save = array();
                $saveVars = array( 'wgReadOnlyFile' );
@@ -20,52 +20,52 @@ class GlobalTest extends PHPUnit_TestCase {
                }
                $GLOBALS['wgReadOnlyFile'] = wfTempDir() . '/testReadOnly-' . mt_rand();
        }
-       
+
        function tearDown() {
                foreach( $this->save as $var => $data ) {
                        $GLOBALS[$var] = $data;
                }
        }
-       
+
        function testRandom() {
                # This could hypothetically fail, but it shouldn't ;)
                $this->assertFalse(
                        wfRandom() == wfRandom() );
        }
-       
+
        function testUrlencode() {
                $this->assertEquals(
                        "%E7%89%B9%E5%88%A5:Contributions/Foobar",
                        wfUrlencode( "\xE7\x89\xB9\xE5\x88\xA5:Contributions/Foobar" ) );
        }
-       
+
        function testReadOnlyEmpty() {
                $this->assertFalse( wfReadOnly() );
        }
-       
+
        function testReadOnlySet() {
                $f = fopen( $GLOBALS['wgReadOnlyFile'], "wt" );
                fwrite( $f, 'Message' );
                fclose( $f );
                $this->assertTrue( wfReadOnly() );
-               
+
                unlink( $GLOBALS['wgReadOnlyFile'] );
                $this->assertFalse( wfReadOnly() );
        }
-       
+
        function testQuotedPrintable() {
                $this->assertEquals(
                        "=?UTF-8?Q?=C4=88u=20legebla=3F?=",
                        wfQuotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) );
        }
-       
+
        function testTime() {
                $start = wfTime();
                $this->assertType( 'double', $start );
                $end = wfTime();
                $this->assertTrue( $end > $start, "Time is running backwards!" );
        }
-       
+
        function testArrayToCGI() {
                $this->assertEquals(
                        "baz=AT%26T&foo=bar",
@@ -73,7 +73,7 @@ class GlobalTest extends PHPUnit_TestCase {
                                array( 'baz' => 'AT&T', 'ignore' => '' ),
                                array( 'foo' => 'bar', 'baz' => 'overridden value' ) ) );
        }
-       
+
        function testMimeTypeMatch() {
                $this->assertEquals(
                        'text/html',
@@ -95,7 +95,7 @@ class GlobalTest extends PHPUnit_TestCase {
                                array( 'image/png'     => 1.0,
                                       'image/svg+xml' => 0.5 ) ) );
        }
-       
+
        function testNegotiateType() {
                $this->assertEquals(
                        'text/html',
@@ -136,7 +136,7 @@ class GlobalTest extends PHPUnit_TestCase {
                                array( 'text/*'                => 1.0 ),
                                array( 'application/xhtml+xml' => 1.0 ) ) );
        }
-       
+
        function testTimestamp() {
                $t = gmmktime( 12, 34, 56, 1, 15, 2001 );
                $this->assertEquals(
@@ -151,7 +151,7 @@ class GlobalTest extends PHPUnit_TestCase {
                        '2001-01-15 12:34:56',
                        wfTimestamp( TS_DB, $t ),
                        'TS_UNIX to TS_DB' );
-               
+
                $this->assertEquals(
                        '20010115123456',
                        wfTimestamp( TS_MW, '20010115123456' ),
@@ -164,7 +164,7 @@ class GlobalTest extends PHPUnit_TestCase {
                        '2001-01-15 12:34:56',
                        wfTimestamp( TS_DB, '20010115123456' ),
                        'TS_MW to TS_DB' );
-               
+
                $this->assertEquals(
                        '20010115123456',
                        wfTimestamp( TS_MW, '2001-01-15 12:34:56' ),
@@ -178,7 +178,7 @@ class GlobalTest extends PHPUnit_TestCase {
                        wfTimestamp( TS_DB, '2001-01-15 12:34:56' ),
                        'TS_DB to TS_DB' );
        }
-       
+
        /* TODO: many more! */
 }
 
index e9ce295..5babf0a 100644 (file)
@@ -10,10 +10,10 @@ class SanitizerTest extends PHPUnit_TestCase {
        function SanitizerTest( $name ) {
                $this->PHPUnit_TestCase( $name );
        }
-       
+
        function setUp() {
        }
-       
+
        function tearDown() {
        }
 
@@ -28,13 +28,13 @@ class SanitizerTest extends PHPUnit_TestCase {
                        "\xc4\x88io bonas dans l'\xc3\xa9cole!",
                        Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&#233;cole!" ) );
        }
-       
+
        function testDecodeMixed() {
                $this->assertEquals(
                        "\xc4\x88io bonas dans l'\xc3\xa9cole!",
                        Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&eacute;cole!" ) );
        }
-       
+
        function testDecodeMixedComplex() {
                $this->assertEquals(
                        "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas &#x108;io dans l'&eacute;cole)",
@@ -46,19 +46,19 @@ class SanitizerTest extends PHPUnit_TestCase {
                        "a & b",
                        Sanitizer::decodeCharReferences( "a & b" ) );
        }
-       
+
        function testDecodeInvalidNamed() {
                $this->assertEquals(
                        "&foo;",
                        Sanitizer::decodeCharReferences( "&foo;" ) );
        }
-       
+
        function testDecodeInvalidNumbered() {
                $this->assertEquals(
                        UTF8_REPLACEMENT,
                        Sanitizer::decodeCharReferences( "&#88888888888888;" ) );
        }
-       
+
        /* TODO: many more! */
 }
 
index 1c732b3..4ede2a8 100644 (file)
@@ -14,7 +14,7 @@ require_once( '../includes/SearchEngine.php' );
 /** @todo document */
 class SearchEngine_TestCase extends PHPUnit_TestCase {
        var $db, $search;
-       
+
        function insertSearchData() {
                $this->db->safeQuery( <<<END
                INSERT INTO ! (page_id,page_namespace,page_title,page_latest)
@@ -73,7 +73,7 @@ END
 END
                        , $this->db->tableName( 'searchindex' ) );
        }
-       
+
        function fetchIds( &$results ) {
                $matches = array();
                while( $row = $results->fetchObject() ) {
@@ -86,7 +86,7 @@ END
                sort( $matches );
                return $matches;
        }
-       
+
        function testTextSearch() {
                $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." );
                if( !is_null( $this->db ) ) {
@@ -96,7 +96,7 @@ END
                                "Plain search failed" );
                }
        }
-       
+
        function testTextPowerSearch() {
                $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." );
                if( !is_null( $this->db ) ) {
@@ -107,7 +107,7 @@ END
                                "Power search failed" );
                }
        }
-       
+
        function testTitleSearch() {
                $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." );
                if( !is_null( $this->db ) ) {
@@ -117,7 +117,7 @@ END
                                "Title search failed" );
                }
        }
-       
+
        function testTextTitlePowerSearch() {
                $this->assertFalse( is_null( $this->db ), "Can't find a database to test with." );
                if( !is_null( $this->db ) ) {
@@ -128,7 +128,7 @@ END
                                "Title power search failed" );
                }
        }
-       
+
 }
 
 
index 4038572..545af23 100644 (file)
@@ -5,11 +5,11 @@ require_once( '../includes/SearchMySQL4.php' );
 
 class SearchMySQL4Test extends SearchEngine_TestCase {
        var $db;
-       
+
        function SearchMySQL4Test( $name ) {
                $this->PHPUnit_TestCase( $name );
        }
-       
+
        function setUp() {
                $GLOBALS['wgContLang'] = new LanguageUtf8;
                $this->db =& buildTestDatabase(
@@ -20,7 +20,7 @@ class SearchMySQL4Test extends SearchEngine_TestCase {
                }
                $this->search =& new SearchMySQL4( $this->db );
        }
-       
+
        function tearDown() {
                if( !is_null( $this->db ) ) {
                        $this->db->close();