Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -57,11 +57,12 @@ |
58 | 58 | self::$minSL[$tag] = 1; |
59 | 59 | } |
60 | 60 | global $wgFlaggedRevsProtectLevels; |
61 | | - foreach( $wgFlaggedRevsProtectLevels as $level => $config ) { |
| 61 | + foreach( $wgFlaggedRevsProtectLevels as $level => &$config ) { |
62 | 62 | # Sanity checks |
63 | 63 | if( !isset($config['select']) || !isset($config['override']) || !isset($config['autoreview']) ) { |
64 | 64 | throw new MWException( 'FlaggedRevs given incomplete $wgFlaggedRevsProtectLevels value!' ); |
65 | 65 | } |
| 66 | + $config['override'] = intval( $config['override'] ); // Type cleanup |
66 | 67 | } |
67 | 68 | self::$loaded = true; |
68 | 69 | } |
— | — | @@ -156,8 +157,24 @@ |
157 | 158 | */ |
158 | 159 | public static function getProtectionLevels() { |
159 | 160 | global $wgFlaggedRevsProtectLevels; |
| 161 | + self::load(); |
160 | 162 | return $wgFlaggedRevsProtectLevels; |
161 | 163 | } |
| 164 | + |
| 165 | + /** |
| 166 | + * Find what protection level a config is in |
| 167 | + * @param array $config |
| 168 | + * @returns mixed (array/string) |
| 169 | + */ |
| 170 | + public static function getProtectionLevel( $config ) { |
| 171 | + global $wgFlaggedRevsProtectLevels; |
| 172 | + self::load(); |
| 173 | + unset( $config['expiry'] ); |
| 174 | + foreach( $wgFlaggedRevsProtectLevels as $level => $settings ) { |
| 175 | + if( $config == $settings ) return $level; |
| 176 | + } |
| 177 | + return "none"; |
| 178 | + } |
162 | 179 | |
163 | 180 | /** |
164 | 181 | * Should comments be allowed on pages and forms? |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1815,14 +1815,14 @@ |
1816 | 1816 | # Can the user actually do anything? |
1817 | 1817 | $isAllowed = $wgUser->isAllowed('stablesettings'); |
1818 | 1818 | $disabledAttrib = !$isAllowed ? array( 'disabled' => 'disabled' ) : array(); |
1819 | | - # Load request params... |
1820 | | - $selected = $wgRequest->getVal( 'wpStabilityConfig' ); |
1821 | | - $expiry = $wgRequest->getText( 'mwStabilize-expiry' ); |
1822 | | - $reviewThis = $wgRequest->getBool( 'wpReviewthis', true ); |
1823 | 1819 | # Get the current config/expiry |
1824 | 1820 | $config = FlaggedRevs::getPageVisibilitySettings( $article->getTitle(), true ); |
1825 | 1821 | $oldExpiry = $config['expiry'] !== 'infinity' ? |
1826 | 1822 | wfTimestamp( TS_RFC2822, $config['expiry'] ) : 'infinite'; |
| 1823 | + # Load request params... |
| 1824 | + $selected = $wgRequest->getVal( 'wpStabilityConfig', FlaggedRevs::getProtectionLevel($config) ); |
| 1825 | + $expiry = $wgRequest->getText( 'mwStabilize-expiry' ); |
| 1826 | + $reviewThis = $wgRequest->getBool( 'wpReviewthis', true ); |
1827 | 1827 | # Add some script for expiry dropdowns |
1828 | 1828 | $wgOut->addScript( |
1829 | 1829 | "<script type=\"text/javascript\"> |