r99888 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99887‎ | r99888 | r99889 >
Date:15:47, 15 October 2011
Author:cervidae
Status:deferred
Tags:
Comment:
eol-style native
Modified paths:
  • /trunk/extensions/SharedCssJs/SharedCssJs.i18n.php (modified) (history)
  • /trunk/extensions/SharedCssJs/SharedCssJs.php (modified) (history)
  • /trunk/extensions/SharedCssJs/SharedCssJsProtector.php (modified) (history)

Diff [purge]

Property changes on: trunk/extensions/SharedCssJs/SharedCssJs.i18n.php
___________________________________________________________________
Added: svn:eol-style
11 + native
Index: trunk/extensions/SharedCssJs/SharedCssJs.php
@@ -1,14 +1,14 @@
22 <?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
1313 */
1414
1515 if(!defined('MEDIAWIKI')) {
@@ -24,12 +24,12 @@
2525 'descriptionmsg' => 'sharedcssjs-desc',
2626 );
2727
28 -// Localisation of this extension
29 -$dir = dirname( __FILE__ ) . '/';
 28+// Localisation of this extension
 29+$dir = dirname( __FILE__ ) . '/';
3030 $wgExtensionMessagesFiles['SharedCssJs'] = $dir . 'SharedCssJs.i18n.php';
3131
3232 // Loading page protector
33 -$dir = dirname( __FILE__ ) . '/';
 33+$dir = dirname( __FILE__ ) . '/';
3434 require_once ( "$dir/SharedCssJsProtector.php" );
3535
3636 // Hooks
@@ -38,7 +38,6 @@
3939 $wgHooks['BeforePageDisplay'][] = 'wfSharedJS';
4040 $wgHooks['BeforePageDisplay'][] = 'wfSharedUserJS';
4141
42 -
4342 function wfSharedCSS( &$out ) {
4443 global $wgDisableSharedCSS, $wgSharedCssJsUrl;
4544 if( !empty( $wgDisableSharedCSS ) ) {
@@ -91,4 +90,4 @@
9291 $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$url}?title=User:{$userName}/global.js&action=raw&ctype={$wgJsMimeType}\"></script>");
9392 }
9493 return true;
95 -}
\ No newline at end of file
 94+}
Property changes on: trunk/extensions/SharedCssJs/SharedCssJs.php
___________________________________________________________________
Added: svn:eol-style
9695 + native
Index: trunk/extensions/SharedCssJs/SharedCssJsProtector.php
@@ -1,4 +1,4 @@
2 -<?php
 2+<?php
33 /**
44 * Page protector file for the SharedCssJs extension
55 *
@@ -9,44 +9,44 @@
1010 *
1111 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1212 * @author Tim Weyer (SVG) <svg@tim-weyer.org>
13 - */
14 -
 13+ */
 14+
1515 if(!defined('MEDIAWIKI')) {
1616 echo("This is an extension to the MediaWiki software and cannot be used standalone");
1717 die(1);
18 -}
19 -
 18+}
 19+
2020 $wgHooks['getUserPermissionsErrors'][] = 'fnProtectSharedCssJs';
21 -
22 -function fnProtectSharedCssJs( &$title, &$user, $action, &$result) {
 21+
 22+function fnProtectSharedCssJs( &$title, &$user, $action, &$result) {
2323 global $wgSharedCssJsDB, $wgDBname;
2424
2525 // only protect MediaWiki:Global.css and MediaWiki:Global.js on non-central wikis
2626 if( $wgSharedCssJsDB != $wgDBname ) {
2727
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
4141 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;
4848 }
4949
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
5454 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99887Adding SharedCssJs extensioncervidae15:42, 15 October 2011

Status & tagging log