'emailaddress',
);
+ /**
+ * @return array
+ */
+ static function getSaveBlacklist() {
+ return self::$saveBlacklist;
+ }
+
/**
* @throws MWException
- * @param $user User
- * @param $context IContextSource
+ * @param User $user
+ * @param IContextSource $context
* @return array|null
*/
static function getPreferences( $user, IContextSource $context ) {
self::profilePreferences( $user, $context, $defaultPreferences );
self::skinPreferences( $user, $context, $defaultPreferences );
- self::filesPreferences( $user, $context, $defaultPreferences );
self::datetimePreferences( $user, $context, $defaultPreferences );
+ self::filesPreferences( $user, $context, $defaultPreferences );
self::renderingPreferences( $user, $context, $defaultPreferences );
self::editingPreferences( $user, $context, $defaultPreferences );
self::rcPreferences( $user, $context, $defaultPreferences );
/**
* Pull option from a user account. Handles stuff like array-type preferences.
*
- * @param $name
- * @param $info
- * @param $user User
- * @return array|String
+ * @param string $name
+ * @param array $info
+ * @param User $user
+ * @return array|string
*/
static function getOptionFromUser( $name, $info, $user ) {
$val = $user->getOption( $name );
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
* @return void
*/
static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) {
global $wgAuth, $wgContLang, $wgParser, $wgCookieExpiration, $wgLanguageCode,
- $wgDisableTitleConversion, $wgDisableLangConversion, $wgMaxSigChars,
+ $wgDisableLangConversion, $wgMaxSigChars,
$wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
$wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress,
$wgSecureLogin;
'section' => 'personal/info',
);
}
- if ( $wgCookieExpiration > 0 ) {
- $defaultPreferences['rememberpassword'] = array(
- 'type' => 'toggle',
- 'label' => $context->msg( 'tog-rememberpassword' )->numParams(
- ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(),
- 'section' => 'personal/info',
- );
- }
- // Only show preferhttps if secure login is turned on
+ // Only show prefershttps if secure login is turned on
if ( $wgSecureLogin && wfCanIPUseHTTPS( $context->getRequest()->getIP() ) ) {
$defaultPreferences['prefershttps'] = array(
'type' => 'toggle',
'section' => 'personal/i18n',
'help-message' => 'prefs-help-variant',
);
-
- if ( !$wgDisableTitleConversion ) {
- $defaultPreferences['noconvertlink'] = array(
- 'type' => 'toggle',
- 'section' => 'personal/i18n',
- 'label-message' => 'tog-noconvertlink',
- );
- }
} else {
$defaultPreferences["variant-$langCode"] = array(
'type' => 'api',
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
* @return void
*/
static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences Array
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function filesPreferences( $user, IContextSource $context, &$defaultPreferences ) {
## Files #####################################
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
* @return void
*/
static function datetimePreferences( $user, IContextSource $context, &$defaultPreferences ) {
'type' => 'radio',
'options' => $dateOptions,
'label' => ' ',
- 'section' => 'datetime/dateformat',
+ 'section' => 'rendering/dateformat',
);
}
'raw' => 1,
'label-message' => 'servertime',
'default' => $nowserver,
- 'section' => 'datetime/timeoffset',
+ 'section' => 'rendering/timeoffset',
);
$defaultPreferences['nowlocal'] = array(
'raw' => 1,
'label-message' => 'localtime',
'default' => $nowlocal,
- 'section' => 'datetime/timeoffset',
+ 'section' => 'rendering/timeoffset',
);
// Grab existing pref.
'options' => $tzOptions,
'default' => $tzSetting,
'size' => 20,
- 'section' => 'datetime/timeoffset',
+ 'section' => 'rendering/timeoffset',
);
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences Array
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function renderingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
## Diffs ####################################
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences Array
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function editingPreferences( $user, IContextSource $context, &$defaultPreferences ) {
global $wgAllowUserCssPrefs;
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences Array
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
global $wgRCMaxAge, $wgRCShowWatchingUsers;
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $defaultPreferences Array
+ * @param User $user
+ * @param IContextSource $context
+ * @param array $defaultPreferences
*/
static function searchPreferences( $user, IContextSource $context, &$defaultPreferences ) {
- global $wgContLang, $wgVectorUseSimpleSearch;
-
- if ( $wgVectorUseSimpleSearch ) {
- $defaultPreferences['vector-simplesearch'] = array(
- 'type' => 'toggle',
- 'label-message' => 'vector-simplesearch-preference',
- 'section' => 'searchoptions/displaysearchoptions',
- );
- }
+ global $wgContLang;
$defaultPreferences['searcheverything'] = array(
'type' => 'toggle',
}
/**
- * @param $user User The User object
- * @param $context IContextSource
- * @return Array: text/links to display as key; $skinkey as value
+ * @param User $user The User object
+ * @param IContextSource $context
+ * @return array Text/links to display as key; $skinkey as value
*/
static function generateSkinOptions( $user, IContextSource $context ) {
global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
$mptitle = Title::newMainPage();
$previewtext = $context->msg( 'skin-preview' )->text();
- # Only show members of Skin::getSkinNames() rather than
- # $skinNames (skins is all skin names from Language.php)
- $validSkinNames = Skin::getUsableSkins();
+ # Only show skins that aren't disabled in $wgSkipSkins
+ $validSkinNames = Skin::getAllowedSkins();
# Sort by UI skin name. First though need to update validSkinNames as sometimes
# the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
}
/**
- * @param $context IContextSource
+ * @param IContextSource $context
* @return array
*/
static function getDateOptions( IContextSource $context ) {
}
/**
- * @param $context IContextSource
+ * @param IContextSource $context
* @return array
*/
static function getImageSizes( IContextSource $context ) {
}
/**
- * @param $context IContextSource
+ * @param IContextSource $context
* @return array
*/
static function getThumbSizes( IContextSource $context ) {
}
/**
- * @param $signature string
- * @param $alldata array
- * @param $form HTMLForm
+ * @param string $signature
+ * @param array $alldata
+ * @param HTMLForm $form
* @return bool|string
*/
static function validateSignature( $signature, $alldata, $form ) {
}
/**
- * @param $signature string
- * @param $alldata array
- * @param $form HTMLForm
+ * @param string $signature
+ * @param array $alldata
+ * @param HTMLForm $form
* @return string
*/
static function cleanSignature( $signature, $alldata, $form ) {
}
/**
- * @param $user User
- * @param $context IContextSource
- * @param $formClass string
- * @param array $remove array of items to remove
+ * @param User $user
+ * @param IContextSource $context
+ * @param string $formClass
+ * @param array $remove Array of items to remove
* @return HtmlForm
*/
static function getFormObject(
}
/**
- * @param $context IContextSource
+ * @param IContextSource $context
* @return array
*/
static function getTimezoneOptions( IContextSource $context ) {
}
/**
- * @param $value
- * @param $alldata
+ * @param string $value
+ * @param array $alldata
* @return int
*/
static function filterIntval( $value, $alldata ) {
}
/**
- * @param $tz
- * @param $alldata
+ * @param string $tz
+ * @param array $alldata
* @return string
*/
static function filterTimezoneInput( $tz, $alldata ) {
/**
* Handle the form submission if everything validated properly
*
- * @param $formData
- * @param $form PreferencesForm
- * @param $entryPoint string
+ * @param array $formData
+ * @param PreferencesForm $form
* @return bool|Status|string
*/
- static function tryFormSubmit( $formData, $form, $entryPoint = 'internal' ) {
+ static function tryFormSubmit( $formData, $form ) {
global $wgHiddenPrefs, $wgAuth;
$user = $form->getModifiedUser();
// Fortunately, the realname field is MUCH simpler
// (not really "private", but still shouldn't be edited without permission)
- if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) ) {
+ if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->isAllowed( 'editmyprivateinfo' ) && array_key_exists( 'realname', $formData ) ) {
$realName = $formData['realname'];
$user->setRealName( $realName );
}
$user->setOption( $key, $value );
}
+ wfRunHooks( 'PreferencesFormPreSave', array( $formData, $form, $user, &$result ) );
$user->saveSettings();
}
}
/**
- * @param $formData
- * @param $form PreferencesForm
+ * @param array $formData
+ * @param PreferencesForm $form
* @return Status
*/
public static function tryUISubmit( $formData, $form ) {
- $res = self::tryFormSubmit( $formData, $form, 'ui' );
+ $res = self::tryFormSubmit( $formData, $form );
if ( $res ) {
$urlOptions = array( 'success' => 1 );
* Caller is responsible for checking $wgAuth and 'editmyprivateinfo'
* right.
*
- * @deprecated in 1.20; use User::setEmailWithConfirmation() instead.
- * @param $user User
+ * @deprecated since 1.20; use User::setEmailWithConfirmation() instead.
+ * @param User $user
* @param string $newaddr New email address
- * @return Array (true on success or Status on failure, info string)
+ * @return array (true on success or Status on failure, info string)
*/
public static function trySetUserEmail( User $user, $newaddr ) {
wfDeprecated( __METHOD__, '1.20' );
}
/**
- * @deprecated in 1.19
- * @param $user User
+ * @deprecated since 1.19
+ * @param User $user
* @return array
*/
public static function loadOldSearchNs( $user ) {
private $modifiedUser;
/**
- * @param $user User
+ * @param User $user
*/
public function setModifiedUser( $user ) {
$this->modifiedUser = $user;
}
/**
- * @param $html string
- * @return String
+ * @param string $html
+ * @return string
*/
function wrapForm( $html ) {
$html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html );
}
/**
- * @return String
+ * @return string
*/
function getButtons() {
if ( !$this->getModifiedUser()->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' ) ) {
/**
* Separate multi-option preferences into multiple preferences, since we
* have to store them separately
- * @param $data array
+ * @param array $data
* @return array
*/
function filterDataForSubmit( $data ) {
/**
* Get the "<legend>" for a given section key. Normally this is the
* prefs-$key message but we'll allow extensions to override it.
- * @param $key string
+ * @param string $key
* @return string
*/
function getLegend( $key ) {