diff --git a/include/version.php b/include/version.php index 8ab8219..0776658 100644 --- a/include/version.php +++ b/include/version.php @@ -12,6 +12,12 @@ require_once(BASE."include/util.php"); require_once(BASE."include/testData.php"); require_once(BASE."include/downloadurl.php"); +define("LICENSE_OPENSOURCE", "Open Source"); +define("LICENSE_FREEWARE", "Freeware"); +define("LICENSE_SHAREWARE", "Shareware"); +define("LICENSE_DEMO", "Demo"); +define("LICENSE_RETAIL", "Retail"); + /** * Version class for handling versions. */ @@ -26,6 +32,7 @@ class Version { var $iSubmitterId; var $sDate; var $sQueued; + var $sLicense; var $iMaintainerRequest; /* Temporary variable for version submisson. Indicates whether the user wants to become a maintainer of the version being submitted. @@ -62,6 +69,7 @@ class Version { $this->sTestedRelease = $oRow->maintainer_release; $this->sTestedRating = $oRow->maintainer_rating; $this->sQueued = $oRow->queued; + $this->sLicense = $oRow->license; } } } @@ -82,12 +90,14 @@ class Version { else $this->sQueued = 'false'; - $hResult = query_parameters("INSERT INTO appVersion (versionName, description, maintainer_release,". - "maintainer_rating, appId, submitterId, queued) VALUES ". - "('?', '?', '?', '?', '?', '?', '?')", - $this->sName, $this->sDescription, $this->sTestedRelease, - $this->sTestedRating, $this->iAppId, $_SESSION['current']->iUserId, - $this->sQueued); + $hResult = query_parameters("INSERT INTO appVersion + (versionName, description, maintainer_release, + maintainer_rating, appId, submitterId, queued, license) + VALUES ('?', '?', '?', '?', '?', '?', '?', '?')", + $this->sName, $this->sDescription, $this->sTestedRelease, + $this->sTestedRating, $this->iAppId, + $_SESSION['current']->iUserId, $this->sQueued, + $this->sLicense); if($hResult) { @@ -183,6 +193,17 @@ class Version { $sWhatChanged .= "Version was moved from application ".$oAppBefore->sName." to application ".$oAppAfter->sName.".\n\n"; } + if ($this->sLicense && ($this->sLicense!=$oVersion->sLicense)) + { + if(!query_parameters("UPDATE appVersion SET license = '?' + WHERE versionId = '?'", + $this->sLicense, $this->iVersionId)) + return FALSE; + + $sWhatChanged .= "License was changed from $oVersion->sLicense to". + "$this->sLicense.\n\n"; + } + if($sWhatChanged and !$bSilent) $this->SendNotificationMail("edit",$sWhatChanged); return true; @@ -585,6 +606,11 @@ class Version { echo 'Version name',"\n"; echo '',"\n"; + // version license + echo html_tr(array( + array("License", "class=\"color0\""), + $this->MakeLicenseList())); + // version description echo 'Version description',"\n"; echo '