\n";
echo "\n\n";
@@ -105,11 +105,11 @@ if (!$aClean['id'])
// app name
echo '
App Name
',"\n";
- echo "
".lookup_app_name($obj_row->appId)."
\n";
+ echo "
".Application::lookup_name($obj_row->appId)."
\n";
// version
echo '
App Version
',"\n";
- echo "
".lookup_version_name($obj_row->versionId)."
\n";
+ echo "
".Version::lookup_name($obj_row->versionId)."
\n";
//dataDescription
echo '
Description
',"\n";
@@ -185,7 +185,7 @@ if (!$aClean['id'])
if ($oUser->sEmail)
{
$sSubject = "Application Data Request Report";
- $sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." has been accepted. ";
+ $sMsg = "Your submission of an application data for ".Application::lookup_name($obj_row->appId).Version::lookup_name($obj_row->versionId)." has been accepted. ";
$sMsg .= $aClean['replyText'];
$sMsg .= "We appreciate your help in making the Application Database better for all users.\r\n";
@@ -207,7 +207,7 @@ if (!$aClean['id'])
if ($oUser->sEmail)
{
$sSubject = "Application Data Request Report";
- $sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." was rejected. ";
+ $sMsg = "Your submission of an application data for ".Application::lookup_name($obj_row->appId).Version::lookup_name($obj_row->versionId)." was rejected. ";
$sMsg .= $aClean['replyText'];
mail_appdb($oUser->sEmail, $sSubject ,$sMsg);
}
diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php
index b929afe..34a57aa 100644
--- a/admin/adminAppQueue.php
+++ b/admin/adminAppQueue.php
@@ -115,7 +115,7 @@ function display_move_test_to_versions_table($aVersionsIds,$icurrentVersionId)
echo "
\n";
@@ -302,7 +302,7 @@ if ($aClean['sub'])
{
echo html_frame_start("Potential duplicate versions in the database","90%","",0);
$oAppForVersion = new Application($oVersion->iAppId);
- display_approved_versions($oAppForVersion->aVersionsIds);
+ Version::display_approved($oAppForVersion->aVersionsIds);
echo html_frame_end(" ");
echo html_frame_start("Move test to version","90%","",0);
@@ -456,7 +456,7 @@ else /* if ($aClean['sub']) is not defined, display the main app queue page */
echo "
\n\n";
//show applist
- showAppList($hResult);
+ Application::showList($hResult);
}
@@ -482,7 +482,7 @@ else /* if ($aClean['sub']) is not defined, display the main app queue page */
echo "\n\n";
//show version list
- showVersionList($hResult);
+ Version::showList($hResult);
}
}
diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php
index cfe5108..813a3c2 100644
--- a/admin/adminMaintainers.php
+++ b/admin/adminMaintainers.php
@@ -115,12 +115,12 @@ if ($aClean['sub'])
echo "
\n\n";
$c++;
diff --git a/include/application.php b/include/application.php
index 7193dd3..02ee4c8 100644
--- a/include/application.php
+++ b/include/application.php
@@ -657,65 +657,25 @@ class Application {
echo html_frame_end("For more details and user comments, view the versions of this application.");
// display versions
- display_approved_versions($this->aVersionsIds);
+ Version::display_approved($this->aVersionsIds);
// display bundle
display_bundle($this->iAppId);
}
-}
+ function lookup_name($appId)
+ {
+ if(!$appId) return null;
+ $result = query_parameters("SELECT appName FROM appFamily WHERE appId = '?'",
+ $appId);
+ if(!$result || mysql_num_rows($result) != 1)
+ return null;
+ $ob = mysql_fetch_object($result);
+ return $ob->appName;
+ }
-/*
- * Application functions that are not part of the class
- */
-
-function lookup_version_name($versionId)
-{
- if(!$versionId) return null;
- $result = query_parameters("SELECT versionName FROM appVersion WHERE versionId = '?'",
- $versionId);
- if(!$result || mysql_num_rows($result) != 1)
- return null;
- $ob = mysql_fetch_object($result);
- return $ob->versionName;
-}
-
-
-function lookup_app_name($appId)
-{
- if(!$appId) return null;
- $result = query_parameters("SELECT appName FROM appFamily WHERE appId = '?'",
- $appId);
- if(!$result || mysql_num_rows($result) != 1)
- return null;
- $ob = mysql_fetch_object($result);
- return $ob->appName;
-}
-
-
-/**
- * Remove html formatting from description and extract the first part of the description only.
- * This is to be used for search results, application summary tables, etc.
- */
-function trim_description($sDescription)
-{
- // 1) let's take the first line of the description:
- $aDesc = explode("\n",trim($sDescription),2);
- // 2) maybe it's an html description and lines are separated with or
@@ -756,5 +716,7 @@ function showAppList($hResult)
}
echo "
\n\n";
echo html_frame_end(" ");
+ }
}
+
?>
diff --git a/include/bugs.php b/include/bugs.php
index 0b82036..de2a665 100644
--- a/include/bugs.php
+++ b/include/bugs.php
@@ -198,14 +198,15 @@ class Bug {
if($this->iSubmitterId)
{
$oSubmitter = new User($this->iSubmitterId);
+ $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bRejected)
{
$sSubject = "Submitted Bug Link accepted";
- $sMsg = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been accepted.";
+ $sMsg = "The Bug Link you submitted for ".$sAppName." has been accepted.";
} else
{
$sSubject = "Submitted Bug Link rejected";
- $sMsg = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been rejected.";
+ $sMsg = "The Bug Link you submitted for ".$sAppName." has been rejected.";
}
$sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -217,11 +218,12 @@ class Bug {
function SendNotificationMail($bDeleted=false)
{
+ $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bDeleted)
{
if(!$this->bQueued)
{
- $sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname;
+ $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId)
{
@@ -232,7 +234,7 @@ class Bug {
addmsg("The Bug Link was successfully added into the database.", "green");
} else // Bug Link queued.
{
- $sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This Bug Link has been queued.";
$sMsg .= "\n";
@@ -240,7 +242,7 @@ class Bug {
}
} else // Bug Link deleted.
{
- $sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Bug Link deleted.", "green");
}
diff --git a/include/comment.php b/include/comment.php
index 373910a..181309f 100644
--- a/include/comment.php
+++ b/include/comment.php
@@ -84,7 +84,7 @@ class Comment {
$sEmail.="$value ";
}
- $sSubject = "Comment for '".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)."' added by ".$_SESSION['current']->sRealname;
+ $sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' added by ".$_SESSION['current']->sRealname;
$sMsg = "To reply to this email please use the link provided below.\n";
$sMsg .= "DO NOT reply via your email client as it will not reach the person who wrote the comment\n";
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."&mode=nested#Comment-".$this->iCommentId."\n";
@@ -165,7 +165,7 @@ class Comment {
$sEmail .= $this->oOwner->sEmail;
if($sEmail)
{
- $sSubject = "Comment for '".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?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/monitor.php b/include/monitor.php
index 23f6880..594a59a 100644
--- a/include/monitor.php
+++ b/include/monitor.php
@@ -93,19 +93,25 @@ class Monitor {
function SendNotificationMail($sAction="add",$sMsg=null)
{
+ /* set $aAppName appropriately */
+ if(isset($this->iVersionId))
+ $sAppName = Application::lookup_name($oVersion->iAppId)." ".Version::lookup_name($this->iVersionId);
+ else
+ $sAppName = Application::lookup_name($oVersion->iAppId);
+
switch($sAction)
{
case "add":
if (isset($this->iVersionId))
{
$oVersion = new Version($this->iVersionId);
- $sSubject = "Monitor for ".lookup_app_name($oVersion->iAppId)." ".lookup_version_name($this->iVersionId);
+ $sSubject = "Monitor for ".$sAppName;
$sSubject .= " added: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("You will now recieve an email whenever changes are made to this Application version.", "green");
} else
{
- $sSubject = "Monitor for ".lookup_app_name($this->iAppId)." added: ".$_SESSION['current']->sRealname;
+ $sSubject = "Monitor for ".$sAppName." added: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n";
addmsg("You will now recieve an email whenever changes are made to this Application.", "green");
}
@@ -114,13 +120,13 @@ class Monitor {
if (isset($this->iVersionId))
{
$oVersion = new Version($this->iVersionId);
- $sSubject = "Monitor for ".lookup_app_name($oVersion->iAppId)." ".lookup_version_name($this->iVersionId);
+ $sSubject = "Monitor for ".$sAppName;
$sSubject .= " removed: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("You will no longer recieve an email whenever changes are made to this Application version.", "green");
} else
{
- $sSubject = "Monitor for ".lookup_app_name($this->iAppId)." removed: ".$_SESSION['current']->sRealname;
+ $sSubject = "Monitor for ".$sAppName." removed: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n";
addmsg("You will no longer recieve an email whenever changes are made to this Application.", "green");
}
diff --git a/include/note.php b/include/note.php
index 4511dff..e780946 100644
--- a/include/note.php
+++ b/include/note.php
@@ -125,19 +125,20 @@ class Note {
function SendNotificationMail($sAction="add",$sMsg=null)
{
+ $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
switch($sAction)
{
case "add":
- $sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname;
+ $sSubject = "Note ".$this->sTitle." for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("The note was successfully added into the database.", "green");
break;
case "edit":
- $sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been modified by ".$_SESSION['current']->sRealname;
+ $sSubject = "Note ".$this->sTitle." for ".$sAppName." has been modified by ".$_SESSION['current']->sRealname;
addmsg("Note modified.", "green");
break;
case "delete":
- $sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been deleted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Note ".$this->sTitle." for ".$sAppName." has been deleted by ".$_SESSION['current']->sRealname;
$sMsg .= "This note was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
$sMsg .= "\n";
$sMsg .= "Subject: ".$this->sTitle."\n";
diff --git a/include/screenshot.php b/include/screenshot.php
index b12c05b..c088e8a 100644
--- a/include/screenshot.php
+++ b/include/screenshot.php
@@ -240,15 +240,16 @@ class Screenshot {
if($this->iSubmitterId)
{
+ $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
$oSubmitter = new User($this->iSubmitterId);
if(!$bRejected)
{
$sSubject = "Submitted screenshot accepted";
- $sMsg = "The screenshot you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been accepted.";
+ $sMsg = "The screenshot you submitted for ".$sAppName." has been accepted.";
} else
{
$sSubject = "Submitted screenshot rejected";
- $sMsg = "The screenshot you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been rejected.";
+ $sMsg = "The screenshot you submitted for ".$sAppName." has been rejected.";
}
$sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -260,11 +261,12 @@ class Screenshot {
function mailMaintainers($bDeleted=false)
{
+ $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bDeleted)
{
if(!$this->bQueued)
{
- $sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname;
+ $sSubject = "Screenshot for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId)
{
@@ -275,7 +277,7 @@ class Screenshot {
addmsg("The screenshot was successfully added into the database.", "green");
} else // Screenshot queued.
{
- $sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Screenshot for ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This screenshot has been queued.";
$sMsg .= "\n";
@@ -283,7 +285,7 @@ class Screenshot {
}
} else // Screenshot deleted.
{
- $sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Screenshot for ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Screenshot deleted.", "green");
}
diff --git a/include/sidebar_login.php b/include/sidebar_login.php
index f56ff8d..d62dbb0 100644
--- a/include/sidebar_login.php
+++ b/include/sidebar_login.php
@@ -27,9 +27,9 @@ function global_sidebar_login() {
while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains))
{
if($superMaintainer)
- $g->addmisc("".lookup_app_name($appId)."*", "center");
+ $g->addmisc("".Application::lookup_name($appId)."*", "center");
else
- $g->addmisc("".lookup_app_name($appId)." ".lookup_version_name($versionId)."", "center");
+ $g->addmisc("".Application::lookup_name($appId)." ".Version::lookup_name($versionId)."", "center");
}
}
$appsRejected = $_SESSION['current']->getAllRejectedApps();
diff --git a/include/url.php b/include/url.php
index 9e3ab18..378a379 100644
--- a/include/url.php
+++ b/include/url.php
@@ -185,15 +185,16 @@ class Url {
$aClean['replyText'] = makeSafe($_REQUEST['replyText']);
if($this->iSubmitterId)
{
+ $sAppName = Application::lookup_name($this->appId)." ".Version::lookup_name($this->versionId);
$oSubmitter = new User($this->iSubmitterId);
if(!$bRejected)
{
$sSubject = "Submitted url accepted";
- $sMsg = "The url you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been accepted.";
+ $sMsg = "The url you submitted for ".$sAppName." has been accepted.";
} else
{
$sSubject = "Submitted url rejected";
- $sMsg = "The url you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been rejected.";
+ $sMsg = "The url you submitted for ".$sAppName." has been rejected.";
}
$sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -205,11 +206,12 @@ class Url {
function SendNotificationMail($bDeleted=false)
{
+ $sAppName = Application::lookup_name($this->appId)." ".Version::lookup_name($this->versionId);
if(!$bDeleted)
{
if(!$this->bQueued)
{
- $sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname;
+ $sSubject = "Url for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId)
{
@@ -220,7 +222,7 @@ class Url {
addmsg("The url was successfully added into the database.", "green");
} else // Url queued.
{
- $sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Url for ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This url has been queued.";
$sMsg .= "\n";
@@ -228,7 +230,7 @@ class Url {
}
} else // Url deleted.
{
- $sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname;
+ $sSubject = "Url for ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Url deleted.", "green");
}
diff --git a/include/util.php b/include/util.php
index e9c6881..1fb3142 100644
--- a/include/util.php
+++ b/include/util.php
@@ -271,7 +271,7 @@ function outputTopXRow($oRow)
echo '
\n\n";
@@ -981,4 +981,20 @@ function HtmlAreaLoaderScript($aTextareas)
$outputIndex++; /* increment the output index */
}
+/**
+ * Remove html formatting from description and extract the first part of the description only.
+ * This is to be used for search results, application summary tables, etc.
+ */
+function util_trim_description($sDescription)
+{
+ // 1) let's take the first line of the description:
+ $aDesc = explode("\n",trim($sDescription),2);
+ // 2) maybe it's an html description and lines are separated with or