From d81f562b712f2387fa02290bf2ca86392ab356f2 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 20:21:25 +0000 Subject: Aktualisierung auf Version 1.8.1 --- includes/SpecialPreferences.php | 70 ++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'includes/SpecialPreferences.php') diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index c6003b7c..5eadf3d6 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -74,7 +74,7 @@ class PreferencesForm { # User toggles (the big ugly unsorted list of checkboxes) $this->mToggles = array(); if ( $this->mPosted ) { - $togs = $wgLang->getUserToggles(); + $togs = User::getToggles(); foreach ( $togs as $tname ) { $this->mToggles[$tname] = $request->getCheck( "wpOp$tname" ) ? 1 : 0; } @@ -156,11 +156,16 @@ class PreferencesForm { /** * @access private */ - function validateDate( &$val, $min = 0, $max=0x7fffffff ) { - if ( ( sprintf('%d', $val) === $val && $val >= $min && $val <= $max ) || $val == 'ISO 8601' ) + function validateDate( $val ) { + global $wgLang, $wgContLang; + if ( $val !== false && ( + in_array( $val, (array)$wgLang->getDatePreferences() ) || + in_array( $val, (array)$wgContLang->getDatePreferences() ) ) ) + { return $val; - else - return 0; + } else { + return $wgLang->getDefaultDateFormat(); + } } /** @@ -257,7 +262,7 @@ class PreferencesForm { if( $wgUseTeX ) { $wgUser->setOption( 'math', $this->mMath ); } - $wgUser->setOption( 'date', $this->validateDate( $this->mDate, 0, 20 ) ); + $wgUser->setOption( 'date', $this->validateDate( $this->mDate ) ); $wgUser->setOption( 'searchlimit', $this->validateIntOrNull( $this->mSearch ) ); $wgUser->setOption( 'contextlines', $this->validateIntOrNull( $this->mSearchLines ) ); $wgUser->setOption( 'contextchars', $this->validateIntOrNull( $this->mSearchChars ) ); @@ -356,7 +361,7 @@ class PreferencesForm { $this->mQuickbar = $wgUser->getOption( 'quickbar' ); $this->mSkin = Skin::normalizeKey( $wgUser->getOption( 'skin' ) ); $this->mMath = $wgUser->getOption( 'math' ); - $this->mDate = $wgUser->getOption( 'date' ); + $this->mDate = $wgUser->getDatePreference(); $this->mRows = $wgUser->getOption( 'rows' ); $this->mCols = $wgUser->getOption( 'cols' ); $this->mStubs = $wgUser->getOption( 'stubthreshold' ); @@ -371,7 +376,7 @@ class PreferencesForm { $this->mUnderline = $wgUser->getOption( 'underline' ); $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' ); - $togs = $wgLang->getUserToggles(); + $togs = User::getToggles(); foreach ( $togs as $tname ) { $ttext = wfMsg('tog-'.$tname); $this->mToggles[$tname] = $wgUser->getOption( $tname ); @@ -470,8 +475,8 @@ class PreferencesForm { $qbs = $wgLang->getQuickbarSettings(); $skinNames = $wgLang->getSkinNames(); $mathopts = $wgLang->getMathNames(); - $dateopts = $wgLang->getDateFormats(); - $togs = $wgLang->getUserToggles(); + $dateopts = $wgLang->getDatePreferences(); + $togs = User::getToggles(); $titleObj = Title::makeTitle( NS_SPECIAL, 'Preferences' ); $action = $titleObj->escapeLocalURL(); @@ -595,7 +600,7 @@ class PreferencesForm { * Make sure the site language is in the list; a custom language code * might not have a defined name... */ - $languages = $wgLang->getLanguageNames(); + $languages = $wgLang->getLanguageNames( true ); if( !array_key_exists( $wgContLanguageCode, $languages ) ) { $languages[$wgContLanguageCode] = $wgContLanguageCode; } @@ -610,12 +615,8 @@ class PreferencesForm { $selbox = null; foreach($languages as $code => $name) { global $IP; - /* only add languages that have a file */ - $langfile="$IP/languages/Language".str_replace('-', '_', ucfirst($code)).".php"; - if(file_exists($langfile) || $code == $wgContLanguageCode) { - $sel = ($code == $selectedLang)? ' selected="selected"' : ''; - $selbox .= "\n"; - } + $sel = ($code == $selectedLang)? ' selected="selected"' : ''; + $selbox .= "\n"; } $wgOut->addHTML( $this->addRow( @@ -764,20 +765,20 @@ class PreferencesForm { " . wfMsg( 'files' ) . "
-
\n\n"); + $imageThumbOptions = null; + $wgOut->addHTML( "{$imageLimitOptions} +
\n\n"); # Date format # @@ -789,9 +790,9 @@ class PreferencesForm { if ($dateopts) { $wgOut->addHTML( "
\n" . wfMsg( 'dateformat' ) . "\n" ); $idCnt = 0; - $epoch = '20010408091234'; - foreach($dateopts as $key => $option) { - if( $key == MW_DATE_DEFAULT ) { + $epoch = '20010115161234'; # Wikipedia day + foreach( $dateopts as $key ) { + if( $key == 'default' ) { $formatted = wfMsgHtml( 'datedefault' ); } else { $formatted = htmlspecialchars( $wgLang->timeanddate( $epoch, false, $key ) ); @@ -816,8 +817,7 @@ class PreferencesForm { ) . " -
-
¹" . wfMsg( 'timezonetext' ) . "
+
¹" . wfMsg( 'timezonetext' ) . "
\n\n" ); # Editing -- cgit v1.2.3-54-g00ecf