jenkins-bot has submitted this change and it was merged.

Change subject: General fixes and cleanup
......................................................................


General fixes and cleanup

Change-Id: I131749779c06df4ddde7802275db144222e4da5a
---
M config.php
M index.php
M qrpedia.org/csv.php
M qrpedia.org/index.html
M qrpedia.org/stats.php
M stats.php
6 files changed, 42 insertions(+), 27 deletions(-)

Approvals:
  Kelson: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/config.php b/config.php
index 5d72a2e..65d6d36 100644
--- a/config.php
+++ b/config.php
@@ -58,4 +58,3 @@
                        }
                }
        }
-?>
diff --git a/index.php b/index.php
index 00133cd..98d2c46 100644
--- a/index.php
+++ b/index.php
@@ -17,7 +17,7 @@
                        $mysqli->set_charset("utf8"); 
                        
                        /* create a prepared statement */
-                       if ($stmt = $mysqli->prepare("  SELECT LanguageName
+                       if ($stmt = $mysqli->prepare("SELECT LanguageName
                                                                                
                                        FROM lang
                                                                                
                                        WHERE `Code`=?"
                                                                                
                ))
@@ -73,7 +73,7 @@
                                break;
                        } 
                }
-       
+
                // Get the language requested. For example fr.qrwp.org/foo 
assumes that /foo is French
                $requested_server = $_SERVER['SERVER_NAME'];
 
@@ -92,14 +92,14 @@
                {
                        $phone_language = $requested_language;
                }
-               
+
                //      The Norwegian language code is... complex!
                //      See http://code.google.com/p/qrwp/issues/detail?id=4 
for a discussion
                if ($phone_language == "nb")
                {
                        $phone_language = "no";
                }
-               
+
                //      If the phone's language is the same as the requested 
language (eg en-gb & en.qrwp) do the redirection without a call to Wikipedia 
                if ($phone_language == $requested_language)
                {
@@ -133,20 +133,20 @@
                $response = curl_exec($curl_handle);
                $response_info=curl_getinfo($curl_handle);
                curl_close($curl_handle);
-       
+
                // Decode the JSON into an array
                $results = json_decode($response,true);
 
                // We need to find the ID of the page
                $page_id_array = $results['query']['pages'];
                $page_id = key($page_id_array);
-               
+
                //If there is no $page_id it means a 404
                if ($page_id != -1)
                {
                        // Find out how many links were returned
                        $links_array = 
$results['query']['pages'][$page_id]['langlinks'];
-       
+
                        // Itterate through the array
                        for ($i = 0; $i <       count($links_array); $i++)
                        {
@@ -159,19 +159,19 @@
                                //      If the URL is ca.qrwp then we do the 
following
                                //      If the phone is set to CA - send the 
article
                                //              Else, show the language select 
screen
-               
+
                                if ($article_language == $phone_language) 
                                {
-                               
+
                                        if ($requested_language == "ca" && 
$phone_language == "es")
                                        {
                                                //      Catalan Fix
                                                break;
                                        }
-                                       
+
                                        // Get the Wikipedia URL for the 
language
                                        $article_url = 
$results['query']['pages'][$page_id]['langlinks'][$i]['url'];
-                               
+
                                        // Quick and dirty search and replace 
to convert the URL into a mobile version
                                        $mobile_url = 
str_replace('.wikipedia.org', '.m.wikipedia.org', $article_url);
                                        $mobile_url = utf8_decode($mobile_url);
@@ -197,8 +197,8 @@
                        //header("Location: 
http://$phone_language.m.wikipedia.org/";);
                        //exit;
                }
-               
-               
+
+
                //Minority Language / Missing Language
 
                //      An html list of articles - for use if a translation 
can't be found
@@ -225,14 +225,14 @@
                        
                        //      Get the Language name
                        $language_name = 
getLanguageNameFromCode($article_language);
-               
+
                        //      Add to the HTML list
                        $article_list .= "<li>$language_name - <a 
href=\"$mobile_url\">$article_title</a></li>\n";
                }
-               
+
                //      Print a list of the available articles and let the user 
choose
                header('Content-Type: text/html;charset=utf-8'); //     We're 
returning lots of unicode, let's make sure the browser knows that
-                       
+
                //      HTML5 FTW!
                echo "<!DOCTYPE html>
                                <html>
@@ -242,12 +242,12 @@
                                                <title>QRpedia Language 
Selection for $request</title>
                                        </head>
                                        <body>";
-               
+
                //      Catalan Fix
                // Catalan isn't well supported on the phone.  Many phones 
don't have it as an option.
                //      If the URL is ca.qrwp then we do the following
                //              Show the language select screen
-               
+
                if ($requested_language == "ca" && $phone_language != "ca")
                {
                        echo "CA: En quin idioma vols llegir aquest article?<br 
/>
@@ -263,7 +263,7 @@
                                        Or read in one of the following 
languages:
                                        <br />\n";
                }
-                       
+
                echo    "<ul>
                                        $article_list
                                </ul>";
diff --git a/qrpedia.org/csv.php b/qrpedia.org/csv.php
index 16b36f3..c23270e 100644
--- a/qrpedia.org/csv.php
+++ b/qrpedia.org/csv.php
@@ -3,22 +3,26 @@
        include "config.php";
 
        //      Connect to database
-       $mysqli = new 
mysqli(localhost,$mySQL_username,$mySQL_password,$mySQL_database);
+       $mysqli = new 
mysqli('localhost',$mySQL_username,$mySQL_password,$mySQL_database);
 
-       mysql_connect(localhost,$mySQL_username,$mySQL_password);
+
+       mysql_connect('localhost',$mySQL_username,$mySQL_password);
        @mysql_select_db($mySQL_database) or die( "Unable to select database");
 
        $path = null;
 
+
        //      The initial query
        $query = "      SELECT *
                                        FROM `stats`";
+
 
        if ($_GET["path"])
        {
                $path = mysql_real_escape_string($_GET["path"]);
                $query .= " WHERE `Path` LIKE '{$path}'";
        }
+
 
        $result = $mysqli->query($query); //mysql_query($query);
 
@@ -42,3 +46,4 @@
                }
        die;
 }
