[aur-dev] [PATCH 2/7] Prefix package functions with pkg_/pkgbase_

Lukas Fleischer archlinux at cryptocrack.de
Sat Apr 5 10:35:28 EDT 2014


Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 scripts/cleanup                  |  2 +-
 web/html/index.php               |  2 +-
 web/html/packages.php            | 10 ++---
 web/html/pkgbase.php             | 32 +++++++--------
 web/html/pkgsubmit.php           | 20 ++++-----
 web/html/voters.php              |  2 +-
 web/lib/pkgfuncs.inc.php         | 88 ++++++++++++++++++++--------------------
 web/template/actions_form.php    |  4 +-
 web/template/pkg_comments.php    |  2 +-
 web/template/pkg_details.php     | 12 +++---
 web/template/pkg_search_form.php |  2 +-
 web/template/pkgbase_details.php |  6 +--
 12 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/scripts/cleanup b/scripts/cleanup
index 7999429..1fe63a2 100755
--- a/scripts/cleanup
+++ b/scripts/cleanup
@@ -34,7 +34,7 @@ foreach ($buckets as $bucket) {
 			continue;
 		}
 		$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";
 			rm_tree($fullpath);
 			$count++;
diff --git a/web/html/index.php b/web/html/index.php
index fe74857..921839a 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -13,7 +13,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
 		 * the routing framework to the individual pages instead of
 		 * initializing arbitrary variables here. */
 		$pkgname = $tokens[2];
