r64585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64584‎ | r64585 | r64586 >
Date:23:11, 3 April 2010
Author:siebrand
Status:deferred
Tags:
Comment:
stylize.php, trailing whitespace removed
Modified paths:
  • /trunk/extensions/Asksql/Asksql.php (modified) (history)
  • /trunk/extensions/Asksql/Asksql_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Asksql/Asksql_body.php
@@ -1,6 +1,5 @@
22 <?php
3 -
4 -if (!defined('MEDIAWIKI')) {
 3+if ( !defined( 'MEDIAWIKI' ) ) {
54 exit;
65 }
76
@@ -16,23 +15,23 @@
1716
1817 wfLoadExtensionMessages( 'Asksql' );
1918
20 - if( !$wgAllowSysopQueries ) {
 19+ if ( !$wgAllowSysopQueries ) {
2120 $wgOut->errorpage( 'nosuchspecialpage', 'nospecialpagetext' );
2221 return;
2322 }
24 - if( !$wgUser->isAllowed('asksql') ) {
 23+ if ( !$wgUser->isAllowed( 'asksql' ) ) {
2524 $wgOut->permissionRequired( 'asksql' );
2625 return;
2726 }
2827
29 - if( $wgRequest->wasPosted() ) {
 28+ if ( $wgRequest->wasPosted() ) {
3029 $query = $wgRequest->getVal( 'wpSqlQuery' );
3130 $action = $wgRequest->getVal( 'action' );
3231 } else {
3332 $query = '';
3433 $action = '';
3534 }
36 - $f = new SqlQueryForm( $query);
 35+ $f = new SqlQueryForm( $query );
3736
3837 if ( "submit" == $action ) {
3938 $f->doSubmit();
@@ -59,12 +58,12 @@
6059
6160 $wgOut->setPagetitle( wfMsg( 'asksql' ) );
6261 $note = wfMsg( 'asksqltext' );
63 - if($wgLogQueries)
 62+ if ( $wgLogQueries )
6463 $note .= ' ' . wfMsg( 'sqlislogged' );
6564 $wgOut->addWikiText( $note );
6665
6766 if ( '' != $err ) {
68 - $wgOut->addHTML( '<p><font color="red" size="+1">' . htmlspecialchars($err) . "</font>\n" );
 67+ $wgOut->addHTML( '<p><font color="red" size="+1">' . htmlspecialchars( $err ) . "</font>\n" );
6968 }
7069 if ( ! $this->query ) { $this->query = 'SELECT ... FROM ... WHERE ...'; }
7170 $q = wfMsg( 'sqlquery' );
@@ -76,7 +75,7 @@
7776 <form id=\"asksql\" method=\"post\" action=\"{$action}\">
7877 <p>{$q}:</p>
7978 <textarea name=\"wpSqlQuery\" cols='80' rows='4' tabindex='1' style='width:100%'>"
80 -. htmlspecialchars($this->query) ."
 79+. htmlspecialchars( $this->query ) . "
8180 </textarea>
8281 <p><input type=submit name=\"wpQueryBtn\" value=\"{$qb}\"></p>
8382 </form>\n" );
@@ -89,7 +88,7 @@
9089
9190 # Use a limit, folks!
9291 $this->query = trim( $this->query );
93 - if( preg_match( '/^SELECT/i', $this->query )
 92+ if ( preg_match( '/^SELECT/i', $this->query )
9493 and !preg_match( '/LIMIT/i', $this->query ) ) {
9594 $this->query .= ' LIMIT 100';
9695 }
@@ -99,9 +98,9 @@
10099
101100 # Start timer, will kill the DB thread in $wgSqlTimeout seconds
102101 # FIXME: timer functions needed!
103 - #$conn->startTimer( $wgSqlTimeout );
 102+ # $conn->startTimer( $wgSqlTimeout );
104103 $res = $conn->query( $this->query, 'SpecialAsksql::doSubmit' );
105 - #$conn->stopTimer();
 104+ # $conn->stopTimer();
106105 $this->logFinishedQuery();
107106
108107 $n = 0;
@@ -149,10 +148,10 @@
150149 $r .= '<tr>';
151150 foreach ( $k as $x ) {
152151 $o = $y->$x ;
153 - if ( $x == 'page_title' or $x == 'rc_title') {
 152+ if ( $x == 'page_title' or $x == 'rc_title' ) {
154153 $namespace = 0;
155 - if( $x == 'page_title' && isset( $y->page_namespace ) ) $namespace = $y->page_namespace;
156 - if( $x == 'rc_title' && isset( $y->rc_namespace ) ) $namespace = $y->rc_namespace;
 154+ if ( $x == 'page_title' && isset( $y->page_namespace ) ) $namespace = $y->page_namespace;
 155+ if ( $x == 'rc_title' && isset( $y->rc_namespace ) ) $namespace = $y->rc_namespace;
157156 $title =& Title::makeTitle( $namespace, $o );
158157 $o = "<a href=\"" . $title->escapeLocalUrl() . "\" class='internal'>" .
159158 htmlspecialchars( $y->$x ) . '</a>' ;
@@ -172,7 +171,7 @@
173172
174173 function logQuery( $q ) {
175174 global $wgSqlLogFile, $wgLogQueries, $wgUser;
176 - if(!$wgLogQueries) return;
 175+ if ( !$wgLogQueries ) return;
177176
178177 $f = fopen( $wgSqlLogFile, 'a' );
179178 fputs( $f, "\n\n" . wfTimestampNow() .
@@ -184,7 +183,7 @@
185184
186185 function logFinishedQuery() {
187186 global $wgSqlLogFile, $wgLogQueries;
188 - if(!$wgLogQueries) return;
 187+ if ( !$wgLogQueries ) return;
189188
190189 $interval = wfTime() - $this->starttime;
191190
Index: trunk/extensions/Asksql/Asksql.php
@@ -11,7 +11,7 @@
1212 * @addtogroup SpecialPage
1313 */
1414
15 -if (!defined('MEDIAWIKI'))
 15+if ( !defined( 'MEDIAWIKI' ) )
1616 exit;
1717
1818 $wgExtensionCredits['specialpage'][] = array(
@@ -36,7 +36,7 @@
3737 $wgSqlLogFile = "{$wgUploadDirectory}/sqllog_mFhyRe6";
3838 $wgAvailableRights[] = 'asksql';
3939
40 -$dir = dirname(__FILE__) . '/';
 40+$dir = dirname( __FILE__ ) . '/';
4141 $wgExtensionMessagesFiles['Asksql'] = $dir . 'Asksql.i18n.php';
4242 $wgExtensionAliasesFiles['Asksql'] = $dir . 'Asksql.alias.php';
4343 $wgAutoloadClasses['SpecialAsksql'] = $dir . 'Asksql_body.php';

Status & tagging log