From 72f2d1b16f36bcdfb5b84b656fc57ecb41e6d9a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 28 Sep 2008 17:14:32 +0000 Subject: [PATCH] * Some cleanup --- includes/specials/SpecialRestrictUser.php | 74 ++++++++++++----------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/includes/specials/SpecialRestrictUser.php b/includes/specials/SpecialRestrictUser.php index d79d15c644..86de2d1db7 100644 --- a/includes/specials/SpecialRestrictUser.php +++ b/includes/specials/SpecialRestrictUser.php @@ -12,10 +12,7 @@ function wfSpecialRestrictUser( $par = null ) { return; } $isIP = User::isIP( $userOrig ); - if( $isIP ) - $user = $userOrig; - else - $user = User::getCanonicalName( $userOrig ); + $user = $isIP ? $userOrig : User::getCanonicalName( $userOrig ); $uid = User::idFromName( $user ); if( !$uid && !$isIP ) { $err = '' . wfMsgHtml( 'restrictuser-notfound' ) . ''; @@ -30,7 +27,8 @@ function wfSpecialRestrictUser( $par = null ) { RestrictUserForm::pageRestrictionForm( $uid, $user, $old ); RestrictUserForm::namespaceRestrictionForm( $uid, $user, $old ); - $old = UserRestriction::fetchForUser( $user, true ); // Renew it after possible changes in previous two functions + // Renew it after possible changes in previous two functions + $old = UserRestriction::fetchForUser( $user, true ); if( $old ) { $wgOut->addHTML( RestrictUserForm::existingRestrictions( $old ) ); } @@ -39,8 +37,7 @@ function wfSpecialRestrictUser( $par = null ) { class RestrictUserForm { public static function selectUserForm( $val = null, $error = null ) { global $wgScript, $wgTitle; - $legend = wfMsgHtml( 'restrictuser-userselect' ); - $s = Xml::fieldset( $legend ) . "
"; + $s = Xml::fieldset( wfMsg( 'restrictuser-userselect' ) ) . ""; if( $error ) $s .= '

' . $error . '

'; $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); @@ -51,9 +48,9 @@ class RestrictUserForm { } public static function existingRestrictions( $restrictions ) { + //TODO: autoload? require_once( dirname( __FILE__ ) . '/SpecialListUserRestrictions.php' ); - $legend = wfMsgHtml( 'restrictuser-existing' ); - $s = Xml::fieldset( $legend ) . '