Merge "Revert "Add support for svg in .list-style-image""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 13 Sep 2014 13:18:30 +0000 (13:18 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 13 Sep 2014 13:18:30 +0000 (13:18 +0000)
includes/Preferences.php
includes/api/ApiEmailUser.php
includes/db/DatabaseMysqli.php
includes/pager/TablePager.php
includes/rcfeed/MachineReadableRCFeedFormatter.php
includes/resourceloader/ResourceLoader.php
includes/specials/SpecialEmailuser.php
resources/src/mediawiki.special/mediawiki.special.userlogin.common.css
resources/src/mediawiki/mediawiki.js

index eb29e41..e0d5ed7 100644 (file)
@@ -113,8 +113,7 @@ class Preferences {
         */
        static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
                ## Remove preferences that wikis don't want to use
-               global $wgHiddenPrefs;
-               foreach ( $wgHiddenPrefs as $pref ) {
+               foreach ( $context->getConfig()->get( 'HiddenPrefs' ) as $pref ) {
                        if ( isset( $defaultPreferences[$pref] ) ) {
                                unset( $defaultPreferences[$pref] );
                        }
@@ -207,12 +206,9 @@ class Preferences {
         * @return void
         */
        static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgAuth, $wgContLang, $wgParser, $wgLanguageCode,
-                       $wgDisableLangConversion, $wgMaxSigChars,
-                       $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
-                       $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress,
-                       $wgSecureLogin;
+               global $wgAuth, $wgContLang, $wgParser;
 
+               $config = $context->getConfig();
                // retrieving user name for GENDER and misc.
                $userName = $user->getName();
 
@@ -310,7 +306,7 @@ class Preferences {
                        );
                }
                // Only show prefershttps if secure login is turned on
-               if ( $wgSecureLogin && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
+               if ( $config->get( 'SecureLogin' ) && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
                        $defaultPreferences['prefershttps'] = array(
                                'type' => 'toggle',
                                'label-message' => 'tog-prefershttps',
@@ -321,8 +317,9 @@ class Preferences {
 
                // Language
                $languages = Language::fetchLanguageNames( null, 'mw' );
-               if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
-                       $languages[$wgLanguageCode] = $wgLanguageCode;
+               $languageCode = $config->get( 'LanguageCode' );
+               if ( !array_key_exists( $languageCode, $languages ) ) {
+                       $languages[$languageCode] = $languageCode;
                }
                ksort( $languages );
 
@@ -353,7 +350,7 @@ class Preferences {
                );
 
                // see if there are multiple language variants to choose from
-               if ( !$wgDisableLangConversion ) {
+               if ( !$config->get( 'DisableLangConversion' ) ) {
                        foreach ( LanguageConverter::$languagesWithVariants as $langCode ) {
                                if ( $langCode == $wgContLang->getCode() ) {
                                        $variants = $wgContLang->getVariants();
@@ -418,7 +415,7 @@ class Preferences {
                );
                $defaultPreferences['nickname'] = array(
                        'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
-                       'maxlength' => $wgMaxSigChars,
+                       'maxlength' => $config->get( 'MaxSigChars' ),
                        'label-message' => 'yournick',
                        'validation-callback' => array( 'Preferences', 'validateSignature' ),
                        'section' => 'personal/signature',
@@ -434,13 +431,13 @@ class Preferences {
 
                ## Email stuff
 
-               if ( $wgEnableEmail ) {
+               if ( $config->get( 'EnableEmail' ) ) {
                        if ( $canViewPrivateInfo ) {
-                               $helpMessages[] = $wgEmailConfirmToEdit
+                               $helpMessages[] = $config->get( 'EmailConfirmToEdit' )
                                                ? 'prefs-help-email-required'
                                                : 'prefs-help-email';
 
-                               if ( $wgEnableUserEmail ) {
+                               if ( $config->get( 'EnableUserEmail' ) ) {
                                        // additional messages when users can send email to each other
                                        $helpMessages[] = 'prefs-help-email-others';
                                }
@@ -472,7 +469,7 @@ class Preferences {
 
                        $disableEmailPrefs = false;
 
-                       if ( $wgEmailAuthentication ) {
+                       if ( $config->get( 'EmailAuthentication' ) ) {
                                $emailauthenticationclass = 'mw-email-not-authenticated';
                                if ( $user->getEmail() ) {
                                        if ( $user->getEmailAuthenticationTimestamp() ) {
@@ -517,7 +514,7 @@ class Preferences {
                                }
                        }
 
-                       if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
+                       if ( $config->get( 'EnableUserEmail' ) && $user->isAllowed( 'sendemail' ) ) {
                                $defaultPreferences['disablemail'] = array(
                                        'type' => 'toggle',
                                        'invert' => true,
@@ -533,7 +530,7 @@ class Preferences {
                                );
                        }
 
-                       if ( $wgEnotifWatchlist ) {
+                       if ( $config->get( 'EnotifWatchlist' ) ) {
                                $defaultPreferences['enotifwatchlistpages'] = array(
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
@@ -541,7 +538,7 @@ class Preferences {
                                        'disabled' => $disableEmailPrefs,
                                );
                        }
-                       if ( $wgEnotifUserTalk ) {
+                       if ( $config->get( 'EnotifUserTalk' ) ) {
                                $defaultPreferences['enotifusertalkpages'] = array(
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
@@ -549,7 +546,7 @@ class Preferences {
                                        'disabled' => $disableEmailPrefs,
                                );
                        }
-                       if ( $wgEnotifUserTalk || $wgEnotifWatchlist ) {
+                       if ( $config->get( 'EnotifUserTalk' ) || $config->get( 'EnotifWatchlist' ) ) {
                                $defaultPreferences['enotifminoredits'] = array(
                                        'type' => 'toggle',
                                        'section' => 'personal/email',
@@ -557,7 +554,7 @@ class Preferences {
                                        'disabled' => $disableEmailPrefs,
                                );
 
-                               if ( $wgEnotifRevealEditorAddress ) {
+                               if ( $config->get( 'EnotifRevealEditorAddress' ) ) {
                                        $defaultPreferences['enotifrevealaddr'] = array(
                                                'type' => 'toggle',
                                                'section' => 'personal/email',
@@ -577,7 +574,6 @@ class Preferences {
         */
        static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
                ## Skin #####################################
-               global $wgAllowUserCss, $wgAllowUserJs;
 
                // Skin selector, if there is at least one valid skin
                $skinOptions = self::generateSkinOptions( $user, $context );
@@ -590,19 +586,22 @@ class Preferences {
                        );
                }
 
+               $config = $context->getConfig();
+               $allowUserCss = $config->get( 'AllowUserCss' );
+               $allowUserJs = $config->get( 'AllowUserJs' );
                # Create links to user CSS/JS pages for all skins
                # This code is basically copied from generateSkinOptions().  It'd
                # be nice to somehow merge this back in there to avoid redundancy.
-               if ( $wgAllowUserCss || $wgAllowUserJs ) {
+               if ( $allowUserCss || $allowUserJs ) {
                        $linkTools = array();
                        $userName = $user->getName();
 
-                       if ( $wgAllowUserCss ) {
+                       if ( $allowUserCss ) {
                                $cssPage = Title::makeTitleSafe( NS_USER, $userName . '/common.css' );
                                $linkTools[] = Linker::link( $cssPage, $context->msg( 'prefs-custom-css' )->escaped() );
                        }
 
-                       if ( $wgAllowUserJs ) {
+                       if ( $allowUserJs ) {
                                $jsPage = Title::makeTitleSafe( NS_USER, $userName . '/common.js' );
                                $linkTools[] = Linker::link( $jsPage, $context->msg( 'prefs-custom-js' )->escaped() );
                        }
@@ -730,8 +729,7 @@ class Preferences {
                );
 
                ## Page Rendering ##############################
-               global $wgAllowUserCssPrefs;
-               if ( $wgAllowUserCssPrefs ) {
+               if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
                        $defaultPreferences['underline'] = array(
                                'type' => 'select',
                                'options' => array(
@@ -776,8 +774,6 @@ class Preferences {
         * @param array $defaultPreferences
         */
        static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgAllowUserCssPrefs;
-
                ## Editing #####################################
                $defaultPreferences['editsectiononrightclick'] = array(
                        'type' => 'toggle',
@@ -790,7 +786,7 @@ class Preferences {
                        'label-message' => 'tog-editondblclick',
                );
 
-               if ( $wgAllowUserCssPrefs ) {
+               if ( $context->getConfig()->get( 'AllowUserCssPrefs' ) ) {
                        $defaultPreferences['editfont'] = array(
                                'type' => 'select',
                                'section' => 'editing/editor',
@@ -864,17 +860,17 @@ class Preferences {
         * @param array $defaultPreferences
         */
        static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgRCMaxAge, $wgRCShowWatchingUsers;
-
+               $config = $context->getConfig();
+               $rcMaxAge = $config->get( 'RCMaxAge' );
                ## RecentChanges #####################################
                $defaultPreferences['rcdays'] = array(
                        'type' => 'float',
                        'label-message' => 'recentchangesdays',
                        'section' => 'rc/displayrc',
                        'min' => 1,
-                       'max' => ceil( $wgRCMaxAge / ( 3600 * 24 ) ),
+                       'max' => ceil( $rcMaxAge / ( 3600 * 24 ) ),
                        'help' => $context->msg( 'recentchangesdays-max' )->numParams(
-                               ceil( $wgRCMaxAge / ( 3600 * 24 ) ) )->text()
+                               ceil( $rcMaxAge / ( 3600 * 24 ) ) )->text()
                );
                $defaultPreferences['rclimit'] = array(
                        'type' => 'int',
@@ -906,7 +902,7 @@ class Preferences {
                        );
                }
 
-               if ( $wgRCShowWatchingUsers ) {
+               if ( $config->get( 'RCShowWatchingUsers' ) ) {
                        $defaultPreferences['shownumberswatching'] = array(
                                'type' => 'toggle',
                                'section' => 'rc/advancedrc',
@@ -921,9 +917,8 @@ class Preferences {
         * @param array $defaultPreferences
         */
        static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
-               global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
-
-               $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) );
+               $config = $context->getConfig();
+               $watchlistdaysMax = ceil( $config->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
 
                ## Watchlist #####################################
                $defaultPreferences['watchlistdays'] = array(
@@ -974,7 +969,7 @@ class Preferences {
                        'label-message' => 'tog-watchlisthideliu',
                );
 
-               if ( $wgUseRCPatrol ) {
+               if ( $context->getConfig()->get( 'UseRCPatrol' ) ) {
                        $defaultPreferences['watchlisthidepatrolled'] = array(
                                'type' => 'toggle',
                                'section' => 'watchlist/advancedwatchlist',
@@ -1010,7 +1005,7 @@ class Preferences {
                        }
                }
 
-               if ( $wgEnableAPI ) {
+               if ( $config->get( 'EnableAPI' ) ) {
                        $defaultPreferences['watchlisttoken'] = array(
                                'type' => 'api',
                        );
@@ -1049,7 +1044,6 @@ class Preferences {
         * @return array Text/links to display as key; $skinkey as value
         */
        static function generateSkinOptions( $user, IContextSource $context ) {
-               global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
                $ret = array();
 
                $mptitle = Title::newMainPage();
@@ -1068,12 +1062,17 @@ class Preferences {
                }
                asort( $validSkinNames );
 
+               $config = $context->getConfig();
+               $defaultSkin = $config->get( 'DefaultSkin' );
+               $allowUserCss = $config->get( 'AllowUserCss' );
+               $allowUserJs = $config->get( 'AllowUserJs' );
+
                $foundDefault = false;
                foreach ( $validSkinNames as $skinkey => $sn ) {
                        $linkTools = array();
 
                        # Mark the default skin
-                       if ( $skinkey == $wgDefaultSkin ) {
+                       if ( $skinkey == $defaultSkin ) {
                                $linkTools[] = $context->msg( 'default' )->escaped();
                                $foundDefault = true;
                        }
@@ -1083,12 +1082,12 @@ class Preferences {
                        $linkTools[] = "<a target='_blank' href=\"$mplink\">$previewtext</a>";
 
                        # Create links to user CSS/JS pages
-                       if ( $wgAllowUserCss ) {
+                       if ( $allowUserCss ) {
                                $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.css' );
                                $linkTools[] = Linker::link( $cssPage, $context->msg( 'prefs-custom-css' )->escaped() );
                        }
 
-                       if ( $wgAllowUserJs ) {
+                       if ( $allowUserJs ) {
                                $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/' . $skinkey . '.js' );
                                $linkTools[] = Linker::link( $jsPage, $context->msg( 'prefs-custom-js' )->escaped() );
                        }
@@ -1125,7 +1124,7 @@ class Preferences {
                                                                                // Bug 19237
                        }
 
-                       // KLUGE: site default might not be valid for user language
+                       // FIXME KLUGE: site default might not be valid for user language
                        global $wgDefaultUserOptions;
                        if ( !in_array( $wgDefaultUserOptions['date'], $dateopts ) ) {
                                $wgDefaultUserOptions['date'] = 'default';
@@ -1149,12 +1148,10 @@ class Preferences {
         * @return array
         */
        static function getImageSizes( IContextSource $context ) {
-               global $wgImageLimits;
-
                $ret = array();
                $pixels = $context->msg( 'unit-pixel' )->text();
 
-               foreach ( $wgImageLimits as $index => $limits ) {
+               foreach ( $context->getConfig()->get( 'ImageLimits' ) as $index => $limits ) {
                        $display = "{$limits[0]}×{$limits[1]}" . $pixels;
                        $ret[$display] = $index;
                }
@@ -1167,12 +1164,10 @@ class Preferences {
         * @return array
         */
        static function getThumbSizes( IContextSource $context ) {
-               global $wgThumbLimits;
-
                $ret = array();
                $pixels = $context->msg( 'unit-pixel' )->text();
 
-               foreach ( $wgThumbLimits as $index => $size ) {
+               foreach ( $context->getConfig()->get( 'ThumbLimits' ) as $index => $size ) {
                        $display = $size . $pixels;
                        $ret[$display] = $index;
                }
@@ -1187,10 +1182,11 @@ class Preferences {
         * @return bool|string
         */
        static function validateSignature( $signature, $alldata, $form ) {
-               global $wgParser, $wgMaxSigChars;
-               if ( mb_strlen( $signature ) > $wgMaxSigChars ) {
+               global $wgParser;
+               $maxSigChars = $form->getConfig()->get( 'MaxSigChars' );
+               if ( mb_strlen( $signature ) > $maxSigChars ) {
                        return Xml::element( 'span', array( 'class' => 'error' ),
-                               $form->msg( 'badsiglength' )->numParams( $wgMaxSigChars )->text() );
+                               $form->msg( 'badsiglength' )->numParams( $maxSigChars )->text() );
                } elseif ( isset( $alldata['fancysig'] ) &&
                                $alldata['fancysig'] &&
                                $wgParser->validateSig( $signature ) === false
@@ -1272,10 +1268,10 @@ class Preferences {
        static function getTimezoneOptions( IContextSource $context ) {
                $opt = array();
 
-               global $wgLocalTZoffset;
+               $localTZoffset = $context->getConfig()->get( 'LocalTZoffset' );
                $timestamp = MWTimestamp::getLocalInstance();
-               // Check that $wgLocalTZoffset is the same as the local time zone offset
-               if ( $wgLocalTZoffset == $timestamp->format( 'Z' ) / 60 ) {
+               // Check that the LocalTZoffset is the same as the local time zone offset
+               if ( $localTZoffset == $timestamp->format( 'Z' ) / 60 ) {
                        $server_tz_msg = $context->msg(
                                'timezoneuseserverdefault',
                                $timestamp->getTimezone()->getName()
@@ -1283,12 +1279,12 @@ class Preferences {
                } else {
                        $tzstring = sprintf(
                                '%+03d:%02d',
-                               floor( $wgLocalTZoffset / 60 ),
-                               abs( $wgLocalTZoffset ) % 60
+                               floor( $localTZoffset / 60 ),
+                               abs( $localTZoffset ) % 60
                        );
                        $server_tz_msg = $context->msg( 'timezoneuseserverdefault', $tzstring )->text();
                }
-               $opt[$server_tz_msg] = "System|$wgLocalTZoffset";
+               $opt[$server_tz_msg] = "System|$localTZoffset";
                $opt[$context->msg( 'timezoneuseoffset' )->text()] = 'other';
                $opt[$context->msg( 'guesstimezone' )->text()] = 'guess';
 
@@ -1388,9 +1384,10 @@ class Preferences {
         * @return bool|Status|string
         */
        static function tryFormSubmit( $formData, $form ) {
-               global $wgHiddenPrefs, $wgAuth;
+               global $wgAuth;
 
                $user = $form->getModifiedUser();
+               $hiddenPrefs = $form->getConfig()->get( 'HiddenPrefs' );
                $result = true;
 
                if ( !$user->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' ) ) {
@@ -1407,7 +1404,7 @@ class Preferences {
 
                // Fortunately, the realname field is MUCH simpler
                // (not really "private", but still shouldn't be edited without permission)
-               if ( !in_array( 'realname', $wgHiddenPrefs )
+               if ( !in_array( 'realname', $hiddenPrefs )
                        && $user->isAllowed( 'editmyprivateinfo' )
                        && array_key_exists( 'realname', $formData )
                ) {
@@ -1423,7 +1420,7 @@ class Preferences {
                        # If users have saved a value for a preference which has subsequently been disabled
                        # via $wgHiddenPrefs, we don't want to destroy that setting in case the preference
                        # is subsequently re-enabled
-                       foreach ( $wgHiddenPrefs as $pref ) {
+                       foreach ( $hiddenPrefs as $pref ) {
                                # If the user has not set a non-default value here, the default will be returned
                                # and subsequently discarded
                                $formData[$pref] = $user->getOption( $pref, null, true );
index d35b848..9870b2d 100644 (file)
@@ -40,7 +40,11 @@ class ApiEmailUser extends ApiBase {
                }
 
                // Check permissions and errors
-               $error = SpecialEmailUser::getPermissionsError( $this->getUser(), $params['token'] );
+               $error = SpecialEmailUser::getPermissionsError(
+                       $this->getUser(),
+                       $params['token'],
+                       $this->getConfig()
+               );
                if ( $error ) {
                        $this->dieUsageMsg( array( $error ) );
                }
index 2ce6307..a03c9aa 100644 (file)
@@ -58,14 +58,22 @@ class DatabaseMysqli extends DatabaseMysqlBase {
                }
 
                // Other than mysql_connect, mysqli_real_connect expects an explicit port
-               // parameter. So we need to parse the port out of $realServer
+               // and socket parameters. So we need to parse the port and socket out of
+               // $realServer
                $port = null;
+               $socket = null;
                $hostAndPort = IP::splitHostAndPort( $realServer );
                if ( $hostAndPort ) {
                        $realServer = $hostAndPort[0];
                        if ( $hostAndPort[1] ) {
                                $port = $hostAndPort[1];
                        }
+               } elseif ( substr_count( $realServer, ':' ) == 1 ) {
+                       // If we have a colon and something that's not a port number
+                       // inside the hostname, assume it's the socket location
+                       $hostAndSocket = explode( ':', $realServer );
+                       $realServer = $hostAndSocket[0];
+                       $socket = $hostAndSocket[1];
                }
 
                $connFlags = 0;
@@ -90,7 +98,7 @@ class DatabaseMysqli extends DatabaseMysqlBase {
                $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
 
                if ( $mysqli->real_connect( $realServer, $this->mUser,
-                       $this->mPassword, $this->mDBname, $port, null, $connFlags )
+                       $this->mPassword, $this->mDBname, $port, $socket, $connFlags )
                ) {
                        return $mysqli;
                }
index c5141a9..8095539 100644 (file)
@@ -402,13 +402,11 @@ abstract class TablePager extends IndexPager {
         * @return string HTML fragment
         */
        function getLimitForm() {
-               global $wgScript;
-
                return Html::rawElement(
                        'form',
                        array(
                                'method' => 'get',
-                               'action' => $wgScript
+                               'action' => wfScript(),
                        ),
                        "\n" . $this->getLimitDropdown()
                ) . "\n";
index 18e6003..519606c 100644 (file)
@@ -39,64 +39,63 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter {
         */
        public function getLine( array $feed, RecentChange $rc, $actionComment ) {
                global $wgCanonicalServer, $wgServerName, $wgScriptPath;
-               $attrib = $rc->getAttributes();
 
                $packet = array(
                        // Usually, RC ID is exposed only for patrolling purposes,
                        // but there is no real reason not to expose it in other cases,
                        // and I can see how this may be potentially useful for clients.
-                       'id' => $attrib['rc_id'],
-                       'type' => RecentChange::parseFromRCType( $attrib['rc_type'] ),
+                       'id' => $rc->getAttribute( 'rc_id' ),
+                       'type' => RecentChange::parseFromRCType( $rc->getAttribute( 'rc_type' ) ),
                        'namespace' => $rc->getTitle()->getNamespace(),
                        'title' => $rc->getTitle()->getPrefixedText(),
-                       'comment' => $attrib['rc_comment'],
-                       'timestamp' => (int)wfTimestamp( TS_UNIX, $attrib['rc_timestamp'] ),
-                       'user' => $attrib['rc_user_text'],
-                       'bot' => (bool)$attrib['rc_bot'],
+                       'comment' => $rc->getAttribute( 'rc_comment' ),
+                       'timestamp' => (int)wfTimestamp( TS_UNIX, $rc->getAttribute( 'rc_timestamp' ) ),
+                       'user' => $rc->getAttribute( 'rc_user_text' ),
+                       'bot' => (bool)$rc->getAttribute( 'rc_bot' ),
                );
 
                if ( isset( $feed['channel'] ) ) {
                        $packet['channel'] = $feed['channel'];
                }
 
-               $type = $attrib['rc_type'];
+               $type = $rc->getAttribute( 'rc_type' );
                if ( $type == RC_EDIT || $type == RC_NEW ) {
                        global $wgUseRCPatrol, $wgUseNPPatrol;
 
-                       $packet['minor'] = (bool)$attrib['rc_minor'];
+                       $packet['minor'] = (bool)$rc->getAttribute( 'rc_minor' );
                        if ( $wgUseRCPatrol || ( $type == RC_NEW && $wgUseNPPatrol ) ) {
-                               $packet['patrolled'] = (bool)$attrib['rc_patrolled'];
+                               $packet['patrolled'] = (bool)$rc->getAttribute( 'rc_patrolled' );
                        }
                }
 
                switch ( $type ) {
                        case RC_EDIT:
                                $packet['length'] = array(
-                                       'old' => $attrib['rc_old_len'],
-                                       'new' => $attrib['rc_new_len']
+                                       'old' => $rc->getAttribute( 'rc_old_len' ),
+                                       'new' => $rc->getAttribute( 'rc_new_len' )
                                );
                                $packet['revision'] = array(
-                                       'old' => $attrib['rc_last_oldid'],
-                                       'new' => $attrib['rc_this_oldid']
+                                       'old' => $rc->getAttribute( 'rc_last_oldid' ),
+                                       'new' => $rc->getAttribute( 'rc_this_oldid' )
                                );
                                break;
 
                        case RC_NEW:
-                               $packet['length'] = array( 'old' => null, 'new' => $attrib['rc_new_len'] );
-                               $packet['revision'] = array( 'old' => null, 'new' => $attrib['rc_this_oldid'] );
+                               $packet['length'] = array( 'old' => null, 'new' => $rc->getAttribute( 'rc_new_len' ) );
+                               $packet['revision'] = array( 'old' => null, 'new' => $rc->getAttribute( 'rc_this_oldid' ) );
                                break;
 
                        case RC_LOG:
-                               $packet['log_id'] = $attrib['rc_logid'];
-                               $packet['log_type'] = $attrib['rc_log_type'];
-                               $packet['log_action'] = $attrib['rc_log_action'];
-                               if ( $attrib['rc_params'] ) {
+                               $packet['log_id'] = $rc->getAttribute( 'rc_logid' );
+                               $packet['log_type'] = $rc->getAttribute( 'rc_log_type' );
+                               $packet['log_action'] = $rc->getAttribute( 'rc_log_action' );
+                               if ( $rc->getAttribute( 'rc_params' ) ) {
                                        wfSuppressWarnings();
-                                       $params = unserialize( $attrib['rc_params'] );
+                                       $params = unserialize( $rc->getAttribute( 'rc_params' ) );
                                        wfRestoreWarnings();
                                        if (
                                                // If it's an actual serialised false...
-                                               $attrib['rc_params'] == serialize( false ) ||
+                                               $rc->getAttribute( 'rc_params' ) == serialize( false ) ||
                                                // Or if we did not get false back when trying to unserialise
                                                $params !== false
                                        ) {
@@ -113,7 +112,7 @@ abstract class MachineReadableRCFeedFormatter implements RCFeedFormatter {
                                                }
                                                $packet['log_params'] = $logParams;
                                        } else {
-                                               $packet['log_params'] = explode( "\n", $attrib['rc_params'] );
+                                               $packet['log_params'] = explode( "\n", $rc->getAttribute( 'rc_params' ) );
                                        }
                                }
                                $packet['log_action_comment'] = $actionComment;
index 918f8be..a041ad6 100644 (file)
@@ -397,7 +397,7 @@ class ResourceLoader {
         *
         * @param array|string $id Source ID (string), or array( id1 => loadUrl, id2 => loadUrl, ... )
         * @param string|array $loadUrl load.php url (string), or array with loadUrl key for
-        *  backwards-compatability.
+        *  backwards-compatibility.
         * @throws MWException
         */
        public function addSource( $id, $loadUrl = null ) {
@@ -417,7 +417,7 @@ class ResourceLoader {
                        );
                }
 
-               // Pre 1.24 backwards-compatability
+               // Pre 1.24 backwards-compatibility
                if ( is_array( $loadUrl ) ) {
                        if ( !isset( $loadUrl['loadScript'] ) ) {
                                throw new MWException(
index 0958126..a4e4c54 100644 (file)
@@ -113,7 +113,8 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                // error out if sending user cannot do this
                $error = self::getPermissionsError(
                        $this->getUser(),
-                       $this->getRequest()->getVal( 'wpEditToken' )
+                       $this->getRequest()->getVal( 'wpEditToken' ),
+                       $this->getConfig()
                );
 
                switch ( $error ) {
@@ -208,12 +209,15 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         *
         * @param User $user
         * @param string $editToken Edit token
+        * @param Config $config optional for backwards compatibility
         * @return string|null Null on success or string on error
         */
-       public static function getPermissionsError( $user, $editToken ) {
-               global $wgEnableEmail, $wgEnableUserEmail;
-
-               if ( !$wgEnableEmail || !$wgEnableUserEmail ) {
+       public static function getPermissionsError( $user, $editToken, Config $config = null ) {
+               if ( $config === null ) {
+                       wfDebug( __METHOD__ . ' called without a Config instance passed to it' );
+                       $config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+               }
+               if ( !$config->get( 'EnableEmail' ) || !$config->get( 'EnableUserEmail' ) ) {
                        return 'usermaildisabled';
                }
 
@@ -256,10 +260,9 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         * @return string Form asking for user name.
         */
        protected function userForm( $name ) {
-               global $wgScript;
                $string = Xml::openElement(
                        'form',
-                       array( 'method' => 'get', 'action' => $wgScript, 'id' => 'askusername' )
+                       array( 'method' => 'get', 'action' => wfScript(), 'id' => 'askusername' )
                ) .
                        Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
                        Xml::openElement( 'fieldset' ) .
@@ -302,7 +305,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         * or maybe even true on success if anything uses the EmailUser hook.
         */
        public static function submit( array $data, IContextSource $context ) {
-               global $wgUserEmailUseReplyTo;
+               $config = $context->getConfig();
 
                $target = self::getTarget( $data['Target'] );
                if ( !$target instanceof User ) {
@@ -325,16 +328,14 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        return $error;
                }
 
-               if ( $wgUserEmailUseReplyTo ) {
+               if ( $config->get( 'UserEmailUseReplyTo' ) ) {
                        // Put the generic wiki autogenerated address in the From:
                        // header and reserve the user for Reply-To.
                        //
                        // This is a bit ugly, but will serve to differentiate
                        // wiki-borne mails from direct mails and protects against
                        // SPF and bounce problems with some mailers (see below).
-                       global $wgPasswordSender;
-
-                       $mailFrom = new MailAddress( $wgPasswordSender,
+                       $mailFrom = new MailAddress( $config->get( 'PasswordSender' ),
                                wfMessage( 'emailsender' )->inContentLanguage()->text() );
                        $replyTo = $from;
                } else {
index b66f20e..28b1446 100644 (file)
@@ -43,6 +43,7 @@ section.mw-form-header {
        border: 1px solid #c9c9c9;
        padding: 10px;
        text-align: center;
+       margin-bottom: 15px;
 }
 
 .mw-createacct-captcha-assisted {
index 4516e20..e29c734 100644 (file)
                                 *
                                 * @param {string} id Short string representing a source wiki, used internally for
                                 *  registered modules to indicate where they should be loaded from (usually lowercase a-z).
-                                * @param {Object|string} loadUrl load.php url, may be an object for backwards-compatability
+                                * @param {Object|string} loadUrl load.php url, may be an object for backwards-compatibility
                                 * @return {boolean}
                                 */
                                addSource: function ( id, loadUrl ) {