r5303 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5302‎ | r5303 | r5304 >
Date:19:04, 19 September 2004
Author:hashar
Status:old
Tags:
Comment:
single quotes
Modified paths:
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBlockip.php
@@ -19,9 +19,9 @@
2020 $ipb = new IPBlockForm();
2121
2222 $action = $wgRequest->getVal( 'action' );
23 - if ( "success" == $action ) { $ipb->showSuccess(); }
24 - else if ( $wgRequest->wasPosted() && "submit" == $action ) { $ipb->doSubmit(); }
25 - else { $ipb->showForm( "" ); }
 23+ if ( 'success' == $action ) { $ipb->showSuccess(); }
 24+ else if ( $wgRequest->wasPosted() && 'submit' == $action ) { $ipb->doSubmit(); }
 25+ else { $ipb->showForm( '' ); }
2626 }
2727
2828 /**
@@ -40,27 +40,26 @@
4141 $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' );
4242 }
4343
44 - function showForm( $err )
45 - {
 44+ function showForm( $err ) {
4645 global $wgOut, $wgUser, $wgLang, $wgDefaultBlockExpiry;
4746 global $wgRequest;
4847
49 - $wgOut->setPagetitle( htmlspecialchars( wfMsg( "blockip" ) ) );
50 - $wgOut->addWikiText( htmlspecialchars( wfMsg( "blockiptext" ) ) );
 48+ $wgOut->setPagetitle( htmlspecialchars( wfMsg( 'blockip' ) ) );
 49+ $wgOut->addWikiText( htmlspecialchars( wfMsg( 'blockiptext' ) ) );
5150
52 - if ( is_null( $this->BlockExpiry ) || $this->BlockExpiry === "" ) {
 51+ if ( is_null( $this->BlockExpiry ) || $this->BlockExpiry === '' ) {
5352 $this->BlockExpiry = $wgDefaultBlockExpiry;
5453 }
5554
56 - $mIpaddress = htmlspecialchars( wfMsg( "ipaddress" ) );
57 - $mIpbexpiry = htmlspecialchars( wfMsg( "ipbexpiry" ) );
58 - $mIpbreason = htmlspecialchars( wfMsg( "ipbreason" ) );
59 - $mIpbsubmit = htmlspecialchars( wfMsg( "ipbsubmit" ) );
60 - $titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" );
 55+ $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
 56+ $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
 57+ $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
 58+ $mIpbsubmit = htmlspecialchars( wfMsg( 'ipbsubmit' ) );
 59+ $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
6160 $action = $titleObj->escapeLocalURL( "action=submit" );
6261
6362 if ( "" != $err ) {
64 - $wgOut->setSubtitle( htmlspecialchars( wfMsg( "formerror" ) ) );
 63+ $wgOut->setSubtitle( htmlspecialchars( wfMsg( 'formerror' ) ) );
6564 $wgOut->addHTML( "<p class='error'>{$err}</p>\n" );
6665 }
6766
@@ -113,13 +112,13 @@
114113 if ( preg_match( "/^($rxIP)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
115114 if ( $wgSysopRangeBans ) {
116115 if ( $matches[2] > 31 || $matches[2] < 16 ) {
117 - $this->showForm( wfMsg( "ip_range_invalid" ) );
 116+ $this->showForm( wfMsg( 'ip_range_invalid' ) );
118117 return;
119118 }
120119 $this->BlockAddress = Block::normaliseRange( $this->BlockAddress );
121120 } else {
122121 # Range block illegal
123 - $this->showForm( wfMsg( "range_block_disabled" ) );
 122+ $this->showForm( wfMsg( 'range_block_disabled' ) );
124123 return;
125124 }
126125 } else {
@@ -127,34 +126,33 @@
128127 if ( $wgSysopUserBans ) {
129128 $userId = User::idFromName( $this->BlockAddress );
130129 if ( $userId == 0 ) {
131 - $this->showForm( wfMsg( "nosuchuser", htmlspecialchars( $this->BlockAddress ) ) );
 130+ $this->showForm( wfMsg( 'nosuchuser', htmlspecialchars( $this->BlockAddress ) ) );
132131 return;
133132 }
134133 } else {
135 - $this->showForm( wfMsg( "badipaddress" ) );
 134+ $this->showForm( wfMsg( 'badipaddress' ) );
136135 return;
137136 }
138137 }
139138 }
140139
141 - if ( $this->BlockExpiry == "infinite" || $this->BlockExpiry == "indefinite" ) {
 140+ if ( $this->BlockExpiry == 'infinite' || $this->BlockExpiry == 'indefinite' ) {
142141 $expiry = '';
143142 } else {
144143 # Convert GNU-style date, returns -1 on error
145144 $expiry = strtotime( $this->BlockExpiry );
146145
147146 if ( $expiry < 0 ) {
148 - $this->showForm( wfMsg( "ipb_expiry_invalid" ) );
 147+ $this->showForm( wfMsg( 'ipb_expiry_invalid' ) );
149148 return;
150149 }
151150
152151 $expiry = wfUnix2Timestamp( $expiry );
153152
154153 }
155 -
156154
157 - if ( "" == $this->BlockReason ) {
158 - $this->showForm( wfMsg( "noblockreason" ) );
 155+ if ( $this->BlockReason == '') {
 156+ $this->showForm( wfMsg( 'noblockreason' ) );
159157 return;
160158 }
161159
@@ -170,16 +168,16 @@
171169 $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), $this->BlockReason );
172170
173171 # Report to the user
174 - $titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" );
175 - $wgOut->redirect( $titleObj->getFullURL( "action=success&ip={$this->BlockAddress}" ) );
 172+ $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
 173+ $wgOut->redirect( $titleObj->getFullURL( 'action=success&ip='.$this->BlockAddress ) );
176174 }
177175
178176 function showSuccess() {
179177 global $wgOut, $wgUser;
180178
181 - $wgOut->setPagetitle( wfMsg( "blockip" ) );
182 - $wgOut->setSubtitle( wfMsg( "blockipsuccesssub" ) );
183 - $text = wfMsg( "blockipsuccesstext", $this->BlockAddress );
 179+ $wgOut->setPagetitle( wfMsg( 'blockip' ) );
 180+ $wgOut->setSubtitle( wfMsg( 'blockipsuccesssub' ) );
 181+ $text = wfMsg( 'blockipsuccesstext', $this->BlockAddress );
184182 $wgOut->addWikiText( $text );
185183 }
186184 }

Status & tagging log