Exemple #1
0
#
# Copyright (c) 1998-2006 DVL Software Limited
#
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/common.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/freshports.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/databaselogin.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php';
#
# If they supply a package name, go for it.
#
if (isset($_REQUEST['package'])) {
    $package = pg_escape_string($_REQUEST['package']);
    if ($package != '') {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/packages.php';
        $Packages = new Packages($db);
        $CategoryPort = $Packages->GetCategoryPortFromPackageName($package);
        switch ($CategoryPort) {
            case "0":
                # no such port found
                header('Location: /package.php?package=' . $package . '&notfound');
                exit;
            case "-1":
                # multiple ports have that package name
                # search for them all and let the users decide which one they want
                require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php';
                $Searches = new Searches($dbh);
                $Redirect = $Searches->GetLink($package, FRESHPORTS_SEARCH_METHOD_Exact, 1);
                header('Location: ' . $Redirect);
                exit;
            default:
                # one port found with that name, show that page.