r50838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50837‎ | r50838 | r50839 >
Date:22:04, 20 May 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* add right- message
* remove trailing whitespace, stylize.php
* bump version
Modified paths:
  • /trunk/extensions/SharedUserRights/SharedUserRights.i18n.php (modified) (history)
  • /trunk/extensions/SharedUserRights/SharedUserRights.php (modified) (history)
  • /trunk/extensions/SharedUserRights/SharedUserRights_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SharedUserRights/SharedUserRights_body.php
@@ -45,7 +45,7 @@
4646 } else {
4747 $this->mTarget = $wgRequest->getVal( 'user' );
4848 }
49 -
 49+
5050 # This might be redundant, but more security is always good. Right?
5151 if ( !$this->userCanExecute( $wgUser ) ) {
5252 global $wgOut;
@@ -104,7 +104,7 @@
105105 $allgroups = $this->getAllGroups();
106106 $addgroup = array();
107107 $removegroup = array();
108 -
 108+
109109 foreach ( $allgroups as $group ) {
110110 // We'll tell it to remove all unchecked groups, and add all checked groups.
111111 // Later on, this gets filtered for what can actually be removed
@@ -114,7 +114,7 @@
115115 $removegroup[] = $group;
116116 }
117117 }
118 -
 118+
119119 $removegroup = array_unique(
120120 array_intersect( (array)$removegroup, $allgroups ) );
121121 $addgroup = array_unique(
@@ -122,7 +122,7 @@
123123
124124 $oldGroups = $this->listGroups( $username );
125125 $newGroups = $oldGroups;
126 -
 126+
127127 # remove groups
128128 if ( $removegroup ) {
129129 $newGroups = array_diff( $newGroups, $removegroup );
@@ -130,7 +130,7 @@
131131 $this->removeGroup( $username, $group );
132132 }
133133 }
134 -
 134+
135135 # add new groups
136136 if ( $addgroup ) {
137137 $newGroups = array_merge( $newGroups, $addgroup );
@@ -138,7 +138,7 @@
139139 $this->addGroup( $username, $group );
140140 }
141141 }
142 -
 142+
143143 $newGroups = array_unique( $newGroups );
144144
145145 # Clear the caches
@@ -191,8 +191,8 @@
192192
193193 function addGroup( $username, $groupname ) {
194194 $groups = $this->listGroups( $username );
195 -
196 - if( in_array( $groupname, $groups )) {
 195+
 196+ if ( in_array( $groupname, $groups ) ) {
197197 return false;
198198 } else {
199199 $user = $this->fetchUser( $username );
@@ -212,7 +212,7 @@
213213
214214 function removeGroup( $username, $groupname ) {
215215 $user = $this->fetchUser( $username );
216 -
 216+
217217 $dbw = wfGetDB( DB_MASTER );
218218
219219 $dbw->delete( efSharedTable( 'shared_user_groups' ), array(
@@ -232,7 +232,7 @@
233233 $dbr = wfGetDB( DB_SLAVE, array(), $wgSharedDB );
234234
235235 $groups = array();
236 -
 236+
237237 $res = $dbr->select(
238238 'shared_user_groups',
239239 'sug_group',
@@ -256,7 +256,7 @@
257257 */
258258 function fetchUser( $username ) {
259259 global $wgOut, $wgUser;
260 -
 260+
261261 $name = trim( $username );
262262
263263 if ( $name == '' ) {
@@ -403,12 +403,12 @@
404404
405405 foreach ( $allgroups as $group ) {
406406 $set = in_array( $group, $usergroups );
407 -
 407+
408408 $attr = array();
409409 $text = User::getGroupMember( $group );
410410 $checkbox = Xml::checkLabel( $text, "wpGroup-$group",
411411 "wpGroup-$group", $set, $attr );
412 -
 412+
413413 $settable_col .= "$checkbox<br />\n";
414414 }
415415
@@ -440,7 +440,7 @@
441441
442442 return $ret;
443443 }
444 -
 444+
445445 /**
446446 * Show a rights log fragment for the specified user
447447 *
Index: trunk/extensions/SharedUserRights/SharedUserRights.i18n.php
@@ -18,6 +18,7 @@
1919 'gblrights-logpage' => 'Global Rights Log',
2020 'gblrights-pagetext' => 'This is a log of all the changes that are made to the wiki family\'s global rights table',
2121 'gblrights-rights-entry' => 'changed global group membership for $1 from $2 to $3',
 22+ 'right-userrights-global' => 'Manage shared user rights',
2223 );
2324
2425 /** Message documentation (Message documentation)
Index: trunk/extensions/SharedUserRights/SharedUserRights.php
@@ -6,7 +6,7 @@
77 *
88 * @author Łukasz 'TOR' Garczewski <tor@wikia-inc.com>
99 * @author Charles Melbye <charlie@yourwiki.net>
10 -* @version 0.10
 10+* @version 0.11
1111 * @copyright Copyright © 2008 Łukasz 'TOR' Garczewski, Wikia, Inc.
1212 * @copyright Copyright (C) 2008 YourWiki, Inc.
1313 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
@@ -23,7 +23,7 @@
2424 'path' => __FILE__,
2525 'name' => 'SharedUserRights',
2626 'url' => 'http://www.mediawiki.org/wiki/Extension:SharedUserRights',
27 - 'version' => '0.10',
 27+ 'version' => '0.11',
2828 'author' => array( "Łukasz 'TOR' Garczewski", 'Charles Melbye' ),
2929 'description' => 'Easy global user rights administration',
3030 'descriptionmsg' => 'gblrights-desc',
@@ -57,7 +57,7 @@
5858 'sug_group',
5959 array ( 'sug_user' => $user->mId ) );
6060 while ( $row = $dbr->fetchObject( $res ) ) {
61 - if( !in_array( $row->sug_group, $groups ) ) {
 61+ if ( !in_array( $row->sug_group, $groups ) ) {
6262 $groups[] = $row->sug_group;
6363 }
6464 }
@@ -68,14 +68,14 @@
6969 return $groups;
7070 }
7171
72 -/**
 72+/**
7373 * Get a shared table name
7474 */
7575 function efSharedTable( $table )
7676 {
7777 global $wgSharedDB;
7878
79 - if (!empty( $wgSharedDB )) {
 79+ if ( !empty( $wgSharedDB ) ) {
8080 return "`$wgSharedDB`.`$table`";
8181 } else {
8282 return "`$table`";

Status & tagging log