random w/s cleanup
authorMark A. Hershberger <mah@users.mediawiki.org>
Wed, 1 Dec 2010 20:22:45 +0000 (20:22 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Wed, 1 Dec 2010 20:22:45 +0000 (20:22 +0000)
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/IP.php
includes/Licenses.php
includes/User.php
includes/Wiki.php
includes/installer/CoreInstaller.php
includes/installer/PostgresInstaller.php
skins/Vector.php

index c69992f..b179b4b 100644 (file)
@@ -73,7 +73,7 @@ $wgServer = $wgProto.'://' . $serverName;
 # If the port is a non-standard one, add it to the URL
 if(    isset( $_SERVER['SERVER_PORT'] )
        && !strpos( $serverName, ':' )
-    && (    ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 )
+       && (    ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 )
         || ( $wgProto == 'https' && $_SERVER['SERVER_PORT'] != 443 ) ) ) {
 
        $wgServer .= ":" . $_SERVER['SERVER_PORT'];
@@ -504,9 +504,9 @@ $wgRepositoryBaseUrl = "http://commons.wikimedia.org/wiki/File:";
  * This is the list of preferred extensions for uploading files. Uploading files
  * with extensions not in this list will trigger a warning.
  *
- * WARNING: If you add any OpenOffice or Microsoft Office file formats here, 
- * such as odt or doc, and untrusted users are allowed to upload files, then 
- * your wiki will be vulnerable to cross-site request forgery (CSRF). 
+ * WARNING: If you add any OpenOffice or Microsoft Office file formats here,
+ * such as odt or doc, and untrusted users are allowed to upload files, then
+ * your wiki will be vulnerable to cross-site request forgery (CSRF).
  */
 $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg' );
 
@@ -544,7 +544,7 @@ $wgMimeTypeBlacklist = array(
        'application/x-opc+zip',
 );
 
-/** 
+/**
  * This is a flag to determine whether or not to check file extensions on upload.
  *
  * WARNING: setting this to false is insecure for public wikis.
@@ -555,7 +555,7 @@ $wgCheckFileExtensions = true;
  * If this is turned off, users may override the warning for files not covered
  * by $wgFileExtensions.
  *
- * WARNING: setting this to false is insecure for public wikis. 
+ * WARNING: setting this to false is insecure for public wikis.
  */
 $wgStrictFileExtensions = true;
 
@@ -2300,7 +2300,7 @@ $wgBetterDirectionality = false;
  */
 
 /**
- * Client-side resource modules. Extensions should add their module definitions 
+ * Client-side resource modules. Extensions should add their module definitions
  * here.
  *
  * Example:
@@ -2331,8 +2331,8 @@ $wgResourceLoaderMaxage = array(
 );
 
 /**
- * Whether to embed private modules inline with HTML output or to bypass 
- * caching and check the user parameter against $wgUser to prevent 
+ * Whether to embed private modules inline with HTML output or to bypass
+ * caching and check the user parameter against $wgUser to prevent
  * unauthorized access to private modules.
  */
 $wgResourceLoaderInlinePrivateModules = true;
index 9dbfde1..5e228bb 100644 (file)
@@ -1287,9 +1287,9 @@ function wfCheckLimits( $deflimit = 50, $optionname = 'rclimit' ) {
  */
 function wfEscapeWikiText( $text ) {
        $text = str_replace(
-               array( '[',     '|',      ']',     '\'',    'ISBN ',     
+               array( '[',     '|',      ']',     '\'',    'ISBN ',
                        'RFC ',     '://',     "\n=",     '{{',           '}}' ),
-               array( '&#91;', '&#124;', '&#93;', '&#39;', 'ISBN&#32;', 
+               array( '&#91;', '&#124;', '&#93;', '&#39;', 'ISBN&#32;',
                        'RFC&#32;', '&#58;//', "\n&#61;", '&#123;&#123;', '&#125;&#125;' ),
                htmlspecialchars( $text )
        );
@@ -1987,7 +1987,7 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
        $uts = 0;
        $da = array();
        $strtime = '';
-       
+
        if ( $ts === 0 ) {
                $uts = time();
                $strtime = "@$uts";
@@ -2034,7 +2034,7 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
                return false;
        }
 
-       
+
 
        static $formats = array(
                TS_UNIX => 'U',
@@ -2058,7 +2058,7 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
                        $ds = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.00+00:00",
                                (int)$da[1], (int)$da[2], (int)$da[3],
                                (int)$da[4], (int)$da[5], (int)$da[6]);
-                       
+
                        $d = date_create( $ds, new DateTimeZone( 'GMT' ) );
                } elseif ( $strtime ) {
                        $d = date_create( $strtime, new DateTimeZone( 'GMT' ) );
@@ -2081,12 +2081,12 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
                } elseif ( $strtime ) {
                        $uts = strtotime( $strtime );
                }
-               
+
                if ( $uts === false ) {
                        wfDebug("wfTimestamp() can't parse the timestamp (non 32-bit time? Update php): $outputtype; $ts\n");
                        return false;
                }
-               
+
                if ( TS_UNIX == $outputtype ) {
                        return $uts;
                }
@@ -2510,7 +2510,7 @@ function wfDl( $extension ) {
  * @param $cmd String Command line, properly escaped for shell.
  * @param &$retval optional, will receive the program's exit code.
  *                 (non-zero is usually failure)
- * @param $environ Array optional environment variables which should be 
+ * @param $environ Array optional environment variables which should be
  *                 added to the executed command environment.
  * @return collected stdout as a string (trailing newlines stripped)
  */
@@ -2545,22 +2545,22 @@ function wfShellExec( $cmd, &$retval = null, $environ = array() ) {
        $envcmd = '';
        foreach( $environ as $k => $v ) {
                if ( wfIsWindows() ) {
-                       /* Surrounding a set in quotes (method used by wfEscapeShellArg) makes the quotes themselves 
-                        * appear in the environment variable, so we must use carat escaping as documented in 
-                        * http://technet.microsoft.com/en-us/library/cc723564.aspx 
-                        * Note however that the quote isn't listed there, but is needed, and the parentheses 
+                       /* Surrounding a set in quotes (method used by wfEscapeShellArg) makes the quotes themselves
+                        * appear in the environment variable, so we must use carat escaping as documented in
+                        * http://technet.microsoft.com/en-us/library/cc723564.aspx
+                        * Note however that the quote isn't listed there, but is needed, and the parentheses
                         * are listed there but doesn't appear to need it.
                         */
                        $envcmd .= "set $k=" . preg_replace( '/([&|()<>^"])/', '^\\1', $v ) . ' && ';
                } else {
-                       /* Assume this is a POSIX shell, thus required to accept variable assignments before the command 
+                       /* Assume this is a POSIX shell, thus required to accept variable assignments before the command
                         * http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01
                         */
                        $envcmd .= "$k=" . escapeshellarg( $v ) . ' ';
                }
        }
        $cmd = $envcmd . $cmd;
-       
+
        if ( wfIsWindows() ) {
                if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && /* Fixed in 5.3.0 :) */
                        ( version_compare( PHP_VERSION, '5.2.1', '>=' ) || php_uname( 's' ) == 'Windows NT' ) )
@@ -3585,20 +3585,20 @@ function wfArrayMap( $function, $input ) {
 
 /**
  * Returns the PackageRepository object for interaction with the package repository.
- * 
- * TODO: Make the repository type also configurable. 
- * 
+ *
+ * TODO: Make the repository type also configurable.
+ *
  * @since 1.17
- * 
+ *
  * @return PackageRepository
  */
 function wfGetRepository() {
        global $wgRepositoryApiLocation;
        static $repository = false;
-       
+
        if ( $repository === false ) {
                $repository = new DistributionRepository( $wgRepositoryApiLocation );
        }
-       
+
        return $repository;
 }
index 9befb59..0883992 100644 (file)
@@ -599,7 +599,7 @@ class IP {
                // IPv6 loopback address
                $m = array();
                if ( preg_match( '/^0*' . RE_IPV6_GAP . '1$/', $addr, $m ) ) {
-                       return '127.0.0.1';
+                       return '127.0.0.1';
                }
                // IPv4-mapped and IPv4-compatible IPv6 addresses
                if ( preg_match( '/^' . RE_IPV6_V4_PREFIX . '(' . RE_IP_ADD . ')$/i', $addr, $m ) ) {
index 96ee124..45944c7 100644 (file)
@@ -31,7 +31,7 @@ class Licenses extends HTMLFormField {
         */
        public function __construct( $params ) {
                parent::__construct( $params );
-               
+
                $this->msg = empty( $params['licenses'] ) ? wfMsgForContent( 'licenses' ) : $params['licenses'];
                $this->selected = null;
 
@@ -105,7 +105,7 @@ class Licenses extends HTMLFormField {
        protected function outputOption( $text, $value, $attribs = null, $depth = 0 ) {
                $attribs['value'] = $value;
                if ( $value === $this->selected )
-                       $attribs['selected'] = 'selected';              
+                       $attribs['selected'] = 'selected';
                $val = str_repeat( /* &nbsp */ "\xc2\xa0", $depth * 2 ) . $text;
                return str_repeat( "\t", $depth ) . Xml::element( 'option', $attribs, $val ) . "\n";
        }
@@ -131,18 +131,18 @@ class Licenses extends HTMLFormField {
         */
        public function getInputHTML( $value ) {
                $this->selected = $value;
-               
+
                $this->html = $this->outputOption( wfMsg( 'nolicense' ), '',
                        (bool)$this->selected ? null : array( 'selected' => 'selected' ) );
                $this->makeHtml( $this->getLicenses() );
-               
+
                $attribs = array(
                        'name' => $this->mName,
                        'id' => $this->mID
                );
                if ( !empty( $this->mParams['disabled'] ) )
                        $attibs['disabled'] = 'disabled';
-               
+
                return Html::rawElement( 'select', $attribs, $this->html );
        }
 }
index bd56fc1..c85558f 100644 (file)
@@ -556,7 +556,7 @@ class User {
         * either by batch processes or by user accounts which have
         * already been created.
         *
-        * Additional blacklisting may be added here rather than in 
+        * Additional blacklisting may be added here rather than in
         * isValidUserName() to avoid disrupting existing accounts.
         *
         * @param $name \string String to match
@@ -615,7 +615,7 @@ class User {
                                return 'passwordtooshort';
                        } elseif ( $lcPassword == $wgContLang->lc( $this->mName ) ) {
                                return 'password-name-match';
-                       } elseif ( in_array( $lcPassword, $wgWeakPasswords ) ) {                        
+                       } elseif ( in_array( $lcPassword, $wgWeakPasswords ) ) {
                                return 'password-too-weak';
                        } else {
                                //it seems weird returning true here, but this is because of the
@@ -658,7 +658,7 @@ class User {
                [$rfc1034_ldh_str]+       # First domain part
                (\\.[$rfc1034_ldh_str]+)+  # Following part prefixed with a dot
                $                      # End of string
-               /ix" ; // case Insensitive, eXtended 
+               /ix" ; // case Insensitive, eXtended
 
                return (bool) preg_match( $HTML5_email_regexp, $addr );
        }
@@ -1762,11 +1762,11 @@ class User {
                        }
 
                        if( !$this->isValidPassword( $str ) ) {
-                               global $wgMinimalPasswordLength;
+                               global $wgMinimalPasswordLength;
                                $valid = $this->getPasswordValidity( $str );
                                throw new PasswordError( wfMsgExt( $valid, array( 'parsemag' ),
                                        $wgMinimalPasswordLength ) );
-                       }
+                       }
                }
 
                if( !$wgAuth->setPassword( $this, $str ) ) {
@@ -2038,7 +2038,7 @@ class User {
                global $wgMaxArticleSize; # Maximum article size, in Kb
                $threshold = intval( $this->getOption( 'stubthreshold' ) );
                if ( $threshold > $wgMaxArticleSize * 1024 ) {
-                       # If they have set an impossible value, disable the preference 
+                       # If they have set an impossible value, disable the preference
                        # so we can use the parser cache again.
                        $threshold = 0;
                }
@@ -2248,7 +2248,7 @@ class User {
                        return $this->mSkin;
                }
        }
-       
+
        // Creates a Skin object, for getSkin()
        private function createSkinObject() {
                wfProfileIn( __METHOD__ );
@@ -2267,7 +2267,7 @@ class User {
 
                $skin = Skin::newFromKey( $userSkin );
                wfProfileOut( __METHOD__ );
-               
+
                return $skin;
        }
 
@@ -2402,7 +2402,7 @@ class User {
 
                // If an option is not set in $str, use the default value
                $this->mOptions = self::getDefaultOptions();
-               
+
                $a = explode( "\n", $str );
                foreach ( $a as $s ) {
                        $m = array();
@@ -2514,8 +2514,8 @@ class User {
                                'user_newpassword' => $this->mNewpassword,
                                'user_newpass_time' => $dbw->timestampOrNull( $this->mNewpassTime ),
                                'user_real_name' => $this->mRealName,
-                               'user_email' => $this->mEmail,
-                               'user_email_authenticated' => $dbw->timestampOrNull( $this->mEmailAuthenticated ),
+                               'user_email' => $this->mEmail,
+                               'user_email_authenticated' => $dbw->timestampOrNull( $this->mEmailAuthenticated ),
                                'user_options' => '',
                                'user_touched' => $dbw->timestamp( $this->mTouched ),
                                'user_token' => $this->mToken,
@@ -2672,7 +2672,7 @@ class User {
                wfDeprecated( __METHOD__ );
 
                // stubthreshold is only included below for completeness,
-               // since it disables the parser cache, its value will always 
+               // since it disables the parser cache, its value will always
                // be 0 when this function is called by parsercache.
 
                $confstr =        $this->getOption( 'math' );
index e961090..bc5ad01 100644 (file)
@@ -50,11 +50,11 @@ class MediaWiki {
         */
        function performRequestForTitle( &$title, &$article, &$output, &$user, $request ) {
                wfProfileIn( __METHOD__ );
-               
+
                $output->setTitle( $title );
-               
+
                wfRunHooks( 'BeforeInitialize', array( &$title, &$article, &$output, &$user, $request, $this ) );
-               
+
                if( !$this->preliminaryChecks( $title, $output, $request ) ) {
                        wfProfileOut( __METHOD__ );
                        return;
@@ -323,11 +323,11 @@ class MediaWiki {
                {
                        // Give extensions a change to ignore/handle redirects as needed
                        $ignoreRedirect = $target = false;
-                       
+
                        $dbr = wfGetDB( DB_SLAVE );
                        $article->loadPageData( $article->pageDataFromTitle( $dbr, $title ) );
 
-                       wfRunHooks( 'InitializeArticleMaybeRedirect', 
+                       wfRunHooks( 'InitializeArticleMaybeRedirect',
                                array(&$title,&$request,&$ignoreRedirect,&$target,&$article) );
 
                        // Follow redirects only for... redirects.
index 78661e8..8809ea2 100644 (file)
@@ -298,7 +298,7 @@ abstract class CoreInstaller extends Installer {
        /**
         * Get an array of install steps. These could be a plain key like the defaults
         * in $installSteps, or could be an array with a name and a specific callback
-        * There must be a config-install-$step message defined per step, which will 
+        * There must be a config-install-$step message defined per step, which will
         * be shown on install.
         *
         * @param $installer DatabaseInstaller so we can make callbacks
@@ -315,7 +315,7 @@ abstract class CoreInstaller extends Installer {
                        array( 'name' => 'mainpage',  'callback' => array( $this, 'createMainpage' ) ),
                );
                if( count( $this->getVar( '_Extensions' ) ) ) {
-                       array_unshift( $installSteps, 
+                       array_unshift( $installSteps,
                                array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
                        );
                }
@@ -374,9 +374,9 @@ abstract class CoreInstaller extends Installer {
        protected function generateSecretKey() {
                return $this->generateSecret( 'wgSecretKey' );
        }
-       
+
        /**
-        * Generate a secret value for a variable using either 
+        * Generate a secret value for a variable using either
         * /dev/urandom or mt_rand() Produce a warning in the later case.
         *
         * @return Status
@@ -411,7 +411,7 @@ abstract class CoreInstaller extends Installer {
        }
 
        /**
-        * Generate a default $wgUpradeKey, Will warn if we had to use 
+        * Generate a default $wgUpradeKey, Will warn if we had to use
         * mt_rand() instead of /dev/urandom
         *
         * @return Status
@@ -453,7 +453,7 @@ abstract class CoreInstaller extends Installer {
 
        /**
         * Insert Main Page with default content.
-        * 
+        *
         * @return Status
         */
        protected function createMainpage( DatabaseInstaller &$installer ) {
@@ -468,9 +468,9 @@ abstract class CoreInstaller extends Installer {
                                                                User::newFromName( 'MediaWiki Default' ) );
                } catch (MWException $e) {
                        //using raw, because $wgShowExceptionDetails can not be set yet
-                       $status->fatal( 'config-install-mainpage-failed', $e->getMessage() ); 
+                       $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
                }
-               
+
                return $status;
        }
 
index 1eead9c..5851bb1 100644 (file)
@@ -5,7 +5,7 @@
  * @file
  * @ingroup Deployment
  */
+
 /**
  * Class for setting up the MediaWiki database using Postgres.
  *
index 4da6bf3..469569d 100644 (file)
@@ -373,26 +373,26 @@ class VectorTemplate extends QuickTemplate {
                                }
                                $nav[$section][$key]['attributes'] =
                                        ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
-                               if ( $nav[$section][$key]['class'] ) {
+                               if ( $nav[$section][$key]['class'] ) {
                                        $nav[$section][$key]['attributes'] .=
                                                ' class="' . htmlspecialchars( $link['class'] ) . '"';
                                        unset( $nav[$section][$key]['class'] );
-                               }
+                               }
                                // We don't want to give the watch tab an accesskey if the page
                                // is being edited, because that conflicts with the accesskey on
                                // the watch checkbox.  We also don't want to give the edit tab
                                // an accesskey, because that's fairly superfluous and conflicts
                                // with an accesskey (Ctrl-E) often used for editing in Safari.
-                               if (
+                               if (
                                        in_array( $action, array( 'edit', 'submit' ) ) &&
                                        in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
                                ) {
-                                       $nav[$section][$key]['key'] =
+                                       $nav[$section][$key]['key'] =
                                                $this->skin->tooltip( $xmlID );
-                               } else {
-                                       $nav[$section][$key]['key'] =
+                               } else {
+                                       $nav[$section][$key]['key'] =
                                                $this->skin->tooltipAndAccesskey( $xmlID );
-                               }
+                               }
                        }
                }
                $this->data['namespace_urls'] = $nav['namespaces'];
@@ -434,7 +434,7 @@ class VectorTemplate extends QuickTemplate {
                $footerlinksClasses = array(
                        'icons' => array( 'noprint' )
                );
-               
+
                // Reduce footer links down to only those which are being used
                $validFooterLinks = array();
                foreach( $footerlinks as $category => $links ) {