[31572] trunk/www/ports.php

jmpp at macports.org jmpp at macports.org
Wed Nov 28 07:25:48 PST 2007


Revision: 31572
          http://trac.macosforge.org/projects/macports/changeset/31572
Author:   jmpp at macports.org
Date:     2007-11-28 07:25:45 -0800 (Wed, 28 Nov 2007)

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

The real whitespace corrections, please do ignore me!

Modified Paths:
--------------
    trunk/www/ports.php

Modified: trunk/www/ports.php
===================================================================
--- trunk/www/ports.php	2007-11-28 12:21:15 UTC (rev 31571)
+++ trunk/www/ports.php	2007-11-28 15:25:45 UTC (rev 31572)
@@ -43,181 +43,185 @@
 
     <h3>Port Categories</h3>
 
-        <p>View the complete <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=all">Ports List</a></p>
+    <p>View the complete <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=all">Ports List</a></p>
+
 <?php
-        if (!$by || (!$substr && $by != "all")) {
-            $query = "SELECT DISTINCT category FROM $portsdb_name.categories ORDER BY category";
-            $result = mysql_query($query);
-            if ($result) {
-                while ($row = mysql_fetch_assoc($result)) {
+    if (!$by || (!$substr && $by != "all")) {
+        $query = "SELECT DISTINCT category FROM $portsdb_name.categories ORDER BY category";
+        $result = mysql_query($query);
+        if ($result) {
+            while ($row = mysql_fetch_assoc($result)) {
 ?>
-                    <div class="port">
+                <div class="port">
 
-                        <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=cat&amp;substr=<?php echo urlencode($row['category']); ?>">
-                        <?php echo htmlspecialchars($row['category']); ?></a>
+                    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=cat&amp;substr=<?php echo urlencode($row['category']); ?>">
+                    <?php echo htmlspecialchars($row['category']); ?></a>
 
-                    </div>
+                </div>
 <?php
-                }
             }
         }
+    }
 ?>
 
 <?php
-        if ($by && ($substr || $by == "all")) {
-            $fields = "name, path, version, description";
-            $query = "1";
-            $tables = "$portsdb_name.portfiles p";
-            if ($by == "name") {
-                $query .= " AND p.name LIKE '%" . mysql_real_escape_string($substr) . "%'";
-            }
-            if ($by == "library") {
-                $query .= " AND p.name='" . mysql_real_escape_string($substr) . "'";
-            }
-            if ($by == "desc") {
-                $query .= " AND p.description LIKE '%" . mysql_real_escape_string($substr) . "%'";
-            }
-            if ($by == "cat") {
-                $tables .= ", $portsdb_name.categories c";
-                $query .= " AND c.portfile=p.name AND c.category='" . mysql_real_escape_string($substr) . "'";
-            }
-            if ($by == "variant") {
-                $tables .= ", $portsdb_name.variants v";
-                $query .= " AND v.portfile=p.name AND v.variant='" . mysql_real_escape_string($substr) . "'";
-            }
-            if ($by == "platform") {
-                $tables .= ", $portsdb_name.platforms pl";
-                $query .= " AND pl.portfile=p.name AND pl.platform ='" . mysql_real_escape_string($substr) . "'";
-            }
-            if ($by == "maintainer") {
-                $tables .= ", $portsdb_name.maintainers m";
-                $query .= " AND m.portfile=p.name AND m.maintainer LIKE '%" . mysql_real_escape_string($substr) . "%'";
-            }
-            $query = "SELECT DISTINCT $fields FROM $tables WHERE $query ORDER BY name";
-            $result = mysql_query($query);
-            if($result) {
+    if ($by && ($substr || $by == "all")) {
+        $fields = "name, path, version, description";
+        $query = "1";
+        $tables = "$portsdb_name.portfiles p";
+        if ($by == "name") {
+            $query .= " AND p.name LIKE '%" . mysql_real_escape_string($substr) . "%'";
+        }
+        if ($by == "library") {
+            $query .= " AND p.name='" . mysql_real_escape_string($substr) . "'";
+        }
+        if ($by == "desc") {
+            $query .= " AND p.description LIKE '%" . mysql_real_escape_string($substr) . "%'";
+        }
+        if ($by == "cat") {
+            $tables .= ", $portsdb_name.categories c";
+            $query .= " AND c.portfile=p.name AND c.category='" . mysql_real_escape_string($substr) . "'";
+        }
+        if ($by == "variant") {
+            $tables .= ", $portsdb_name.variants v";
+            $query .= " AND v.portfile=p.name AND v.variant='" . mysql_real_escape_string($substr) . "'";
+        }
+        if ($by == "platform") {
+            $tables .= ", $portsdb_name.platforms pl";
+            $query .= " AND pl.portfile=p.name AND pl.platform ='" . mysql_real_escape_string($substr) . "'";
+        }
+        if ($by == "maintainer") {
+            $tables .= ", $portsdb_name.maintainers m";
+            $query .= " AND m.portfile=p.name AND m.maintainer LIKE '%" . mysql_real_escape_string($substr) . "%'";
+        }
+        $query = "SELECT DISTINCT $fields FROM $tables WHERE $query ORDER BY name";
+        $result = mysql_query($query);
+        if($result) {
 ?>
-                <p><i><?php echo mysql_num_rows($result) . ' ' . (mysql_num_rows($result) == 1 ? 'Portfile' : 'Portfiles') . 
-                ' Selected'; ?></i></p>
+            <p><i><?php echo mysql_num_rows($result) . ' ' . (mysql_num_rows($result) == 1 ? 'Portfile' : 'Portfiles') . 
+            ' Selected'; ?></i></p>
 
-                <dl>
+            <dl>
 <?php
-                while ($row = mysql_fetch_assoc($result)) {
+            while ($row = mysql_fetch_assoc($result)) {
 ?>
-                    <dt><b><a href="<?php print $trac_url . 'browser/trunk/dports/' . $row['path'] . '/Portfile'; ?>">
-                    <?php echo htmlspecialchars($row['name']); ?></a></b> <?php echo htmlspecialchars($row['version']); ?></dt>
-                    <dd>
-                        <?php echo htmlspecialchars($row['description']); ?><br />
+                <dt><b><a href="<?php print $trac_url . 'browser/trunk/dports/' . $row['path'] . '/Portfile'; ?>"><?php echo
+                htmlspecialchars($row['name']); ?></a></b> <?php echo htmlspecialchars($row['version']); ?></dt>
+                <dd>
+                    <?php echo htmlspecialchars($row['description']); ?><br />
 <?php
 /* MAINTAINERS */
-                        $nquery = "SELECT maintainer FROM $portsdb_name.maintainers WHERE portfile='" . mysql_real_escape_string($row['name']) .
-                        "' ORDER BY is_primary DESC, maintainer";
-                        $nresult = mysql_query($nquery);
-                        if ($nresult) {
+                    $nquery = "SELECT maintainer FROM $portsdb_name.maintainers WHERE portfile='" . mysql_real_escape_string($row['name']) .
+                    "' ORDER BY is_primary DESC, maintainer";
+                    $nresult = mysql_query($nquery);
+                    if ($nresult) {
 ?>
-                            <i>Maintained by:</i>
+                        <i>Maintained by:</i>
 <?php
-                            $primary = 1;
-                            while ($nrow = mysql_fetch_array($nresult)) {
-                                if ($primary) { echo "<b>"; }
-                                else { echo " "; }
-                                $addr = obfuscate_email($nrow[0]);
-                                print $addr;
-                                if ($primary) { echo "</b>"; }
-                                $primary = 0;
-                            }
+                        $primary = 1;
+                        while ($nrow = mysql_fetch_array($nresult)) {
+                            if ($primary) { echo "<b>"; }
+                            else { echo " "; }
+                            $addr = obfuscate_email($nrow[0]);
+                            print $addr;
+                            if ($primary) { echo "</b>"; }
+                            $primary = 0;
                         }
+                    }
 
 /* CATEGORIES */
-                        $nquery = "SELECT category FROM $portsdb_name.categories WHERE portfile='" . mysql_real_escape_string($row['name']) .
-                        "' ORDER BY is_primary DESC, category";
-                        $nresult = mysql_query($nquery);
-                        if ($nresult) {
+                    $nquery = "SELECT category FROM $portsdb_name.categories WHERE portfile='" . mysql_real_escape_string($row['name']) .
+                    "' ORDER BY is_primary DESC, category";
+                    $nresult = mysql_query($nquery);
+                    if ($nresult) {
 ?>
-                            <br />
-                            <i>Categories:</i>
+                        <br />
+                        <i>Categories:</i>
 <?php
-                            $primary = 1;
-                            while ($nrow = mysql_fetch_assoc($nresult)) {
-                                if ($primary) { echo "<b>"; }
+                        $primary = 1;
+                        while ($nrow = mysql_fetch_assoc($nresult)) {
+                            if ($primary) { echo "<b>"; }
 ?>
-                                <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=cat&amp;substr=<?php echo urlencode($nrow['category']); ?>">
-                                <?php echo htmlspecialchars($nrow['category']); ?></a>
+                            <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=cat&amp;substr=<?php echo urlencode($nrow['category']); ?>">
+                            <?php echo htmlspecialchars($nrow['category']); ?></a>
 <?php
-                                if ($primary) { echo "</b>"; }
-                                $primary = 0;
-                            }
+                            if ($primary) { echo "</b>"; }
+                            $primary = 0;
                         }
+                    }
 
 /* PLATFORMS */
-                        $nquery = "SELECT platform FROM $portsdb_name.platforms WHERE portfile='" . mysql_real_escape_string($row['name']) .
-                        "' ORDER BY platform";
-                        $nresult = mysql_query($nquery);
-                        if ($nresult && mysql_num_rows($nresult) > 0) {
+                    $nquery = "SELECT platform FROM $portsdb_name.platforms WHERE portfile='" . mysql_real_escape_string($row['name']) .
+                    "' ORDER BY platform";
+                    $nresult = mysql_query($nquery);
+                    if ($nresult && mysql_num_rows($nresult) > 0) {
 ?>
-                            <br />
-                            <i>Platforms:</i>
+                        <br />
+                        <i>Platforms:</i>
 <?php
-                            while ($nrow = mysql_fetch_array($nresult)) {
-                                $platform = $nrow[0];
+                        while ($nrow = mysql_fetch_array($nresult)) {
+                            $platform = $nrow[0];
 ?>
-                                <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=platform&amp;substr=<?php echo urlencode($platform); ?>">
-                                <?php echo htmlspecialchars($platform); ?></a>
+                            <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=platform&amp;substr=<?php echo urlencode($platform); ?>">
+                            <?php echo htmlspecialchars($platform); ?></a>
 <?php
-                            }
                         }
+                    }
 
 /* DEPENDENCIES */
-                        $nquery = "SELECT library FROM $portsdb_name.dependencies WHERE portfile='" . mysql_real_escape_string($row['name']) .
-                        "' ORDER BY library";
-                        $nresult = mysql_query($nquery);
-                        if ($nresult && mysql_num_rows($nresult) > 0) {
+                    $nquery = "SELECT library FROM $portsdb_name.dependencies WHERE portfile='" . mysql_real_escape_string($row['name']) .
+                    "' ORDER BY library";
+                    $nresult = mysql_query($nquery);
+                    if ($nresult && mysql_num_rows($nresult) > 0) {
 ?>
-                            <br />
-                            <i>Dependencies:</i>
+                        <br />
+                        <i>Dependencies:</i>
 <?php
-                            while ($nrow = mysql_fetch_array($nresult)) {
-                                // lib:libpng.3:libpng -> libpng
-                                // might need adapting to the new port: depspec
-                                $library = eregi_replace("^([^:]*:[^:]*:|[^:]*:)", "", $nrow[0]);
+                        while ($nrow = mysql_fetch_array($nresult)) {
+                            // lib:libpng.3:libpng -> libpng
+                            // might need adapting to the new port: depspec
+                            $library = eregi_replace("^([^:]*:[^:]*:|[^:]*:)", "", $nrow[0]);
 ?>
-                                <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=library&amp;substr=<?php echo urlencode($library); ?>">
-                                <?php echo htmlspecialchars($library); ?></a>
+                            <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=library&amp;substr=<?php echo urlencode($library); ?>">
+                            <?php echo htmlspecialchars($library); ?></a>
 <?php
-                            }
                         }
+                    }
 
 /* VARIANTS */
-                        $nquery = "SELECT variant FROM $portsdb_name.variants WHERE portfile='" . mysql_real_escape_string($row['name']) .
-                        "' ORDER BY variant";
-                        $nresult = mysql_query($nquery);
-                        if ($nresult && mysql_num_rows($nresult) > 0) {
+                    $nquery = "SELECT variant FROM $portsdb_name.variants WHERE portfile='" . mysql_real_escape_string($row['name']) .
+                    "' ORDER BY variant";
+                    $nresult = mysql_query($nquery);
+                    if ($nresult && mysql_num_rows($nresult) > 0) {
 ?>
-                            <br />
-                            <i>Variants:</i>
+                        <br />
+                        <i>Variants:</i>
 <?php
-                            while ($nrow = mysql_fetch_array($nresult)) {
-                                $variant = $nrow[0];
+                        while ($nrow = mysql_fetch_array($nresult)) {
+                            $variant = $nrow[0];
 ?>
-                                <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=variant&amp;substr=<?php echo urlencode($variant); ?>">
-                                <?php echo htmlspecialchars($variant); ?></a>
+                            <a href="<?php echo $_SERVER['PHP_SELF']; ?>?by=variant&amp;substr=<?php echo urlencode($variant); ?>">
+                            <?php echo htmlspecialchars($variant); ?></a>
 <?php
-                            }
+                        }
                     }
 
 ?>
                     <br />
                 </dd>
 <?php
-                }
-            } else {
-                echo "An Error Occurred. (501)";
             }
+
+        } else {
+            echo "An Error Occurred. (501)";
+        }
 ?>
         </dl>
+
 <?php
-        }
+    }
 ?>
+
 </div>
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071128/1f4d7f59/attachment-0001.html


More information about the macports-changes mailing list