\n"; echo "\n"; echo "\n"; echo "\n"; echo "AUR (".$LANG.")\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo <<
Arch Linux
\n"; echo '
'."\n"; echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; echo "\n\n"; return; } # common footer # function html_footer($ver="") { print "\n\n\n"; print "
\n"; if ($ver) { print "

\n"; print "\n"; print "\n"; print "
".$ver."
\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 ?>