Index: trunk/extensions/WhiteList/WhiteListAuth.php |
— | — | @@ -28,62 +28,70 @@ |
29 | 29 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
30 | 30 | */ |
31 | 31 | |
| 32 | +if (!defined("WHITELIST_GRANT")) { |
| 33 | + define("WHITELIST_GRANT", 1); |
| 34 | +} |
| 35 | +if (!defined("WHITELIST_DENY")) { |
| 36 | + define("WHITELIST_DENY", -1); |
| 37 | +} |
| 38 | +if (!defined("WHITELIST_NOACTION")) { |
| 39 | + define("WHITELIST_NOACTION", 0); |
| 40 | +} |
| 41 | + |
32 | 42 | class WhiteListExec |
33 | 43 | { |
34 | | - const WHITELIST_GRANT = 1; |
35 | | - const WHITELIST_DENY = 0; |
36 | | - const WHITELIST_NOACTION = -1; |
37 | 44 | |
38 | 45 | /* $result value: |
39 | 46 | * true=Access Granted |
40 | 47 | * false=Access Denied |
41 | | - * null=Do not know/do not care (not 'allowed' or 'denied') |
| 48 | + * null=Don't know/don't care (not 'allowed' or 'denied') |
42 | 49 | * Return value: |
43 | 50 | * true=Later functions can override. |
44 | 51 | * false=Later functions not consulted. |
45 | 52 | */ |
46 | | - static function CheckWhiteList( &$title, &$wgUser, $action, &$result ) { |
| 53 | + static function CheckWhiteList(&$title, &$wgUser, $action, &$result) { |
47 | 54 | |
48 | | - $override = self::WHITELIST_NOACTION; |
| 55 | + $override = WHITELIST_NOACTION; |
49 | 56 | |
50 | | - /* Bail if the user is not restricted.... */ |
51 | | - if ( !in_array( 'restricttowhitelist', $wgUser->getRights() ) ) { |
52 | | - $result = null; /* do not care */ |
| 57 | + |
| 58 | + /* Bail if the user isn't restricted.... */ |
| 59 | + if( !in_array('restricttowhitelist', $wgUser->getRights()) ) { |
| 60 | + $result = null; /* don't care */ |
53 | 61 | return true; /* Later functions can override */ |
54 | 62 | } |
55 | 63 | |
56 | 64 | /* Sanity Check */ |
57 | | - if ( !$title ) |
58 | | - return $hideMe; |
| 65 | + if (!$title) |
| 66 | + return false; |
59 | 67 | |
60 | 68 | # If this is a talk page, we need to check permissions |
61 | 69 | # of the subject page instead... |
62 | 70 | $true_title = $title->getSubjectPage(); |
63 | 71 | |
64 | 72 | /* Check global allow/deny lists */ |
65 | | - $override = self::GetOverride( $true_title, $action ); |
| 73 | + $override = self::GetOverride($true_title, $action); |
| 74 | + |
| 75 | + /* Check if page is on whitelist */ |
| 76 | + if( WHITELIST_NOACTION == $override ) |
| 77 | + $override = self::IsAllowedNamespace( $true_title, $wgUser, $action ); |
66 | 78 | |
67 | 79 | /* Check if page is on whitelist */ |
68 | | - if ( self::WHITELIST_NOACTION == $override ) |
69 | | - $override = self::IsAllowedNamespace( $true_title, $wgUser, $action ); |
70 | | - |
71 | | - /* Check if page is on whitelist */ |
72 | | - if ( self::WHITELIST_NOACTION == $override ) |
| 80 | + if( WHITELIST_NOACTION == $override ) |
73 | 81 | $override = self::IsAllowed( $true_title, $wgUser, $action ); |
74 | 82 | |
75 | 83 | /* Check if user page */ |
76 | | - if ( self::WHITELIST_NOACTION == $override ) |
| 84 | + if( WHITELIST_NOACTION == $override ) |
77 | 85 | $override = self::IsUserPage( $true_title->GetPrefixedText(), $wgUser ); |
78 | 86 | |
79 | 87 | switch( $override ) |
80 | 88 | { |
81 | | - case self::WHITELIST_GRANT: |
| 89 | + case WHITELIST_GRANT: |
82 | 90 | $result = true; /* Allow other checks to be run */ |
83 | 91 | return true; /* Later functions can override */ |
84 | 92 | break; |
85 | | - case self::WHITELIST_DENY: |
86 | | - case self::WHITELIST_NOACTION: |
87 | | - default: /* Invalid - should not be possible... */ |
| 93 | + case WHITELIST_DENY: |
| 94 | + case WHITELIST_NOACTION: |
| 95 | + default: /* Invalid - shouldn't be possible... */ |
88 | 96 | $result = false; /* Access Denied */ |
89 | 97 | return false; /* Later functions not consulted */ |
90 | 98 | } |
— | — | @@ -91,63 +99,63 @@ |
92 | 100 | |
93 | 101 | /* Check for global page overrides (allow or deny) |
94 | 102 | */ |
95 | | - static function GetOverride( $title, $action ) |
| 103 | + static function GetOverride($title, $action ) |
96 | 104 | { |
97 | 105 | global $wgWhiteListOverride; |
98 | 106 | |
99 | | - $allowView = $allowEdit = $denyView = $denyEdit = false; |
| 107 | + $allowView = $allowEdit = $denyView = $denyEdit = false; |
| 108 | + |
| 109 | + foreach( $wgWhiteListOverride['always']['read'] as $value ) |
| 110 | + { |
| 111 | + if( self::RegexCompare($title, $value) ) |
| 112 | + { |
| 113 | + $allowView = true; |
| 114 | + } |
| 115 | + } |
| 116 | + |
| 117 | + foreach( $wgWhiteListOverride['always']['edit'] as $value ) |
| 118 | + { |
| 119 | + if( self::RegexCompare($title, $value) ) |
| 120 | + { |
| 121 | + $allowEdit = true; |
| 122 | + } |
| 123 | + } |
100 | 124 | |
101 | | - foreach ( $wgWhiteListOverride['always']['read'] as $value ) |
102 | | - { |
103 | | - if ( self::RegexCompare( $title, $value ) ) |
104 | | - { |
105 | | - $allowView = true; |
106 | | - } |
107 | | - } |
| 125 | + unset($override); |
108 | 126 | |
109 | | - foreach ( $wgWhiteListOverride['always']['edit'] as $value ) |
110 | | - { |
111 | | - if ( self::RegexCompare( $title, $value ) ) |
112 | | - { |
113 | | - $allowEdit = true; |
114 | | - } |
115 | | - } |
| 127 | + foreach( $wgWhiteListOverride['never']['read'] as $value ) |
| 128 | + { |
| 129 | + if( self::RegexCompare($title, $value) ) |
| 130 | + { |
| 131 | + $denyView = true; |
| 132 | + } |
| 133 | + } |
| 134 | + |
| 135 | + foreach( $wgWhiteListOverride['never']['edit'] as $value ) |
| 136 | + { |
| 137 | + if( self::RegexCompare($title, $value) ) |
| 138 | + { |
| 139 | + $denyEdit = true; |
| 140 | + } |
| 141 | + } |
116 | 142 | |
117 | | - $override = 'undef'; |
118 | | - |
119 | | - foreach ( $wgWhiteListOverride['never']['read'] as $value ) |
| 143 | + if( $action == 'edit' ) |
120 | 144 | { |
121 | | - if ( self::RegexCompare( $title, $value ) ) |
122 | | - { |
123 | | - $denyView = true; |
124 | | - } |
125 | | - } |
126 | | - |
127 | | - foreach ( $wgWhiteListOverride['never']['edit'] as $value ) |
128 | | - { |
129 | | - if ( self::RegexCompare( $title, $value ) ) |
130 | | - { |
131 | | - $denyEdit = true; |
132 | | - } |
133 | | - } |
134 | | - |
135 | | - if ( $action == 'edit' ) |
136 | | - { |
137 | | - if ( $denyEdit || $denyView ) |
138 | | - $override = self::WHITELIST_DENY; |
139 | | - else if ( $allowEdit ) |
140 | | - $override = self::WHITELIST_GRANT; |
| 145 | + if( $denyEdit || $denyView ) |
| 146 | + $override = WHITELIST_DENY; |
| 147 | + else if( $allowEdit ) |
| 148 | + $override = WHITELIST_GRANT; |
141 | 149 | else |
142 | | - $override = self::WHITELIST_NOACTION; |
| 150 | + $override = WHITELIST_NOACTION; |
143 | 151 | } |
144 | 152 | else |
145 | 153 | { |
146 | | - if ( $denyView ) |
147 | | - $override = self::WHITELIST_DENY; |
148 | | - else if ( $allowView || $allowEdit ) |
149 | | - $override = self::WHITELIST_GRANT; |
| 154 | + if( $denyView ) |
| 155 | + $override = WHITELIST_DENY; |
| 156 | + else if( $allowView || $allowEdit ) |
| 157 | + $override = WHITELIST_GRANT; |
150 | 158 | else |
151 | | - $override = self::WHITELIST_NOACTION; |
| 159 | + $override = WHITELIST_NOACTION; |
152 | 160 | } |
153 | 161 | |
154 | 162 | return $override; |
— | — | @@ -162,27 +170,28 @@ |
163 | 171 | $userPage = $wgUser->getUserPage()->getPrefixedText(); |
164 | 172 | $userTalkPage = $wgUser->getTalkPage()->getPrefixedText(); |
165 | 173 | |
166 | | - if ( ( $wgWhiteListAllowUserPages == true ) && |
167 | | - ( $title_text == $userPage ) || ( $title_text == $userTalkPage ) ) |
168 | | - return self::WHITELIST_GRANT; |
| 174 | + if( ($wgWhiteListAllowUserPages == true) && |
| 175 | + ($title_text == $userPage) || ($title_text == $userTalkPage) ) |
| 176 | + return WHITELIST_GRANT; |
169 | 177 | else |
170 | | - return self::WHITELIST_NOACTION; |
| 178 | + return WHITELIST_NOACTION; |
171 | 179 | } |
172 | 180 | |
173 | | - static function IsAllowedNamespace( &$title, &$wgUser, $action ) |
174 | | - { |
| 181 | + static function IsAllowedNamespace( &$title, &$wgUser, $action) |
| 182 | + { |
175 | 183 | |
176 | | - $page_ns = $title->getNsText(); |
177 | | - if ( ( $page_ns == 'Mediawiki' ) || |
178 | | - ( $page_ns == 'Image' ) || |
179 | | - ( $page_ns == 'Help' ) ) |
180 | | - { |
181 | | - return self::WHITELIST_GRANT; |
182 | | - } |
| 184 | + $page_ns = $title->getNsText(); |
| 185 | + if( ($page_ns == 'Mediawiki' ) || |
| 186 | + ($page_ns == 'Image' ) || |
| 187 | + ($page_ns == 'Help' ) ) |
| 188 | + { |
| 189 | + return WHITELIST_GRANT; |
| 190 | + } |
183 | 191 | |
184 | | - return self::WHITELIST_NOACTION; |
185 | | - } |
| 192 | + return WHITELIST_NOACTION; |
| 193 | + } |
186 | 194 | |
| 195 | + |
187 | 196 | /* Check whether the page is whitelisted. |
188 | 197 | * returns true if page is on whitelist, false if it is not. |
189 | 198 | */ |
— | — | @@ -197,88 +206,113 @@ |
198 | 207 | $dbr = wfGetDB( DB_SLAVE ); |
199 | 208 | |
200 | 209 | $wl_table_name = $dbr->tableName( 'whitelist' ); |
201 | | - $current_date = date( "Y-m-d H:i:s" ); |
202 | | - $sql = "SELECT wl_page_title |
| 210 | + $current_date = date("Y-m-d H:i:s"); |
| 211 | + $sql = "SELECT wl_page_title |
203 | 212 | FROM " . $wl_table_name . " |
204 | | - WHERE wl_user_id = " . $dbr->addQuotes( $wgUser->getId() ) . " |
205 | | - AND ( (wl_expires_on >= " . $dbr->addQuotes( $current_date ) . ") |
206 | | - OR ( wl_expires_on = " . $dbr->addQuotes( '' ) . "))"; |
207 | | - if ( $action == 'edit' ) { |
| 213 | + WHERE wl_user_id = " . $dbr->addQuotes($wgUser->getId()) . " |
| 214 | + AND ( (wl_expires_on >= " . $dbr->addQuotes($current_date) . ") |
| 215 | + OR ( wl_expires_on = " . $dbr->addQuotes('') . "))"; |
| 216 | + if( $action == 'edit' ) { |
208 | 217 | $sql .= " |
209 | | - AND wl_allow_edit = " . $dbr->addQuotes( '1' ); |
| 218 | + AND wl_allow_edit = " . $dbr->addQuotes('1'); |
210 | 219 | } |
211 | | - # print $sql; |
| 220 | +//wfDebug($sql); |
212 | 221 | |
213 | | - // We should also check that $title is not a redirect to a whitelisted page |
214 | | - $redirecttitle = NULL; |
215 | | - $article = new Article( $title ); |
216 | | - if ( is_object( $article ) ) |
217 | | - { |
218 | | - $pagetext = $article->getContent(); |
219 | | - $redirecttitle = Title::newFromRedirect( $pagetext ); |
220 | | - } |
221 | | - |
| 222 | + // We should also check that $title is not a redirect to a whitelisted page |
| 223 | + $redirecttitle = NULL; |
| 224 | + $article = new Article($title); |
| 225 | + if (is_object($article)) |
| 226 | + { |
| 227 | + $pagetext = $article->getContent(); |
| 228 | + $redirecttitle = Title::newFromRedirect($pagetext); |
| 229 | + } |
| 230 | + |
222 | 231 | /* Loop through each result returned and |
223 | 232 | * check for matches. |
224 | 233 | */ |
225 | | - $dbr->begin(); |
226 | | - $db_results = $dbr->query( $sql , __METHOD__, true ); |
227 | | - $dbr->commit(); |
228 | | - while ( $db_result = $dbr->fetchObject( $db_results ) ) |
| 234 | + $dbr->begin(); |
| 235 | + $db_results = $dbr->query( $sql , __METHOD__, true); |
| 236 | + $dbr->commit(); |
| 237 | + while( $db_result = $dbr->fetchObject($db_results) ) |
229 | 238 | { |
230 | | - if ( self::RegexCompare( $title, $db_result->wl_page_title ) ) |
| 239 | + if( self::RegexCompare($title, $db_result->wl_page_title) ) |
231 | 240 | { |
232 | | - $dbr->freeResult( $db_results ); |
233 | | - # wfDebug("\n\nAccess granted based on PAGE [" . $db_result->wl_page_title . "]\n\n"); |
234 | | - return self::WHITELIST_GRANT; |
| 241 | + $dbr->freeResult($db_results); |
| 242 | +//wfDebug("\n\nAccess granted based on PAGE [" . $db_result->wl_page_title . "]\n\n"); |
| 243 | + return WHITELIST_GRANT; |
235 | 244 | } |
236 | | - if ( $redirecttitle ) |
237 | | - { |
238 | | - if ( self::RegexCompare( $redirecttitle, $db_result->wl_page_title ) ) |
239 | | - { |
240 | | - $dbr->freeResult( $db_results ); |
241 | | - # wfDebug("\n\nAccess granted based on REDIRECT to PAGE [" . $db_result->wl_page_title . "]\n\n"); |
242 | | - return self::WHITELIST_GRANT; |
243 | | - } |
244 | | - } |
| 245 | + if ($redirecttitle) |
| 246 | + { |
| 247 | + if( self::RegexCompare($redirecttitle, $db_result->wl_page_title) ) |
| 248 | + { |
| 249 | + $dbr->freeResult($db_results); |
| 250 | +//wfDebug("\n\nAccess granted based on REDIRECT to PAGE [" . $db_result->wl_page_title . "]\n\n"); |
| 251 | + return WHITELIST_GRANT; |
| 252 | + } |
| 253 | + } |
245 | 254 | } |
246 | | - $dbr->freeResult( $db_results ); |
| 255 | + $dbr->freeResult($db_results); |
247 | 256 | |
248 | | - return self::WHITELIST_NOACTION; |
| 257 | + return WHITELIST_NOACTION; |
249 | 258 | } |
250 | 259 | |
251 | 260 | /* Returns true if hit, false otherwise */ |
252 | | - static function RegexCompare( &$title, $sql_regex ) |
| 261 | + static function RegexCompare(&$title, $sql_regex) |
253 | 262 | { |
254 | | - global $wgWhiteListWildCardInsensitive; |
255 | | - |
| 263 | + global $wgWhiteListWildCardInsensitive; |
| 264 | + |
256 | 265 | $ret_val = false; |
257 | | - |
| 266 | + |
258 | 267 | /* Convert regex to PHP format */ |
259 | | - $php_regex = str_replace( '%', '.*', $sql_regex ); |
260 | | - $php_regex = str_replace( '_', ' ', $php_regex ); |
261 | | - $php_regex = ltrim( $php_regex, ":" ); |
| 268 | + $illegal_chars = array( |
| 269 | + '%', |
| 270 | + '_', |
| 271 | + '\\', |
| 272 | + '(', |
| 273 | + ')', |
| 274 | + '$', |
| 275 | + '^', |
| 276 | + '[', |
| 277 | + ']' |
| 278 | + ); |
| 279 | + $escaped_chars = array( |
| 280 | + '.*', |
| 281 | + ' ', |
| 282 | + '\\\\', |
| 283 | + '\(', |
| 284 | + '\)', |
| 285 | + '\$', |
| 286 | + '\^', |
| 287 | + '\[', |
| 288 | + '\]' |
| 289 | + ); |
| 290 | + $php_regex = str_replace($illegal_chars, $escaped_chars, $sql_regex); |
| 291 | + $php_regex = ltrim($php_regex, ":"); |
262 | 292 | |
263 | 293 | /* Generate regex; use | as delimiter as it is an illegal title character. */ |
264 | 294 | $php_regex_full = '|^' . $php_regex . '$|'; |
265 | | - if ( $wgWhiteListWildCardInsensitive ) |
266 | | - $php_regex_full .= 'i'; |
| 295 | + if ($wgWhiteListWildCardInsensitive) |
| 296 | + $php_regex_full .= 'i'; |
267 | 297 | |
268 | | - # print( $php_regex_full . " [" . $title->getPrefixedText() . "]<br />\n"); |
269 | | - if ( self::preg_test( $php_regex_full ) ) { |
270 | | - if ( preg_match( $php_regex_full, $title->getPrefixedText() ) ) { |
271 | | - # print("MATCH!!"); |
| 298 | +//print("* Comapring '" . $php_regex_full . "' to page title '" . $title->getPrefixedText() . "'\n"); |
| 299 | + if (self::preg_test($php_regex_full)) { |
| 300 | + if( preg_match( $php_regex_full, $title->getPrefixedText() ) ) { |
| 301 | +//print("** MATCH\n"); |
272 | 302 | $ret_val = true; |
| 303 | + } |
| 304 | + else |
| 305 | + { |
| 306 | +//print("** fail\n"); |
273 | 307 | } |
274 | 308 | } |
275 | | - |
| 309 | + |
276 | 310 | return $ret_val; |
277 | 311 | } |
278 | 312 | |
279 | 313 | # test to see if a regular expression is valid |
280 | | - static function preg_test( $regex ) |
| 314 | + function preg_test($regex) |
281 | 315 | { |
282 | | - if ( sprintf( "%s", @preg_match( $regex, '' ) ) == '' ) |
| 316 | + if (sprintf("%s",@preg_match($regex,'')) == '') |
283 | 317 | { |
284 | 318 | $error = error_get_last(); |
285 | 319 | return false; |
— | — | @@ -286,35 +320,31 @@ |
287 | 321 | else |
288 | 322 | return true; |
289 | 323 | } |
290 | | -} |
| 324 | +} /* End class */ |
291 | 325 | |
292 | | -class WhiteListHooks |
293 | | -{ |
294 | | - static function AddRestrictedPagesTab( &$personal_urls, $wgTitle ) |
| 326 | +class WhiteListHooks { |
| 327 | + function AddRestrictedPagesTab(&$personal_urls, $wgTitle) |
295 | 328 | { |
296 | | - global $wgOut, $wgUser, $wgWhiteListRestrictedGroup; |
| 329 | + global $wgUser, $wgWhiteListRestrictedGroup; |
297 | 330 | |
298 | | - wfLoadExtensionMessages( 'WhiteList' ); |
| 331 | + $userIsRestricted = in_array( $wgWhiteListRestrictedGroup, $wgUser->getGroups() ); |
299 | 332 | |
300 | | - $userIsRestricted = in_array( $wgWhiteListRestrictedGroup, $wgUser->getGroups() ); |
301 | | - |
302 | | - if ( $wgUser->isLoggedIn() && $userIsRestricted ) { |
303 | | - $personal_urls['mypages'] = array( |
304 | | - 'text' => wfMsg( 'mywhitelistpages' ), |
305 | | - 'href' => Skin::makeSpecialUrl( 'WhiteList' ) |
306 | | - ); |
307 | | - } |
308 | | - return true; |
| 333 | + if ($wgUser->isLoggedIn() && $userIsRestricted) { |
| 334 | + # In older versions of MW, loading of message files was done differently than the |
| 335 | + # current default. So, let's work around that by forcing the load of the message file. |
| 336 | + WhiteList::loadMessages(); |
| 337 | + |
| 338 | + $personal_urls['mypages'] = array( |
| 339 | + 'text' => wfMsg('mywhitelistpages'), |
| 340 | + 'href' => Skin::makeSpecialUrl('WhiteList') |
| 341 | + ); |
| 342 | + } |
| 343 | + return true; |
309 | 344 | } |
310 | | - |
311 | | - public static function CheckSchema() { |
312 | | - // Get a connection |
313 | | - $db = wfGetDB( DB_MASTER ); |
314 | | - // Create table if it doesn't exist |
315 | | - if ( !$db->tableExists( 'whitelist' ) ) { |
316 | | - $db->sourceFile( dirname( __FILE__ ) . '/WhiteListEdit.sql' ); |
317 | | - } |
318 | | - // Continue |
| 345 | + |
| 346 | + // TODO - this is missing from Siebrand's changes |
| 347 | + function CheckSchema() |
| 348 | + { |
319 | 349 | return true; |
320 | 350 | } |
321 | | -} |
| 351 | +} /* End class */ |
Index: trunk/extensions/WhiteList/WhiteListEdit_body.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | 4 | This program is free software; you can redistribute it and/or |
5 | | -modify it under the terms of the GNU General Public License |
| 5 | +modify it under the terms of the GNU General Public LicenseWh |
6 | 6 | as published by the Free Software Foundation, version 2 |
7 | 7 | of the License. |
8 | 8 | |
— | — | @@ -27,17 +27,63 @@ |
28 | 28 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
29 | 29 | */ |
30 | 30 | |
| 31 | +# older versions of MW did not have the NewFromId method, let's define our own |
| 32 | +function WhiteListUserFromId($id) { |
| 33 | + if (method_exists('User', 'newfromid')) { |
| 34 | + return User::NewFromId($id); |
| 35 | + } else { |
| 36 | + $u = new User; |
| 37 | + $u->mId = $id; |
| 38 | + $u->mFrom = 'id'; |
| 39 | + return $u; |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +# older versions of MW did not have the standard method for loading messages. So, let's recreate it |
| 44 | +function WhiteListLoadMessages() { |
| 45 | + static $messagesLoaded = false; |
| 46 | + global $wgMessageCache; |
| 47 | + if ($messagesLoaded) return; |
| 48 | + $messagesLoaded = true; |
| 49 | + |
| 50 | + require_once(dirname(__FILE__) . '/WhiteListEdit.i18n.php' ); |
| 51 | + foreach ( $messages as $lang => $langMessages ) { |
| 52 | + $wgMessageCache->addMessages( $langMessages, $lang ); |
| 53 | + } |
| 54 | +} |
| 55 | + |
31 | 56 | class WhiteListEdit extends SpecialPage |
32 | 57 | { |
33 | 58 | function __construct() { |
| 59 | + self::loadMessages(); |
34 | 60 | SpecialPage::SpecialPage( 'WhiteListEdit', 'editwhitelist' ); |
35 | 61 | } |
36 | 62 | |
| 63 | + function loadMessages() { |
| 64 | + # the new method for loading extension messages is only available in MW versions > 1.12 |
| 65 | + # so let's keep the compatibility with older versions |
| 66 | + if (function_exists('wfLoadExtensionMessages')) |
| 67 | + { |
| 68 | + wfLoadExtensionMessages('WhiteListEdit'); |
| 69 | + } |
| 70 | + else |
| 71 | + { |
| 72 | + WhiteListLoadMessages(); |
| 73 | + } |
| 74 | + |
| 75 | + return true; |
| 76 | + } |
| 77 | + |
37 | 78 | function execute( $par ) { |
38 | 79 | global $wgRequest, $wgOut, $wgUser; |
39 | 80 | |
40 | | - wfLoadExtensionMessages( 'WhiteList' ); |
41 | | - |
| 81 | + # sanity check |
| 82 | + if ($wgUser->isAnon()) |
| 83 | + { |
| 84 | + $wgOut->PermissionRequired('editwhitelist'); |
| 85 | + return; |
| 86 | + } |
| 87 | + |
42 | 88 | $this->setHeaders(); |
43 | 89 | $wgOut->setPagetitle( wfMsg( 'whitelistedit' ) ); |
44 | 90 | |
— | — | @@ -78,7 +124,7 @@ |
79 | 125 | $wgOut->addHTML( "<input type='hidden' name='NewExpiryDate' value='$NewExpiryDate'>" ); |
80 | 126 | $wgOut->addHTML( "<input type='hidden' name='action' value='$action'>" ); |
81 | 127 | |
82 | | - $ContractorUser = User::newFromID( $contractorId ); |
| 128 | + $ContractorUser = WhiteListUserFromID( $contractorId ); |
83 | 129 | $wgOut->addWikiText( wfMsg( 'whitelistoverview', $ContractorUser->getRealName() ) ); |
84 | 130 | } |
85 | 131 | |
— | — | @@ -294,7 +340,7 @@ |
295 | 341 | $wgOut->addHTML( ob_get_contents() ); |
296 | 342 | ob_clean(); |
297 | 343 | |
298 | | - $ContractorUser = User::newFromID( $contractorId ); |
| 344 | + $ContractorUser = WhiteListUserFromID( $contractorId ); |
299 | 345 | $wgOut->addHTML( wfMsg( 'whitelistfor', $ContractorUser->getRealName() ) ); |
300 | 346 | $wgOut->addHTML( '</td></tr><tr><th><center>' . |
301 | 347 | wfMsg( 'whitelisttablemodify' ) . "<br /><a href=\"javascript:SetChecked(1,'cb_modify[]')\">" . |
— | — | @@ -318,7 +364,7 @@ |
319 | 365 | $wgOut->addHTML( wfMsg( 'whitelisttableview' ) ); |
320 | 366 | } |
321 | 367 | $wgOut->addHTML( "</center></td><td> $row->wl_expires_on</td><td>" ); |
322 | | - $u = User::newFromId( $row->wl_updated_by_user_id ); |
| 368 | + $u = WhiteListUserFromId( $row->wl_updated_by_user_id ); |
323 | 369 | $wgOut->addHTML( $u->getRealName() ); |
324 | 370 | $wgOut->addHTML( "</td><td>$row->wl_updated_on</td></tr>" ); |
325 | 371 | } |
— | — | @@ -406,7 +452,7 @@ |
407 | 453 | $dbr->commit(); |
408 | 454 | |
409 | 455 | for ( $row = $dbr->fetchObject( $res ); $row; $row = $dbr->fetchObject( $res ) ) { |
410 | | - $u = User::newFromID( $row->ug_user ); |
| 456 | + $u = WhiteListUserFromID( $row->ug_user ); |
411 | 457 | $users[$row->ug_user] = $u->getRealName(); |
412 | 458 | if ( $users[$row->ug_user] == "" ) |
413 | 459 | $users[$row->ug_user] = $u->getName(); |
— | — | @@ -451,24 +497,37 @@ |
452 | 498 | |
453 | 499 | function ExpandWildCardWhiteList( $wl_pattern ) |
454 | 500 | { |
455 | | - global $wgContLanguageCode, $wgWhiteListWildCardInsensitive; |
| 501 | + global $wgOut, $wgContLanguageCode, $wgWhiteListWildCardInsensitive; |
456 | 502 | |
457 | 503 | $dbr = wfGetDB( DB_SLAVE ); |
458 | | - $dbr->debug( true ); |
459 | 504 | $expanded = array(); |
460 | 505 | $whitelisted = array(); |
461 | 506 | $debug = 0; |
| 507 | + $dbr->debug($debug); |
462 | 508 | |
463 | 509 | # extract the NameSpace (the first part before the optional first colon followed by the article name |
464 | 510 | $pattern = '/^((:?)(.*?):)?(.*)$/'; |
465 | 511 | $pattern .= $wgWhiteListWildCardInsensitive ? 'i' : ''; |
466 | 512 | |
467 | | - if ( preg_match( $pattern, $wl_pattern, $matches ) ) { |
| 513 | + if (preg_match($pattern, $wl_pattern, $matches)) { |
| 514 | +if ($debug) |
| 515 | +{ |
| 516 | + $wgOut->addWikiText("* found something for '$wl_pattern'"); |
| 517 | + ob_start(); |
| 518 | + print_r($matches); |
| 519 | + $wgOut->addWikiText(ob_get_contents()); |
| 520 | + ob_end_flush(); |
| 521 | +} |
| 522 | + global $wgContLang; |
468 | 523 | $found = array(); |
469 | 524 | $found['title'] = $matches[4]; |
470 | 525 | $found['ns'] = '%'; |
471 | 526 | |
472 | | - $ns = Language::Factory( $wgContLanguageCode ); |
| 527 | + if (method_exists('Language', 'Factory')) { |
| 528 | + $ns = Language::Factory( $wgContLanguageCode ); |
| 529 | + } else { |
| 530 | + $ns = $wgContLang; |
| 531 | + } |
473 | 532 | if ( $matches[1] == ':' && $matches[2] == '' ) |
474 | 533 | $found['ns'] = NS_MAIN; |
475 | 534 | if ( $nsindex = $ns->getNsIndex( $matches[3] ) ) |
— | — | @@ -491,19 +550,25 @@ |
492 | 551 | } |
493 | 552 | |
494 | 553 | if ( $debug ) |
| 554 | +{ |
| 555 | + $wgOut->addWikiText("expanded array is"); |
| 556 | + ob_start(); |
495 | 557 | print_r( $expanded ); |
496 | | - |
| 558 | + $wgOut->addWikiText(ob_get_contents()); |
| 559 | + ob_end_flush(); |
| 560 | +} |
497 | 561 | foreach ( $expanded as $entry ) { |
498 | | - $sql = "SELECT page_id FROM " . $dbr->tableName( 'page' ) . |
499 | | - " WHERE `page_namespace` LIKE '" . $entry['ns'] . |
500 | | - "' AND `page_title` LIKE '" . $entry['title'] . "'"; |
501 | | - |
502 | | - if ( $wgWhiteListWildCardInsensitive ) { |
503 | | - $sql = "SELECT page_id FROM " . |
504 | | - $dbr->tableName( 'page' ) . |
505 | | - " WHERE UPPER(`page_namespace`) LIKE '" . strtoupper( $entry['ns'] ) . "'" . |
506 | | - " AND UPPER(`page_title`) LIKE '" . strtoupper( $entry['title'] ) . "'"; |
| 562 | + $sql = "SELECT `page_id` FROM " . $dbr->tableName( 'page' ) . |
| 563 | + " WHERE CONVERT(`page_namespace` USING utf8) LIKE CONVERT('" . $entry['ns'] . |
| 564 | + "' USING utf8) AND CONVERT(`page_title` USING utf8) LIKE CONVERT('" . $entry['title'] . |
| 565 | + "' USING utf8)"; |
| 566 | + if ($wgWhiteListWildCardInsensitive) { |
| 567 | + $sql = "SELECT `page_id` FROM ". $dbr->tableName('page') . |
| 568 | + " WHERE UPPER(CONVERT(`page_namespace` USING utf8)) LIKE CONVERT('" . strtoupper($entry['ns']) . |
| 569 | + "' USING utf8) AND UPPER(CONVERT(`page_title` USING utf8)) LIKE CONVERT('" . strtoupper($entry['title']) . |
| 570 | + "' USING utf8)"; |
507 | 571 | } |
| 572 | +if ($debug) $wgOut->addWikiText("the SQL query is :$sql:\n<br>"); |
508 | 573 | $dbr->begin(); |
509 | 574 | $res = $dbr->query( $sql, __METHOD__ ); |
510 | 575 | $dbr->commit(); |
— | — | @@ -514,8 +579,13 @@ |
515 | 580 | } |
516 | 581 | |
517 | 582 | if ( $debug ) |
518 | | - print_r( $whitelisted ); |
519 | | - |
| 583 | +{ |
| 584 | + $wgOut->addWikiText("Whitelisted array is"); |
| 585 | + ob_start(); |
| 586 | + print_r( $whitelisted ); |
| 587 | + $wgOut->addWikiText(ob_get_contents()); |
| 588 | + ob_end_flush(); |
| 589 | +} |
520 | 590 | return $whitelisted; |
521 | 591 | } |
522 | 592 | |
— | — | @@ -528,7 +598,9 @@ |
529 | 599 | $debug = 0; |
530 | 600 | |
531 | 601 | $wildcard_match = self::ExpandWildCardWhiteList( $pagename ); |
| 602 | +if ($debug) $wgOut->addWikiText("* tried to find matches for '$pagename'\n"); |
532 | 603 | $num_matches = count( $wildcard_match ); |
| 604 | +if ($debug) $wgOut->addWikiText("** found $num_matches\n"); |
533 | 605 | $need_bullet = 0; |
534 | 606 | if ( substr( $headertext, 0, 1 ) == '*' ) |
535 | 607 | { |
— | — | @@ -540,8 +612,7 @@ |
541 | 613 | $headertext = "[[:$pagename|$headertext]]"; |
542 | 614 | if ( $need_bullet ) |
543 | 615 | $headertext = '* ' . $headertext; |
544 | | - if ( $debug ) |
545 | | - print "Adding '$headertext'\n"; |
| 616 | +if ($debug) $wgOut->addWikiText("* Adding '$headertext'\n"); |
546 | 617 | $wgOut->addWikiText( $headertext ); |
547 | 618 | return; |
548 | 619 | } |
— | — | @@ -554,7 +625,7 @@ |
555 | 626 | $wgOut->addHTML( '<div class="NavFrame" style="padding:0px;border-style:none;">' ); |
556 | 627 | $wgOut->addHTML( '<div class="NavHead" style="background: #ffffff; text-align: left; font-size:100%;">' ); |
557 | 628 | # this is a hack to make the [show]/[hide] always appear after the text |
558 | | - $wgOut->addWikiText( "$headertext" . wfMsgExt( 'whitelistnummatches', array( 'parsemag' ), array( $num_matches ) ) . " <font color='#ffffff'>[show]</font> </div>" ); |
| 629 | + $wgOut->addHtml("$headertext" . wfMsgExt('whitelistnummatches', array( 'parsemag' ), $num_matches) . " <font color='#ffffff'>[show]</font> </div>"); |
559 | 630 | $wgOut->addHTML( '<div class="NavContent" style="display:none; font-size:normal; text-align:left">' ); |
560 | 631 | |
561 | 632 | foreach ( $wildcard_match as $pageid ) |
— | — | @@ -572,9 +643,25 @@ |
573 | 644 | class WhiteList extends SpecialPage |
574 | 645 | { |
575 | 646 | function __construct() { |
| 647 | + self::loadMessages(); |
576 | 648 | SpecialPage::SpecialPage( 'WhiteList', 'restricttowhitelist' ); |
577 | 649 | } |
578 | 650 | |
| 651 | + function loadMessages() { |
| 652 | + # the new method for loading extension messages is only available in MW versions > 1.12 |
| 653 | + # so let's keep the compatibility with older versions |
| 654 | + if (function_exists('wfLoadExtensionMessages')) |
| 655 | + { |
| 656 | + wfLoadExtensionMessages('WhiteList'); |
| 657 | + } |
| 658 | + else |
| 659 | + { |
| 660 | + WhiteListLoadMessages(); |
| 661 | + } |
| 662 | + |
| 663 | + return true; |
| 664 | + } |
| 665 | + |
579 | 666 | function execute( $para ) { |
580 | 667 | global $wgRequest, $wgOut, $wgUser, $wgWhiteListOverride, $wgWhiteListManagerGroup, $wgWhiteListRestrictedGroup, $wgSitename; |
581 | 668 | |
— | — | @@ -583,11 +670,9 @@ |
584 | 671 | if ( !isset( $para ) || $para == '' ) { |
585 | 672 | $user = $wgUser; |
586 | 673 | } else { |
587 | | - $user = User::newFromId( $user ); |
| 674 | + $user = WhiteListUserFromId( $user ); |
588 | 675 | } |
589 | 676 | |
590 | | - wfLoadExtensionMessages( 'WhiteList' ); |
591 | | - |
592 | 677 | $this->setHeaders(); |
593 | 678 | $wgOut->setPagetitle( wfMsg( 'whitelist' ) ); |
594 | 679 | |
— | — | @@ -608,7 +693,7 @@ |
609 | 694 | $to = new User(); |
610 | 695 | $to->mId = $wgRequest->getint( 'manager', 0 ); |
611 | 696 | } else { |
612 | | - $to = User::newFromId( $wgRequest->getint( 'manager', 0 ) ); |
| 697 | + $to = WhiteListUserFromId( $wgRequest->getint( 'manager', 0 ) ); |
613 | 698 | } |
614 | 699 | |
615 | 700 | // FIXME: I think this mail will be sent in the wrong language. |
— | — | @@ -660,7 +745,7 @@ |
661 | 746 | $res = $dbr->select( 'user_groups', 'ug_user', array( 'ug_group' => $wgWhiteListManagerGroup ), __METHOD__ ); |
662 | 747 | $dbr->commit(); |
663 | 748 | for ( $row = $dbr->fetchObject( $res ); $row; $row = $dbr->fetchObject( $res ) ) { |
664 | | - $u = User::newFromID( $row->ug_user ); |
| 749 | + $u = WhiteListUserFromID( $row->ug_user ); |
665 | 750 | $users[$u->getRealName()] = $row->ug_user; |
666 | 751 | } |
667 | 752 | $dbr->freeResult( $res ); |
Index: trunk/extensions/WhiteList/WhiteListEdit.i18n.php |
— | — | @@ -316,7 +316,6 @@ |
317 | 317 | */ |
318 | 318 | $messages['bs'] = array( |
319 | 319 | 'whitelisttablemodifyall' => 'Sve', |
320 | | - 'whitelisttableedit' => 'Uredi', |
321 | 320 | 'whitelistrequestmsg' => '$1 zahtijeva pristup slijedećim stranicama: |
322 | 321 | |
323 | 322 | $2', |
— | — | @@ -398,8 +397,7 @@ |
399 | 398 | 'whitelistoverviewrm' => '* Zugriff auf [[:$1|$1]] wird entfernt', |
400 | 399 | 'whitelistoverviewna' => "* [[:$1|$1]] wird zur Whitelist hinzugefügt. (Zugriff: '''$2''', Ablaufdatum: '''$3''')", |
401 | 400 | 'whitelistrequest' => 'Weiteren Zugriff beantragen', |
402 | | - 'whitelistrequestmsg' => '$1 hat Zugriff auf die {{PLURAL:$3|folgende Seite|folgenden Seiten}} beantragt: |
403 | | - |
| 401 | + 'whitelistrequestmsg' => '$1 hat Zugriff auf die folgenden Seiten beantragt: |
404 | 402 | $2', |
405 | 403 | 'whitelistrequestconf' => 'Beantragung an $1 geschickt', |
406 | 404 | 'whitelistnonrestricted' => "'''$1''' ist kein beschränkter Benutzer. |
— | — | @@ -532,8 +530,6 @@ |
533 | 531 | 'whitelistnewtabledate' => 'Date d’expiration :', |
534 | 532 | 'whitelistnewtableedit' => 'Activer modification', |
535 | 533 | 'whitelistnewtableview' => 'Activer visualisation', |
536 | | - 'whitelistnowhitelistedusers' => 'Il n’y a aucun utilisateur dans le groupe « {{MediaWiki:Group-restricted}} ». |
537 | | -Vous devez [[Special:UserRights|ajouter l’utilisateur au groupe]] avant que vous puissiez ajouter des pages à la liste blanche d’un utilisateur.', |
538 | 534 | 'whitelistnewtableprocess' => 'Traiter', |
539 | 535 | 'whitelistnewtablereview' => 'Réviser', |
540 | 536 | 'whitelistselectrestricted' => '== Sélectionner un nom d’utilisateur à accès restreint ==', |
— | — | @@ -546,7 +542,7 @@ |
547 | 543 | 'whitelistoverviewrm' => '* Retrait de l’accès à [[:$1|$1]]', |
548 | 544 | 'whitelistoverviewna' => "* Ajoute [[:$1|$1]] à la liste blanche avec les droits de '''$2''' avec pour date d’expiration le '''$3'''", |
549 | 545 | 'whitelistrequest' => 'Demande d’accès à plus de pages', |
550 | | - 'whitelistrequestmsg' => '$1 a demandé l’accès {{PLURAL:$3|à la page suivante|aux pages suivantes}} : |
| 546 | + 'whitelistrequestmsg' => '$1 a demandé l’accès aux pages suivantes : |
551 | 547 | |
552 | 548 | $2', |
553 | 549 | 'whitelistrequestconf' => 'Une demande d’accès pour de nouvelles pages a été envoyée à $1', |
— | — | @@ -554,14 +550,6 @@ |
555 | 551 | Cette page ne s’applique qu’aux utilisateurs disposant de droits restreints.", |
556 | 552 | 'whitelistnever' => 'jamais', |
557 | 553 | 'whitelistnummatches' => ' - {{PLURAL:$1|une occurence|$1 occurences}}', |
558 | | - 'right-editwhitelist' => 'Modifier la liste blanche pour les utilisateurs existants', |
559 | | - 'right-restricttowhitelist' => 'Modifier et visionner les pages figurant uniquement sur la liste blanche', |
560 | | - 'action-editwhitelist' => 'modifier la liste blanche pour les utilisateurs existants', |
561 | | - 'action-restricttowhitelist' => 'modifier et visionner les pages figurant uniquement sur la liste blanche', |
562 | | - 'group-restricted' => 'Utilisateurs restreints', |
563 | | - 'group-restricted-member' => 'Utilisateur restreint', |
564 | | - 'group-manager' => 'Gestionnaires', |
565 | | - 'group-manager-member' => 'Gestionnaire', |
566 | 554 | ); |
567 | 555 | |
568 | 556 | /** Western Frisian (Frysk) |
— | — | @@ -614,7 +602,7 @@ |
615 | 603 | 'whitelistoverviewrm' => '* Eliminando o acceso a [[:$1|$1]]', |
616 | 604 | 'whitelistoverviewna' => "* Engadindo [[:$1|$1]] á listaxe branca (whitelist) con acceso a '''$2''' e data de remate '''$3'''", |
617 | 605 | 'whitelistrequest' => 'Solicitar acceso a máis páxinas', |
618 | | - 'whitelistrequestmsg' => '$1 solicitou ter acceso {{PLURAL:$3|á seguinte páxina|ás seguintes páxinas}}: |
| 606 | + 'whitelistrequestmsg' => '$1 solicitou ter acceso ás seguintes páxinas: |
619 | 607 | |
620 | 608 | $2', |
621 | 609 | 'whitelistrequestconf' => 'A solicitude para páxinas novas foi enviada a $1', |
— | — | @@ -622,8 +610,6 @@ |
623 | 611 | Esta páxina só é aplicable aos usuarios limitados", |
624 | 612 | 'whitelistnever' => 'nunca', |
625 | 613 | 'whitelistnummatches' => ' - {{PLURAL:$1|unha coincidencia|$1 coincidencias}}', |
626 | | - 'group-restricted' => 'Usuarios restrinxidos', |
627 | | - 'group-restricted-member' => 'Usuario restrinxido', |
628 | 614 | ); |
629 | 615 | |
630 | 616 | /** Gothic |
— | — | @@ -682,8 +668,6 @@ |
683 | 669 | 'whitelistnewtabledate' => 'תאריך הפקיעה:', |
684 | 670 | 'whitelistnewtableedit' => 'הגדרה לעריכה', |
685 | 671 | 'whitelistnewtableview' => 'הגדרה לתצוגה', |
686 | | - 'whitelistnowhitelistedusers' => 'אין משתמשים בקבוצה "{{MediaWiki:Group-restricted}}". |
687 | | -יהיה עליכם [[Special:UserRights|להוסיף משתמשים לקבוצה]] לפני שתוכלו להוסיף דפים לרשימה הלבנה של המשתמש.', |
688 | 672 | 'whitelistnewtableprocess' => 'עיבוד', |
689 | 673 | 'whitelistnewtablereview' => 'סקירה', |
690 | 674 | 'whitelistselectrestricted' => '== בחירת שם המשתמש המוגבל ==', |
— | — | @@ -696,7 +680,7 @@ |
697 | 681 | 'whitelistoverviewrm' => '* הסרת הגישה אל [[:$1|$1]]', |
698 | 682 | 'whitelistoverviewna' => "* הוספת [[:$1|$1]] לרשימה הלבנה עם הגישה '''$2''' ותאריך הפקיעה '''$3'''", |
699 | 683 | 'whitelistrequest' => 'בקשת גישה לדפים נוספים', |
700 | | - 'whitelistrequestmsg' => '$1 ביקש גישה ל{{PLURAL:$3|דף הבא|דפים הבאים}}: |
| 684 | + 'whitelistrequestmsg' => '$1 ביקש גישה לדפים הבאים: |
701 | 685 | |
702 | 686 | $2', |
703 | 687 | 'whitelistrequestconf' => 'הבקשה לדפים חדשים נשלחה אל $1', |
— | — | @@ -704,14 +688,6 @@ |
705 | 689 | ניתן להשתמש בדף זה עבור משתמשים מוגבלים בלבד", |
706 | 690 | 'whitelistnever' => 'לעולם לא', |
707 | 691 | 'whitelistnummatches' => ' - {{PLURAL:$1|תוצאה אחת|$1 תוצאות}}', |
708 | | - 'right-editwhitelist' => 'שינוי הרשימה הלבנה למשתמשים קיימים', |
709 | | - 'right-restricttowhitelist' => 'עריכה והצגה של דפים מהרשימה הלבנה בלבד', |
710 | | - 'action-editwhitelist' => 'לשנות את הרשימה הלבנה למשתמשים קיימים', |
711 | | - 'action-restricttowhitelist' => 'לערוך ולהציג דפים מהרשימה הלבנה בלבד', |
712 | | - 'group-restricted' => 'משתמשים מוגבלים', |
713 | | - 'group-restricted-member' => 'משתמש מוגבל', |
714 | | - 'group-manager' => 'מנהלים', |
715 | | - 'group-manager-member' => 'מנהל', |
716 | 692 | ); |
717 | 693 | |
718 | 694 | /** Hindi (हिन्दी) |
— | — | @@ -984,13 +960,12 @@ |
985 | 961 | 'whitelistoverviewsa' => "* Autorisatioun vum '''$1''' op [[:$2|$2]] astellen", |
986 | 962 | 'whitelistoverviewrm' => '* Autorisatioun fir [[:$1|$1]] gët ewechgeholl', |
987 | 963 | 'whitelistrequest' => 'Zougang zu méi Säite froen', |
988 | | - 'whitelistrequestmsg' => '$1 huet Zougrëff op dës {{PLURAL:$3|Säit|Säite}} gfrot: |
| 964 | + 'whitelistrequestmsg' => '$1 huet Accès op dës Säite gfrot: |
989 | 965 | |
990 | 966 | $2', |
991 | 967 | 'whitelistrequestconf' => "D'Ufro fir nei Säite gouf geschéckt un $1", |
992 | 968 | 'whitelistnever' => 'nie', |
993 | 969 | 'whitelistnummatches' => ' - $1 {{PLURAL:$1|Resultat|Resultater}}', |
994 | | - 'group-restricted' => 'Limitéiert Benotzer', |
995 | 970 | ); |
996 | 971 | |
997 | 972 | /** Eastern Mari (Олык Марий) |
— | — | @@ -1296,7 +1271,6 @@ |
1297 | 1272 | |
1298 | 1273 | /** Polish (Polski) |
1299 | 1274 | * @author Derbeth |
1300 | | - * @author Leinad |
1301 | 1275 | * @author Sp5uhe |
1302 | 1276 | * @author Wpedzich |
1303 | 1277 | */ |
— | — | @@ -1338,7 +1312,7 @@ |
1339 | 1313 | 'whitelistoverviewrm' => '* Usuwanie dostępu do [[:$1|$1]]', |
1340 | 1314 | 'whitelistoverviewna' => "* Dodawanie elementu [[:$1|$1]] do listy dostępu – dostęp dla '''$2''', data wygaśnięcia '''$3'''", |
1341 | 1315 | 'whitelistrequest' => 'Zażądaj dostępu do większej liczby stron', |
1342 | | - 'whitelistrequestmsg' => 'Użytkownik $1 zażądał dostępu do {{PLURAL:$3|następującej strony|następujących stron}}: |
| 1316 | + 'whitelistrequestmsg' => 'Użytkownik $1 zażądał dostępu do następujących stron: |
1343 | 1317 | |
1344 | 1318 | $2', |
1345 | 1319 | 'whitelistrequestconf' => 'Żądanie utworzenia nowych stron zostało przesłane do $1', |
— | — | @@ -1459,8 +1433,6 @@ |
1460 | 1434 | 'whitelistnewtabledate' => 'Dátum vypršania:', |
1461 | 1435 | 'whitelistnewtableedit' => 'Nastaviť na Upraviť', |
1462 | 1436 | 'whitelistnewtableview' => 'Nastaviť na Zobraziť', |
1463 | | - 'whitelistnowhitelistedusers' => 'V skupine „{{MediaWiki:Group-restricted}}“ sa nenachádzajú žiadni používatelia. |
1464 | | -Musíte [[Special:UserRights|pridať používateľov do tejto skupiny]] predtým, než budete môcť pridávať stránky na bielu listinu používateľa.', |
1465 | 1437 | 'whitelistnewtableprocess' => 'Spracovať', |
1466 | 1438 | 'whitelistnewtablereview' => 'Skontrolovať', |
1467 | 1439 | 'whitelistselectrestricted' => '== Vyberte meno používateľa ==', |
— | — | @@ -1473,7 +1445,7 @@ |
1474 | 1446 | 'whitelistoverviewrm' => '* Odstránenie prístupu na [[:$1|$1]]', |
1475 | 1447 | 'whitelistoverviewna' => "* Pridanie prístupu [[:$1|$1]] na bielu listinu s prístupom '''$2''' a vypršaním '''$3'''", |
1476 | 1448 | 'whitelistrequest' => 'Požiadať o prístup k viacerým stránkam', |
1477 | | - 'whitelistrequestmsg' => '$1 požiadal o prístup k {{PLURAL:$3|nasledovnej stránke|nasledovným stránkam}}: |
| 1449 | + 'whitelistrequestmsg' => '$1 požiadal o prístup k nasledovným stránkam: |
1478 | 1450 | |
1479 | 1451 | $2', |
1480 | 1452 | 'whitelistrequestconf' => 'Žiadosť o nové stránky bola odoslaná $1', |
— | — | @@ -1481,14 +1453,6 @@ |
1482 | 1454 | Táto stránka sa týka iba obmedzneých používateľov.", |
1483 | 1455 | 'whitelistnever' => 'nikdy', |
1484 | 1456 | 'whitelistnummatches' => ' - $1 {{PLURAL:$1|výsledok|výsledky|výsledkov}}', |
1485 | | - 'right-editwhitelist' => 'Zmeniť bielu listinu existujúcich používateľov', |
1486 | | - 'right-restricttowhitelist' => 'Upravovať a prezerať iba stránky z bielej listiny', |
1487 | | - 'action-editwhitelist' => 'zmeniť bielu listinu existujúcich používateľov', |
1488 | | - 'action-restricttowhitelist' => 'upravovať a prezerať iba stránky z bielej listiny', |
1489 | | - 'group-restricted' => 'Obmedzení používatelia', |
1490 | | - 'group-restricted-member' => 'Obmedzený používateľ', |
1491 | | - 'group-manager' => 'Správcovia', |
1492 | | - 'group-manager-member' => 'Správca', |
1493 | 1457 | ); |
1494 | 1458 | |
1495 | 1459 | /** Serbian Cyrillic ekavian (ћирилица) |
Index: trunk/extensions/WhiteList/WhiteListEdit.php |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | |
32 | 32 | $wgExtensionCredits['specialpage'][] = array( |
33 | 33 | 'name' => 'WhiteListEdit', |
34 | | - 'version' => 'v0.11.0', |
35 | | - 'author' => array( 'Paul Grinberg', 'Mike Sullivan' ), |
| 34 | + 'version' => 'v0.11.2', |
| 35 | + 'author' => array('Paul Grinberg', 'Mike Sullivan'), |
36 | 36 | 'email' => 'gri6507 at yahoo dot com, ms-mediawiki AT umich DOT edu', |
37 | 37 | 'description' => 'Edit the access permissions of restricted users', |
38 | 38 | 'descriptionmsg' => 'whitelist-desc', |
— | — | @@ -92,17 +92,32 @@ |
93 | 93 | |
94 | 94 | $dir = dirname( __FILE__ ) . '/'; |
95 | 95 | |
96 | | -$wgExtensionMessagesFiles['WhiteList'] = $dir . 'WhiteListEdit.i18n.php'; |
97 | | -$wgExtensionAliasesFiles['WhiteList'] = $dir . 'WhiteListEdit.alias.php'; |
98 | | -$wgAutoloadClasses['WhiteListEdit'] = $dir . 'WhiteListEdit_body.php'; |
99 | | -$wgAutoloadClasses['WhiteList'] = $dir . 'WhiteListEdit_body.php'; |
100 | | -$wgAutoloadClasses['WhiteListExec'] = $dir . 'WhiteListAuth.php'; |
101 | | -$wgAutoloadClasses['WhiteListHooks'] = $dir . 'WhiteListAuth.php'; |
102 | | -$wgSpecialPages['WhiteListEdit'] = 'WhiteListEdit'; |
103 | | -$wgSpecialPages['WhiteList'] = 'WhiteList'; |
| 96 | +$wgExtensionMessagesFiles['WhiteListEdit'] = $dir . 'WhiteListEdit.i18n.php'; |
| 97 | +$wgExtensionMessagesFiles['WhiteList'] = $dir . 'WhiteListEdit.i18n.php'; |
| 98 | +$wgExtensionAliasesFiles['WhiteList'] = $dir . 'WhiteListEdit.alias.php'; |
| 99 | +$wgAutoloadClasses['WhiteListEdit'] = $dir . 'WhiteListEdit_body.php'; |
| 100 | +$wgAutoloadClasses['WhiteList'] = $dir . 'WhiteListEdit_body.php'; |
| 101 | +$wgAutoloadClasses['WhiteListExec'] = $dir . 'WhiteListAuth.php'; |
| 102 | +$wgAutoloadClasses['WhiteListHooks'] = $dir . 'WhiteListAuth.php'; |
| 103 | +$wgSpecialPages['WhiteListEdit'] = 'WhiteListEdit'; |
| 104 | +$wgSpecialPages['WhiteList'] = 'WhiteList'; |
104 | 105 | $wgSpecialPageGroups['WhiteListEdit'] = 'users'; |
105 | 106 | $wgSpecialPageGroups['WhiteList'] = 'users'; |
106 | 107 | |
107 | | -$wgHooks['PersonalUrls'][] = 'WhiteListHooks::AddRestrictedPagesTab'; |
108 | | -$wgHooks['userCan'][] = 'WhiteListExec::CheckWhiteList'; |
109 | | -$wgHooks['LoadExtensionSchemaUpdates'][] = 'WhiteListHooks::CheckSchema'; |
| 108 | +# this is a compatability workaround for MW versions 1.9.3 and earlier. |
| 109 | +function WL_doCheckWhiteList(&$title, &$uwUser, $action, &$result) { |
| 110 | + return WhiteListExec::CheckWhiteList($title, $uwUser, $action, $result); |
| 111 | +} |
| 112 | + |
| 113 | +function WL_doAddRestrictedPagesTab(&$personal_urls, $wgTitle) { |
| 114 | + return WhiteListHooks::AddRestrictedPagesTab($personal_urls, $wgTitle); |
| 115 | +} |
| 116 | + |
| 117 | +// TODO - this is missing from Siebrand's changes |
| 118 | +function WL_doCheckSchema() { |
| 119 | + return WhiteListHooks::CheckSchema(); |
| 120 | +} |
| 121 | + |
| 122 | +$wgHooks['PersonalUrls'][] = 'WL_doAddRestrictedPagesTab'; |
| 123 | +$wgHooks['userCan'][] = 'WL_doCheckWhiteList'; |
| 124 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'WL_doCheckSchema'; |