* Escaping and Xml
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 18 Jan 2007 00:52:15 +0000 (00:52 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 18 Jan 2007 00:52:15 +0000 (00:52 +0000)
includes/SpecialBlockip.php
includes/SpecialMIMEsearch.php
includes/SpecialNewimages.php
includes/SpecialNewpages.php

index fe1a7af..3dcdbd0 100644 (file)
@@ -62,15 +62,14 @@ class IPBlockForm {
                $wgOut->addWikiText( wfMsg( 'blockiptext' ) );
 
                if($wgSysopUserBans) {
-                       $mIpaddress = wfMsgHtml( 'ipadressorusername' );
+                       $mIpaddress = Xml::label( wfMsg( 'ipadressorusername' ), 'mw-bi-target' );
                } else {
-                       $mIpaddress = wfMsgHtml( 'ipaddress' );
+                       $mIpaddress = Xml::label( wfMsg( 'ipadress' ), 'mw-bi-target' );
                }
-               $mIpbexpiry = wfMsgHtml( 'ipbexpiry' );
-               $mIpbother = wfMsgHtml( 'ipbother' );
+               $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' );
+               $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' );
                $mIpbothertime = wfMsgHtml( 'ipbotheroption' );
-               $mIpbreason = wfMsgHtml( 'ipbreason' );
-               $mIpbsubmit = wfMsgHtml( 'ipbsubmit' );
+               $mIpbreason = Xml::label( wfMsg( 'ipbreason' ), 'mw-bi-reason' );
                $titleObj = SpecialPage::getTitleFor( 'Blockip' );
                $action = $titleObj->escapeLocalURL( "action=submit" );
 
@@ -79,10 +78,7 @@ class IPBlockForm {
                        $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
                }
 
-               $scBlockAddress = htmlspecialchars( $this->BlockAddress );
-               $scBlockReason = htmlspecialchars( $this->BlockReason );
-               $scBlockOtherTime = htmlspecialchars( $this->BlockOther );
-               $scBlockExpiryOptions = htmlspecialchars( wfMsgForContent( 'ipboptions' ) );
+               $scBlockExpiryOptions = wfMsgForContent( 'ipboptions' );
 
                $showblockoptions = $scBlockExpiryOptions != '-';
                if (!$showblockoptions)
@@ -108,7 +104,8 @@ class IPBlockForm {
                <tr>
                        <td align=\"right\">{$mIpaddress}:</td>
                        <td align=\"left\">
-                               <input tabindex='1' type='text' size='40' name=\"wpBlockAddress\" value=\"{$scBlockAddress}\" />
+                               " . Xml::input( 'wpBlockAddress', 40, $this->BlockAddress,
+                                       array( 'tabindex' => '1', 'id' => 'mw-bi-target' ) ) . "
                        </td>
                </tr>
                <tr>");
@@ -127,13 +124,15 @@ class IPBlockForm {
                <tr id='wpBlockOther'>
                        <td align=\"right\">{$mIpbother}:</td>
                        <td align=\"left\">
-                               <input tabindex='3' type='text' size='40' name=\"wpBlockOther\" value=\"{$scBlockOtherTime}\" />
+                               " . Xml::input( 'wpBlockOther', 40, $this->BlockOther,
+                                       array( 'tabindex' => '3', 'id' => 'mw-bi-other' ) ) . "
                        </td>
                </tr>
                <tr>
                        <td align=\"right\">{$mIpbreason}:</td>
                        <td align=\"left\">
-                               <input tabindex='3' type='text' size='40' name=\"wpBlockReason\" value=\"{$scBlockReason}\" />
+                               " . Xml::input( 'wpBlockReason', 40, $this->BlockReason,
+                                       array( 'tabindex' => '3', 'id' => 'mw-bi-reason' ) ) . "
                        </td>
                </tr>
                <tr>
@@ -152,23 +151,24 @@ class IPBlockForm {
                                        array( 'tabindex' => 5 ) ) . "
                        </td>
                </tr>
-                <tr>
-                        <td>&nbsp;</td>
-                        <td align=\"left\">
-                                " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ),
-                                        'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
-                                        array( 'tabindex' => 6 ) ) . "
-                        </td>
-                </tr>
+               <tr>
+                       <td>&nbsp;</td>
+                       <td align=\"left\">
+                               " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ),
+                                               'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
+                                                       array( 'tabindex' => 6 ) ) . "
+                       </td>
+               </tr>
                <tr>
                        <td style='padding-top: 1em'>&nbsp;</td>
                        <td style='padding-top: 1em' align=\"left\">
-                               <input tabindex='7' type='submit' name=\"wpBlock\" value=\"{$mIpbsubmit}\" />
+                               " . Xml::submitButton( wfMsg( 'ipbsubmit' ),
+                                                       array( 'name' => 'wpBlock', 'tabindex' => '7' ) ) . "
                        </td>
                </tr>
-       </table>
-       <input type='hidden' name='wpEditToken' value=\"{$token}\" />
-</form>\n" );
+       </table>" .
+       Xml::hidden( 'wpEditToken', $token ) .
+"</form>\n" );
 
                $wgOut->addHtml( $this->getConvenienceLinks() );
 
