Changeset 35168 for trunk/www


Ignore:
Timestamp:
Mar 19, 2008, 8:24:46 AM (12 years ago)
Author:
jmpp@…
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 xhtml markup breaks, so a real fix for that will come in a later commit.
Location:
trunk/www
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/includes/common.inc

    r33095 r35168  
    6969   
    7070    $portsdb_connection = mysql_connect($portsdb_host, $portsdb_user, $portsdb_passwd);
    71     if ($portsdb_connection === false) {
     71    if ($portsdb_connection === FALSE) {
    7272        switch ($script) {
    7373            case "index.php":
    7474                $portsdb_info = array(
    75                     'connection_stream' => false,
     75                    'connection_handler' => FALSE,
    7676                    'num_ports' => 'a lot of',
    7777                    'num_categories' => 'many'
     
    9494    } else {
    9595        $portsdb_info = array(
    96             'connection_stream' => $portsdb_connection,
     96            'connection_handler' => $portsdb_connection,
    9797            'num_ports' => ports_count(),
    9898            'num_categories' => categories_count()
  • trunk/www/index.php

    r32819 r35168  
    7171<?php
    7272    print_footer();
    73     if ($portsdb_info['connection_stream'] !== false) {
    74         mysql_close($portsdb_info['connection_stream']);
     73    if ($portsdb_info['connection_handler'] !== false) {
     74        mysql_close($portsdb_info['connection_handler']);
    7575    }
    7676?>
  • trunk/www/ports.php

    r35152 r35168  
    99    include_once("$MPWEB/includes/common.inc");
    1010    print_header('The MacPorts Project -- Available Ports', 'utf-8');
     11   
    1112    $portsdb_info = portsdb_connect($portsdb_host, $portsdb_user, $portsdb_passwd);
    12     $by = isset($_GET['by']) ? $_GET['by'] : '';
    13     $substr = isset($_GET['substr']) ? $_GET['substr'] : '';
    14 
    1513    $sql = "SELECT UNIX_TIMESTAMP(activity_time) FROM $portsdb_name.log ORDER BY UNIX_TIMESTAMP(activity_time) DESC";
    1614    $result = mysql_query($sql);
     
    2220        $time = '(unknown)';
    2321    }
     22    $by = isset($_GET['by']) ? $_GET['by'] : '';
     23    $substr = isset($_GET['substr']) ? $_GET['substr'] : '';
    2424?>
    2525
     
    6060        $result = mysql_query($query);
    6161        if ($result) {
    62             print "<h3>Port Categories</h3>\n<div id=\"categories\">\n<ul>";
    6362            $max_entries_per_column = floor($portsdb_info['num_categories']/4);
    6463            $columns = 0;
     64            print "<h3>Port Categories</h3>\n<div id=\"categories\">\n<ul>";
    6565            while ($columns < 4) {
     66                $entries_per_colum = 0;
    6667                print "<li>\n<ul>\n";
    67                 $entries_per_colum = 0;
    6868                while ($row = mysql_fetch_assoc($result)) {
    6969                    print '<li><a href="' . $_SERVER['PHP_SELF'] . '?by=category&amp;substr=' . urlencode($row['category']) . '">'
     
    227227
    228228        } else {
    229             print "An Error Occurred. (501)";
     229            print '<p>An Error Occurred: '. mysql_error($portsdb_info['connection_handler']) . '</p>';
    230230        }
    231231?>
     
    241241<?php
    242242    print_footer();
    243     mysql_close($portsdb_info['connection_stream']);
    244 ?>
     243    mysql_close($portsdb_info['connection_handler']);
     244?>
Note: See TracChangeset for help on using the changeset viewer.