Fixed a bunch of silly instances of [^!=]==\s*(true|false)
authorChad Horohoe <demon@users.mediawiki.org>
Wed, 9 Jun 2010 11:44:05 +0000 (11:44 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Wed, 9 Jun 2010 11:44:05 +0000 (11:44 +0000)
21 files changed:
config/Installer.php
includes/BagOStuff.php
includes/EditPage.php
includes/GlobalFunctions.php
includes/ImageGallery.php
includes/OutputPage.php
includes/SkinTemplate.php
includes/SpecialPage.php
includes/Title.php
includes/api/ApiProtect.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php
includes/parser/CoreParserFunctions.php
includes/parser/ParserOutput.php
languages/LanguageConverter.php
languages/messages/MessagesEn.php
maintenance/rebuildrecentchanges.php
maintenance/refreshLinks.php
maintenance/runJobs.php

index 082d491..191ca85 100644 (file)
@@ -1330,7 +1330,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                $localSettings = str_replace( "\r\n", "\n", $localSettings );
                $f = fopen( "LocalSettings.php", 'xt' );
 
-               if( $f == false ) {
+               if( !$f ) {
                        print( "</li>\n" );
                        dieout( "<p>Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...</p>\n" .
                        "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
index aa52a84..fb57ad0 100644 (file)
@@ -102,7 +102,7 @@ abstract class BagOStuff {
        }
 
        public function add( $key, $value, $exptime = 0 ) {
-               if ( $this->get( $key ) == false ) {
+               if ( !$this->get( $key ) ) {
                        $this->set( $key, $value, $exptime );
 
                        return true;
index a158193..8830a7d 100644 (file)
@@ -2628,7 +2628,7 @@ INPUTS
        }
 
        function getBaseRevision() {
-               if ( $this->mBaseRevision == false ) {
+               if ( !$this->mBaseRevision ) {
                        $db = wfGetDB( DB_MASTER );
                        $baseRevision = Revision::loadFromTimestamp(
                                $db, $this->mTitle, $this->edittime );
index 005fb8e..273a7d0 100644 (file)
@@ -1500,7 +1500,7 @@ function wfMerge( $old, $mine, $yours, &$result ){
        pclose( $handle );
        unlink( $mytextName ); unlink( $oldtextName ); unlink( $yourtextName );
 
-       if ( $result === '' && $old !== '' && $conflict == false ) {
+       if ( $result === '' && $old !== '' && !$conflict ) {
                wfDebug( "Unexpected null result from diff3. Command: $cmd\n" );
                $conflict = true;
        }
index e5a8070..0b44ab9 100644 (file)
@@ -183,7 +183,7 @@ class ImageGallery
         * @param $f Boolean: set to false to disable.
         */
        function setShowBytes( $f ) {
-               $this->mShowBytes = ( $f == true);
+               $this->mShowBytes = $f;
        }
 
        /**
@@ -193,7 +193,7 @@ class ImageGallery
         * @param $f Boolean: set to false to disable.
         */
        function setShowFilename( $f ) {
-               $this->mShowFilename = ( $f == true);
+               $this->mShowFilename = $f;
        }
 
        /**
index 9722be8..3812ce1 100644 (file)
@@ -39,6 +39,7 @@ class OutputPage {
        var $mParseWarnings = array();
        var $mSquidMaxage = 0;
        var $mRevisionId = null;
+       var $mPageIcons = array();
        protected $mTitle = null;
 
        /**
@@ -1079,6 +1080,7 @@ class OutputPage {
                $this->addCategoryLinks( $parserOutput->getCategories() );
                $this->mNewSectionLink = $parserOutput->getNewSection();
                $this->mHideNewSectionLink = $parserOutput->getHideNewSection();
+               $this->mPageIcons = $parserOutput->getPageIcons();
 
                $this->mParseWarnings = $parserOutput->getWarnings();
                if ( !$parserOutput->isCacheable() ) {
index e049f57..c5d09b2 100644 (file)
@@ -230,6 +230,21 @@ class SkinTemplate extends Skin {
                $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) );
                $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
 
+               $icons = '';
+               foreach( $out->mPageIcons as $icon ) {
+                       list( $file, $alt ) = $icon;
+                       $fileAttr = array( 'src' => $file->createThumb( 16 ) );
+                       if( $alt != '' ) {
+                               $msg = wfMsg( $alt );
+                               if( !wfEmptyMsg( $alt ) ) {
+                                       $alt = $msg;
+                               }
+                               $fileAttr['alt'] = htmlspecialchars( $alt );
+                       }
+                       $icons .= Html::element( 'img', $fileAttr ) . "&nbsp;";
+               }
+               $tpl->set( 'pageicons', $icons );
+
                $nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ?
                                        MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) :
                                        $this->mTitle->getNsText();
index b0f8fc4..c452b17 100644 (file)
@@ -698,7 +698,7 @@ Perhaps no page aliases are defined for it?" );
                $this->mRestriction = $restriction;
                $this->mListed = $listed;
                $this->mIncludable = $includable;
-               if ( $function == false ) {
+               if ( !$function ) {
                        $this->mFunction = 'wfSpecial'.$name;
                } else {
                        $this->mFunction = $function;
index 8bdc183..29a4e70 100644 (file)
@@ -824,7 +824,7 @@ class Title {
                }
 
                // internal links should point to same variant as current page (only anonymous users)
-               if ( $variant == false && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) {
+               if ( !$variant && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) {
                        $pref = $wgContLang->getPreferredVariant( false );
                        if ( $pref != $wgContLang->getCode() )
                                $variant = $pref;
@@ -843,7 +843,7 @@ class Title {
                        $dbkey = wfUrlencode( $this->getPrefixedDBkey() );
                        if ( $query == '' ) {
                                if ( $variant != false && $wgContLang->hasVariants() ) {
-                                       if ( $wgVariantArticlePath == false ) {
+                                       if ( !$wgVariantArticlePath ) {
                                                $variantArticlePath =  "$wgScript?title=$1&variant=$2"; // default
                                        } else {
                                                $variantArticlePath = $wgVariantArticlePath;
@@ -1474,7 +1474,7 @@ class Title {
                                $scBlockExpiryOptions = wfMsg( 'ipboptions' );
 
                                foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) {
-                                       if ( strpos( $option, ':' ) == false )
+                                       if ( !strpos( $option, ':' ) )
                                                continue;
 
                                        list ( $show, $value ) = explode( ":", $option );
index 0dfa6a9..126303c 100644 (file)
@@ -95,7 +95,7 @@ class ApiProtect extends ApiBase {
                                $expiryarray[$p[0]] = Block::infinity();
                        } else {
                                $exp = strtotime( $expiry[$i] );
-                               if ( $exp < 0 || $exp == false ) {
+                               if ( $exp < 0 || !$exp ) {
                                        $this->dieUsageMsg( array( 'invalidexpiry', $expiry[$i] ) );
                                }
 
index e53c028..2319056 100644 (file)
@@ -520,7 +520,7 @@ class DatabaseIbm_db2 extends DatabaseBase {
                // Rather, turn autocommit off in the begin function and turn on after a commit
                db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON);
 
-               if ( $this->mConn == false ) {
+               if ( !$this->mConn ) {
                        $this->installPrint( "DB connection error\n" );
                        $this->installPrint( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
                        $this->installPrint( $this->lastError()."\n" );
index bd60bbf..bb967fc 100644 (file)
@@ -249,7 +249,7 @@ class DatabaseOracle extends DatabaseBase {
                        $this->mConn = oci_connect( $user, $password, $dbName, $this->defaultCharset, $session_mode );
                }
 
-               if ( $this->mConn == false ) {
+               if ( !$this->mConn ) {
                        wfDebug( "DB connection error\n" );
                        wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
                        wfDebug( $this->lastError() . "\n" );
@@ -310,7 +310,7 @@ class DatabaseOracle extends DatabaseBase {
                        return false;
                }
 
-               if ( oci_execute( $stmt, $this->execFlags() ) == false ) {
+               if ( !oci_execute( $stmt, $this->execFlags() ) ) {
                        $e = oci_error( $stmt );
                        if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) {
                                $this->reportQueryError( $e['message'], $e['code'], $sql, __FUNCTION__ );
@@ -1013,7 +1013,7 @@ class DatabaseOracle extends DatabaseBase {
                // Avoid the non-standard "REPLACE INTO" syntax
                echo "<li>Populating interwiki table</li>\n";
                $f = fopen( "../maintenance/interwiki.sql", 'r' );
-               if ( $f == false ) {
+               if ( !$f ) {
                        dieout( "Could not find the interwiki.sql file" );
                }
 
index cf62554..e321906 100644 (file)
@@ -181,7 +181,7 @@ class DatabasePostgres extends DatabaseBase {
                $this->mConn = pg_connect( $connectString );
                $phpError = $this->restoreErrorHandler();
 
-               if ( $this->mConn == false ) {
+               if ( !$this->mConn ) {
                        wfDebug( "DB connection error\n" );
                        wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
                        wfDebug( $this->lastError()."\n" );
@@ -309,7 +309,7 @@ class DatabasePostgres extends DatabaseBase {
                                $connectVars['password'] = $password;
 
                                @$this->mConn = pg_connect( $this->makeConnectionString( $connectVars ) );
-                               if ( $this->mConn == false ) {
+                               if ( $this->mConn ) {
                                        print "<b>FAILED TO CONNECT!</b></li>";
                                        dieout("</ul>");
                                }
@@ -1355,7 +1355,7 @@ SQL;
                echo "<li>Populating interwiki table... ";
                ## Avoid the non-standard "REPLACE INTO" syntax
                $f = fopen( "../maintenance/interwiki.sql", 'r' );
-               if ($f == false ) {
+               if ( $f ) {
                        print "<b>FAILED</b></li>";
                        dieout( "Could not find the interwiki.sql file" );
                }
index c149cf0..83876b4 100644 (file)
@@ -494,7 +494,7 @@ class DatabaseSqlite extends DatabaseBase {
 
                # Use DatabasePostgres's code to populate interwiki from MySQL template
                $f = fopen( "$IP/maintenance/interwiki.sql", 'r' );
-               if ( $f == false ) {
+               if ( !$f ) {
                        dieout( "Could not find the interwiki.sql file." );
                }
                
index c3e9884..d557711 100644 (file)
@@ -69,6 +69,7 @@ class CoreParserFunctions {
                $parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
                $parser->setFunctionHook( 'tag',              array( __CLASS__, 'tagObj'           ), SFH_OBJECT_ARGS );
                $parser->setFunctionHook( 'formatdate',       array( __CLASS__, 'formatDate'       ) );
+               $parser->setFunctionHook( 'pageicon',         array( __CLASS__, 'pageicon'        ) );
 
                if ( $wgAllowDisplayTitle ) {
                        $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
@@ -628,6 +629,14 @@ class CoreParserFunctions {
                }
        }
 
+       public static function pageicon( $parser, $name = '', $alt = '' ) {
+               $file = wfFindFile( $name );
+               if( $file ) {
+                       $parser->mOutput->addPageIcon( $file, $alt );
+               }
+               return '';
+       }
+
        /**
         * Parser function to extension tag adaptor
         */
index 1f390a2..b2a774e 100644 (file)
@@ -28,7 +28,8 @@ class ParserOutput
                $mSections = array(),         # Table of contents
                $mProperties = array(),       # Name/value pairs to be cached in the DB
                $mTOCHTML = '';               # HTML of the TOC
-       private $mIndexPolicy = '';           # 'index' or 'noindex'?  Any other value will result in no change.
+       private $mIndexPolicy = '',           # 'index' or 'noindex'?  Any other value will result in no change.
+               $mPageIcons = array();        # Array of icons to show for the page (like Protect, Featured, etc)
 
        function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(),
                $containsOldMagic = false, $titletext = '' )
@@ -59,6 +60,7 @@ class ParserOutput
        function getWarnings()               { return array_keys( $this->mWarnings ); }
        function getIndexPolicy()            { return $this->mIndexPolicy; }
        function getTOCHTML()                { return $this->mTOCHTML; }
+       function getPageIcons()              { return $this->mPageIcons; }
 
        function containsOldMagic()          { return $this->mContainsOldMagic; }
        function setText( $text )            { return wfSetVar( $this->mText, $text ); }
@@ -250,6 +252,15 @@ class ParserOutput
                }
        }
 
+       /**
+        * Add page icons to the parser output.
+        * @param File $file A valid file
+        * @param String $alt Alt text, if any
+        */
+       function addPageIcon( $file, $alt = '' ) {
+               $this->mPageIcons[] = array( $file, $alt );
+       }
+
        /**
         * Override the title to be used for display
         * -- this is assumed to have been validated
index 06f794d..c983583 100644 (file)
@@ -698,7 +698,7 @@ class LanguageConverter {
                }
 
                $variants = $this->autoConvertToAllVariants( $link );
-               if ( $variants == false ) { // give up
+               if ( !$variants ) { // give up
                        return;
                }
 
index ce69a93..3c396e3 100644 (file)
@@ -356,6 +356,7 @@ $magicWords = array(
        'url_path'               => array( 0,    'PATH' ),
        'url_wiki'               => array( 0,    'WIKI' ),
        'url_query'              => array( 0,    'QUERY' ),
+       'pageicon'               => array( 1,    'pageicon' ),
 );
 
 /**
index dc6db59..8bd0458 100644 (file)
@@ -216,10 +216,10 @@ class RebuildRecentchanges extends Maintenance {
        
                $botgroups = $autopatrolgroups = array();
                foreach ( $wgGroupPermissions as $group => $rights ) {
-                       if ( isset( $rights['bot'] ) && $rights['bot'] == true ) {
+                       if ( isset( $rights['bot'] ) && $rights['bot'] ) {
                                $botgroups[] = $dbw->addQuotes( $group );
                        }
-                       if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] == true ) {
+                       if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] ) {
                                $autopatrolgroups[] = $dbw->addQuotes( $group );
                        }
                }
index 018e3d7..917c53a 100644 (file)
@@ -176,7 +176,7 @@ class RefreshLinks extends Maintenance {
        
                $rt = $wgArticle->followRedirect();
        
-               if ( $rt == false || !is_object( $rt ) ) {
+               if ( !$rt || !is_object( $rt ) ) {
                        // $wgTitle is not a redirect
                        // Delete any redirect table entry for it
                        $dbw->delete( 'redirect', array( 'rd_from' => $id ),
index 99d30ea..25dde7d 100644 (file)
@@ -64,11 +64,9 @@ class RunJobs extends Maintenance {
                while ( $dbw->selectField( 'job', 'job_id', $conds, 'runJobs.php' ) ) {
                        $offset = 0;
                        for ( ; ; ) {
-                               $job = ( $type == false ) ?
-                                               Job::pop( $offset )
-                                               : Job::pop_type( $type );
+                               $job = !$type ? Job::pop( $offset ) : Job::pop_type( $type );
 
-                               if ( $job == false )
+                               if ( !$job )
                                        break;
 
                                wfWaitForSlaves( 5 );