Changeset 35134 for trunk/www


Ignore:
Timestamp:
Mar 18, 2008, 3:51:36 AM (12 years ago)
Author:
jmpp@…
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;
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/ports.php

    r35133 r35134  
    4242                <option value="category"<?php if ($by == "category") { print " selected=\"selected\""; } ?>>Category</option>
    4343                <option value="maintainer"<?php if ($by == "maintainer") { print " selected=\"selected\""; } ?>>Maintainer</option>
    44                 <option value="dep"<?php if ($by == "dep") { print " selected=\"selected\""; } ?>>Dependency</option>
     44                <option value="dependency"<?php if ($by == "dependency") { print " selected=\"selected\""; } ?>>Dependency</option>
     45                <option value="variant"<?php if ($by == "variant") { print " selected=\"selected\""; } ?>>Variant</option>
     46                <option value="platform"<?php if ($by == "platform") { print " selected=\"selected\""; } ?>>Platform</option>
    4547            </select>
    4648            <input type="text" name="substr" size="40" />
     
    8486            $query .= " AND p.name LIKE '%" . mysql_real_escape_string($substr) . "%'";
    8587        }
    86         if ($by == "dependency") {
    87             $query .= " AND p.name='" . mysql_real_escape_string($substr) . "'";
    88         }
    8988        if ($by == "category") {
    9089            $tables .= ", $portsdb_name.categories c";
    9190            $query .= " AND c.portfile=p.name AND c.category='" . mysql_real_escape_string($substr) . "'";
    9291        }
     92        if ($by == "maintainer") {
     93            $tables .= ", $portsdb_name.maintainers m";
     94            $query .= " AND m.portfile=p.name AND m.maintainer LIKE '%" . mysql_real_escape_string($substr) . "%'";
     95        }
     96        if ($by == "dependency") {
     97            $query .= " AND p.name='" . mysql_real_escape_string($substr) . "'";
     98        }
    9399        if ($by == "variant") {
    94100            $tables .= ", $portsdb_name.variants v";
     
    98104            $tables .= ", $portsdb_name.platforms pl";
    99105            $query .= " AND pl.portfile=p.name AND pl.platform ='" . mysql_real_escape_string($substr) . "'";
    100         }
    101         if ($by == "maintainer") {
    102             $tables .= ", $portsdb_name.maintainers m";
    103             $query .= " AND m.portfile=p.name AND m.maintainer LIKE '%" . mysql_real_escape_string($substr) . "%'";
    104106        }
    105107        $query = "SELECT DISTINCT $fields FROM $tables WHERE $query ORDER BY name";
Note: See TracChangeset for help on using the changeset viewer.