r36877 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36876‎ | r36877 | r36878 >
Date:02:44, 2 July 2008
Author:skizzerz
Status:old
Tags:
Comment:
* porting a function locally since it was added in 1.13 and the extension is for 1.12+
Modified paths:
  • /trunk/extensions/GroupPermissionsManager/GPManager.i18n.php (modified) (history)
  • /trunk/extensions/GroupPermissionsManager/GPManager.php (modified) (history)
  • /trunk/extensions/GroupPermissionsManager/GPManager_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GroupPermissionsManager/GPManager_body.php
@@ -53,7 +53,7 @@
5454 if( $this->target != '') {
5555 //ok, we do. Now, what action was just being performed?
5656 if( $wgRequest->getCheck( 'dosearch' ) || !$wgRequest->wasPosted() ) {
57 - $wgOut->addScriptFile('prefs.js');
 57+ addScriptFile('prefs.js');
5858 //it was a search, check the group
5959 if(in_array($this->target, $this->groupslist)) {
6060 global $wgImplicitGroups;
Index: trunk/extensions/GroupPermissionsManager/GPManager.i18n.php
@@ -14,7 +14,7 @@
1515 'grouppermissions' => 'Manage Group Permissions',
1616 'grouppermissions-desc' => 'Manage group permissions via a special page',
1717 'grouppermissions-desc2' => 'Extended permissions system',
18 - 'grouppermissions-header' => "You may use this page to change the underlying permissions of the various usergroups",
 18+ 'grouppermissions-header' => 'You may use this page to change the underlying permissions of the various usergroups',
1919 'grouppermissions-search' => 'Group:',
2020 'grouppermissions-dologin' => 'Login',
2121 'grouppermissions-dosearch' => 'Go',
@@ -44,6 +44,9 @@
4545 'grouppermissions-log-name' => 'GroupPermissions log',
4646 'grouppermissions-log-entry' => '', #do not translate this message
4747 'grouppermissions-log-header' => 'This page tracks changes to the underlying permissions of user groups',
 48+ 'grouppermissions-needjs' => 'Warning: JavaScript is disabled on your browser. Some features may not work!',
 49+ 'grouppermissions-sp-header' => 'You may use this page to manage how permissions are sorted and add new permissions',
 50+
4851 'right-viewsource' => 'View wiki source of protected pages',
4952 'right-raw' => 'View raw pages',
5053 'right-render' => 'View rendered pages without navigation',
Index: trunk/extensions/GroupPermissionsManager/GPManager.php
@@ -14,13 +14,17 @@
1515 'name' => 'GroupPermissions Manager',
1616 'author' => 'Ryan Schmidt',
1717 'url' => 'http://www.mediawiki.org/wiki/Extension:GroupPermissions_Manager',
 18+#'version' => '3.1',
1819 'version' => '3.0',
1920 'description' => 'Manage group permissions via a special page',
2021 'descriptionmsg' => 'grouppermissions-desc',
2122 );
2223 $wgAutoloadClasses['GroupPermissions'] = dirname(__FILE__) . '/GPManager_body.php';
 24+#$wgAutoloadClasses['RemoveUnusedGroups'] = dirname(__FILE__) . '/RemoveUnusedGroups.php';
 25+#$wgAutoloadClasses['SortPermissions'] = dirname(__FILE__) . '/SortPermissions.php';
2326 $wgSpecialPages['GroupPermissions'] = 'GroupPermissions';
24 -$wgAvailableRights[] = 'grouppermissions';
 27+#$wgSpecialPages['RemoveUnusedGroups'] = 'RemoveUnusedGroups';
 28+#$wgSpecialPages['SortPermissions'] = 'SortPermissions';
2529 $wgExtensionMessagesFiles['GroupPermissions'] = dirname(__FILE__) . '/GPManager.i18n.php';
2630
2731 $wgLogTypes[] = 'gpmanager';
@@ -31,12 +35,15 @@
3236 $wgLogHeaders['gpmanager'] = 'grouppermissions-log-header';
3337 $wgLogNames['gpmanager'] = 'grouppermissions-log-name';
3438 $wgSpecialPageGroups['GroupPermissions'] = 'wiki';
 39+#$wgSpecialPageGroups['RemoveUnusedGroups'] = 'user';
 40+#$wgSpecialPageGroups['SortPermissions'] = 'wiki';
3541
36 -##Permission required to use the special page
 42+##Permission required to use the 'GroupPermissions' and 'SortPermissions' special page
3743 ##By default all bureaucrats can
3844 $wgGroupPermissions['bureaucrat']['grouppermissions'] = true;
3945 ##Uncomment this if you want to make a separate group that can access the page as well
4046 #$wgGroupPermissions['grouppermissions']['grouppermissions'] = true;
 47+##'RemoveUnusedGroups' requires the 'userrights' permission, also given to bureaucrats by default
4148
4249 /**
4350 * Permissions++ sub-extension
@@ -84,7 +91,7 @@
8592 $wgGPManagerSort['manage'] = array( 'delete', 'bigdelete', 'deletedhistory', 'undelete', 'mergehistory',
8693 'protect', 'block', 'blockemail', 'hideuser', 'userrights', 'userrights-interwiki', 'rollback', 'markbotedits',
8794 'patrol', 'editinterface', 'editusercssjs', 'hiderevision', 'deleterevision', 'browsearchive', 'suppressrevision',
88 -'suppressionlog' );
 95+'suppressionlog', 'suppress' );
8996 $wgGPManagerSort['admin'] = array( 'siteadmin', 'import', 'importupload', 'trackback', 'unwatchedpages',
9097 'grouppermissions' );
9198 $wgGPManagerSort['tech'] = array( 'bot', 'purge', 'minoredit', 'nominornewtalk', 'ipblock-exempt',
@@ -253,4 +260,16 @@
254261 } else {
255262 return false;
256263 }
257 -}
\ No newline at end of file
 264+}
 265+
 266+//was added in 1.13, so supporting for downwards compatibility with 1.12
 267+function addScriptFile( $file ) {
 268+ global $wgStylePath, $wgStyleVersion, $wgJsMimeType;
 269+ if( substr( $file, 0, 1 ) == '/' ) {
 270+ $path = $file;
 271+ } else {
 272+ $path = "{$wgStylePath}/common/{$file}";
 273+ }
 274+ $encPath = htmlspecialchars( $path );
 275+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$path?$wgStyleVersion\"></script>\n" );
 276+ }
\ No newline at end of file

Status & tagging log