";
print "ArchLinux User-community Repository ";
# XXX CSS help - a:link, a:visited, etc are defined, but I don't want to
# use the defaults. Is this the way to override them?
#
print "English ";
print "Polski ";
print "Italiano ";
print "Català ";
print "Português ";
print "Español ";
print "Deutsch ";
print "Français";
print "Русский";
print "
\n";
print "
\n";
print "
\n";
print "
\n";
print "
\n";
# Menu items
#
print "
\n";
print "
";
print " .:";
print " ".__("Home")." ";
print " - ";
print " ".__("Accounts")." ";
print " - ";
print " ".__("Packages")." ";
if ($_COOKIE["AURSID"]) {
# Only display these items if the visitor is logged in. This should
# be a safe check because check_sid() has been called prior to
# html_header().
#
print " - ";
print " ".__("Submit")." ";
}
print " - ";
print " ".__("Bugs")." ";
print " - ";
print " ".__("Discussion")." ";
if ($_COOKIE["AURSID"]) {
# This is a usability change, so we can go to My Packages page
# with just one click
# Added by: dsa
print " - ";
print " ".__("My Packages")." ";
print " - ";
print " ".__("Logout")." ";
}
print " :.";
print "
\n";
print "\n";
}
print " \n";
print "\n";
return;
}
# debug logging
#
function dbug($msg) {
$fp = fopen(AURD_LOG, "a");
fwrite($fp, $msg . "\n");
fclose($fp);
return;
}
# check to see if the user can overwrite an existing package
#
function can_overwrite_pkg($name="", $sid="") {
if (!$name || !$sid) {return 0;}
$dbh = db_connect();
$q = "SELECT SubmitterUID, MaintainerUID, AURMaintainerUID ";
$q.= "FROM Packages WHERE Name = '".mysql_real_escape_string($name)."'";
$result = db_query($q, $dbh);
if (!$result) {return 0;}
$row = mysql_fetch_row($result);
$my_uid = uid_from_sid($sid);
# user is a dev and maintains the package
#
if ($my_uid == $row[2]) {return 1;}
# user is a TU and there is no dev
#
if (!$row[2] && $my_uid == $row[1]) {return 1;}
# user is a user and there is no TU or dev
#
if (!$row[2] && !$row[1] && $my_uid == $row[0]) {return 1;}
return 0;
}
# convert an ini_get number to a real integer - stupid PHP!
#
function initeger($inival="0", $isbytes=1) {
$last_char = strtolower(substr($inival, -1));
if ($isbytes) {
switch ($last_char) {
case 't': $multiplier = 1024 * 1024 * 1024; break;
case 'm': $multiplier = 1024 * 1024; break;
case 'k': $multiplier = 1024; break;
default: $multiplier = 1; break;
}
} else {
switch ($last_char) {
case 't': $multiplier = 1000 * 1000 * 1000; break;
case 'm': $multiplier = 1000 * 1000; break;
case 'k': $multiplier = 1000; break;
default: $multiplier = 1; break;
}
}
return intval($inival) * $multiplier;
}
# recursive delete directory
#
function rm_rf($dirname="") {
$d = dir($dirname);
while ($f = $d->read()) {
if ($f != "." && $f != "..") {
if (is_dir($dirname."/".$f)) {
rm_rf($dirname."/".$f);
}
if (is_file($dirname."/".$f) || is_link($dirname."/".$f)) {
unlink($dirname."/".$f);
}
}
}
$d->close();
rmdir($dirname);
return;
}
# obtain the uid given a Users.Username
#
function uid_from_username($username="")
{
if (!$username) {
return "";
}
$dbh = db_connect();
$q = "SELECT ID FROM Users WHERE Username = '".mysql_real_escape_string($username)
."'";
$result = db_query($q, $dbh);
if (!$result) {
return "None";
}
$row = mysql_fetch_row($result);
return $row[0];
}
# vim: ts=2 sw=2 noet ft=php
?>