Prefix package functions with pkg_/pkgbase_

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-04-05 15:41:29 +02:00
parent d16f7cf712
commit 676595f9bf
12 changed files with 91 additions and 91 deletions

View file

@ -34,7 +34,7 @@ foreach ($buckets as $bucket) {
continue; continue;
} }
$fullpath = INCOMING_DIR . $bucket . "/" . $pkgname; $fullpath = INCOMING_DIR . $bucket . "/" . $pkgname;
if (!pkgid_from_name($pkgname) && is_dir($fullpath)) { if (!pkg_from_name($pkgname) && is_dir($fullpath)) {
echo 'Removing ' . $fullpath . "\n"; echo 'Removing ' . $fullpath . "\n";
rm_tree($fullpath); rm_tree($fullpath);
$count++; $count++;

View file

@ -13,7 +13,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
* the routing framework to the individual pages instead of * the routing framework to the individual pages instead of
* initializing arbitrary variables here. */ * initializing arbitrary variables here. */
$pkgname = $tokens[2]; $pkgname = $tokens[2];
$pkgid = pkgid_from_name($pkgname); $pkgid = pkg_from_name($pkgname);
if (!$pkgid) { if (!$pkgid) {
header("HTTP/1.0 404 Not Found"); header("HTTP/1.0 404 Not Found");

View file

@ -11,9 +11,9 @@ check_sid(); # see if they're still logged in
if (!isset($pkgid) || !isset($pkgname)) { if (!isset($pkgid) || !isset($pkgname)) {
if (isset($_GET['ID'])) { if (isset($_GET['ID'])) {
$pkgid = intval($_GET['ID']); $pkgid = intval($_GET['ID']);
$pkgname = pkgname_from_id($_GET['ID']); $pkgname = pkg_name_from_id($_GET['ID']);
} else if (isset($_GET['N'])) { } else if (isset($_GET['N'])) {
$pkgid = pkgid_from_name($_GET['N']); $pkgid = pkg_from_name($_GET['N']);
$pkgname = $_GET['N']; $pkgname = $_GET['N'];
} else { } else {
unset($pkgid, $pkgname); unset($pkgid, $pkgname);
@ -44,7 +44,7 @@ if (isset($_COOKIE["AURSID"])) {
$details = array(); $details = array();
if (isset($pkgname)) { if (isset($pkgname)) {
$details = get_package_details($pkgid); $details = pkg_get_details($pkgid);
} }
html_header($title, $details); html_header($title, $details);
@ -55,10 +55,10 @@ if (isset($pkgid)) {
include('pkg_search_form.php'); include('pkg_search_form.php');
if ($pkgid) { if ($pkgid) {
if (isset($_COOKIE["AURSID"])) { if (isset($_COOKIE["AURSID"])) {
display_package_details($pkgid, $details, $_COOKIE["AURSID"]); pkg_display_details($pkgid, $details, $_COOKIE["AURSID"]);
} }
else { else {
display_package_details($pkgid, $details, null); pkg_display_details($pkgid, $details, null);
} }
} else { } else {
print __("Error trying to retrieve package details.")."<br />\n"; print __("Error trying to retrieve package details.")."<br />\n";

View file

@ -55,27 +55,27 @@ $ret = false;
$output = ""; $output = "";
if (check_token()) { if (check_token()) {
if (current_action("do_Flag")) { if (current_action("do_Flag")) {
list($ret, $output) = pkg_flag($atype, $ids); list($ret, $output) = pkgbase_flag($atype, $ids);
} elseif (current_action("do_UnFlag")) { } elseif (current_action("do_UnFlag")) {
list($ret, $output) = pkg_unflag($atype, $ids); list($ret, $output) = pkgbase_unflag($atype, $ids);
} elseif (current_action("do_Adopt")) { } elseif (current_action("do_Adopt")) {
list($ret, $output) = pkg_adopt($atype, $ids, true); list($ret, $output) = pkgbase_adopt($atype, $ids, true);
} elseif (current_action("do_Disown")) { } elseif (current_action("do_Disown")) {
list($ret, $output) = pkg_adopt($atype, $ids, false); list($ret, $output) = pkgbase_adopt($atype, $ids, false);
} elseif (current_action("do_Vote")) { } elseif (current_action("do_Vote")) {
list($ret, $output) = pkg_vote($atype, $ids, true); list($ret, $output) = pkgbase_vote($atype, $ids, true);
} elseif (current_action("do_UnVote")) { } elseif (current_action("do_UnVote")) {
list($ret, $output) = pkg_vote($atype, $ids, false); list($ret, $output) = pkgbase_vote($atype, $ids, false);
} elseif (current_action("do_Delete")) { } elseif (current_action("do_Delete")) {
if (isset($_POST['confirm_Delete'])) { if (isset($_POST['confirm_Delete'])) {
if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) { if (!isset($_POST['merge_Into']) || empty($_POST['merge_Into'])) {
list($ret, $output) = pkg_delete($atype, $ids, NULL); list($ret, $output) = pkgbase_delete($atype, $ids, NULL);
unset($_GET['ID']); unset($_GET['ID']);
} }
else { else {
$merge_base_id = pkgbase_from_name($_POST['merge_Into']); $merge_base_id = pkgbase_from_name($_POST['merge_Into']);
if ($merge_base_id) { if ($merge_base_id) {
list($ret, $output) = pkg_delete($atype, $ids, $merge_base_id); list($ret, $output) = pkgbase_delete($atype, $ids, $merge_base_id);
unset($_GET['ID']); unset($_GET['ID']);
} }
else { else {
@ -87,18 +87,18 @@ if (check_token()) {
$output = __("The selected packages have not been deleted, check the confirmation checkbox."); $output = __("The selected packages have not been deleted, check the confirmation checkbox.");
} }
} elseif (current_action("do_Notify")) { } elseif (current_action("do_Notify")) {
list($ret, $output) = pkg_notify($atype, $ids); list($ret, $output) = pkgbase_notify($atype, $ids);
} elseif (current_action("do_UnNotify")) { } elseif (current_action("do_UnNotify")) {
list($ret, $output) = pkg_notify($atype, $ids, false); list($ret, $output) = pkgbase_notify($atype, $ids, false);
} elseif (current_action("do_DeleteComment")) { } elseif (current_action("do_DeleteComment")) {
list($ret, $output) = pkg_delete_comment($atype); list($ret, $output) = pkgbase_delete_comment($atype);
} elseif (current_action("do_ChangeCategory")) { } elseif (current_action("do_ChangeCategory")) {
list($ret, $output) = pkg_change_category($base_id, $atype); list($ret, $output) = pkgbase_change_category($base_id, $atype);
} }
if (isset($_REQUEST['comment'])) { if (isset($_REQUEST['comment'])) {
$uid = uid_from_sid($_COOKIE["AURSID"]); $uid = uid_from_sid($_COOKIE["AURSID"]);
add_package_comment($base_id, $uid, $_REQUEST['comment']); pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
$ret = true; $ret = true;
} }
@ -115,7 +115,7 @@ if (check_token()) {
} }
} }
$details = get_pkgbase_details($base_id); $details = pkgbase_get_details($base_id);
html_header($title, $details); html_header($title, $details);
?> ?>
@ -126,9 +126,9 @@ html_header($title, $details);
<?php <?php
include('pkg_search_form.php'); include('pkg_search_form.php');
if (isset($_COOKIE["AURSID"])) { if (isset($_COOKIE["AURSID"])) {
display_pkgbase_details($base_id, $details, $_COOKIE["AURSID"]); pkgbase_display_details($base_id, $details, $_COOKIE["AURSID"]);
} else { } else {
display_pkgbase_details($base_id, $details, null); pkgbase_display_details($base_id, $details, null);
} }
html_footer(AUR_VERSION); html_footer(AUR_VERSION);

View file

@ -259,7 +259,7 @@ if ($uid):
} }
/* Check if package name is blacklisted. */ /* Check if package name is blacklisted. */
if (!$base_id && pkgname_is_blacklisted($pi['pkgname']) && !can_submit_blacklisted(account_from_sid($_COOKIE["AURSID"]))) { if (!$base_id && pkg_name_is_blacklisted($pi['pkgname']) && !can_submit_blacklisted(account_from_sid($_COOKIE["AURSID"]))) {
$error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pi['pkgname']); $error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pi['pkgname']);
break; break;
} }
@ -329,30 +329,30 @@ if ($uid):
*/ */
$was_orphan = (pkgbase_maintainer_uid($base_id) === NULL); $was_orphan = (pkgbase_maintainer_uid($base_id) === NULL);
update_pkgbase($base_id, $pkgbase_info['pkgbase'], $uid); pkgbase_update($base_id, $pkgbase_info['pkgbase'], $uid);
if ($category_id > 1) { if ($category_id > 1) {
update_pkgbase_category($base_id, $category_id); pkgbase_update_category($base_id, $category_id);
} }
pkgbase_delete_packages($base_id); pkgbase_delete_packages($base_id);
} else { } else {
/* This is a brand new package. */ /* This is a brand new package. */
$was_orphan = true; $was_orphan = true;
$base_id = create_pkgbase($pkgbase_name, $category_id, $uid); $base_id = pkgbase_create($pkgbase_name, $category_id, $uid);
} }
foreach ($pkginfo as $pi) { foreach ($pkginfo as $pi) {
$pkgid = create_pkg($base_id, $pi['pkgname'], $pi['license'], $pi['full-version'], $pi['pkgdesc'], $pi['url']); $pkgid = pkg_create($base_id, $pi['pkgname'], $pi['license'], $pi['full-version'], $pi['pkgdesc'], $pi['url']);
foreach ($pi['depends'] as $dep) { foreach ($pi['depends'] as $dep) {
$deppkgname = preg_replace("/(<|=|>).*/", "", $dep); $deppkgname = preg_replace("/(<|=|>).*/", "", $dep);
$depcondition = str_replace($deppkgname, "", $dep); $depcondition = str_replace($deppkgname, "", $dep);
add_pkg_dep($pkgid, $deppkgname, $depcondition); pkg_add_dep($pkgid, $deppkgname, $depcondition);
} }
foreach ($pi['source'] as $src) { foreach ($pi['source'] as $src) {
add_pkg_src($pkgid, $src); pkg_add_src($pkgid, $src);
} }
} }
@ -362,7 +362,7 @@ if ($uid):
* notification list. * notification list.
*/ */
if ($was_orphan) { if ($was_orphan) {
pkg_notify(account_from_sid($_COOKIE["AURSID"]), array($base_id), true); pkgbase_notify(account_from_sid($_COOKIE["AURSID"]), array($base_id), true);
} }
end_atomic_commit(); end_atomic_commit();
@ -387,7 +387,7 @@ html_header("Submit");
# give the visitor the default upload form # give the visitor the default upload form
if (ini_get("file_uploads")): if (ini_get("file_uploads")):
$pkg_categories = pkg_categories(); $pkgbase_categories = pkgbase_categories();
?> ?>
<?php if ($error): ?> <?php if ($error): ?>
@ -406,7 +406,7 @@ html_header("Submit");
<select id="id_category" name="category"> <select id="id_category" name="category">
<option value="1"><?= __("Select Category"); ?></option> <option value="1"><?= __("Select Category"); ?></option>
<?php <?php
foreach ($pkg_categories as $num => $cat): foreach ($pkgbase_categories as $num => $cat):
print '<option value="' . $num . '"'; print '<option value="' . $num . '"';
if (isset($_POST['category']) && $_POST['category'] == $cat): if (isset($_POST['category']) && $_POST['category'] == $cat):
print ' selected="selected"'; print ' selected="selected"';

View file

@ -5,7 +5,7 @@ include_once('pkgfuncs.inc.php');
$SID = $_COOKIE['AURSID']; $SID = $_COOKIE['AURSID'];
$pkgname = htmlspecialchars($_GET['N']); $pkgname = htmlspecialchars($_GET['N']);
$votes = votes_for_pkgname($pkgname); $votes = pkgbase_votes_from_name($pkgname);
$atype = account_from_sid($SID); $atype = account_from_sid($SID);
html_header(__("Voters")); html_header(__("Voters"));

View file

@ -90,7 +90,7 @@ function can_submit_blacklisted($atype = "") {
* *
* @return array All package categories * @return array All package categories
*/ */
function pkg_categories() { function pkgbase_categories() {
$cats = array(); $cats = array();
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT * FROM PackageCategories WHERE ID != 1 "; $q = "SELECT * FROM PackageCategories WHERE ID != 1 ";
@ -111,7 +111,7 @@ function pkg_categories() {
* *
* @return string|void Package name if it already exists * @return string|void Package name if it already exists
*/ */
function pkgid_from_name($name="") { function pkg_from_name($name="") {
if (!$name) {return NULL;} if (!$name) {return NULL;}
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT ID FROM Packages "; $q = "SELECT ID FROM Packages ";
@ -131,7 +131,7 @@ function pkgid_from_name($name="") {
* *
* @return array All package dependencies for the package * @return array All package dependencies for the package
*/ */
function package_dependencies($pkgid) { function pkg_dependencies($pkgid) {
$deps = array(); $deps = array();
$pkgid = intval($pkgid); $pkgid = intval($pkgid);
if ($pkgid > 0) { if ($pkgid > 0) {
@ -158,7 +158,7 @@ function package_dependencies($pkgid) {
* *
* @return array All packages that depend on the specified package name * @return array All packages that depend on the specified package name
*/ */
function package_required($name="") { function pkg_required($name="") {
$deps = array(); $deps = array();
if ($name != "") { if ($name != "") {
$dbh = DB::connect(); $dbh = DB::connect();
@ -182,7 +182,7 @@ function package_required($name="") {
* *
* @return string The number of comments left for a specific package * @return string The number of comments left for a specific package
*/ */
function package_comments_count($base_id) { function pkgbase_comments_count($base_id) {
$dbh = DB::connect(); $dbh = DB::connect();
$base_id = intval($base_id); $base_id = intval($base_id);
@ -209,7 +209,7 @@ function package_comments_count($base_id) {
* *
* @return array All package comment information for a specific package base * @return array All package comment information for a specific package base
*/ */
function package_comments($base_id) { function pkgbase_comments($base_id) {
$base_id = intval($base_id); $base_id = intval($base_id);
$comments = array(); $comments = array();
if ($base_id > 0) { if ($base_id > 0) {
@ -248,7 +248,7 @@ function package_comments($base_id) {
* *
* @return void * @return void
*/ */
function add_package_comment($base_id, $uid, $comment) { function pkgbase_add_comment($base_id, $uid, $comment) {
global $AUR_LOCATION; global $AUR_LOCATION;
$dbh = DB::connect(); $dbh = DB::connect();
@ -311,7 +311,7 @@ function add_package_comment($base_id, $uid, $comment) {
* *
* @return array All sources associated with a specific package * @return array All sources associated with a specific package
*/ */
function package_sources($pkgid) { function pkg_sources($pkgid) {
$sources = array(); $sources = array();
$pkgid = intval($pkgid); $pkgid = intval($pkgid);
if ($pkgid > 0) { if ($pkgid > 0) {
@ -337,7 +337,7 @@ function package_sources($pkgid) {
* *
* @return array All packages the visitor has voted for * @return array All packages the visitor has voted for
*/ */
function pkgvotes_from_sid($sid="") { function pkgbase_votes_from_sid($sid="") {
$pkgs = array(); $pkgs = array();
if (!$sid) {return $pkgs;} if (!$sid) {return $pkgs;}
$dbh = DB::connect(); $dbh = DB::connect();
@ -362,7 +362,7 @@ function pkgvotes_from_sid($sid="") {
* *
* @return array|string All names if multiple package IDs, otherwise package name * @return array|string All names if multiple package IDs, otherwise package name
*/ */
function pkgname_from_id($pkgids) { function pkg_name_from_id($pkgids) {
if (is_array($pkgids)) { if (is_array($pkgids)) {
$pkgids = sanitize_ids($pkgids); $pkgids = sanitize_ids($pkgids);
$names = array(); $names = array();
@ -398,7 +398,7 @@ function pkgname_from_id($pkgids) {
* *
* @return bool True if the name is blacklisted, otherwise false * @return bool True if the name is blacklisted, otherwise false
*/ */
function pkgname_is_blacklisted($name) { function pkg_name_is_blacklisted($name) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT COUNT(*) FROM PackageBlacklist "; $q = "SELECT COUNT(*) FROM PackageBlacklist ";
$q.= "WHERE Name = " . $dbh->quote($name); $q.= "WHERE Name = " . $dbh->quote($name);
@ -415,7 +415,7 @@ function pkgname_is_blacklisted($name) {
* *
* @return array The package's details OR error message * @return array The package's details OR error message
**/ **/
function get_package_details($id=0) { function pkg_get_details($id=0) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT Packages.*, PackageBases.Name AS BaseName, "; $q = "SELECT Packages.*, PackageBases.Name AS BaseName, ";
@ -451,7 +451,7 @@ function get_package_details($id=0) {
* *
* @return array The package base's details OR error message * @return array The package base's details OR error message
**/ **/
function get_pkgbase_details($base_id) { function pkgbase_get_details($base_id) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT PackageBases.ID, PackageBases.Name, "; $q = "SELECT PackageBases.ID, PackageBases.Name, ";
@ -485,12 +485,12 @@ function get_pkgbase_details($base_id) {
* @global string $AUR_LOCATION The AUR's URL used for notification e-mails * @global string $AUR_LOCATION The AUR's URL used for notification e-mails
* @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false * @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
* @param string $id The package ID to get details page for * @param string $id The package ID to get details page for
* @param array $row Package details retrieved by get_package_details * @param array $row Package details retrieved by pkg_get_details()
* @param string $SID The session ID of the visitor * @param string $SID The session ID of the visitor
* *
* @return void * @return void
*/ */
function display_package_details($id=0, $row, $SID="") { function pkg_display_details($id=0, $row, $SID="") {
global $AUR_LOCATION; global $AUR_LOCATION;
global $USE_VIRTUAL_URLS; global $USE_VIRTUAL_URLS;
@ -510,7 +510,7 @@ function display_package_details($id=0, $row, $SID="") {
include('pkg_comment_form.php'); include('pkg_comment_form.php');
} }
$comments = package_comments($base_id); $comments = pkgbase_comments($base_id);
if (!empty($comments)) { if (!empty($comments)) {
include('pkg_comments.php'); include('pkg_comments.php');
} }
@ -523,12 +523,12 @@ function display_package_details($id=0, $row, $SID="") {
* @global string $AUR_LOCATION The AUR's URL used for notification e-mails * @global string $AUR_LOCATION The AUR's URL used for notification e-mails
* @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false * @global bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
* @param string $id The package base ID to get details page for * @param string $id The package base ID to get details page for
* @param array $row Package base details retrieved by get_pkgbase_details * @param array $row Package base details retrieved by pkgbase_get_details()
* @param string $SID The session ID of the visitor * @param string $SID The session ID of the visitor
* *
* @return void * @return void
*/ */
function display_pkgbase_details($base_id, $row, $SID="") { function pkgbase_display_details($base_id, $row, $SID="") {
global $AUR_LOCATION; global $AUR_LOCATION;
global $USE_VIRTUAL_URLS; global $USE_VIRTUAL_URLS;
@ -547,7 +547,7 @@ function display_pkgbase_details($base_id, $row, $SID="") {
include('pkg_comment_form.php'); include('pkg_comment_form.php');
} }
$comments = package_comments($base_id); $comments = pkgbase_comments($base_id);
if (!empty($comments)) { if (!empty($comments)) {
include('pkg_comments.php'); include('pkg_comments.php');
} }
@ -608,7 +608,7 @@ function pkg_search_page($SID="") {
*/ */
if ($SID) if ($SID)
$myuid = uid_from_sid($SID); $myuid = uid_from_sid($SID);
$cats = pkg_categories($dbh); $cats = pkgbase_categories($dbh);
/* Sanitize paging variables. */ /* Sanitize paging variables. */
if (isset($_GET['O'])) { if (isset($_GET['O'])) {
@ -950,7 +950,7 @@ function pkgbase_maintainer_uid($base_id) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_flag($atype, $base_ids) { function pkgbase_flag($atype, $base_ids) {
global $AUR_LOCATION; global $AUR_LOCATION;
if (!$atype) { if (!$atype) {
@ -1008,7 +1008,7 @@ function pkg_flag($atype, $base_ids) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_unflag($atype, $base_ids) { function pkgbase_unflag($atype, $base_ids) {
if (!$atype) { if (!$atype) {
return array(false, __("You must be logged in before you can unflag packages.")); return array(false, __("You must be logged in before you can unflag packages."));
} }
@ -1044,7 +1044,7 @@ function pkg_unflag($atype, $base_ids) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_delete ($atype, $base_ids, $merge_base_id) { function pkgbase_delete ($atype, $base_ids, $merge_base_id) {
if (!$atype) { if (!$atype) {
return array(false, __("You must be logged in before you can delete packages.")); return array(false, __("You must be logged in before you can delete packages."));
} }
@ -1152,7 +1152,7 @@ function pkg_delete ($atype, $base_ids, $merge_base_id) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_adopt ($atype, $base_ids, $action=true) { function pkgbase_adopt ($atype, $base_ids, $action=true) {
if (!$atype) { if (!$atype) {
if ($action) { if ($action) {
return array(false, __("You must be logged in before you can adopt packages.")); return array(false, __("You must be logged in before you can adopt packages."));
@ -1194,7 +1194,7 @@ function pkg_adopt ($atype, $base_ids, $action=true) {
$dbh->exec($q); $dbh->exec($q);
if ($action) { if ($action) {
pkg_notify(account_from_sid($_COOKIE["AURSID"]), $pkg_ids); pkgbase_notify(account_from_sid($_COOKIE["AURSID"]), $pkg_ids);
return array(true, __("The selected packages have been adopted.")); return array(true, __("The selected packages have been adopted."));
} else { } else {
return array(true, __("The selected packages have been disowned.")); return array(true, __("The selected packages have been disowned."));
@ -1210,7 +1210,7 @@ function pkg_adopt ($atype, $base_ids, $action=true) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_vote ($atype, $base_ids, $action=true) { function pkgbase_vote ($atype, $base_ids, $action=true) {
if (!$atype) { if (!$atype) {
if ($action) { if ($action) {
return array(false, __("You must be logged in before you can vote for packages.")); return array(false, __("You must be logged in before you can vote for packages."));
@ -1229,7 +1229,7 @@ function pkg_vote ($atype, $base_ids, $action=true) {
} }
$dbh = DB::connect(); $dbh = DB::connect();
$my_votes = pkgvotes_from_sid($_COOKIE["AURSID"]); $my_votes = pkgbase_votes_from_sid($_COOKIE["AURSID"]);
$uid = uid_from_sid($_COOKIE["AURSID"]); $uid = uid_from_sid($_COOKIE["AURSID"]);
$first = 1; $first = 1;
@ -1287,7 +1287,7 @@ function pkg_vote ($atype, $base_ids, $action=true) {
* *
* @return array User IDs and usernames that voted for a specific package * @return array User IDs and usernames that voted for a specific package
*/ */
function votes_for_pkgname($pkgname) { function pkgbase_votes_from_name($pkgname) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT UsersID,Username,Name FROM PackageVotes "; $q = "SELECT UsersID,Username,Name FROM PackageVotes ";
@ -1317,7 +1317,7 @@ function votes_for_pkgname($pkgname) {
* *
* @return bool True if the user has already voted, otherwise false * @return bool True if the user has already voted, otherwise false
*/ */
function user_voted($uid, $pkgid) { function pkgbase_user_voted($uid, $pkgid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT * FROM PackageVotes, Packages WHERE "; $q = "SELECT * FROM PackageVotes, Packages WHERE ";
@ -1342,7 +1342,7 @@ function user_voted($uid, $pkgid) {
* *
* @return bool True if the user wants notifications, otherwise false * @return bool True if the user wants notifications, otherwise false
*/ */
function user_notify($uid, $base_id) { function pkgbase_user_notify($uid, $base_id) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT * FROM CommentNotify WHERE UserID = " . $dbh->quote($uid); $q = "SELECT * FROM CommentNotify WHERE UserID = " . $dbh->quote($uid);
@ -1365,7 +1365,7 @@ function user_notify($uid, $base_id) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_notify ($atype, $base_ids, $action=true) { function pkgbase_notify ($atype, $base_ids, $action=true) {
if (!$atype) { if (!$atype) {
return; return;
} }
@ -1442,7 +1442,7 @@ function pkg_notify ($atype, $base_ids, $action=true) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_delete_comment($atype) { function pkgbase_delete_comment($atype) {
if (!$atype) { if (!$atype) {
return array(false, __("You must be logged in before you can edit package information.")); return array(false, __("You must be logged in before you can edit package information."));
} }
@ -1473,7 +1473,7 @@ function pkg_delete_comment($atype) {
* *
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkg_change_category($pid, $atype) { function pkgbase_change_category($pid, $atype) {
if (!$atype) { if (!$atype) {
return array(false, __("You must be logged in before you can edit package information.")); return array(false, __("You must be logged in before you can edit package information."));
} }
@ -1485,7 +1485,7 @@ function pkg_change_category($pid, $atype) {
} }
$dbh = DB::connect(); $dbh = DB::connect();
$catArray = pkg_categories($dbh); $catArray = pkgbase_categories($dbh);
if (!array_key_exists($category_id, $catArray)) { if (!array_key_exists($category_id, $catArray)) {
return array(false, __("Invalid category ID.")); return array(false, __("Invalid category ID."));
} }
@ -1522,7 +1522,7 @@ function pkg_change_category($pid, $atype) {
* *
* @return array All package details for a specific package * @return array All package details for a specific package
*/ */
function pkgdetails_by_pkgname($pkgname) { function pkg_details_by_name($pkgname) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "SELECT Packages.*, PackageBases.Name AS BaseName, "; $q = "SELECT Packages.*, PackageBases.Name AS BaseName, ";
$q.= "PackageBases.CategoryID, PackageBases.NumVotes, "; $q.= "PackageBases.CategoryID, PackageBases.NumVotes, ";
@ -1548,7 +1548,7 @@ function pkgdetails_by_pkgname($pkgname) {
* *
* @return int ID of the new package base * @return int ID of the new package base
*/ */
function create_pkgbase($name, $category_id, $uid) { function pkgbase_create($name, $category_id, $uid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("INSERT INTO PackageBases (Name, CategoryID, " . $q = sprintf("INSERT INTO PackageBases (Name, CategoryID, " .
"SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID) " . "SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID) " .
@ -1570,7 +1570,7 @@ function create_pkgbase($name, $category_id, $uid) {
* *
* @return int ID of the new package * @return int ID of the new package
*/ */
function create_pkg($base_id, $pkgname, $license, $pkgver, $pkgdesc, $pkgurl) { function pkg_create($base_id, $pkgname, $license, $pkgver, $pkgdesc, $pkgurl) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("INSERT INTO Packages (PackageBaseID, Name, License, " . $q = sprintf("INSERT INTO Packages (PackageBaseID, Name, License, " .
"Version, Description, URL) VALUES (%d, %s, %s, %s, %s, %s)", "Version, Description, URL) VALUES (%d, %s, %s, %s, %s, %s)",
@ -1590,7 +1590,7 @@ function create_pkg($base_id, $pkgname, $license, $pkgver, $pkgdesc, $pkgurl) {
* *
* @return void * @return void
*/ */
function update_pkgbase($base_id, $name, $uid) { function pkgbase_update($base_id, $name, $uid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("UPDATE PackageBases SET " . $q = sprintf("UPDATE PackageBases SET " .
"Name = %s, ModifiedTS = UNIX_TIMESTAMP(), " . "Name = %s, ModifiedTS = UNIX_TIMESTAMP(), " .
@ -1612,7 +1612,7 @@ function update_pkgbase($base_id, $name, $uid) {
* *
* @return void * @return void
*/ */
function update_pkg($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) { function pkg_update($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("UPDATE Packages SET Name = %s, Version = %s, " . $q = sprintf("UPDATE Packages SET Name = %s, Version = %s, " .
"License = %s, Description = %s, URL = %s WHERE ID = %d", "License = %s, Description = %s, URL = %s WHERE ID = %d",
@ -1634,7 +1634,7 @@ function update_pkg($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
* *
* @return void * @return void
*/ */
function add_pkg_dep($pkgid, $depname, $depcondition) { function pkg_add_dep($pkgid, $depname, $depcondition) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, %s, %s)", $q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, %s, %s)",
$pkgid, $pkgid,
@ -1652,7 +1652,7 @@ function add_pkg_dep($pkgid, $depname, $depcondition) {
* *
* @return void * @return void
*/ */
function add_pkg_src($pkgid, $pkgsrc) { function pkg_add_src($pkgid, $pkgsrc) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "INSERT INTO PackageSources (PackageID, Source) VALUES ("; $q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
$q .= $pkgid . ", " . $dbh->quote($pkgsrc) . ")"; $q .= $pkgid . ", " . $dbh->quote($pkgsrc) . ")";
@ -1668,7 +1668,7 @@ function add_pkg_src($pkgid, $pkgsrc) {
* *
* @return void * @return void
*/ */
function update_pkgbase_category($base_id, $category_id) { function pkgbase_update_category($base_id, $category_id) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = sprintf("UPDATE PackageBases SET CategoryID = %d WHERE ID = %d", $q = sprintf("UPDATE PackageBases SET CategoryID = %d WHERE ID = %d",
$category_id, $base_id); $category_id, $base_id);
@ -1682,7 +1682,7 @@ function update_pkgbase_category($base_id, $category_id) {
* *
* @return void * @return void
*/ */
function remove_pkg_deps($pkgid) { function pkg_remove_deps($pkgid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "DELETE FROM PackageDepends WHERE PackageID = " . $pkgid; $q = "DELETE FROM PackageDepends WHERE PackageID = " . $pkgid;
@ -1696,7 +1696,7 @@ function remove_pkg_deps($pkgid) {
* *
* @return void * @return void
*/ */
function remove_pkg_sources($pkgid) { function pkg_remove_sources($pkgid) {
$dbh = DB::connect(); $dbh = DB::connect();
$q = "DELETE FROM PackageSources WHERE PackageID = " . $pkgid; $q = "DELETE FROM PackageSources WHERE PackageID = " . $pkgid;

View file

@ -6,13 +6,13 @@
<input type="hidden" name="ID" value="<?= $row['ID'] ?>" /> <input type="hidden" name="ID" value="<?= $row['ID'] ?>" />
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<?php if (user_voted($uid, $row['ID'])): ?> <?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
<input type="submit" class="button" name="do_UnVote" value="<?= __("UnVote") ?>" /> <input type="submit" class="button" name="do_UnVote" value="<?= __("UnVote") ?>" />
<?php else: ?> <?php else: ?>
<input type="submit" class="button" name="do_Vote" value="<?= __("Vote") ?>" /> <input type="submit" class="button" name="do_Vote" value="<?= __("Vote") ?>" />
<?php endif; ?> <?php endif; ?>
<?php if (user_notify($uid, $row['ID'])): ?> <?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
<input type="submit" class="button" name="do_UnNotify" value="<?= __("UnNotify") ?>" title="<?= __("No New Comment Notification") ?>" /> <input type="submit" class="button" name="do_UnNotify" value="<?= __("UnNotify") ?>" title="<?= __("No New Comment Notification") ?>" />
<?php else: ?> <?php else: ?>
<input type="submit" class="button" name="do_Notify" value="<?= __("Notify") ?>" title="<?= __("New Comment Notification") ?>" /> <input type="submit" class="button" name="do_Notify" value="<?= __("Notify") ?>" title="<?= __("New Comment Notification") ?>" />

View file

@ -1,7 +1,7 @@
<?php <?php
$uid = uid_from_sid($SID); $uid = uid_from_sid($SID);
$base_id = pkgbase_from_pkgid($row['ID']); $base_id = pkgbase_from_pkgid($row['ID']);
$count = package_comments_count($base_id); $count = pkgbase_comments_count($base_id);
?> ?>
<div id="news"> <div id="news">
<h3> <h3>

View file

@ -4,7 +4,7 @@ $uid = uid_from_sid($SID);
$pkgid = intval($row['ID']); $pkgid = intval($row['ID']);
$catarr = pkg_categories(); $catarr = pkgbase_categories();
$submitter = username_from_id($row["SubmitterUID"]); $submitter = username_from_id($row["SubmitterUID"]);
$maintainer = username_from_id($row["MaintainerUID"]); $maintainer = username_from_id($row["MaintainerUID"]);
@ -22,11 +22,11 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($
$urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName']; $urlpath = URL_DIR . substr($row['BaseName'], 0, 2) . "/" . $row['BaseName'];
$deps = package_dependencies($row["ID"]); $deps = pkg_dependencies($row["ID"]);
$requiredby = package_required($row["Name"]); $requiredby = pkg_required($row["Name"]);
# $sources[0] = 'src'; # $sources[0] = 'src';
$sources = package_sources($row["ID"]); $sources = pkg_sources($row["ID"]);
?> ?>
<div id="pkgdetails" class="box"> <div id="pkgdetails" class="box">
<h2><?= __('Package Details') . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></h2> <h2><?= __('Package Details') . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></h2>
@ -54,7 +54,7 @@ $sources = package_sources($row["ID"]);
</form> </form>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php if (user_voted($uid, $row['ID'])): ?> <?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
<li> <li>
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post"> <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
@ -69,7 +69,7 @@ $sources = package_sources($row["ID"]);
</form> </form>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php if (user_notify($uid, $row['ID'])): ?> <?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
<li> <li>
<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post"> <form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />

View file

@ -47,7 +47,7 @@ $per_page = array(50, 100, 250);
<label for="id_category"><?= __("Category"); ?></label> <label for="id_category"><?= __("Category"); ?></label>
<select name='C' id="id_category"> <select name='C' id="id_category">
<option value='0'><?= __("Any"); ?></option> <option value='0'><?= __("Any"); ?></option>
<?php foreach (pkg_categories() as $id => $cat): ?> <?php foreach (pkgbase_categories() as $id => $cat): ?>
<?php if (isset($_REQUEST['C']) && $_REQUEST['C'] == $id): ?> <?php if (isset($_REQUEST['C']) && $_REQUEST['C'] == $id): ?>
<option value="<?= $id ?>" selected="selected"><?= $cat; ?></option> <option value="<?= $id ?>" selected="selected"><?= $cat; ?></option>
<?php else: ?> <?php else: ?>

View file

@ -4,7 +4,7 @@ $uid = uid_from_sid($SID);
$base_id = intval($row['ID']); $base_id = intval($row['ID']);
$catarr = pkg_categories(); $catarr = pkgbase_categories();
$submitter = username_from_id($row["SubmitterUID"]); $submitter = username_from_id($row["SubmitterUID"]);
$maintainer = username_from_id($row["MaintainerUID"]); $maintainer = username_from_id($row["MaintainerUID"]);
@ -49,7 +49,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
</form> </form>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php if (user_voted($uid, $row['ID'])): ?> <?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
<li> <li>
<form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post"> <form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
@ -64,7 +64,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
</form> </form>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php if (user_notify($uid, $row['ID'])): ?> <?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
<li> <li>
<form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post"> <form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />