FALSE,
'num_ports' => 'a lot of',
'num_categories' => 'many'
);
break;
case "ports.php":
print '
MacPorts Portfiles
Our database is currently unavailable. We hope to have it back soon!
';
default:
print_footer();
die();
break;
}
} else {
$portsdb_info = array(
'connection_handler' => $portsdb_connection,
'num_ports' => ports_count(),
'num_categories' => categories_count()
);
}
return $portsdb_info;
}
######################################################################
# Total count of currently available ports:
function ports_count() {
global $portsdb_name;
$result = mysql_query("SELECT COUNT(DISTINCT name) FROM $portsdb_name.portfiles") or die("Error: " . mysql_error());
if ($result) {
$row = mysql_fetch_array($result);
$count = $row[0];
} else {
$count = 0;
}
return $count;
}
######################################################################
# Total count of port categories:
function categories_count() {
global $portsdb_name;
$result = mysql_query("SELECT COUNT(DISTINCT category) FROM $portsdb_name.categories") or die ("Error: " . mysql_error());
if ($result) {
$row = mysql_fetch_array($result);
$count = $row[0];
} else {
$count = 0;
}
return $count;
}
######################################################################
# Obfuscate e-mail addresses:
# Input: e-mail address in plain text
# Output: obfuscated e-mail address in HTML
function obfuscate_email($email) {
$IMGDIR = '/img';
return '