- improve application and related classes
- use application/version/vendor class in scripts - don't use a full table for queued appication but only one field in the application and version tables - simplify the code in many places
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
/* this class represents an application incl. all versions */
|
||||
/***********************************************************/
|
||||
|
||||
require(BASE."include/version.php");
|
||||
require(BASE."include/vendor.php");
|
||||
require_once(BASE."include/version.php");
|
||||
require_once(BASE."include/vendor.php");
|
||||
|
||||
/**
|
||||
* Application class for handling applications.
|
||||
@@ -19,6 +19,7 @@ class Application {
|
||||
var $sDescription;
|
||||
var $sWebpage;
|
||||
var $bQueued;
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
|
||||
|
||||
@@ -47,6 +48,7 @@ class Application {
|
||||
$this->iVendorId = $oRow->vendorId;
|
||||
$this->iCatId = $oRow->catId;
|
||||
$this->iSubmitterId = $oRow->submitterId;
|
||||
$this->sSubmitTime = $oRow->submitTime;
|
||||
$this->sDate = $oRow->submitTime;
|
||||
$this->sName = $oRow->appName;
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
@@ -104,6 +106,7 @@ class Application {
|
||||
'webPage' => $sWebpage,
|
||||
'vendorId' => $iVendorId,
|
||||
'catId' => $iCatId,
|
||||
'submitterId'=> $_REQUEST['current']->iUserId,
|
||||
'queued' => $this->bQueued ));
|
||||
$sFields = "({$aInsert['FIELDS']})";
|
||||
$sValues = "({$aInsert['VALUES']})";
|
||||
@@ -123,34 +126,36 @@ class Application {
|
||||
/**
|
||||
* Update application.
|
||||
* FIXME: Informs interested people about the modification.
|
||||
* FIXME: tell what changed in the email.
|
||||
* FIXME: get rid of addslashes and use compile_update_string
|
||||
* Returns true on success and false on failure.
|
||||
*/
|
||||
function update($sName=null, $sDescription=null, $sKeywords=null, $sWebpage=null, $iVendorId=null, $iCatId=null)
|
||||
{
|
||||
if ($sName)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET appName = '".$sName."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET appName = '".addslashes($sName)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sName = $sName;
|
||||
}
|
||||
|
||||
if ($sDescription)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET description = '".$sDescription."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET description = '".addslashes($sDescription)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sDescription = $sDescription;
|
||||
}
|
||||
|
||||
if ($sKeywords)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET keywords = '".$sKeywords."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET keywords = '".addslashes($sKeywords)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sKeywords = $sKeywords;
|
||||
}
|
||||
|
||||
if ($sWebpage)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET webPage = '".$sWebpage."' WHERE appId = ".$this->iAppId))
|
||||
if (!query_appdb("UPDATE appFamily SET webPage = '".addslashes($sWebpage)."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->sWebpage = $sWebpage;
|
||||
}
|
||||
@@ -161,6 +166,13 @@ class Application {
|
||||
return false;
|
||||
$this->iVendorId = $iVendorId;
|
||||
}
|
||||
|
||||
if ($iCatId)
|
||||
{
|
||||
if (!query_appdb("UPDATE appFamily SET catId = '".$iCatId."' WHERE appId = ".$this->iAppId))
|
||||
return false;
|
||||
$this->iCatId = $iCatId;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,8 +208,9 @@ class Application {
|
||||
if(!$this->bQueued)
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_insert_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appFamily ".$sUpdate))
|
||||
$sUpdate = compile_update_string(array('queued' => "false",
|
||||
'keywords'=> str_replace(" *** ","",$this->sKeywords) ));
|
||||
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
|
||||
{
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
@@ -258,8 +271,7 @@ class Application {
|
||||
$sSubject = "Application ".$this->sName." deleted by ".$_SESSION['current']->sRealname;
|
||||
addmsg("Application deleted.", "green");
|
||||
}
|
||||
|
||||
$sEmail = get_notify_email_address_list(null, $this->iVersionId);
|
||||
$sEmail = get_notify_email_address_list($this->iAppId);
|
||||
if($sEmail)
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
|
||||
@@ -203,14 +203,16 @@ function make_cat_path($path, $appId = '', $versionId = '')
|
||||
|
||||
if(!empty($appId))
|
||||
{
|
||||
$oApp = new Application($appId);
|
||||
if(!empty($versionId))
|
||||
{
|
||||
$str .= " > ".html_ahref(lookup_app_name($appId),"appview.php?appId=$appId");
|
||||
$str .= " > ".lookup_version_name($versionId);
|
||||
$oVersion = new Version($versionId);
|
||||
$str .= " > ".html_ahref($oApp->sName,"appview.php?appId=$appId");
|
||||
$str .= " > ".$oVersion->sName;
|
||||
}
|
||||
else
|
||||
{
|
||||
$str .= " > ".lookup_app_name($appId);
|
||||
$str .= " > ".$oApp->sName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ function global_sidebar_menu() {
|
||||
$g->add("AppDB Home", BASE);
|
||||
$g->add("Browse Apps", BASE."appbrowse.php");
|
||||
$g->add("Top 25", BASE."votestats.php");
|
||||
$g->add("Submit App", BASE."appsubmit.php");
|
||||
$g->add("Submit App", BASE."appsubmit.php?apptype=1");
|
||||
$g->add("Documentation", BASE."help/");
|
||||
$g->add("Help & Support", BASE."support.php");
|
||||
$g->add("Appdb Stats", BASE."appdbStats.php");
|
||||
|
||||
@@ -128,25 +128,25 @@ function make_maintainer_rating_list($varname, $cvalue)
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued applications */
|
||||
function getQueuedAppCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_apps FROM appQueue";
|
||||
$qstring = "SELECT count(*) as queued_apps FROM appFamily WHERE queued='true'";
|
||||
$result = query_appdb($qstring);
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->queued_apps;
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued appdata */
|
||||
function getQueuedAppDataCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_appdata FROM appDataQueue";
|
||||
$qstring = "SELECT count(*) as queued_appdata FROM appData WHERE queued='true'";
|
||||
$result = query_appdb($qstring);
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->queued_appdata;
|
||||
}
|
||||
|
||||
/* get the number of applications in the appQueue table */
|
||||
/* get the number of queued maintainers */
|
||||
function getQueuedMaintainerCount()
|
||||
{
|
||||
$qstring = "SELECT count(*) as queued_maintainers FROM appMaintainerQueue";
|
||||
|
||||
@@ -13,7 +13,9 @@ class Version {
|
||||
var $sDescription;
|
||||
var $sTestedRelease;
|
||||
var $sTestedRating;
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $sDate;
|
||||
var $aNotesIds; // an array that contains the noteId of every note linked to this version
|
||||
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version
|
||||
var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version
|
||||
@@ -42,6 +44,7 @@ class Version {
|
||||
$this->iVendorId = $oRow->vendorId;
|
||||
$this->iCatId = $oRow->catId;
|
||||
$this->iSubmitterId = $oRow->submitterId;
|
||||
$this->sSubmitTime = $oRow->submitTime;
|
||||
$this->sDate = $oRow->submitTime;
|
||||
$this->sName = $oRow->versionName;
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
@@ -206,8 +209,8 @@ class Version {
|
||||
if(!$this->bQueued)
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_insert_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appVersion ".$sUpdate))
|
||||
$sUpdate = compile_update_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
||||
{
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
|
||||
Reference in New Issue
Block a user