index 8678118..fb27403 100644 (file)
@@ -69,7 +69,7 @@ class MIMEsearchPage extends QueryPage {
                $download = $skin->makeMediaLink( $nt->getText(), 'fuck me!', wfMsgHtml( 'download' ) );
                $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'),
                        $wgLang->formatNum( $result->img_size ) );
-               $dimensions = wfMsg( 'widthheight', $wgLang->formatNum( $result->img_width ),
+               $dimensions = wfMsgHtml( 'widthheight', $wgLang->formatNum( $result->img_width ),
                        $wgLang->formatNum( $result->img_height ) );
                $user = $skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text );
                $time = $wgLang->timeanddate( $result->img_timestamp );
index 062e7e1..47318cc 100644 (file)
@@ -161,9 +161,9 @@ function wfSpecialNewimages( $par, $specialPage ) {
        if ($shownav) {
                $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
                  "{$action}\">" .
-                 "<input type='text' size='20' name=\"wpIlMatch\" value=\"" .
-                 htmlspecialchars( $wpIlMatch ) . "\" /> " .
-                 "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" );
+                       Xml::input( 'wpIlMatch', 20, $wpIlMatch ) . ' ' .
+                 Xml::submitButton( $sub, array( 'name' => 'wpIlSubmit' ) ) .
+                 "</form>" );
        }
 
        /**
@@ -178,21 +178,21 @@ function wfSpecialNewimages( $par, $specialPage ) {
        }
        $now = wfTimestampNow();
        $date = $wgLang->timeanddate( $now, true );
-       $dateLink = $sk->makeKnownLinkObj( $titleObj, wfMsg( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
+       $dateLink = $sk->makeKnownLinkObj( $titleObj, wfMsgHtml( 'sp-newimages-showfrom', $date ), 'from='.$now.$botpar.$searchpar );
 
-       $botLink = $sk->makeKnownLinkObj($titleObj, wfMsg( 'showhidebots', ($hidebots ? wfMsg('show') : wfMsg('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
+       $botLink = $sk->makeKnownLinkObj($titleObj, wfMsgHtml( 'showhidebots', ($hidebots ? wfMsgHtml('show') : wfMsgHtml('hide'))),'hidebots='.($hidebots ? '0' : '1').$searchpar);
 
-       $prevLink = wfMsg( 'prevn', $wgLang->formatNum( $limit ) );
+       $prevLink = wfMsgHtml( 'prevn', $wgLang->formatNum( $limit ) );
        if( $firstTimestamp && $firstTimestamp != $latestTimestamp ) {
                $prevLink = $sk->makeKnownLinkObj( $titleObj, $prevLink, 'from=' . $firstTimestamp . $botpar . $searchpar );
        }
 
-       $nextLink = wfMsg( 'nextn', $wgLang->formatNum( $limit ) );
+       $nextLink = wfMsgHtml( 'nextn', $wgLang->formatNum( $limit ) );
        if( $shownImages > $limit && $lastTimestamp ) {
                $nextLink = $sk->makeKnownLinkObj( $titleObj, $nextLink, 'until=' . $lastTimestamp.$botpar.$searchpar );
        }
 
-       $prevnext = '<p>' . $botLink . ' '. wfMsg( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';
+       $prevnext = '<p>' . $botLink . ' '. wfMsgHtml( 'viewprevnext', $prevLink, $nextLink, $dateLink ) .'</p>';
 
        if ($shownav)
                $wgOut->addHTML( $prevnext );
index 6200738..428dbc5 100644 (file)
@@ -133,13 +133,13 @@ class NewPagesPage extends QueryPage {
         */     
        function getPageHeader() {
                $self = SpecialPage::getTitleFor( $this->getName() );
-               $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
-               $form .= '<table><tr><td align="right">' . wfMsgHtml( 'namespace' ) . '</td>';
-               $form .= '<td>' . HtmlNamespaceSelector( $this->namespace ) . '</td><tr>';
-               $form .= '<tr><td align="right">' . wfMsgHtml( 'newpages-username' ) . '</td>';
-               $form .= '<td>' . wfInput( 'username', 30, $this->username ) . '</td></tr>';
-               $form .= '<tr><td></td><td>' . wfSubmitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
-               $form .= wfHidden( 'offset', $this->offset ) . wfHidden( 'limit', $this->limit ) . '</form>';
+               $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
+               $form .= '<table><tr><td align="right">' . Xml::label( wfMsg( 'namespace' ), 'namespace' ) . '</td>';
+               $form .= '<td>' . Xml::namespaceSelector( $this->namespace ) . '</td><tr>';
+               $form .= '<tr><td align="right">' . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . '</td>';
+               $form .= '<td>' . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . '</td></tr>';
+               $form .= '<tr><td></td><td>' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
+               $form .= Xml::hidden( 'offset', $this->offset ) . Xml::hidden( 'limit', $this->limit ) . '</form>';
                return $form;
        }