+
diff --git a/qrpedia.org/index.html b/qrpedia.org/index.html
index b2fdc21..a397f4e 100644
--- a/qrpedia.org/index.html
+++ b/qrpedia.org/index.html
@@ -75,7 +75,7 @@
                 if (original_URL.indexOf('wikipedia.org/wiki/') > 0) {
 
                     // Get Encoding status
-                    var is_URL_encoded = decodeURI(original_URL) === 
original_URL ? false : true;
+                    var is_URL_encoded = decodeURI(original_URL) !== 
original_URL;
 
                     // Form a qrwp URL
                     var new_URL = original_URL.replace('wikipedia.org/wiki/', 
'qrwp.org/');
diff --git a/qrpedia.org/stats.php b/qrpedia.org/stats.php
index 22914a0..3d28b15 100644
--- a/qrpedia.org/stats.php
+++ b/qrpedia.org/stats.php
@@ -3,7 +3,7 @@
        include "config.php";
 
        //      Connect to database
-       mysql_connect(localhost,$mySQL_username,$mySQL_password);
+       mysql_connect('localhost',$mySQL_username,$mySQL_password);
        @mysql_select_db($mySQL_database) or die( "Unable to select database");
 
        // UA to search for
diff --git a/stats.php b/stats.php
index 050c1f2..33888a1 100644
--- a/stats.php
+++ b/stats.php
@@ -9,11 +9,22 @@
        include "config.php";
 
        //      Connect to database
-       mysql_connect(localhost,$mySQL_username,$mySQL_password);
+       mysql_connect('localhost',$mySQL_username,$mySQL_password);
        @mysql_select_db($mySQL_database) or die( "Unable to select database");
 
        // UA to search for
-       $user_agents = array("iPhone",  "iPad", "iPod", "Android",      
"Nokia",                "BlackBerry",   "Opera",                "Windows Phone 
OS 7",   "MSIE 6",       "Bada");
+       $user_agents = array(
+               "iPhone",
+               "iPad",
+               "iPod",
+               "Android",
+               "Nokia",
+               "BlackBerry",
+               "Opera",
+               "Windows Phone OS 7",
+               "MSIE 6",
+               "Bada"
+       );
 
        $path = null;
 
@@ -81,7 +92,7 @@
 
        //      Get Top 10 QRpedia code destinations
        // Exclude qrpedia
-       $query = "      SELECT Path, COUNT( * )
+       $query = "SELECT Path, COUNT( * )
                                        FROM stats
                                        WHERE `Path` NOT LIKE 'qrpedia'
                                        GROUP BY Path

-- 
To view, visit https://gerrit.wikimedia.org/r/121661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I131749779c06df4ddde7802275db144222e4da5a
Gerrit-PatchSet: 3
Gerrit-Project: qrpedia
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Kelson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to