);
if ( $user->getRegistration() ) {
+ $displayUser = $context->getUser();
+ $userRegistration = $user->getRegistration();
$defaultPreferences['registrationdate'] = array(
'type' => 'info',
'label-message' => 'prefs-registration',
'default' => $context->msg(
'prefs-registration-date-time',
- $lang->timeanddate( $user->getRegistration(), true ),
- $lang->date( $user->getRegistration(), true ),
- $lang->time( $user->getRegistration(), true )
+ $lang->userTimeAndDate( $userRegistration, $displayUser ),
+ $lang->userDate( $userRegistration, $displayUser ),
+ $lang->userTime( $userRegistration, $displayUser )
)->parse(),
'section' => 'personal/info',
);
// date and time are separate parameters to facilitate localisation.
// $time is kept for backward compat reasons.
// 'emailauthenticated' is also used in SpecialConfirmemail.php
- $time = $lang->timeAndDate( $user->getEmailAuthenticationTimestamp(), true );
- $d = $lang->date( $user->getEmailAuthenticationTimestamp(), true );
- $t = $lang->time( $user->getEmailAuthenticationTimestamp(), true );
+ $displayUser = $context->getUser();
+ $emailTimestamp = $user->getEmailAuthenticationTimestamp();
+ $time = $lang->userTimeAndDate( $emailTimestamp, $displayUser );
+ $d = $lang->userDate( $emailTimestamp, $displayUser );
+ $t = $lang->userTime( $emailTimestamp, $displayUser );
$emailauthenticated = $context->msg( 'emailauthenticated',
$time, $d, $t )->parse() . '<br />';
$disableEmailPrefs = false;
* @param $defaultPreferences
*/
static function watchlistPreferences( $user, IContextSource $context, &$defaultPreferences ) {
- global $wgUseRCPatrol, $wgEnableAPI;
+ global $wgUseRCPatrol, $wgEnableAPI, $wgRCMaxAge;
+ $watchlistdaysMax = ceil( $wgRCMaxAge / ( 3600 * 24 ) );
+
## Watchlist #####################################
$defaultPreferences['watchlistdays'] = array(
'type' => 'float',
'min' => 0,
- 'max' => 7,
+ 'max' => $watchlistdaysMax,
'section' => 'watchlist/displaywatchlist',
- 'help' => $context->msg( 'prefs-watchlist-days-max' )->escaped(),
+ 'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams(
+ $watchlistdaysMax )->text(),
'label-message' => 'prefs-watchlist-days',
);
$defaultPreferences['wllimit'] = array(
* @return array
*/
static function getDateOptions( IContextSource $context ) {
- $dateopts = $context->getLanguage()->getDatePreferences();
+ $lang = $context->getLanguage();
+ $dateopts = $lang->getDatePreferences();
$ret = array();
if ( $key == 'default' ) {
$formatted = $context->msg( 'datedefault' )->escaped();
} else {
- $formatted = htmlspecialchars( $context->getLanguage()->timeanddate( $epoch, false, $key ) );
+ $formatted = htmlspecialchars( $lang->timeanddate( $epoch, false, $key ) );
}
$ret[$formatted] = $key;
}
$removeKeys = array_flip( $remove );
$formDescriptor = array_diff_key( $formDescriptor, $removeKeys );
}
+
+ /**
+ * @var $htmlForm PreferencesForm
+ */
$htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
$htmlForm->setModifiedUser( $user );
/**
* @param $formData
- * @param $form HTMLForm
+ * @param $form PreferencesForm
* @param $entryPoint string
* @return bool|Status|string
*/
/**
* @param $formData
+ * @param $form PreferencesForm
* @return Status
*/
public static function tryUISubmit( $formData, $form ) {
# The user has supplied a new email address on the login page
# new behaviour: set this new emailaddr from login-page into user database record
$user->setEmail( $newaddr );
- # But flag as "dirty" = unauthenticated
- $user->invalidateEmail();
if ( $wgEmailAuthentication ) {
# Mail a temporary password to the dirty address.
# User can come back through the confirmation URL to re-enable email.
}
$info = 'eauth';
}
- } else {
+ } elseif ( $newaddr != $oldaddr ) { // if the address is the same, don't change it
$user->setEmail( $newaddr );
}
if ( $oldaddr != $newaddr ) {
}
/**
+ * @deprecated in 1.19; will be removed in 1.20.
* @param $user User
* @return array
*/
public static function loadOldSearchNs( $user ) {
+ wfDeprecated( __METHOD__, '1.19' );
+
$searchableNamespaces = SearchEngine::searchableNamespaces();
// Back compat with old format
$arr = array();
class PreferencesForm extends HTMLForm {
// Override default value from HTMLForm
protected $mSubSectionBeforeFields = false;
-
+
private $modifiedUser;
+ /**
+ * @param $user User
+ */
public function setModifiedUser( $user ) {
$this->modifiedUser = $user;
}
+ /**
+ * @return User
+ */
public function getModifiedUser() {
if ( $this->modifiedUser === null ) {
return $this->getUser();
return $data;
}
+
/**
* Get the whole body of the form.
+ * @return string
*/
function getBody() {
return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
}
-
+
/**
* 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
+ * @return string
*/
function getLegend( $key ) {
$legend = parent::getLegend( $key );