From cfd1d1ac096215d05be29bff83126410c92c6389 Mon Sep 17 00:00:00 2001 From: Jonathan Ernst Date: Fri, 4 Feb 2005 02:59:05 +0000 Subject: [PATCH] - renamed lookupVersionName and lookupAppName into lookup_version_name and lookup_app_name in respect to CODING_STANDARD - removed appIdToName($appId) and versionIdToName($appId) from category.php - replaced every occurence of appIdToName and versionIdToName with lookup_app_name and lookup_version_name --- admin/adminAppQueue.php | 8 ++++---- admin/adminMaintainerQueue.php | 20 ++++++++++---------- admin/adminMaintainers.php | 8 ++++---- admin/editAppFamily.php | 2 +- admin/editAppVersion.php | 6 +++--- include/application.php | 6 ++++-- include/category.php | 24 +++--------------------- include/comment.php | 4 ++-- include/note.php | 4 ++-- include/sidebar_login.php | 6 +++--- include/vote.php | 2 +- maintainerdelete.php | 12 ++++++------ maintainersubmit.php | 8 ++++---- 13 files changed, 47 insertions(+), 63 deletions(-) diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 6d22c45..d4760a8 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -309,11 +309,11 @@ if ($_REQUEST['sub']) //Send Status Email if($_REQUEST['type'] == 'ver') { - $sFullAppName = lookupAppName($_REQUEST['appParent'])." ".lookupVersionName($_REQUEST['appVersion']); + $sFullAppName = lookup_app_name($_REQUEST['appParent'])." ".lookup_version_name($_REQUEST['appVersion']); $sUrl = APPDB_ROOT."appview.php?versionId=".$_REQUEST['appVersion']; } else { - $sFullAppName = lookupAppName($_REQUEST['appParent']); + $sFullAppName = lookup_app_name($_REQUEST['appParent']); $sUrl = APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']; } $sSubject = $sFullAppName." has been added into the AppDB"; @@ -350,10 +350,10 @@ if ($_REQUEST['sub']) //Send Status Email if($_REQUEST['type'] == 'ver') { - $sFullAppName = lookupAppName($_REQUEST['appParent'])." ".lookupVersionName($_REQUEST['appVersion']); + $sFullAppName = lookup_app_name($_REQUEST['appParent'])." ".lookup_version_name($_REQUEST['appVersion']); } else { - $sFullAppName = lookupAppName($_REQUEST['appParent']); + $sFullAppName = lookup_app_name($_REQUEST['appParent']); } $sSubject = $sFullAppName." has not been added into the AppDB"; if ($ob->queueEmail) diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php index 3ab3629..92c9f70 100644 --- a/admin/adminMaintainerQueue.php +++ b/admin/adminMaintainerQueue.php @@ -115,15 +115,15 @@ if ($_REQUEST['sub']) { $firstDisplay = false; if($superMaintainerOther) - echo "".appIdToName($appIdOther)."*\n"; + echo "".lookup_app_name($appIdOther)."*\n"; else - echo "".appIdToName($appIdOther).versionIdToName($versionIdOther)."\n"; + echo "".lookup_app_name($appIdOther).lookup_version_name($versionIdOther)."\n"; } else { if($superMaintainerOther) - echo "".appIdToName($appIdOther)."*\n"; + echo "".lookup_app_name($appIdOther)."*\n"; else - echo "".appIdToName($appIdOther).versionIdToName($versionIdOther)."\n"; + echo "".lookup_app_name($appIdOther).lookup_version_name($versionIdOther)."\n"; } } } else @@ -133,11 +133,11 @@ if ($_REQUEST['sub']) //app name echo 'App Name',"\n"; - echo "".appIdToName($ob->appId)."\n"; + echo "".lookup_app_name($ob->appId)."\n"; //version echo 'App Version',"\n"; - echo "".versionIdToName($ob->versionId)."\n"; + echo "".lookup_version_name($ob->versionId)."\n"; //maintainReason echo 'Maintainer request reason',"\n"; @@ -188,7 +188,7 @@ if ($_REQUEST['sub']) if ($sEmail) { $sSubject = "Application Maintainer Request Report"; - $sMsg = "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." has been accepted. "; + $sMsg = "Your application to be the maintainer of ".lookup_app_name($ob->appId).lookup_version_name($ob->versionId)." has been accepted. "; $sMsg .= $_REQUEST['replyText']; $sMsg .= "We appreciate your help in making the Application Database better for all users.\n\n"; @@ -205,7 +205,7 @@ if ($_REQUEST['sub']) if ($sEmail) { $sSubject = "Application Maintainer Request Report"; - $sMsg = "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." was rejected. "; + $sMsg = "Your application to be the maintainer of ".lookup_app_name($ob->appId).lookup_version_name($ob->versionId)." was rejected. "; $sMsg .= $_REQUEST['replyText']; $sMsg .= ""; $sMsg .= "-The AppDB admins\n"; @@ -284,7 +284,7 @@ if ($_REQUEST['sub']) echo " ".date("Y-n-t h:i:sa", $ob->submitTime)."  \n"; echo " $ob->queueId\n"; echo " ".$oUser->sRealName."\n"; - echo " ".appIdToName($ob->appId)."\n"; + echo " ".lookup_app_name($ob->appId)."\n"; if($ob->superMaintainer) { @@ -292,7 +292,7 @@ if ($_REQUEST['sub']) echo "Yes\n"; } else { - echo "".versionIdToName($ob->versionId)."  \n"; + echo "".lookup_version_name($ob->versionId)."  \n"; echo "No\n"; } diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php index 60a13d1..28f94eb 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -76,13 +76,13 @@ if ($_REQUEST['sub']) if($ob->superMaintainer) { - echo " ".appIdToName($ob->appId)."\n"; - echo " ".versionIdToName($ob->versionId)." \n"; + echo " ".lookup_app_name($ob->appId)."\n"; + echo " ".lookup_version_name($ob->versionId)." \n"; echo " Yes\n"; } else { - echo " ".appIdToName($ob->appId)."\n"; - echo " ".versionIdToName($ob->versionId)." \n"; + echo " ".lookup_app_name($ob->appId)."\n"; + echo " ".lookup_version_name($ob->versionId)." \n"; echo " No\n"; } echo " ".$oUser->sEmail."  \n"; diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index fcda8c0..1738f5d 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -106,7 +106,7 @@ if(isset($_REQUEST['submit'])) $sEmail = get_notify_email_address_list($_REQUEST['appId']); if($sEmail) { - $sSubject = lookupAppName($_REQUEST['appId'])." has been modified by ".$_SESSION['current']->sRealname; + $sSubject = lookup_app_name($_REQUEST['appId'])." has been modified by ".$_SESSION['current']->sRealname; $sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n"; $sMsg .= "\n"; $sMsg .= "The following changes have been made:"; diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php index 08a6471..7fae2b8 100644 --- a/admin/editAppVersion.php +++ b/admin/editAppVersion.php @@ -89,7 +89,7 @@ if(isset($_REQUEST['submit1'])) $sEmail = get_notify_email_address_list($_REQUEST['appId'], $_REQUEST['versionId']); if($sEmail) { - $sSubject = lookupAppName($_REQUEST['appId'])." ".lookupVersionName($_REQUEST['versionId'])." has been modified by".$_SESSION['current']->sRealname; + $sSubject = lookup_app_name($_REQUEST['appId'])." ".lookup_version_name($_REQUEST['versionId'])." has been modified by".$_SESSION['current']->sRealname; $sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n"; $sMsg .= "\n"; $sMsg .= "The following changes have been made:"; @@ -180,7 +180,7 @@ if(isset($_REQUEST['submit1'])) $sEmail = get_notify_email_address_list($_REQUEST['appId']); if($sEmail) { - $sSubject = "Links for ".lookupAppName($_REQUEST['appId'])." ".lookupAppName($_REQUEST['versionId'])." have been updated by ".$_SESSION['current']->sRealname; + $sSubject = "Links for ".lookup_app_name($_REQUEST['appId'])." ".lookup_app_name($_REQUEST['versionId'])." have been updated by ".$_SESSION['current']->sRealname; $sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n"; $sMsg .= "\n"; $sMsg .= "The following changes have been made:"; @@ -212,7 +212,7 @@ if(isset($_REQUEST['submit1'])) echo html_table_begin("width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body'"); echo ''; echo ''; - echo 'Name'.lookupAppName($_REQUEST['appId']).'',"\n"; + echo 'Name'.lookup_app_name($_REQUEST['appId']).'',"\n"; echo 'Version',"\n"; echo 'Version specific description', "\n"; if(trim(strip_tags($oRow->description))=="") diff --git a/include/application.php b/include/application.php index b49a005..0df7202 100644 --- a/include/application.php +++ b/include/application.php @@ -97,8 +97,9 @@ function deleteAppVersion($versionId) addmsg("Application Version $versionId deleted", "green"); } -function lookupVersionName($versionId) +function lookup_version_name($versionId) { + if(!$versionId) return null; $result = query_appdb("SELECT versionName FROM appVersion WHERE versionId = $versionId"); if(!$result || mysql_num_rows($result) != 1) return null; @@ -107,8 +108,9 @@ function lookupVersionName($versionId) } -function lookupAppName($appId) +function lookup_app_name($appId) { + if(!$appId) return null; $result = query_appdb("SELECT appName FROM appFamily WHERE appId = $appId"); if(!$result || mysql_num_rows($result) != 1) return null; diff --git a/include/category.php b/include/category.php index 6db45f2..38b0a38 100644 --- a/include/category.php +++ b/include/category.php @@ -161,24 +161,6 @@ class Category { }; -function appIdToName($appId) -{ - $result = query_appdb("SELECT appName FROM appFamily WHERE appId = $appId"); - if(!$result || !mysql_num_rows($result)) - return ""; // shouldn't normally happen - $ob = mysql_fetch_object($result); - return $ob->appName; -} - -function versionIdToName($versionId) -{ - $result = query_appdb("SELECT versionName FROM appVersion WHERE versionId = $versionId"); - if(!$result || !mysql_num_rows($result)) - return ""; // shouldn't normally happen - $ob = mysql_fetch_object($result); - return $ob->versionName; -} - /** * create the Category: line at the top of appdb pages$ */ @@ -202,12 +184,12 @@ function make_cat_path($path, $appId = '', $versionId = '') { if(!empty($versionId)) { - $str .= " > ".html_ahref(appIdToName($appId),"appview.php?appId=$appId"); - $str .= " > ".versionIdToName($versionId); + $str .= " > ".html_ahref(lookup_app_name($appId),"appview.php?appId=$appId"); + $str .= " > ".lookup_version_name($versionId); } else { - $str .= " > ".appIdToName($appId); + $str .= " > ".lookup_app_name($appId); } } diff --git a/include/comment.php b/include/comment.php index 2a9ca34..3265d61 100644 --- a/include/comment.php +++ b/include/comment.php @@ -76,7 +76,7 @@ class Comment { } if($sEmail) { - $sSubject = "Comment for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." added by ".$_SESSION['current']->sRealname; + $sSubject = "Comment for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n"; $sMsg .= "\n"; $sMsg .= "Subject: ".$this->sSubject."\r\n"; @@ -147,7 +147,7 @@ class Comment { $sEmail .= $this->oOwner->sEmail; if($sEmail) { - $sSubject = "Comment for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; + $sSubject = "Comment for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; $sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n"; $sMsg .= "\n"; $sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n"; diff --git a/include/note.php b/include/note.php index 91ba1be..0ee8eec 100644 --- a/include/note.php +++ b/include/note.php @@ -57,7 +57,7 @@ class Note { $sEmail = get_notify_email_address_list($this->iAppId, $this->iVersionId); if($sEmail) { - $sSubject = "Note for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." added by ".$_SESSION['current']->sRealname; + $sSubject = "Note for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n"; $sMsg .= "\n"; $sMsg .= "Title: ".$this->sTitle."\r\n"; @@ -119,7 +119,7 @@ class Note { $sEmail = get_notify_email_address_list($this->iAppId, $this->iVersionId); if($sEmail) { - $sSubject = "Note for ".lookupAppName($this->iAppId)." ".lookupVersionName($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; + $sSubject = "Note for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; $sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."&versionId=".$this->iVersionId."\n"; $sMsg .= "\n"; $sMsg .= "This note was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n"; diff --git a/include/sidebar_login.php b/include/sidebar_login.php index 231061e..664457b 100644 --- a/include/sidebar_login.php +++ b/include/sidebar_login.php @@ -4,7 +4,7 @@ /*****************/ require_once(BASE."include/maintainer.php"); -require_once(BASE."include/category.php"); +require_once(BASE."include/application.php"); function global_sidebar_login() { @@ -27,9 +27,9 @@ function global_sidebar_login() { while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains)) { if($superMaintainer) - $g->addmisc("".appIdToName($appId)."*", "center"); + $g->addmisc("".lookup_app_name($appId)."*", "center"); else - $g->addmisc("".appIdToName($appId)." ".versionIdToName($versionId)."", "center"); + $g->addmisc("".lookup_app_name($appId)." ".lookup_version_name($versionId)."", "center"); } } } diff --git a/include/vote.php b/include/vote.php index 2463622..7c1b1ef 100644 --- a/include/vote.php +++ b/include/vote.php @@ -117,7 +117,7 @@ function vote_menu() { if(isset($votes[$i])) { - $appName = lookupAppName($votes[$i]->appId); + $appName = lookup_app_name($votes[$i]->appId); $str = " $appName"; $m->add(" ".$str); } diff --git a/maintainerdelete.php b/maintainerdelete.php index 2d44db1..1f6a49b 100644 --- a/maintainerdelete.php +++ b/maintainerdelete.php @@ -27,12 +27,12 @@ if($confirmed) if($superMaintainer) { - apidb_header("You have resigned as supermaintainer of ".appIdToName($appId)); + apidb_header("You have resigned as supermaintainer of ".lookup_app_name($appId)); $query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->userid. " AND appId = ".$appId." AND superMaintainer = ".$superMaintainer.";"; } else { - apidb_header("You have resigned as maintainer of ".appIdToName($appId)); + apidb_header("You have resigned as maintainer of ".lookup_app_name($appId)); $query = "DELETE FROM appMaintainers WHERE userId = ".$_SESSION['current']->userid. " AND appId = ".$appId." AND versionId = ".$versionId." AND superMaintainer = ".$superMaintainer.";"; } @@ -41,16 +41,16 @@ if($confirmed) if($result = query_appdb($query)) { if($superMaintainer) - echo "You were removed as a supermaintainer of ".appIdToName($appId); + echo "You were removed as a supermaintainer of ".lookup_app_name($appId); else - echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId); + echo "You were removed as a maintainer of ".lookup_app_name($appId).lookup_version_name($versionId); } } else { if($superMaintainer) - apidb_header("Confirm supermaintainer resignation of ".appIdToName($appId)); + apidb_header("Confirm supermaintainer resignation of ".lookup_app_name($appId)); else - apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId)); + apidb_header("Confirm maintainer resignation of ".lookup_app_name($appId).lookup_version_name ($versionId)); echo '
',"\n"; diff --git a/maintainersubmit.php b/maintainersubmit.php index b3823f2..5a7270b 100644 --- a/maintainersubmit.php +++ b/maintainersubmit.php @@ -93,9 +93,9 @@ if($_REQUEST['maintainReason']) { // header if($versionId) - apidb_header("Request to become an application maintainer of ".appIdToName($appId)." ".versionIdToName($versionId)); + apidb_header("Request to become an application maintainer of ".lookup_app_name($appId)." ".lookup_version_name($versionId)); else - apidb_header("Request to become an application super maintainer of ".appIdToName($appId)); + apidb_header("Request to become an application super maintainer of ".lookup_app_name($appId)); // show add to queue form @@ -138,12 +138,12 @@ if($_REQUEST['maintainReason']) echo "\n"; echo "',"\n"; if($versionId) { echo "',"\n"; } echo "";
"; - echo 'Application'.appIdToName($appId); + echo 'Application'.lookup_app_name($appId); echo '
"; - echo 'Version'.versionIdToName($versionId); + echo 'Version'.lookup_version_name($versionId); echo '