db = new PDO($dbhandle);
}
catch (Exception $exception) {
die($exception->getMessage());
}
}
private function lazy_programmer() {
die("LAZY PROGRAMMER ERROR");
}
protected function getQuery($query) {
try {
$res = $this->db->query($query);
}
catch (Exception $exception) {
die($exception->getMessage());
}
$this->last_result = $res->fetchAll();
return $this->last_result;
}
public function doQuery() {
$this->lazy_programmer();
}
protected function htmlHeader() {
return file_get_contents("header.html");
}
protected function htmlFooter() {
return file_get_contents("footer.html");
}
protected function toHTML() {
die($this->lazy_programmer());
}
public function toXML() {
header("Content-type: text/xml");
echo '';
}
}
class RepoList extends PortDb {
public function doQuery() {
$sql = 'select collname,maintainer,colltype,url,count(*) as tot from collections
join ports on collection=collname
group by collname order by collections.collid';
return $this->getQuery($sql);
}
public function toXML($res) {
PortDb::toXML($res);
$xml = "\n
| Repo Name | # ports | Type | Maintainer | Repo URL |
|---|---|---|---|---|
| $name | $count | $type | $maintainer | $url |