" . htmlspecialchars($port['name'])
. ' ' . htmlspecialchars($port['version']) . '';
} else {
print "Version: ". htmlspecialchars($port['version']) . "
";
}
print '';
/* Port short description */
print htmlspecialchars($port['description']) . '
';
/* Maintainers */
printRepeatingPortInfo('maintainer', 'maintainers', $port['name'], null, 'obfuscate_email', true);
/* Categories */
printRepeatingPortInfo('category', 'categories', $port['name'], null, null, true);
/* Platforms */
printRepeatingPortInfo('platform', 'platforms', $port['name']);
/* Dependencies */
printRepeatingPortInfo('library', 'dependencies', $port['name'], 'cleanLibraryName');
/* Variants */
printRepeatingPortInfo('variant', 'variants', $port['name']);
print '
';
}
function printRepeatingPortInfo($select, $from, $port, $parser = null, $formatter = null, $highlightFirstItem = false) {
global $portsdb_name;
$port = mysql_real_escape_string($port);
$result = mysql_query("SELECT $select FROM $portsdb_name.$from WHERE portfile='$port' ORDER BY $select");
if ($result && mysql_num_rows($result) > 0) {
print '
' . ucfirst($from) . ':';
while ($row = mysql_fetch_row($result)) {
print " ";
if ($parser) {
$out = call_user_func($parser, $row[0]);
} else {
$out = $row[0];
}
if ($formatter) {
$outText = call_user_func($formatter, $out);
} else {
$outText = $out;
}
if ($highlightFirstItem) {
$outText = "$outText";
$highlightFirstItem = false;
}
print "$outText";
}
}
}
function cleanLibraryName($name) {
return eregi_replace('^([^:]*:[^:]*:|[^:]*:)', '', $name);
}
function queryForPort($name) {
global $portsdb_name;
$result = mysql_query("SELECT DISTINCT name, path, version, description FROM $portsdb_name.portfiles AS p WHERE p.name = \"" . mysql_real_escape_string($name) . "\" ORDER BY name");
if ($result) {
list($name, $path, $version, $description) = mysql_fetch_row($result);
return array("name" => $name, "path" => $path, "version" => $version, "description" => $description);
}
}
function portTickets($feed, $max) {
$tickets = parseRSS($feed, $max);
$output = "";
foreach ($tickets as $ticket) {
$output .= "- ${ticket['title']}
";
}
$output .= "
";
return $output;
}
function portRevisions($feed, $max) {
$changesets = parseRSS($feed, $max);
$output = "";
foreach ($changesets as $changeset) {
$output .= "- ${changeset['title']} on ${changeset['pubDate']}
";
$output .= "${changeset['description']}
";
}
$output .= "
";
return $output;
}
?>