$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
include_once("$DOCUMENT_ROOT/it/includes/common.inc");
include_once("$DOCUMENT_ROOT/includes/db.inc");
include_once("$DOCUMENT_ROOT/includes/email.inc");
print_header('Ports Disponibili', 'utf-8');
$by = isset($_GET['by']) ? $_GET['by'] : '';
$substr = isset($_GET['substr']) ? $_GET['substr'] : '';
?>
Portfiles di DarwinPorts
Questo form permette di cercare il software nel corrente indice dei
ports di DarwinPorts.
Indice aggiornato al:
$sql = "SELECT UNIX_TIMESTAMP(activity_time) FROM darwinports.log ORDER BY UNIX_TIMESTAMP(activity_time) DESC";
$result = mysql_query($sql);
if($result && $row = mysql_fetch_row($result)) {
echo date("d-M-Y H:i:s", $row[0]);
}
?>
if ($by && ($substr || $by == "all")) {
$fields = "name, path, version, description";
$query = "1";
$tables = "darwinports.portfiles p";
if ($by == "name") {
$query = $query . " AND p.name LIKE '%" . addslashes($substr) . "%'";
}
if ($by == "library") {
$query = $query . " AND p.name='" . addslashes($substr) . "'";
}
if ($by == "desc") {
$query = $query . " AND p.description LIKE '%" . addslashes($substr) . "%'";
}
if ($by == "cat") {
$tables = $tables . ", darwinports.categories c";
$query = $query . " AND c.portfile=p.name AND c.category='" . addslashes($substr) . "'";
}
if ($by == "variant") {
$tables = $tables . ", darwinports.variants v";
$query = $query . " AND v.portfile=p.name AND v.variant='" . addslashes($substr) . "'";
}
if ($by == "platform") {
$tables = $tables . ", darwinports.platforms pl";
$query = $query . " AND pl.portfile=p.name AND pl.platform ='" . addslashes($substr) . "'";
}
if ($by == "maintainer") {
$tables = $tables . ", darwinports.maintainers m";
$query = $query . " AND m.portfile=p.name AND m.maintainer LIKE '%" . addslashes($substr) . "%'";
}
$query = "SELECT DISTINCT $fields FROM $tables WHERE $query ORDER BY name";
$result = mysql_query($query);
if($result) {
?>
= mysql_num_rows($result); ?> Portfile if (mysql_num_rows($result) != 1) { echo "s"; } ?>
while( $row = mysql_fetch_assoc($result) ) {
?>
- = $row['name']; ?> = $row['version']; ?>
-
= $row['description']; ?>
// MAINTAINERS
$nquery = "SELECT maintainer FROM darwinports.maintainers WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, maintainer";
$nresult = mysql_query($nquery);
if ($nresult) {
?>
Maintainer:
$primary = 1;
while ( $nrow = mysql_fetch_array($nresult) ) {
if ($primary) { echo ""; }
$addr = obfuscate_email($nrow[0]);
print $addr;
if ($primary) { echo ""; }
$primary = 0;
}
}
// CATEGORIES
$nquery = "SELECT category FROM darwinports.categories WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, category";
$nresult = mysql_query($nquery);
if ($nresult) {
?>
Categorie:
$primary = 1;
while ( $nrow = mysql_fetch_assoc($nresult) ) {
if ($primary) { echo ""; }
?>
= $nrow['category']; ?>
if ($primary) { echo ""; }
$primary = 0;
}
}
// PLATFORMS
$nquery = "SELECT platform FROM darwinports.platforms WHERE portfile='" . $row['name'] . "' ORDER BY platform";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
Sistemi:
while ( $nrow = mysql_fetch_array($nresult) ) {
$platform = $nrow[0];
?>
= $platform; ?>
}
}
// DEPENDENCIES
$nquery = "SELECT library FROM darwinports.dependencies WHERE portfile='" . $row['name'] . "' ORDER BY library";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
Dipendenze:
while ( $nrow = mysql_fetch_array($nresult) ) {
// lib:libpng.3:libpng -> libpng
$library = preg_replace("/^(?:[^:]*:){1,2}/", "", $nrow[0]);
?>
= $library; ?>
}
}
/*
// VARIANTS
$nquery = "SELECT variant FROM darwinports.variants WHERE portfile='" . $row['name'] . "' ORDER BY variant";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
Variants:
while ( $nrow = mysql_fetch_array($nresult) ) {
$variant = $nrow[0];
?>
= $variant; ?>
}
}
*/
?>
}
} else {
echo "C'e' stato un errore. (501)";
}
}
?>