2 include_once( "LinksUpdate.php" );
4 function wfSpecialMakesysop()
6 global $wgUser, $wgOut, $action, $target;
8 if ( 0 == $wgUser->getID() or $wgUser->isBlocked() ) {
9 $wgOut->errorpage( "movenologin", "movenologintext" );
12 if (! $wgUser->isBureaucrat()){
13 $wgOut->errorpage( "bureaucrattitle", "bureaucrattext" );
18 $wgOut->readOnlyPage();
22 $f = new MakesysopForm();
24 if ( $_POST['wpMakesysopSubmit'] ) {
32 function showForm( $err = "")
34 global $wgOut, $wgUser, $wgLang;
35 global $wpNewTitle, $wpOldTitle, $wpMovetalk, $target;
37 $wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
39 $wgOut->addWikiText( wfMsg( "makesysoptext" ) );
41 $action = wfLocalUrlE( $wgLang->specialPage( "Makesysop" ),
45 $wgOut->setSubtitle( wfMsg( "formerror" ) );
46 $wgOut->addHTML( "<p><font color='red' size='+1'>{$err}</font>\n" );
48 $namedesc = wfMsg( "makesysopname" );
50 <form id=\"makesysop\" method=\"post\" action=\"{$action}\">
53 <td align=right>$namedesc</td>
55 <input type=text size=40 name=\"wpMakesysopUser\">
59 $mss = wfMsg( "makesysopsubmit" );
62 <td> </td><td align=left>
63 <input type=submit name=\"wpMakesysopSubmit\" value=\"{$mss}\">
72 global $wgOut, $wgUser, $wgLang, $wpMakesysopUser, $wgDBname, $wgMemc;
73 $sqname = addslashes($wpMakesysopUser);
74 $res = wfQuery("SELECT user_id, user_rights FROM user WHERE user_name = '{$sqname}'", DB_WRITE
);
75 if( ! $sqname ||
wfNumRows( $res ) == 0 ){
80 $row = wfFetchObject( $res );
81 $id = intval( $row->user_id
);
83 if( $row->user_rights
){
84 $rights = explode(",", $row->user_rights
);
85 if(! in_array("sysop", $rights ) ){
88 $newrights = addslashes( implode( ",", $rights ) );
93 $sql = "UPDATE user SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
94 wfQuery($sql, DB_WRITE
);
95 $wgMemc->delete( "$wgDBname:user:id:$id" );
100 function showSuccess()
102 global $wgOut, $wpMakesysopUser;
104 $wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
105 $text = wfMsg( "makesysopok", $wpMakesysopUser );
106 $wgOut->addWikiText( $text );
113 global $wgOut, $wpMakesysopUser;
115 $wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
116 $this->showForm( wfMsg( "makesysopfail", $wpMakesysopUser ) );