Bureaucratic improvements -- lots of forms to fill in for increased levels of account...
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 7 Feb 2004 02:02:42 +0000 (02:02 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 7 Feb 2004 02:02:42 +0000 (02:02 +0000)
includes/SpecialMakesysop.php
languages/Language.php

index 5996032..10122bf 100644 (file)
@@ -85,9 +85,11 @@ class MakesysopForm {
                if( count( $parts ) == 2){
                        $username = addslashes( $parts[0] );
                        $usertable = $parts[1] . "wiki.user";
+                       $dbName = $parts[1] . "wiki";
                } else {
                        $username = addslashes( $wpMakesysopUser );
                        $usertable = "user";
+                       $dbName = $wgDBname;
                }
                $prev = wfIgnoreSQLErrors( TRUE );
                $res = wfQuery("SELECT user_id, user_rights FROM $usertable WHERE user_name = '{$username}'", DB_WRITE);
@@ -100,25 +102,43 @@ class MakesysopForm {
 
                $row = wfFetchObject( $res );
                $id = intval( $row->user_id );
+               $rightsNotation = array();
 
                if( $row->user_rights ){
                        $rights = explode(",", $row->user_rights );
                        if(! in_array("sysop", $rights ) ){
                                $rights[] = "sysop";
+                               $rightsNotation[] = "+sysop ";
                        }
                        if ( $wpSetBureaucrat && !in_array( "bureaucrat", $rights ) ) {
                                $rights[] = "bureaucrat";
+                               $rightsNotation[] = "+bureaucrat ";
                        }
                        $newrights = addslashes( implode( ",", $rights ) );
                } else {
                        $newrights = "sysop";
+                       $rightsNotation[] = "+sysop";
+                       if ( $wpSetBureaucrat ) {
+                               $rightsNotation[] = "+bureaucrat";
+                               $newrights .= ",bureaucrat";
+                       }
                }
                
-               $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
-               wfQuery($sql, DB_WRITE);
-               $wgMemc->delete( "$wgDBname:user:id:$id" );
-
-               $this->showSuccess();
+               if ( count( $rightsNotation ) == 0 ) {
+                       $this->showFail();
+               } else {
+                       $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
+                       wfQuery($sql, DB_WRITE);
+                       $wgMemc->delete( "$dbName:user:id:$id" );
+                       
+                       $bureaucratLog = wfMsg( "bureaucratlog" );
+                       $action = wfMsg( "bureaucratlogentry", $wpMakesysopUser, implode( " ", $rightsNotation ) );
+                       
+                       $log = new LogPage( $bureaucratLog );
+                       $log->addEntry( $action, "" );
+                       
+                       $this->showSuccess();
+               }
        }
 
        function showSuccess()
index 07d15d5..1b3ca3c 100644 (file)
@@ -1279,6 +1279,8 @@ Type the name of the user in the box and press the button to make the user an ad
 "makesysopok"          => "<b>User '$1' is now a sysop</b>",
 "makesysopfail"                => "<b>User '$1' could not be made into a sysop. (Did you enter the name correctly?)</b>",
 "setbureaucratflag" => "Set bureaucrat flag",
+"bureaucratlog"                => "Bureaucrat_log",
+"bureaucratlogentry"   => " set $1: $2",
 
 # Move page
 #