[35134] trunk/www/ports.php

jmpp at macports.org jmpp at macports.org
Mon Mar 17 20:51:37 PDT 2008


Revision: 35134
          http://trac.macosforge.org/projects/macports/changeset/35134
Author:   jmpp at macports.org
Date:     2008-03-17 20:51:36 -0700 (Mon, 17 Mar 2008)

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

 * Correct the search menu entry for the 'dependency' option;
 * Allow searching by variant and platform, since they are also $by options (and we index them through PortIndex2MySQL);
 * Reorder the $by options to match those of the search menu;

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

Modified: trunk/www/ports.php
===================================================================
--- trunk/www/ports.php	2008-03-18 03:46:59 UTC (rev 35133)
+++ trunk/www/ports.php	2008-03-18 03:51:36 UTC (rev 35134)
@@ -41,7 +41,9 @@
                 <option value="name"<?php if ($by == "name") { print " selected=\"selected\""; } ?>>Software Title</option>
                 <option value="category"<?php if ($by == "category") { print " selected=\"selected\""; } ?>>Category</option>
                 <option value="maintainer"<?php if ($by == "maintainer") { print " selected=\"selected\""; } ?>>Maintainer</option>
-                <option value="dep"<?php if ($by == "dep") { print " selected=\"selected\""; } ?>>Dependency</option>
+                <option value="dependency"<?php if ($by == "dependency") { print " selected=\"selected\""; } ?>>Dependency</option>
+                <option value="variant"<?php if ($by == "variant") { print " selected=\"selected\""; } ?>>Variant</option>
+                <option value="platform"<?php if ($by == "platform") { print " selected=\"selected\""; } ?>>Platform</option>
             </select>
             <input type="text" name="substr" size="40" />
             <input type="submit" value="Search" />
@@ -83,13 +85,17 @@
         if ($by == "name") {
             $query .= " AND p.name LIKE '%" . mysql_real_escape_string($substr) . "%'";
         }
-        if ($by == "dependency") {
-            $query .= " AND p.name='" . mysql_real_escape_string($substr) . "'";
-        }
         if ($by == "category") {
             $tables .= ", $portsdb_name.categories c";
             $query .= " AND c.portfile=p.name AND c.category='" . 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) . "%'";
+        }
+        if ($by == "dependency") {
+            $query .= " AND p.name='" . 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) . "'";
@@ -98,10 +104,6 @@
             $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) {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080317/2dc23538/attachment.html 


More information about the macports-changes mailing list