-		$pkgid = pkgid_from_name($pkgname);
+		$pkgid = pkg_from_name($pkgname);
 
 		if (!$pkgid) {
 			header("HTTP/1.0 404 Not Found");
diff --git a/web/html/packages.php b/web/html/packages.php
index 876e2c0..bf325cf 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -11,9 +11,9 @@ check_sid();                      # see if they're still logged in
 if (!isset($pkgid) || !isset($pkgname)) {
 	if (isset($_GET['ID'])) {
 		$pkgid = intval($_GET['ID']);
-		$pkgname = pkgname_from_id($_GET['ID']);
+		$pkgname = pkg_name_from_id($_GET['ID']);
 	} else if (isset($_GET['N'])) {
-		$pkgid = pkgid_from_name($_GET['N']);
+		$pkgid = pkg_from_name($_GET['N']);
 		$pkgname = $_GET['N'];
 	} else {
 		unset($pkgid, $pkgname);
@@ -44,7 +44,7 @@ if (isset($_COOKIE["AURSID"])) {
 
 $details = array();
 if (isset($pkgname)) {
-	$details = get_package_details($pkgid);
+	$details = pkg_get_details($pkgid);
 }
 
 html_header($title, $details);
@@ -55,10 +55,10 @@ if (isset($pkgid)) {
 	include('pkg_search_form.php');
 	if ($pkgid) {
 		if (isset($_COOKIE["AURSID"])) {
-			display_package_details($pkgid, $details, $_COOKIE["AURSID"]);
+			pkg_display_details($pkgid, $details, $_COOKIE["AURSID"]);
 		}
 		else {
-			display_package_details($pkgid, $details, null);
+			pkg_display_details($pkgid, $details, null);
 		}
 	} else {
 		print __("Error trying to retrieve package details.")."<br />\n";
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index 42705ed..24bbbdc 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.php
@@ -55,27 +55,27 @@ $ret = false;
 $output = "";
 if (check_token()) {
 	if (current_action("do_Flag")) {
-		list($ret, $output) = pkg_flag($atype, $ids);
+		list($ret, $output) = pkgbase_flag($atype, $ids);
 	} elseif (current_action("do_UnFlag")) {
-		list($ret, $output) = pkg_unflag($atype, $ids);
+		list($ret, $output) = pkgbase_unflag($atype, $ids);
 	} 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")) {
-		list($ret, $output) = pkg_adopt($atype, $ids, false);
+		list($ret, $output) = pkgbase_adopt($atype, $ids, false);
 	} 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")) {
-		list($ret, $output) = pkg_vote($atype, $ids, false);
+		list($ret, $output) = pkgbase_vote($atype, $ids, false);
 	} elseif (current_action("do_Delete")) {
 		if (isset($_POST['confirm_Delete'])) {
 			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']);
 			}
 			else {
 				$merge_base_id = pkgbase_from_name($_POST['merge_Into']);
 				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']);
 				}
 				else {
@@ -87,18 +87,18 @@ if (check_token()) {
 			$output = __("The selected packages have not been deleted, check the confirmation checkbox.");
 		}
 	} elseif (current_action("do_Notify")) {
-		list($ret, $output) = pkg_notify($atype, $ids);
+		list($ret, $output) = pkgbase_notify($atype, $ids);
 	} 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")) {
-		list($ret, $output) = pkg_delete_comment($atype);
+		list($ret, $output) = pkgbase_delete_comment($atype);
 	} 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'])) {
 		$uid = uid_from_sid($_COOKIE["AURSID"]);
-		add_package_comment($base_id, $uid, $_REQUEST['comment']);
+		pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
 		$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);
 ?>
 
@@ -126,9 +126,9 @@ html_header($title, $details);
 <?php
 include('pkg_search_form.php');
 if (isset($_COOKIE["AURSID"])) {
-	display_pkgbase_details($base_id, $details, $_COOKIE["AURSID"]);
+	pkgbase_display_details($base_id, $details, $_COOKIE["AURSID"]);
 } else {
-	display_pkgbase_details($base_id, $details, null);
+	pkgbase_display_details($base_id, $details, null);
 }
 
 html_footer(AUR_VERSION);
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 95566f7..7db81a5 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -259,7 +259,7 @@ if ($uid):
 			}
 
 			/* 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']);
 				break;
 			}
@@ -329,30 +329,30 @@ if ($uid):
 				 */
 				$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) {
-					update_pkgbase_category($base_id, $category_id);
+					pkgbase_update_category($base_id, $category_id);
 				}
 
 				pkgbase_delete_packages($base_id);
 			} else {
 				/* This is a brand new package. */
 				$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) {
-				$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) {
 					$deppkgname = preg_replace("/(<|=|>).*/", "", $dep);
 					$depcondition = str_replace($deppkgname, "", $dep);
-					add_pkg_dep($pkgid, $deppkgname, $depcondition);
+					pkg_add_dep($pkgid, $deppkgname, $depcondition);
 				}
 
 				foreach ($pi['source'] as $src) {
-					add_pkg_src($pkgid, $src);
+					pkg_add_src($pkgid, $src);
 				}
 			}
 
@@ -362,7 +362,7 @@ if ($uid):
 			 * notification list.
 			 */
 			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();
@@ -387,7 +387,7 @@ html_header("Submit");
 		# give the visitor the default upload form
 		if (ini_get("file_uploads")):
 
-			$pkg_categories = pkg_categories();
+			$pkgbase_categories = pkgbase_categories();
 ?>
 
 <?php if ($error): ?>
@@ -406,7 +406,7 @@ html_header("Submit");
 			<select id="id_category" name="category">
 				<option value="1"><?= __("Select Category"); ?></option>
 				<?php
-					foreach ($pkg_categories as $num => $cat):
+					foreach ($pkgbase_categories as $num => $cat):
 						print '<option value="' . $num . '"';
 						if (isset($_POST['category']) && $_POST['category'] == $cat):
 							print ' selected="selected"';
diff --git a/web/html/voters.php b/web/html/voters.php
index 9a0bdd3..bbcf547 100644
--- a/web/html/voters.php
+++ b/web/html/voters.php
@@ -5,7 +5,7 @@ include_once('pkgfuncs.inc.php');
 
 $SID = $_COOKIE['AURSID'];
 $pkgname = htmlspecialchars($_GET['N']);
