adding label atttributes for confirm checkboxes in SpecialLockdb and SpecialUnlockdb...
[lhc/web/wiklou.git] / includes / specials / SpecialLockdb.php
index f8ab57b..53f5a92 100644 (file)
@@ -34,12 +34,13 @@ class SpecialLockdb extends SpecialPage {
        }
 
        public function execute( $par ) {
-               global $wgUser, $wgOut, $wgRequest;
+               global $wgUser, $wgRequest;
 
                $this->setHeaders();
 
-               if( !$wgUser->isAllowed( 'siteadmin' ) ) {
-                       $wgOut->permissionRequired( 'siteadmin' );
+               # Permission check
+               if( !$this->userCanExecute( $wgUser ) ) {
+                       $this->displayRestrictionError();
                        return;
                }
 
@@ -57,7 +58,7 @@ class SpecialLockdb extends SpecialPage {
 
                if ( $action == 'success' ) {
                        $this->showSuccess();
-               } else if ( $action == 'submit' && $wgRequest->wasPosted() &&
+               } elseif ( $action == 'submit' && $wgRequest->wasPosted() &&
                        $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
                        $this->doSubmit();
                } else {
@@ -83,10 +84,12 @@ class SpecialLockdb extends SpecialPage {
 <table>
        <tr>
                " . Html::openElement( 'td', array( 'style' => 'text-align:right' ) ) . "
-                       " . Html::input( 'wpLockConfirm', null, 'checkbox' ) . "
+                       " . Html::input( 'wpLockConfirm', null, 'checkbox', array( 'id' => 'mw-input-wplockconfirm' ) ) . "
                </td>
                " . Html::openElement( 'td', array( 'style' => 'text-align:left' ) ) .
-                       wfMsgHtml( 'lockconfirm' ) . "</td>
+                   Html::openElement( 'label', array( 'for' => 'mw-input-wplockconfirm' ) ) .
+
+                       wfMsgHtml( 'lockconfirm' ) . "</label></td>
        </tr>
        <tr>
                <td>&#160;</td>
@@ -122,8 +125,14 @@ class SpecialLockdb extends SpecialPage {
                        return;
                }
                fwrite( $fp, $this->reason );
-               fwrite( $fp, "\n<p>(by " . $wgUser->getName() . " at " .
-                 $wgContLang->timeanddate( wfTimestampNow() ) . ")</p>\n" );
+               $timestamp = wfTimestampNow();
+               fwrite( $fp, "\n<p>" . wfMsgExt(
+                       'lockedbyandtime',
+                       array( 'content', 'parsemag' ),
+                       $wgUser->getName(),
+                       $wgContLang->date( $timestamp ),
+                       $wgContLang->time( $timestamp )
+               ) . "</p>\n" );
                fclose( $fp );
 
                $wgOut->redirect( $this->getTitle()->getFullURL( 'action=success' ) );