[aur-dev] [PATCH 1/7] Use snake case for all package functions

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


Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 web/html/pkgsubmit.php           |  4 ++--
 web/lib/pkgfuncs.inc.php         | 14 +++++++-------
 web/template/pkg_comments.php    |  2 +-
 web/template/pkg_details.php     |  2 +-
 web/template/pkg_search_form.php |  2 +-
 web/template/pkgbase_details.php |  2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 2432510..95566f7 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']) && !canSubmitBlacklisted(account_from_sid($_COOKIE["AURSID"]))) {
+			if (!$base_id && pkgname_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;
 			}
@@ -387,7 +387,7 @@ html_header("Submit");
 		# give the visitor the default upload form
 		if (ini_get("file_uploads")):
 
-			$pkg_categories = pkgCategories();
+			$pkg_categories = pkg_categories();
 ?>
 
 <?php if ($error): ?>
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index 4e37d2f..01d7c3e 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -13,7 +13,7 @@ include_once("config.inc.php");
  *
  * @return bool True if the user can delete the comment, otherwise false
  */
-function canDeleteComment($comment_id=0, $atype="", $uid=0) {
+function can_delete_comment($comment_id=0, $atype="", $uid=0) {
 	if (!$uid) {
 		/* Unauthenticated users cannot delete anything. */
 		return false;
@@ -49,7 +49,7 @@ function canDeleteComment($comment_id=0, $atype="", $uid=0) {
  *
  * @return bool True if the user can delete the comment, otherwise false
  */
-function canDeleteCommentArray($comment, $atype="", $uid=0) {
+function can_delete_comment_array($comment, $atype="", $uid=0) {
 	if (!$uid) {
 		/* Unauthenticated users cannot delete anything. */
 		return false;
@@ -73,7 +73,7 @@ function canDeleteCommentArray($comment, $atype="", $uid=0) {
  *
  * @return bool True if the user can submit blacklisted packages, otherwise false
  */
-function canSubmitBlacklisted($atype = "") {
+function can_submit_blacklisted($atype = "") {
 	if ($atype == "Trusted User" || $atype == "Developer") {
 		/* Only TUs and developers can submit blacklisted packages. */
 		return true;
@@ -90,7 +90,7 @@ function canSubmitBlacklisted($atype = "") {
  *
  * @return array All package categories
  */
-function pkgCategories() {
+function pkg_categories() {
 	$cats = array();
 	$dbh = DB::connect();
 	$q = "SELECT * FROM PackageCategories WHERE ID != 1 ";
@@ -608,7 +608,7 @@ function pkg_search_page($SID="") {
 	 */
 	if ($SID)
 		$myuid = uid_from_sid($SID);
-	$cats = pkgCategories($dbh);
+	$cats = pkg_categories($dbh);
 
 	/* Sanitize paging variables. */
 	if (isset($_GET['O'])) {
@@ -1455,7 +1455,7 @@ function pkg_delete_comment($atype) {
 
 	$dbh = DB::connect();
 	$uid = uid_from_sid($_COOKIE["AURSID"]);
-	if (canDeleteComment($comment_id, $atype, $uid)) {
+	if (can_delete_comment($comment_id, $atype, $uid)) {
 		   $q = "UPDATE PackageComments ";
 		   $q.= "SET DelUsersID = ".$uid." ";
 		   $q.= "WHERE ID = ".intval($comment_id);
@@ -1485,7 +1485,7 @@ function pkg_change_category($pid, $atype) {
 	}
 
 	$dbh = DB::connect();
-	$catArray = pkgCategories($dbh);
+	$catArray = pkg_categories($dbh);
 	if (!array_key_exists($category_id, $catArray)) {
 		return array(false, __("Invalid category ID."));
 	}
diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
index 1f47bb3..d718118 100644
--- a/web/template/pkg_comments.php
+++ b/web/template/pkg_comments.php
@@ -14,7 +14,7 @@ $count = package_comments_count($base_id);
 			$row['UserName'] = "<a href=\"" . get_user_uri($row['UserName']) . "\">{$row['UserName']}</a>";
 		endif; ?>
 		<h4>
-			<?php if (canDeleteCommentArray($row, $atype, $uid)): ?>
+			<?php if (can_delete_comment_array($row, $atype, $uid)): ?>
 				<form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($pkgbase_name), ENT_QUOTES); ?>">
 					<fieldset style="display:inline;">
 						<input type="hidden" name="action" value="do_DeleteComment" />
diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php
index 5268d3b..ed1b030 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 = pkgCategories();
+$catarr = pkg_categories();
 
 $submitter = username_from_id($row["SubmitterUID"]);
 $maintainer = username_from_id($row["MaintainerUID"]);
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index ececf06..d004acc 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 (pkgCategories() as $id => $cat): ?>
+				<?php foreach (pkg_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 8da23c4..20d75be 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 = pkgCategories();
+$catarr = pkg_categories();
 
 $submitter = username_from_id($row["SubmitterUID"]);
 $maintainer = username_from_id($row["MaintainerUID"]);
-- 
1.9.1



More information about the aur-dev mailing list