single quotes :o)
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 11 Jan 2005 18:10:07 +0000 (18:10 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 11 Jan 2005 18:10:07 +0000 (18:10 +0000)
includes/SpecialAsksql.php

index 96f0623..567901a 100644 (file)
@@ -17,7 +17,7 @@ function wfSpecialAsksql() {
        global $wgUser, $wgOut, $wgRequest, $wgAllowSysopQueries;
 
        if( !$wgAllowSysopQueries ) {
-               $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
+               $wgOut->errorpage( 'nosuchspecialpage', 'nospecialpagetext' );
                return;
        }
        if( !$wgUser->isAllowed('asksql') ) {
@@ -29,8 +29,8 @@ function wfSpecialAsksql() {
                $query = $wgRequest->getVal( 'wpSqlQuery' );
                $action = $wgRequest->getVal( 'action' );
        } else {
-               $query = "";
-               $action = "";
+               $query = '';
+               $action = ;
        }
        $f = new SqlQueryForm( $query);
 
@@ -57,20 +57,20 @@ class SqlQueryForm {
                global $wgOut, $wgUser, $wgLang;
                global $wgLogQueries;
 
-               $wgOut->setPagetitle( wfMsg( "asksql" ) );
-               $note = wfMsg( "asksqltext" );
+               $wgOut->setPagetitle( wfMsg( 'asksql' ) );
+               $note = wfMsg( 'asksqltext' );
                if($wgLogQueries)
-                       $note .= " " . wfMsg( "sqlislogged" );
+                       $note .= ' ' . wfMsg( 'sqlislogged' );
                $wgOut->addWikiText( $note );
 
-               if ( "" != $err ) {
-                       $wgOut->addHTML( "<p><font color='red' size='+1'>" . htmlspecialchars($err) . "</font>\n" );
+               if ( '' != $err ) {
+                       $wgOut->addHTML( '<p><font color="red" size="+1">' . htmlspecialchars($err) . "</font>\n" );
                }
-               if ( ! $this->query ) { $this->query = "SELECT ... FROM ... WHERE ..."; }
-               $q = wfMsg( "sqlquery" );
-               $qb = wfMsg( "querybtn" );
-               $titleObj = Title::makeTitle( NS_SPECIAL, "Asksql" );
-               $action = $titleObj->escapeLocalURL( "action=submit" );
+               if ( ! $this->query ) { $this->query = 'SELECT ... FROM ... WHERE ...'; }
+               $q = wfMsg( 'sqlquery' );
+               $qb = wfMsg( 'querybtn' );
+               $titleObj = Title::makeTitle( NS_SPECIAL, 'Asksql' );
+               $action = $titleObj->escapeLocalURL( 'action=submit' );
 
                $wgOut->addHTML( "<p>
 <form id=\"asksql\" method=\"post\" action=\"{$action}\">
@@ -95,9 +95,9 @@ class SqlQueryForm {
 
                # Use a limit, folks!
                $this->query = trim( $this->query );
-               if( preg_match( "/^SELECT/i", $this->query )
-                       and !preg_match( "/LIMIT/i", $this->query ) ) {
-                       $this->query .= " LIMIT 100";
+               if( preg_match( '/^SELECT/i', $this->query )
+                       and !preg_match( '/LIMIT/i', $this->query ) ) {
+                       $this->query .= ' LIMIT 100';
                }
                $conn = Database::newFromParams( $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname );
 
@@ -105,7 +105,7 @@ class SqlQueryForm {
 
                # Start timer, will kill the DB thread in $wgSqlTimeout seconds
                $conn->startTimer( $wgSqlTimeout );
-               $res = $conn->query( $this->query, "SpecialAsksql::doSubmit" );
+               $res = $conn->query( $this->query, 'SpecialAsksql::doSubmit' );
                $conn->stopTimer();
                $this->logFinishedQuery();
 
@@ -119,7 +119,7 @@ class SqlQueryForm {
                                array_push( $k, $conn->fieldName( $res, $x ) );
                        }
 
-                       if ( $n == 2 && in_array( "page_title", $k ) && in_array( "page_namespace", $k ) ) {
+                       if ( $n == 2 && in_array( 'page_title', $k ) && in_array( 'page_namespace', $k ) ) {
                                $titleList = true;
                        }
 
@@ -151,20 +151,20 @@ class SqlQueryForm {
                                $r .= "</tr>\n";
 
                                foreach ( $a as $y ) {
-                                       $r .= "<tr>";
+                                       $r .= '<tr>';
                                        foreach ( $k as $x ) {
                                                $o = $y->$x ;
-                                               if ( $x == "page_title"  or $x == "rc_title") {
+                                               if ( $x == 'page_title'  or $x == 'rc_title') {
                                                        $namespace = 0;
-                                                       if( $x == "page_title" && isset( $y->page_namespace ) ) $namespace = $y->page_namespace;
-                                                       if( $x == "rc_title" && isset( $y->rc_namespace ) ) $namespace = $y->rc_namespace;
+                                                       if( $x == 'page_title' && isset( $y->page_namespace ) ) $namespace = $y->page_namespace;
+                                                       if( $x == 'rc_title' && isset( $y->rc_namespace ) ) $namespace = $y->rc_namespace;
                                                        $title =& Title::makeTitle( $namespace, $o );
                                                        $o = "<a href=\"" . $title->escapeLocalUrl() . "\" class='internal'>" .
-                                                         htmlspecialchars( $y->$x ) . "</a>" ;
+                                                         htmlspecialchars( $y->$x ) . '</a>' ;
                                                } else {
                                                        $o = htmlspecialchars( $o );
                                                }
-                                               $r .= "<td>" . $o . "</td>\n";
+                                               $r .= '<td>' . $o . "</td>\n";
                                        }
                                        $r .= "</tr>\n";
                                }
@@ -179,7 +179,7 @@ class SqlQueryForm {
                global $wgSqlLogFile, $wgLogQueries, $wgUser;
                if(!$wgLogQueries) return;
                
-               $f = fopen( $wgSqlLogFile, "a" );
+               $f = fopen( $wgSqlLogFile, 'a' );
                fputs( $f, "\n\n" . wfTimestampNow() .
                        " query by " . $wgUser->getName() .
                        ":\n$q\n" );
@@ -193,8 +193,8 @@ class SqlQueryForm {
                
                $interval = wfTime() - $this->starttime;
                
-               $f = fopen( $wgSqlLogFile, "a" );
-               fputs( $f, "finished at " . wfTimestampNow() . "; took $interval secs\n" );
+               $f = fopen( $wgSqlLogFile, 'a' );
+               fputs( $f, 'finished at ' . wfTimestampNow() . "; took $interval secs\n" );
                fclose( $f );
        }