From 89220a543c8edb03b1045b31ef428fabcbe0a82a Mon Sep 17 00:00:00 2001 From: "Mr. E23" Date: Wed, 4 Feb 2004 18:50:54 +0000 Subject: [PATCH] Made it possible for bureaucrats to sysop users at other wikis --- includes/SpecialMakesysop.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/SpecialMakesysop.php b/includes/SpecialMakesysop.php index 522ff0ed4f..1a99fd9a07 100644 --- a/includes/SpecialMakesysop.php +++ b/includes/SpecialMakesysop.php @@ -70,9 +70,19 @@ class MakesysopForm { function doSubmit() { global $wgOut, $wgUser, $wgLang, $wpMakesysopUser, $wgDBname, $wgMemc; - $sqname = addslashes($wpMakesysopUser); - $res = wfQuery("SELECT user_id, user_rights FROM user WHERE user_name = '{$sqname}'", DB_WRITE); - if( ! $sqname || wfNumRows( $res ) == 0 ){ + $parts = explode( "@", $wpMakesysopUser ); + if( count( $parts ) == 2){ + $username = addslashes( $parts[0] ); + $usertable = $parts[1] . "wiki.user"; + } else { + $username = addslashes( $wpMakesysopUser ); + $usertable = "user"; + } + $prev = wfIgnoreSQLErrors( TRUE ); + $res = wfQuery("SELECT user_id, user_rights FROM $usertable WHERE user_name = '{$username}'", DB_WRITE); + wfIgnoreSQLErrors( $prev ); + + if( wfLastErrno() || ! $username || wfNumRows( $res ) == 0 ){ $this->showFail(); return; } @@ -90,7 +100,7 @@ class MakesysopForm { $newrights = "sysop"; } - $sql = "UPDATE user SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1"; + $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1"; wfQuery($sql, DB_WRITE); $wgMemc->delete( "$wgDBname:user:id:$id" ); -- 2.20.1