diff --git a/admin/editAppFamily.php b/admin/editAppFamily.php index b8f1ce6..1908692 100644 --- a/admin/editAppFamily.php +++ b/admin/editAppFamily.php @@ -19,7 +19,8 @@ if(!empty($aClean['sSubmit'])) { process_app_version_changes(false); url::processForm($aClean); - util_redirect_and_exit(apidb_fullurl("appview.php?iAppId={$aClean['iAppId']}")); + $oApp = new application($aClean['iAppId']); + util_redirect_and_exit($oApp->objectMakeUrl()); } else // Show the form for editing the Application Family @@ -52,7 +53,7 @@ else // URL editor echo url::outputEditor("editAppFamily.php", NULL, $oApp); - echo html_back_link(1,BASE."appview.php?iAppId=$oApp->iAppId"); + echo html_back_link(1,$oApp->objectMakeUrl()); } apidb_footer(); diff --git a/admin/editAppNote.php b/admin/editAppNote.php index 21cbd62..ad54222 100644 --- a/admin/editAppNote.php +++ b/admin/editAppNote.php @@ -12,6 +12,7 @@ if(!is_numeric($aClean['iNoteId'])) /* Get note data */ $oNote = new Note($aClean['iNoteId']); +$oVersion = new version($oNote->iVersionId); /* Check for privs */ if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->isMaintainer($oNote->iVersionId) && !$_SESSION['current']->isSuperMaintainer($oNote->iAppId)) @@ -29,7 +30,7 @@ if(!empty($aClean['sSub'])) { $oNote->update(); } - util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId={$oNote->iVersionId}")); + util_redirect_and_exit($oVersion->objectMakeUrl()); } else /* display note */ { // show form @@ -53,7 +54,7 @@ if(!empty($aClean['sSub'])) echo '',"\n"; echo ''; - echo html_back_link(1,BASE."appview.php?iVersionId=".$oNote->iVersionId); + echo html_back_link(1,$oVersion->objectMakeUrl()); } apidb_footer(); diff --git a/admin/editAppVersion.php b/admin/editAppVersion.php index b33605e..92c9685 100644 --- a/admin/editAppVersion.php +++ b/admin/editAppVersion.php @@ -18,7 +18,8 @@ if(!empty($aClean['sSubmit'])) process_app_version_changes(true); downloadurl::processForm($aClean); url::processForm($aClean); - util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId'])); + $oVersion = new version($aClean['iVersionId']); + util_redirect_and_exit($oVersion->objectMakeUrl()); } else /* or display the webform for making changes */ { @@ -59,7 +60,7 @@ if(!empty($aClean['sSubmit'])) echo html_frame_end(); } - echo html_back_link(1,BASE."appview.php?iVersionId=".$oVersion->iVersionId); + echo html_back_link(1,$oVersion->objectMakeUrl()); apidb_footer(); } ?> diff --git a/admin/moveAppVersion.php b/admin/moveAppVersion.php index 78dece5..daa69c6 100644 --- a/admin/moveAppVersion.php +++ b/admin/moveAppVersion.php @@ -18,9 +18,10 @@ if(!empty($aClean['sAction'])) $oVersion = new Version($aClean['iVersionId']); $oVersion->iAppId = $aClean['iAppId']; $oVersion->update(); + $oApp = new application($aClean['iAppId']); /* redirect to the application we just moved this version to */ - util_redirect_and_exit(apidb_fullurl("appview.php?iAppId=".$aClean['iAppId'])); + util_redirect_and_exit($oApp->objectMakeUrl()); } else /* or display the webform for making changes */ { ?> @@ -50,12 +51,13 @@ if(!empty($aClean['sAction'])) { /* if the version ids differ then we should start a row with a new application */ /* and the version that matches with it */ - if($currentAppId != $oRow->appId) + if($iCurrentAppId != $oRow->appId) { - $currentAppId = $oRow->appId; + $oApp = new application($oRow->appId); + $iCurrentAppId = $oRow->appId; echo '
The maintainer was successfully added into the database
\n"; - $oApp = new Application($this->iAppId); - $oVersion = new Version($this->iVersionId); //Send Status Email $sEmail = $oUser->sEmail; if ($sEmail) { if($this->iVersionId) - $sURL = APPDB_ROOT."appview.php?iVersionId=$this->iVersionId"; - else - $sURL = APPDB_ROOT."appview.php?iAppId=$this->iAppId"; + { + $oVersion = new Version($this->iVersionId); + $sURL = $oVersion->objectMakeUrl(); + $sName = version::fullName($this->iVersionId); + } else + { + $oApp = new Application($this->iAppId); + $sURL = $oApp->objectMakeUrl(); + $sName = $oApp->sName; + } $sSubject = "Application Maintainer Request Report"; - $sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." has been accepted.\n"; + $sMsg = "Your application to be the maintainer of $sName has been accepted.\n"; $sMsg .= "$sURL\n"; $sMsg .= "$this->sReplyText\n"; $sMsg .= "We appreciate your help in making the Application Database better for all users.\n\n"; diff --git a/include/monitor.php b/include/monitor.php index f7bdec3..a9ecac6 100644 --- a/include/monitor.php +++ b/include/monitor.php @@ -98,41 +98,35 @@ class Monitor { function SendNotificationMail($sAction="add",$sMsg=null) { - /* set $aAppName appropriately */ + /* Set variables depending on whether it is an application or version monitor */ if(isset($this->iVersionId)) - $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId); - else + { + $oVersion = new version($this->iVersionId); + $sAppName = version::fullName($this->iVersionId); + $sUrl = $oVersion->objectMakeUrl(); + $sVersion = " version"; + } else + { + $oApp = new application($this->iAppId); $sAppName = Application::lookup_name($this->iAppId); + $sUrl = $oApp->objectMakeUrl(); + } switch($sAction) { case "add": - if (isset($this->iVersionId)) - { - $sSubject = "Monitor for ".$sAppName; - $sSubject .= " added: ".$_SESSION['current']->sRealname; - $sMsg .= APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; - addmsg("You will now receive an email whenever changes are made to this Application version.", "green"); - } else - { - $sSubject = "Monitor for ".$sAppName." added: ".$_SESSION['current']->sRealname; - $sMsg .= APPDB_ROOT."appview.php?iAppId=".$this->iAppid."\n"; - addmsg("You will now receive an email whenever changes are made to this Application.", "green"); - } + $sSubject = "Monitor for ".$sAppName; + $sSubject .= " added: ".$_SESSION['current']->sRealname; + $sMsg .= "$sUrl\n"; + addmsg("You will now receive an email whenever changes are made ". + "to this application$sVersion.", "green"); break; case "delete": - if (isset($this->iVersionId)) - { - $sSubject = "Monitor for ".$sAppName; - $sSubject .= " removed: ".$_SESSION['current']->sRealname; - $sMsg .= APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; - addmsg("You will no longer receive an email whenever changes are made to this Application version.", "green"); - } else - { - $sSubject = "Monitor for ".$sAppName." removed: ".$_SESSION['current']->sRealname; - $sMsg .= APPDB_ROOT."appview.php?iAppId=".$this->iAppid."\n"; - addmsg("You will no longer receive an email whenever changes are made to this Application.", "green"); - } + $sSubject = "Monitor for ".$sAppName; + $sSubject .= " removed: ".$_SESSION['current']->sRealname; + $sMsg .= "$sUrl\n"; + addmsg("You will no longer receive an email whenever changes ". + "are made to this application$sVersion.", "green"); break; } $sEmail = User::get_notify_email_address_list(null, $this->iVersionId); diff --git a/include/note.php b/include/note.php index d44cb00..18408b0 100644 --- a/include/note.php +++ b/include/note.php @@ -137,21 +137,25 @@ class Note { function SendNotificationMail($sAction="add",$sMsg=null) { - $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId); + $oVersion = new version($this->iVersionId); + $sAppName = version::fullName($this->iVersionId); + $sMsg = $oVersion->objectMakeUrl()."\n"; switch($sAction) { case "add": - $sSubject = "Note ".$this->sTitle." for ".$sAppName." added by ".$_SESSION['current']->sRealname; - $sMsg .= APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Note $this->sTitle for $sAppName added by ". + $_SESSION['current']->sRealname; addmsg("The note was successfully added into the database.", "green"); break; case "edit": - $sSubject = "Note ".$this->sTitle." for ".$sAppName." 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": $oSubmitter = new User($this->iSubmitterId); - $sSubject = "Note ".$this->sTitle." for ".$sAppName." 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 ".print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime))." by ".$oSubmitter->sRealname."\n"; $sMsg .= "\n"; $sMsg .= "Subject: ".$this->sTitle."\n"; diff --git a/include/screenshot.php b/include/screenshot.php index 7b8ad5b..67be68a 100644 --- a/include/screenshot.php +++ b/include/screenshot.php @@ -331,32 +331,37 @@ class Screenshot { function mailMaintainers($bDeleted=false) { - $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId); + $oVersion = new version($this->iVersionId); + $sAppName = version::fullName($this->iVersionId); + $sMsg = $oVersion->objectMakeUrl()."\n"; if(!$bDeleted) { if(!$this->bQueued) { - $sSubject = "Screenshot for ".$sAppName." added by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Screenshot for $sAppName added by ". + $_SESSION['current']->sRealname; if($this->iSubmitterId) { $oSubmitter = new User($this->iSubmitterId); - $sMsg .= "This screenshot has been submitted by ".$oSubmitter->sRealname."."; + $sMsg .= "This screenshot has been submitted by ". + $oSubmitter->sRealname."."; $sMsg .= "\n"; } - addmsg("The screenshot was successfully added into the database.", "green"); + addmsg("The screenshot was successfully added into the database.", + "green"); } else // Screenshot queued. { - $sSubject = "Screenshot for ".$sAppName." submitted by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Screenshot for $sAppName submitted by ". + $_SESSION['current']->sRealname; $sMsg .= "This screenshot has been queued."; $sMsg .= "\n"; - addmsg("The screenshot you submitted will be added to the database database after being reviewed.", "green"); + addmsg("The screenshot you submitted will be added to the ". + "database after being reviewed.", "green"); } } else // Screenshot deleted. { - $sSubject = "Screenshot for ".$sAppName." deleted by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Screenshot for $sAppName deleted by ". + $_SESSION['current']->sRealname; addmsg("Screenshot deleted.", "green"); } diff --git a/include/testData.php b/include/testData.php index 18b037a..e257578 100644 --- a/include/testData.php +++ b/include/testData.php @@ -255,28 +255,35 @@ class testData{ /* Get the full app/version name to display */ $sName = version::fullName($this->iVersionId); + $oVersion = new version($this->iVersionId); + switch($sAction) { case "add": $sSubject = "Submitted testing data accepted"; - $sMsg = "The testing data you submitted for '$sName' has been accepted by ".$_SESSION['current']->sRealname."."; - $sMsg .= APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."&iTestingId=".$this->iTestingId."\n"; + $sMsg = "The testing data you submitted for '$sName' has been ". + "accepted by ".$_SESSION['current']->sRealname."."; + $sMsg .= $oVersion->objectMakeUrl()."&iTestingId=".$this->iTestingId."\n"; $sMsg .= "Administrators Responce:\n"; break; case "reject": $sSubject = "Submitted testing data rejected"; - $sMsg = "The testing data you submitted for '$sName' has been rejected by ".$_SESSION['current']->sRealname."."; - $sMsg .= APPDB_ROOT."testResults.php?sSub=view&iTestingId=".$this->iTestingId."\n"; + $sMsg = "The testing data you submitted for '$sName' has ". + "been rejected by ".$_SESSION['current']->sRealname."."; + $sMsg .= APPDB_ROOT."testResults.php?sSub=view&iTestingId=". + $this->iTestingId."\n"; $sMsg .= "Reason given:\n"; break; case "delete": $sSubject = "Submitted testing data deleted"; - $sMsg = "The testing data you submitted for '$sName' has been deleted by ".$_SESSION['current']->sRealname."."; + $sMsg = "The testing data you submitted for '$sName' has ". + "been deleted by ".$_SESSION['current']->sRealname."."; $sMsg .= "Reason given:\n"; break; } $sMsg .= $aClean['sReplyText']."\n"; - $sMsg .= "We appreciate your help in making the Application Database better for all users."; + $sMsg .= "We appreciate your help in making the Application ". + "Database better for all users."; mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg); } @@ -289,7 +296,7 @@ class testData{ $oVersion = new Version($this->iVersionId); $oApp = new Application($oVersion->iAppId); - $sBacklink = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."&iTestingId=".$this->iTestingId."\n"; + $sBacklink = $oVersion->objectMakeUrl()."&iTestingId=".$this->iTestingId."\n"; switch($sAction) { @@ -666,7 +673,7 @@ class testData{ for($i = 1; $oRow = mysql_fetch_object($hResult); $i++) $sReturn .= html_tr(array( - "versionId\">$oRow->appName: $oRow->versionName", + version::fullNameLink($oRow->versionId), $oRow->testedRating, $oRow->testedRelease, print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))), diff --git a/include/url.php b/include/url.php index b66342e..7f87ea2 100644 --- a/include/url.php +++ b/include/url.php @@ -213,13 +213,25 @@ class Url { function SendNotificationMail($bDeleted=false) { - $sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId); + /* Set variables depending on whether the url is for an app or version */ + if($this->iVersionId) + { + $oVersion = new version($this->iVersionId); + $sAppName = version::fullName($this->iVersionId); + $sUrl = $oVersion->objectMakeUrl(); + } else + { + $oApp = new application($this->iAppId); + $sAppName = $oApp->sName; + $sUrl = $oApp->objectMakeUrl(); + } + if(!$bDeleted) { if(!$this->bQueued) { - $sSubject = "Url for ".$sAppName." added by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Url for $sAppName added by ".$_SESSION['current']->sRealname; + $sMsg = "$sUrl\n"; if($this->iSubmitterId) { $oSubmitter = new User($this->iSubmitterId); @@ -229,16 +241,18 @@ class Url { addmsg("The url was successfully added into the database.", "green"); } else // Url queued. { - $sSubject = "Url for ".$sAppName." submitted by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Url for $sAppName submitted by ". + $_SESSION['current']->sRealname; + $sMsg = "$sUrl\n"; $sMsg .= "This url has been queued."; $sMsg .= "\n"; - addmsg("The url you submitted will be added to the database database after being reviewed.", "green"); + addmsg("The url you submitted will be added to the database ". + "database after being reviewed.", "green"); } } else // Url deleted. { - $sSubject = "Url for ".$sAppName." deleted by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n"; + $sSubject = "Url for $sAppName deleted by ".$_SESSION['current']->sRealname; + $sMsg = "$sUrl\n"; addmsg("Url deleted.", "green"); } @@ -425,8 +439,8 @@ class Url { $_SESSION['current']->sRealname; $sMsg = $aValues["iVersionId"] ? - APPDB_ROOT."appview.php?iVersionId=".$aValues['iVersionId'] : - APPDB_ROOT."appview.php?iAppId=".$avalues["iAppid"]; + $oVersion->objectMakeUrl() : + $oApp->objectMakeUrl(); $sMsg .= "\n\n"; $sMsg .= "The following changed were made\n\n"; $sMsg .= "$sWhatChanged\n\n"; diff --git a/include/util.php b/include/util.php index 2a99101..fe3465d 100644 --- a/include/util.php +++ b/include/util.php @@ -243,10 +243,9 @@ function outputTopXRow($oRow) $oVersion = new Version($oRow->versionId); $oApp = new Application($oVersion->iAppId); $img = Screenshot::get_random_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting - html_tr_highlight_clickable('appview.php?iVersionId='.$oRow->versionId, "white", "#f0f6ff", "white"); + html_tr_highlight_clickable($oVersion->objectMakeUrl(), "white", "#f0f6ff", "white"); echo ' -