Property changes on: trunk/extensions/SharedCssJs/SharedCssJs.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1 | + native |
Index: trunk/extensions/SharedCssJs/SharedCssJs.php |
— | — | @@ -1,14 +1,14 @@ |
2 | 2 | <?php |
3 | | -/**
|
4 | | - * SharedCssJs
|
5 | | - *
|
6 | | - * @package MediaWiki
|
7 | | - * @subpackage Extensions
|
8 | | - *
|
9 | | - * @author Tim Weyer (SVG) <svg@tim-weyer.org>
|
10 | | - *
|
11 | | - * @copyright Copyright (C) 2011 by Tim Weyer
|
12 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
| 3 | +/** |
| 4 | + * SharedCssJs |
| 5 | + * |
| 6 | + * @package MediaWiki |
| 7 | + * @subpackage Extensions |
| 8 | + * |
| 9 | + * @author Tim Weyer (SVG) <svg@tim-weyer.org> |
| 10 | + * |
| 11 | + * @copyright Copyright (C) 2011 by Tim Weyer |
| 12 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | 15 | if(!defined('MEDIAWIKI')) { |
— | — | @@ -24,12 +24,12 @@ |
25 | 25 | 'descriptionmsg' => 'sharedcssjs-desc', |
26 | 26 | ); |
27 | 27 | |
28 | | -// Localisation of this extension
|
29 | | -$dir = dirname( __FILE__ ) . '/';
|
| 28 | +// Localisation of this extension |
| 29 | +$dir = dirname( __FILE__ ) . '/'; |
30 | 30 | $wgExtensionMessagesFiles['SharedCssJs'] = $dir . 'SharedCssJs.i18n.php'; |
31 | 31 | |
32 | 32 | // Loading page protector |
33 | | -$dir = dirname( __FILE__ ) . '/';
|
| 33 | +$dir = dirname( __FILE__ ) . '/'; |
34 | 34 | require_once ( "$dir/SharedCssJsProtector.php" ); |
35 | 35 | |
36 | 36 | // Hooks |
— | — | @@ -38,7 +38,6 @@ |
39 | 39 | $wgHooks['BeforePageDisplay'][] = 'wfSharedJS'; |
40 | 40 | $wgHooks['BeforePageDisplay'][] = 'wfSharedUserJS'; |
41 | 41 | |
42 | | - |
43 | 42 | function wfSharedCSS( &$out ) { |
44 | 43 | global $wgDisableSharedCSS, $wgSharedCssJsUrl; |
45 | 44 | if( !empty( $wgDisableSharedCSS ) ) { |
— | — | @@ -91,4 +90,4 @@ |
92 | 91 | $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=User:{$userName}/global.js&action=raw&ctype={$wgJsMimeType}\"></script>"); |
93 | 92 | } |
94 | 93 | return true; |
95 | | -} |
\ No newline at end of file |
| 94 | +} |
Property changes on: trunk/extensions/SharedCssJs/SharedCssJs.php |
___________________________________________________________________ |
Added: svn:eol-style |
96 | 95 | + native |
Index: trunk/extensions/SharedCssJs/SharedCssJsProtector.php |
— | — | @@ -1,4 +1,4 @@ |
2 | | -<?php
|
| 2 | +<?php |
3 | 3 | /** |
4 | 4 | * Page protector file for the SharedCssJs extension |
5 | 5 | * |
— | — | @@ -9,44 +9,44 @@ |
10 | 10 | * |
11 | 11 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 12 | * @author Tim Weyer (SVG) <svg@tim-weyer.org> |
13 | | - */
|
14 | | -
|
| 13 | + */ |
| 14 | + |
15 | 15 | if(!defined('MEDIAWIKI')) { |
16 | 16 | echo("This is an extension to the MediaWiki software and cannot be used standalone"); |
17 | 17 | die(1); |
18 | | -}
|
19 | | -
|
| 18 | +} |
| 19 | + |
20 | 20 | $wgHooks['getUserPermissionsErrors'][] = 'fnProtectSharedCssJs'; |
21 | | -
|
22 | | -function fnProtectSharedCssJs( &$title, &$user, $action, &$result) {
|
| 21 | + |
| 22 | +function fnProtectSharedCssJs( &$title, &$user, $action, &$result) { |
23 | 23 | global $wgSharedCssJsDB, $wgDBname; |
24 | 24 | |
25 | 25 | // only protect MediaWiki:Global.css and MediaWiki:Global.js on non-central wikis |
26 | 26 | if( $wgSharedCssJsDB != $wgDBname ) { |
27 | 27 | |
28 | | - // block actions 'edit' and 'create'
|
29 | | - if( $action != 'edit' && $action != 'create') {
|
30 | | - return true;
|
31 | | - }
|
32 | | -
|
33 | | - // check pagenames
|
34 | | - if( $title->getText() != 'Global.css' && $title->getText() != 'Global.js' ) {
|
35 | | - return true;
|
36 | | - }
|
37 | | -
|
38 | | - $ns = $title->getNamespace();
|
39 | | -
|
40 | | - // check namespaces
|
| 28 | + // block actions 'edit' and 'create' |
| 29 | + if( $action != 'edit' && $action != 'create') { |
| 30 | + return true; |
| 31 | + } |
| 32 | + |
| 33 | + // check pagenames |
| 34 | + if( $title->getText() != 'Global.css' && $title->getText() != 'Global.js' ) { |
| 35 | + return true; |
| 36 | + } |
| 37 | + |
| 38 | + $ns = $title->getNamespace(); |
| 39 | + |
| 40 | + // check namespaces |
41 | 41 | if($ns == 8 || $ns == 9 ) { |
42 | | -
|
43 | | - // error message if action is blocked
|
44 | | - $result = array('sharedcssjs-error');
|
45 | | -
|
46 | | - // bail, and stop the request
|
47 | | - return false;
|
| 42 | + |
| 43 | + // error message if action is blocked |
| 44 | + $result = array('sharedcssjs-error'); |
| 45 | + |
| 46 | + // bail, and stop the request |
| 47 | + return false; |
48 | 48 | } |
49 | 49 | |
50 | | - }
|
51 | | -
|
52 | | - return true;
|
53 | | -} |
\ No newline at end of file |
| 50 | + } |
| 51 | + |
| 52 | + return true; |
| 53 | +} |
Property changes on: trunk/extensions/SharedCssJs/SharedCssJsProtector.php |
___________________________________________________________________ |
Added: svn:eol-style |
54 | 54 | + native |