Bug 1761: Cleanup of Recent Changes indicator flags
[lhc/web/wiklou.git] / includes / SpecialBlockip.php
index 81493f7..5da520d 100644 (file)
@@ -47,12 +47,16 @@ class IPBlockForm {
        
        function showForm( $err ) {
                global $wgOut, $wgUser, $wgLang, $wgBlockExpiryOptions;
-               global $wgRequest;
+               global $wgRequest, $wgSysopUserBans;
 
                $wgOut->setPagetitle( htmlspecialchars( wfMsg( 'blockip' ) ) );
-               $wgOut->addWikiText( htmlspecialchars( wfMsg( 'blockiptext' ) ) );
+               $wgOut->addWikiText( wfMsg( 'blockiptext' ) );
 
-               $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
+               if($wgSysopUserBans) {
+                       $mIpaddress = htmlspecialchars( wfMsg( 'ipadressorusername' ) );
+               } else {
+                       $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
+               }
                $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
                $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
                $mIpbsubmit = htmlspecialchars( wfMsg( 'ipbsubmit' ) );
@@ -68,8 +72,9 @@ class IPBlockForm {
                $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
                $scBlockReason = htmlspecialchars( $this->BlockReason );
 
-               $blockExpiryOptions = join("</option><option>", split(",", $wgBlockExpiryOptions));
-               $blockExpiryOptions = "<option>" . $blockExpiryOptions . "</option>";
+               $blockExpiryFormOptions = '<option>' .
+                       implode("</option>\n\t\t\t\t\t<option>", explode(',', $wgBlockExpiryOptions)) .
+                       '</option>';
 
                $token = htmlspecialchars( $wgUser->editToken() );
                
@@ -85,8 +90,8 @@ class IPBlockForm {
                <tr>
                        <td align=\"right\">{$mIpbexpiry}:</td>
                        <td align=\"left\">
-                               <select tabindex='2' name=\"wpBlockExpiry\"/>
-                                       <?= $blockExpiryOptions ?>
+                               <select tabindex='2' name=\"wpBlockExpiry\">
+                                       $blockExpiryFormOptions
                                </select>
                        </td>
                </tr>
@@ -172,10 +177,11 @@ class IPBlockForm {
                $ban = new Block( $this->BlockAddress, $userId, $wgUser->getID(), 
                        $this->BlockReason, wfTimestampNow(), 0, $expiry );
                
-               if (wfRunHooks('BlockIp', $ban, $wgUser)) {
+               if (wfRunHooks('BlockIp', array(&$ban, &$wgUser))) {
+                       
                        $ban->insert();
                        
-                       wfRunHooks('BlockIpComplete', $ban, $wgUser);
+                       wfRunHooks('BlockIpComplete', array($ban, $wgUser));
                        
                        # Make log entry
                        $log = new LogPage( 'block' );