-$votes = votes_for_pkgname($pkgname);
+$votes = pkgbase_votes_from_name($pkgname);
 $atype = account_from_sid($SID);
 
 html_header(__("Voters"));
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index 01d7c3e..45c786b 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -90,7 +90,7 @@ function can_submit_blacklisted($atype = "") {
  *
  * @return array All package categories
  */
-function pkg_categories() {
+function pkgbase_categories() {
 	$cats = array();
 	$dbh = DB::connect();
 	$q = "SELECT * FROM PackageCategories WHERE ID != 1 ";
@@ -111,7 +111,7 @@ function pkg_categories() {
  *
  * @return string|void Package name if it already exists
  */
-function pkgid_from_name($name="") {
+function pkg_from_name($name="") {
 	if (!$name) {return NULL;}
 	$dbh = DB::connect();
 	$q = "SELECT ID FROM Packages ";
@@ -131,7 +131,7 @@ function pkgid_from_name($name="") {
  *
  * @return array All package dependencies for the package
  */
-function package_dependencies($pkgid) {
+function pkg_dependencies($pkgid) {
 	$deps = array();
 	$pkgid = intval($pkgid);
 	if ($pkgid > 0) {
@@ -158,7 +158,7 @@ function package_dependencies($pkgid) {
  *
  * @return array All packages that depend on the specified package name
  */
-function package_required($name="") {
+function pkg_required($name="") {
 	$deps = array();
 	if ($name != "") {
 		$dbh = DB::connect();
@@ -182,7 +182,7 @@ function package_required($name="") {
  *
  * @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();
 
 	$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
  */
-function package_comments($base_id) {
+function pkgbase_comments($base_id) {
 	$base_id = intval($base_id);
 	$comments = array();
 	if ($base_id > 0) {
@@ -248,7 +248,7 @@ function package_comments($base_id) {
  *
  * @return void
  */
-function add_package_comment($base_id, $uid, $comment) {
+function pkgbase_add_comment($base_id, $uid, $comment) {
 	global $AUR_LOCATION;
 
 	$dbh = DB::connect();
@@ -311,7 +311,7 @@ function add_package_comment($base_id, $uid, $comment) {
  *
  * @return array All sources associated with a specific package
  */
-function package_sources($pkgid) {
+function pkg_sources($pkgid) {
 	$sources = array();
 	$pkgid = intval($pkgid);
 	if ($pkgid > 0) {
@@ -337,7 +337,7 @@ function package_sources($pkgid) {
  *
  * @return array All packages the visitor has voted for
  */
-function pkgvotes_from_sid($sid="") {
+function pkgbase_votes_from_sid($sid="") {
 	$pkgs = array();
 	if (!$sid) {return $pkgs;}
 	$dbh = DB::connect();
@@ -362,7 +362,7 @@ function pkgvotes_from_sid($sid="") {
  *
  * @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)) {
 		$pkgids = sanitize_ids($pkgids);
 		$names = array();
@@ -398,7 +398,7 @@ function pkgname_from_id($pkgids) {
  *
  * @return bool True if the name is blacklisted, otherwise false
  */
-function pkgname_is_blacklisted($name) {
+function pkg_name_is_blacklisted($name) {
 	$dbh = DB::connect();
 	$q = "SELECT COUNT(*) FROM PackageBlacklist ";
 	$q.= "WHERE Name = " . $dbh->quote($name);
@@ -415,7 +415,7 @@ function pkgname_is_blacklisted($name) {
  *
  * @return array The package's details OR error message
  **/
-function get_package_details($id=0) {
+function pkg_get_details($id=0) {
 	$dbh = DB::connect();
 
 	$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
  **/
-function get_pkgbase_details($base_id) {
+function pkgbase_get_details($base_id) {
 	$dbh = DB::connect();
 
 	$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 bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
  * @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
  *
  * @return void
  */
-function display_package_details($id=0, $row, $SID="") {
+function pkg_display_details($id=0, $row, $SID="") {
 	global $AUR_LOCATION;
 	global $USE_VIRTUAL_URLS;
 
@@ -510,7 +510,7 @@ function display_package_details($id=0, $row, $SID="") {
 			include('pkg_comment_form.php');
 		}
 
-		$comments = package_comments($base_id);
+		$comments = pkgbase_comments($base_id);
 		if (!empty($comments)) {
 			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 bool $USE_VIRTUAL_URLS True if using URL rewriting, otherwise false
  * @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
  *
  * @return void
  */
-function display_pkgbase_details($base_id, $row, $SID="") {
+function pkgbase_display_details($base_id, $row, $SID="") {
 	global $AUR_LOCATION;
 	global $USE_VIRTUAL_URLS;
 
@@ -547,7 +547,7 @@ function display_pkgbase_details($base_id, $row, $SID="") {
 			include('pkg_comment_form.php');
 		}
 
-		$comments = package_comments($base_id);
+		$comments = pkgbase_comments($base_id);
 		if (!empty($comments)) {
 			include('pkg_comments.php');
 		}
@@ -608,7 +608,7 @@ function pkg_search_page($SID="") {
 	 */
 	if ($SID)
 		$myuid = uid_from_sid($SID);
-	$cats = pkg_categories($dbh);
+	$cats = pkgbase_categories($dbh);
 
 	/* Sanitize paging variables. */
 	if (isset($_GET['O'])) {
@@ -950,7 +950,7 @@ function pkgbase_maintainer_uid($base_id) {
  *
  * @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;
 
 	if (!$atype) {
@@ -1008,7 +1008,7 @@ function pkg_flag($atype, $base_ids) {
  *
  * @return array Tuple of success/failure indicator and error message
  */
-function pkg_unflag($atype, $base_ids) {
+function pkgbase_unflag($atype, $base_ids) {
 	if (!$atype) {
 		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
  */
-function pkg_delete ($atype, $base_ids, $merge_base_id) {
+function pkgbase_delete ($atype, $base_ids, $merge_base_id) {
 	if (!$atype) {
 		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
  */
-function pkg_adopt ($atype, $base_ids, $action=true) {
+function pkgbase_adopt ($atype, $base_ids, $action=true) {
 	if (!$atype) {
 		if ($action) {
 			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);
 
 	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."));
 	} else {
 		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
  */
-function pkg_vote ($atype, $base_ids, $action=true) {
+function pkgbase_vote ($atype, $base_ids, $action=true) {
 	if (!$atype) {
 		if ($action) {
 			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();
-	$my_votes = pkgvotes_from_sid($_COOKIE["AURSID"]);
+	$my_votes = pkgbase_votes_from_sid($_COOKIE["AURSID"]);
 	$uid = uid_from_sid($_COOKIE["AURSID"]);
 
 	$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
  */
-function votes_for_pkgname($pkgname) {
+function pkgbase_votes_from_name($pkgname) {
 	$dbh = DB::connect();
 
 	$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
  */
-function user_voted($uid, $pkgid) {
+function pkgbase_user_voted($uid, $pkgid) {
 	$dbh = DB::connect();
 
 	$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
  */
-function user_notify($uid, $base_id) {
+function pkgbase_user_notify($uid, $base_id) {
 	$dbh = DB::connect();
 
 	$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
  */
-function pkg_notify ($atype, $base_ids, $action=true) {
+function pkgbase_notify ($atype, $base_ids, $action=true) {
 	if (!$atype) {
 		return;
 	}
@@ -1442,7 +1442,7 @@ function pkg_notify ($atype, $base_ids, $action=true) {
  *
  * @return array Tuple of success/failure indicator and error message
  */
-function pkg_delete_comment($atype) {
+function pkgbase_delete_comment($atype) {
 	if (!$atype) {
 		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
  */
-function pkg_change_category($pid, $atype) {
+function pkgbase_change_category($pid, $atype) {
 	if (!$atype)  {
 		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();
-	$catArray = pkg_categories($dbh);
+	$catArray = pkgbase_categories($dbh);
 	if (!array_key_exists($category_id, $catArray)) {
 		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
  */
-function pkgdetails_by_pkgname($pkgname) {
+function pkg_details_by_name($pkgname) {
 	$dbh = DB::connect();
 	$q = "SELECT Packages.*, PackageBases.Name AS BaseName, ";
 	$q.= "PackageBases.CategoryID, PackageBases.NumVotes, ";
@@ -1548,7 +1548,7 @@ function pkgdetails_by_pkgname($pkgname) {
  *
  * @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();
 	$q = sprintf("INSERT INTO PackageBases (Name, CategoryID, " .
 		"SubmittedTS, ModifiedTS, SubmitterUID, MaintainerUID) " .
@@ -1570,7 +1570,7 @@ function create_pkgbase($name, $category_id, $uid) {
  *
  * @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();
 	$q = sprintf("INSERT INTO Packages (PackageBaseID, Name, License, " .
 		"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
  */
-function update_pkgbase($base_id, $name, $uid) {
+function pkgbase_update($base_id, $name, $uid) {
 	$dbh = DB::connect();
 	$q = sprintf("UPDATE PackageBases SET  " .
 		"Name = %s, ModifiedTS = UNIX_TIMESTAMP(), " .
@@ -1612,7 +1612,7 @@ function update_pkgbase($base_id, $name, $uid) {
  *
  * @return void
  */
-function update_pkg($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
+function pkg_update($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
 	$dbh = DB::connect();
 	$q = sprintf("UPDATE Packages SET Name = %s, Version = %s, " .
 		"License = %s, Description = %s, URL = %s WHERE ID = %d",
@@ -1634,7 +1634,7 @@ function update_pkg($pkgname, $license, $pkgver, $pkgdesc, $pkgurl, $pkgid) {
  *
  * @return void
  */
-function add_pkg_dep($pkgid, $depname, $depcondition) {
+function pkg_add_dep($pkgid, $depname, $depcondition) {
 	$dbh = DB::connect();
 	$q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, %s, %s)",
 	$pkgid,
@@ -1652,7 +1652,7 @@ function add_pkg_dep($pkgid, $depname, $depcondition) {
  *
  * @return void
  */
-function add_pkg_src($pkgid, $pkgsrc) {
+function pkg_add_src($pkgid, $pkgsrc) {
 	$dbh = DB::connect();
 	$q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
 	$q .= $pkgid . ", " . $dbh->quote($pkgsrc) . ")";
@@ -1668,7 +1668,7 @@ function add_pkg_src($pkgid, $pkgsrc) {
  *
  * @return void
  */
-function update_pkgbase_category($base_id, $category_id) {
+function pkgbase_update_category($base_id, $category_id) {
 	$dbh = DB::connect();
 	$q = sprintf("UPDATE PackageBases SET CategoryID = %d WHERE ID = %d",
 		$category_id, $base_id);
@@ -1682,7 +1682,7 @@ function update_pkgbase_category($base_id, $category_id) {
  *
  * @return void
  */
-function remove_pkg_deps($pkgid) {
+function pkg_remove_deps($pkgid) {
 	$dbh = DB::connect();
 	$q = "DELETE FROM PackageDepends WHERE PackageID = " . $pkgid;
 
@@ -1696,7 +1696,7 @@ function remove_pkg_deps($pkgid) {
  *
  * @return void
  */
-function remove_pkg_sources($pkgid) {
+function pkg_remove_sources($pkgid) {
 	$dbh = DB::connect();
 	$q = "DELETE FROM PackageSources WHERE PackageID = " . $pkgid;
 
diff --git a/web/template/actions_form.php b/web/template/actions_form.php
index c5abbb3..a69e40d 100644
--- a/web/template/actions_form.php
+++ b/web/template/actions_form.php
@@ -6,13 +6,13 @@
 			<input type="hidden" name="ID" value="<?= $row['ID'] ?>" />
 			<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") ?>" />
 		<?php else: ?>
 			<input type="submit" class="button" name="do_Vote" value="<?= __("Vote") ?>" />
 		<?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") ?>" />
 		<?php else: ?>
 			<input type="submit" class="button" name="do_Notify" value="<?= __("Notify") ?>" title="<?= __("New Comment Notification") ?>" />
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
index d718118..ca4abc6 100644
--- a/web/template/pkg_comments.php
+++ b/web/template/pkg_comments.php
@@ -1,7 +1,7 @@
 <?php
 $uid = uid_from_sid($SID);
 $base_id = pkgbase_from_pkgid($row['ID']);
-$count = package_comments_count($base_id);
+$count = pkgbase_comments_count($base_id);
 ?>
 <div id="news">
 	<h3>
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index ed1b030..3eaeac7 100644
--- a/web/template/pkg_details.php
+++ b/web/template/pkg_details.php
@@ -4,7 +4,7 @@ $uid = uid_from_sid($SID);
 
 $pkgid = intval($row['ID']);
 
-$catarr = pkg_categories();
+$catarr = pkgbase_categories();
 
 $submitter = username_from_id($row["SubmitterUID"]);
 $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'];
 
-$deps = package_dependencies($row["ID"]);
-$requiredby = package_required($row["Name"]);
+$deps = pkg_dependencies($row["ID"]);
+$requiredby = pkg_required($row["Name"]);
 
 # $sources[0] = 'src';
-$sources = package_sources($row["ID"]);
+$sources = pkg_sources($row["ID"]);
 ?>
 <div id="pkgdetails" class="box">
 	<h2><?= __('Package Details') . ': ' . htmlspecialchars($row['Name']) . ' ' . htmlspecialchars($row['Version']) ?></h2>
@@ -54,7 +54,7 @@ $sources = package_sources($row["ID"]);
 					</form>
 				</li>
 				<?php endif; ?>
-				<?php if (user_voted($uid, $row['ID'])): ?>
+				<?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
 				<li>
 					<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unvote/'; ?>" method="post">
 						<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
@@ -69,7 +69,7 @@ $sources = package_sources($row["ID"]);
 					</form>
 				</li>
 				<?php endif; ?>
-				<?php if (user_notify($uid, $row['ID'])): ?>
+				<?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
 				<li>
 					<form action="<?= get_pkgbase_uri($row['BaseName']) . 'unnotify/'; ?>" method="post">
 						<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index d004acc..7428250 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -47,7 +47,7 @@ $per_page = array(50, 100, 250);
 			<label for="id_category"><?= __("Category"); ?></label>
 			<select name='C' id="id_category">
 				<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): ?>
 				<option value="<?= $id ?>" selected="selected"><?= $cat; ?></option>
 				<?php else: ?>
diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php
index 20d75be..83b474c 100644
--- a/web/template/pkgbase_details.php
+++ b/web/template/pkgbase_details.php
@@ -4,7 +4,7 @@ $uid = uid_from_sid($SID);
 
 $base_id = intval($row['ID']);
 
-$catarr = pkg_categories();
+$catarr = pkgbase_categories();
 
 $submitter = username_from_id($row["SubmitterUID"]);
 $maintainer = username_from_id($row["MaintainerUID"]);
@@ -49,7 +49,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
 					</form>
 				</li>
 				<?php endif; ?>
-				<?php if (user_voted($uid, $row['ID'])): ?>
+				<?php if (pkgbase_user_voted($uid, $row['ID'])): ?>
 				<li>
 					<form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
 						<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
@@ -64,7 +64,7 @@ $pkgs = pkgbase_get_pkgnames($base_id);
 					</form>
 				</li>
 				<?php endif; ?>
-				<?php if (user_notify($uid, $row['ID'])): ?>
+				<?php if (pkgbase_user_notify($uid, $row['ID'])): ?>
 				<li>
 					<form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
 						<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
-- 
1.9.1



More information about the aur-dev mailing list