Index: trunk/extensions/SharedUserRights/SharedUserRights_body.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | } else { |
47 | 47 | $this->mTarget = $wgRequest->getVal( 'user' ); |
48 | 48 | } |
49 | | - |
| 49 | + |
50 | 50 | # This might be redundant, but more security is always good. Right? |
51 | 51 | if ( !$this->userCanExecute( $wgUser ) ) { |
52 | 52 | global $wgOut; |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | $allgroups = $this->getAllGroups(); |
106 | 106 | $addgroup = array(); |
107 | 107 | $removegroup = array(); |
108 | | - |
| 108 | + |
109 | 109 | foreach ( $allgroups as $group ) { |
110 | 110 | // We'll tell it to remove all unchecked groups, and add all checked groups. |
111 | 111 | // Later on, this gets filtered for what can actually be removed |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | $removegroup[] = $group; |
116 | 116 | } |
117 | 117 | } |
118 | | - |
| 118 | + |
119 | 119 | $removegroup = array_unique( |
120 | 120 | array_intersect( (array)$removegroup, $allgroups ) ); |
121 | 121 | $addgroup = array_unique( |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | |
124 | 124 | $oldGroups = $this->listGroups( $username ); |
125 | 125 | $newGroups = $oldGroups; |
126 | | - |
| 126 | + |
127 | 127 | # remove groups |
128 | 128 | if ( $removegroup ) { |
129 | 129 | $newGroups = array_diff( $newGroups, $removegroup ); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | $this->removeGroup( $username, $group ); |
132 | 132 | } |
133 | 133 | } |
134 | | - |
| 134 | + |
135 | 135 | # add new groups |
136 | 136 | if ( $addgroup ) { |
137 | 137 | $newGroups = array_merge( $newGroups, $addgroup ); |
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | $this->addGroup( $username, $group ); |
140 | 140 | } |
141 | 141 | } |
142 | | - |
| 142 | + |
143 | 143 | $newGroups = array_unique( $newGroups ); |
144 | 144 | |
145 | 145 | # Clear the caches |
— | — | @@ -191,8 +191,8 @@ |
192 | 192 | |
193 | 193 | function addGroup( $username, $groupname ) { |
194 | 194 | $groups = $this->listGroups( $username ); |
195 | | - |
196 | | - if( in_array( $groupname, $groups )) { |
| 195 | + |
| 196 | + if ( in_array( $groupname, $groups ) ) { |
197 | 197 | return false; |
198 | 198 | } else { |
199 | 199 | $user = $this->fetchUser( $username ); |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | |
214 | 214 | function removeGroup( $username, $groupname ) { |
215 | 215 | $user = $this->fetchUser( $username ); |
216 | | - |
| 216 | + |
217 | 217 | $dbw = wfGetDB( DB_MASTER ); |
218 | 218 | |
219 | 219 | $dbw->delete( efSharedTable( 'shared_user_groups' ), array( |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | $dbr = wfGetDB( DB_SLAVE, array(), $wgSharedDB ); |
234 | 234 | |
235 | 235 | $groups = array(); |
236 | | - |
| 236 | + |
237 | 237 | $res = $dbr->select( |
238 | 238 | 'shared_user_groups', |
239 | 239 | 'sug_group', |
— | — | @@ -256,7 +256,7 @@ |
257 | 257 | */ |
258 | 258 | function fetchUser( $username ) { |
259 | 259 | global $wgOut, $wgUser; |
260 | | - |
| 260 | + |
261 | 261 | $name = trim( $username ); |
262 | 262 | |
263 | 263 | if ( $name == '' ) { |
— | — | @@ -403,12 +403,12 @@ |
404 | 404 | |
405 | 405 | foreach ( $allgroups as $group ) { |
406 | 406 | $set = in_array( $group, $usergroups ); |
407 | | - |
| 407 | + |
408 | 408 | $attr = array(); |
409 | 409 | $text = User::getGroupMember( $group ); |
410 | 410 | $checkbox = Xml::checkLabel( $text, "wpGroup-$group", |
411 | 411 | "wpGroup-$group", $set, $attr ); |
412 | | - |
| 412 | + |
413 | 413 | $settable_col .= "$checkbox<br />\n"; |
414 | 414 | } |
415 | 415 | |
— | — | @@ -440,7 +440,7 @@ |
441 | 441 | |
442 | 442 | return $ret; |
443 | 443 | } |
444 | | - |
| 444 | + |
445 | 445 | /** |
446 | 446 | * Show a rights log fragment for the specified user |
447 | 447 | * |
Index: trunk/extensions/SharedUserRights/SharedUserRights.i18n.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | 'gblrights-logpage' => 'Global Rights Log', |
20 | 20 | 'gblrights-pagetext' => 'This is a log of all the changes that are made to the wiki family\'s global rights table', |
21 | 21 | 'gblrights-rights-entry' => 'changed global group membership for $1 from $2 to $3', |
| 22 | + 'right-userrights-global' => 'Manage shared user rights', |
22 | 23 | ); |
23 | 24 | |
24 | 25 | /** Message documentation (Message documentation) |
Index: trunk/extensions/SharedUserRights/SharedUserRights.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * |
8 | 8 | * @author Łukasz 'TOR' Garczewski <tor@wikia-inc.com> |
9 | 9 | * @author Charles Melbye <charlie@yourwiki.net> |
10 | | -* @version 0.10 |
| 10 | +* @version 0.11 |
11 | 11 | * @copyright Copyright © 2008 Łukasz 'TOR' Garczewski, Wikia, Inc. |
12 | 12 | * @copyright Copyright (C) 2008 YourWiki, Inc. |
13 | 13 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | 'path' => __FILE__, |
25 | 25 | 'name' => 'SharedUserRights', |
26 | 26 | 'url' => 'http://www.mediawiki.org/wiki/Extension:SharedUserRights', |
27 | | - 'version' => '0.10', |
| 27 | + 'version' => '0.11', |
28 | 28 | 'author' => array( "Łukasz 'TOR' Garczewski", 'Charles Melbye' ), |
29 | 29 | 'description' => 'Easy global user rights administration', |
30 | 30 | 'descriptionmsg' => 'gblrights-desc', |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | 'sug_group', |
59 | 59 | array ( 'sug_user' => $user->mId ) ); |
60 | 60 | while ( $row = $dbr->fetchObject( $res ) ) { |
61 | | - if( !in_array( $row->sug_group, $groups ) ) { |
| 61 | + if ( !in_array( $row->sug_group, $groups ) ) { |
62 | 62 | $groups[] = $row->sug_group; |
63 | 63 | } |
64 | 64 | } |
— | — | @@ -68,14 +68,14 @@ |
69 | 69 | return $groups; |
70 | 70 | } |
71 | 71 | |
72 | | -/** |
| 72 | +/** |
73 | 73 | * Get a shared table name |
74 | 74 | */ |
75 | 75 | function efSharedTable( $table ) |
76 | 76 | { |
77 | 77 | global $wgSharedDB; |
78 | 78 | |
79 | | - if (!empty( $wgSharedDB )) { |
| 79 | + if ( !empty( $wgSharedDB ) ) { |
80 | 80 | return "`$wgSharedDB`.`$table`"; |
81 | 81 | } else { |
82 | 82 | return "`$table`"; |