portdb: update email address, cleaned up unused cruft

This commit is contained in:
Simone Rota 2006-12-01 13:14:13 +01:00
parent 463c355cfc
commit d97e38d294

View File

@ -4,11 +4,9 @@ require('DB.php');
# Written by Simone Rota <sip@crux.nu>
$dsn = 'sqlite:////home/crux/public_html/local/portdb.db';
$admin = 'viper@hometux.de';
function sanitize($str) {
return $str;
//return ereg_replace("[^[:alnum:]]","",$str);
}
function nospam($mail) {
@ -45,7 +43,6 @@ function printFooter() {
}
function printNav() {
# echo '<div class="content"><b>Sections: </b><a href="?a=index">Repositories</a> :: <a href="?a=search">Search</a> :: <a href="?a=register">Register</a> :: <a href="?a=dups">Duplicates</a> :: <a href="?a=dupm">DupMeister</a>';
echo '<div class="content"><b>Sections: </b><a href="?a=index">Repositories</a> :: <a href="?a=search">Search</a> :: <a href="?a=register">Register</a> :: <a href="?a=dups">Duplicates</a>';
}
@ -135,7 +132,7 @@ function showSearch($singlerepo) {
function showRegister() {
$query = sanitize($_GET['q']);
echo "<h2>Register your ports repository</h2>";
echo "<p>You can register your personal HttpUp repository sending an email with the following information to <i>viper at hometux dot de</i>:</p>";
echo "<p>You can register your personal HttpUp repository sending an email with the following information to <i>contrib-admin at crux dot nu</i>:</p>";
echo '<ul><li>Repository Name <small>(e.g. myports)</small></li>
<li>Root URL <small>(e.g. http://mypage.se/ports/)</small></li>
<li>Your name</li>
@ -143,20 +140,6 @@ function showRegister() {
echo "<p>A CRUX team member will put your repository into our database. Please give us some time to do this. Once it is active it is synced once a day. <b>Please do not submit .httpup files, only the URL for the repository. This means the URL to the repository itself, not portspage or other indexes.</b>";
}
#function showSendMail() {
# $name = $_POST['name'];
# $url = $_POST['url'];
# $mail = $_POST['mail'];
# $maint = $_POST['maint'];
# echo "<h2>Registration results</h2>";
# if (sendMail($name, $url, $mail, $maint)) {
# echo "<p>Your data was sent to the responsible CRUX member. Thanks for your contribution!</p>";
# } else {
# echo "<p>Your mail could not be sent. Please contact a CRUX Team member.</p>";
# }
#
#}
function showDuplicates() {
global $db;
$sql = "select portname, count(*) as dup from ports
@ -179,50 +162,6 @@ function showDuplicates() {
echo "</table>";
}
function showDupMeister() {
global $db;
$sql = "select p1.collection as coll, p1.portname, count(*) as dups from ports as p1
join ports as p2 on (p1.portname=p2.portname and p1.collection!=p2.collection)
where (p1.collection<>'contrib' and p1.collection<>'opt' and p1.collection<>'core')
group by coll
order by dups desc";
$res =& $db->Query($sql);
if (DB::isError($res)) die("Query error");
echo "<h2>Duplicates by repository</h2>\n";
echo '<table class="listing">';
echo '<thead><tr><th>Collection</th><th># of duplicates</th></tr></thead>';
$i=0;
while ($port =& $res->fetchRow()) {
$cl = "row".$i%2;
echo '<tr class="'.$cl.'">
<td><a href="?a=repo&q='.$port['coll'].'">'.$port['coll']."</a></td>\n"
.'<td>'.$port['dups']."</td>\n";
$i++;
}
echo "</table>";
}
function sendMail($name, $url, $mail, $maint) {
require_once('Mail.php');
global $admin;
if ($maint == "" || $name == "" || $url == "" || $mail == "")
return false;
$headers = array();
$headers["From"] = "CRUX Team <crux@crux.nu>";
$headers["Subject"] = "[crux-portdb] New httpup repository $name";
$msg = "New httpup repository:\n\n";
$msg .= "Repo Name : $name\n";
$msg .= "Root URL : $url\n";
$msg .= "Maintainer : $maint\n";
$msg .= "Email : $mail\n";
$msg .= "\nConfig line: \"$name|$maint <$mail>|httpup|$url\",\n\n";
$msg .= "REMOTE_ADDR: " . $_SERVER["REMOTE_ADDR"] . "\n";
$msg .= "USER_AGENT : " . $_SERVER["HTTP_USER_AGENT"] . "\n";
$params["host"] = "localhost";
$mail_obj = &Mail::factory("smtp", $params);
return $mail_obj->send($admin, $headers, $msg);
}
function getUp() {
global $db;
$query = sanitize($_GET['q']);
@ -274,15 +213,9 @@ switch ($action) {
case "register":
showRegister();
break;
# case "send":
# showSendMail();
# break;
case "dups":
showDuplicates();
break;
# case "dupm":
# showDupMeister();
# break;
default:
showCollections();
}