[35168] trunk/www

jmpp at macports.org jmpp at macports.org
Wed Mar 19 01:24:47 PDT 2008


Revision: 35168
          http://trac.macosforge.org/projects/macports/changeset/35168
Author:   jmpp at macports.org
Date:     2008-03-19 01:24:46 -0700 (Wed, 19 Mar 2008)

Log Message:
-----------

 * It's more common to call a connection handler 'handler' indeed, not 'stream', comply. No functional changes;
 * It's more common to use an upper case FALSE, comply. No functional changes;
 * Reorder some php statements in ports.php. No functional changes;
 * Provide some more information in case querying the db in ports.php fails for whaever reason, along with some markup.
   Note, however, that if we do hit that case, overall xhmlt markup breaks, so a real fix for that will come in a later commit.

Modified Paths:
--------------
    trunk/www/includes/common.inc
    trunk/www/index.php
    trunk/www/ports.php

Modified: trunk/www/includes/common.inc
===================================================================
--- trunk/www/includes/common.inc	2008-03-19 08:10:15 UTC (rev 35167)
+++ trunk/www/includes/common.inc	2008-03-19 08:24:46 UTC (rev 35168)
@@ -68,11 +68,11 @@
     $script = basename($_SERVER['PHP_SELF']);
     
     $portsdb_connection = mysql_connect($portsdb_host, $portsdb_user, $portsdb_passwd);
-    if ($portsdb_connection === false) {
+    if ($portsdb_connection === FALSE) {
         switch ($script) {
             case "index.php":
                 $portsdb_info = array(
-                    'connection_stream' => false,
+                    'connection_handler' => FALSE,
                     'num_ports' => 'a lot of',
                     'num_categories' => 'many'
                 );
@@ -93,7 +93,7 @@
         }
     } else {
         $portsdb_info = array(
-            'connection_stream' => $portsdb_connection,
+            'connection_handler' => $portsdb_connection,
             'num_ports' => ports_count(),
             'num_categories' => categories_count()
         );

Modified: trunk/www/index.php
===================================================================
--- trunk/www/index.php	2008-03-19 08:10:15 UTC (rev 35167)
+++ trunk/www/index.php	2008-03-19 08:24:46 UTC (rev 35168)
@@ -70,7 +70,7 @@
 
 <?php
     print_footer();
-    if ($portsdb_info['connection_stream'] !== false) {
-        mysql_close($portsdb_info['connection_stream']);
+    if ($portsdb_info['connection_handler'] !== false) {
+        mysql_close($portsdb_info['connection_handler']);
     }
 ?>

Modified: trunk/www/ports.php
===================================================================
--- trunk/www/ports.php	2008-03-19 08:10:15 UTC (rev 35167)
+++ trunk/www/ports.php	2008-03-19 08:24:46 UTC (rev 35168)
@@ -8,10 +8,8 @@
     $MPWEB = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['SCRIPT_NAME']);
     include_once("$MPWEB/includes/common.inc");
     print_header('The MacPorts Project -- Available Ports', 'utf-8');
+    
     $portsdb_info = portsdb_connect($portsdb_host, $portsdb_user, $portsdb_passwd);
-    $by = isset($_GET['by']) ? $_GET['by'] : '';
-    $substr = isset($_GET['substr']) ? $_GET['substr'] : '';
-
     $sql = "SELECT UNIX_TIMESTAMP(activity_time) FROM $portsdb_name.log ORDER BY UNIX_TIMESTAMP(activity_time) DESC";
     $result = mysql_query($sql);
     if ($result && $row = mysql_fetch_row($result)) {
@@ -21,6 +19,8 @@
         $date = '(unknown)';
         $time = '(unknown)';
     }
+    $by = isset($_GET['by']) ? $_GET['by'] : '';
+    $substr = isset($_GET['substr']) ? $_GET['substr'] : '';
 ?>
 
 <div id="content">
@@ -59,12 +59,12 @@
         $query = "SELECT DISTINCT category FROM $portsdb_name.categories ORDER BY category";
         $result = mysql_query($query);
         if ($result) {
-            print "<h3>Port Categories</h3>\n<div id=\"categories\">\n<ul>";
             $max_entries_per_column = floor($portsdb_info['num_categories']/4);
             $columns = 0;
+            print "<h3>Port Categories</h3>\n<div id=\"categories\">\n<ul>";
             while ($columns < 4) {
+                $entries_per_colum = 0;
                 print "<li>\n<ul>\n";
-                $entries_per_colum = 0;
                 while ($row = mysql_fetch_assoc($result)) {
                     print '<li><a href="' . $_SERVER['PHP_SELF'] . '?by=category&amp;substr=' . urlencode($row['category']) . '">'
                     . htmlspecialchars($row['category']) . '</a></li>';
@@ -226,7 +226,7 @@
             }
 
         } else {
-            print "An Error Occurred. (501)";
+            print '<p>An Error Occurred: '. mysql_error($portsdb_info['connection_handler']) . '</p>';
         }
 ?>
         </dl>
@@ -240,5 +240,5 @@
 
 <?php
     print_footer();
-    mysql_close($portsdb_info['connection_stream']);
+    mysql_close($portsdb_info['connection_handler']);
 ?>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080319/3e745a73/attachment.html 


More information about the macports-changes mailing list