Unit tests should run with E_ALL so we can detect all errors. Fix dozens of errors that popped up after enabling all errors.
This commit is contained in:
@@ -49,17 +49,20 @@ class Application {
|
|||||||
if($hResult = query_parameters($sQuery, $iAppId))
|
if($hResult = query_parameters($sQuery, $iAppId))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iAppId = $iAppId;
|
if($oRow)
|
||||||
$this->iVendorId = $oRow->vendorId;
|
{
|
||||||
$this->iCatId = $oRow->catId;
|
$this->iAppId = $iAppId;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iVendorId = $oRow->vendorId;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->iCatId = $oRow->catId;
|
||||||
$this->sDate = $oRow->submitTime;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
$this->sName = $oRow->appName;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->sKeywords = $oRow->keywords;
|
$this->sDate = $oRow->submitTime;
|
||||||
$this->sDescription = $oRow->description;
|
$this->sName = $oRow->appName;
|
||||||
$this->sWebpage = $oRow->webPage;
|
$this->sKeywords = $oRow->keywords;
|
||||||
$this->sQueued = $oRow->queued;
|
$this->sDescription = $oRow->description;
|
||||||
|
$this->sWebpage = $oRow->webPage;
|
||||||
|
$this->sQueued = $oRow->queued;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fetch versions of this application, if there are any */
|
/* fetch versions of this application, if there are any */
|
||||||
@@ -404,7 +407,10 @@ class Application {
|
|||||||
{
|
{
|
||||||
$aClean = array(); //array of filtered user input
|
$aClean = array(); //array of filtered user input
|
||||||
|
|
||||||
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
if(isset($_REQUEST['sReplyText']))
|
||||||
|
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
||||||
|
else
|
||||||
|
$aClean['sReplyText'] = "";
|
||||||
|
|
||||||
switch($sAction)
|
switch($sAction)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ class Category {
|
|||||||
if($hResult = query_parameters($sQuery, $iCatId))
|
if($hResult = query_parameters($sQuery, $iCatId))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iCatId = $iCatId;
|
if($oRow)
|
||||||
$this->iParentId = $oRow->catParent;
|
{
|
||||||
$this->sName = $oRow->catName;
|
$this->iCatId = $iCatId;
|
||||||
$this->sDescription = $oRow->catDescription;
|
$this->iParentId = $oRow->catParent;
|
||||||
|
$this->sName = $oRow->catName;
|
||||||
|
$this->sDescription = $oRow->catDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -32,13 +32,16 @@ class distribution{
|
|||||||
if($hResult = query_parameters($sQuery, $iDistributionId))
|
if($hResult = query_parameters($sQuery, $iDistributionId))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iDistributionId = $iDistributionId;
|
if($oRow)
|
||||||
$this->sName = $oRow->name;
|
{
|
||||||
$this->sDescription = $oRow->description;
|
$this->iDistributionId = $iDistributionId;
|
||||||
$this->sUrl = $oRow->url;
|
$this->sName = $oRow->name;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sDescription = $oRow->description;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->sUrl = $oRow->url;
|
||||||
$this->sQueued = $oRow->queued;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
|
$this->sQueued = $oRow->queued;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define(ERROR_SQL, "sql_error");
|
define("ERROR_SQL", "sql_error");
|
||||||
define(ERROR_GENERAL, "general_error");
|
define("ERROR_GENERAL", "general_error");
|
||||||
|
|
||||||
class error_log
|
class error_log
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Image {
|
|||||||
$this->iHeight = $oInfo[1];
|
$this->iHeight = $oInfo[1];
|
||||||
$this->iType = $oInfo[2];
|
$this->iType = $oInfo[2];
|
||||||
|
|
||||||
$this->set_debuglog("New image class created with as $sFile as"
|
$this->set_debuglog("New image class created with as $this->sFile as"
|
||||||
." file and {$oInfo[2]} as type. Dimensions"
|
." file and {$oInfo[2]} as type. Dimensions"
|
||||||
." {$oInfo[0]}x{$oInfo[1]}");
|
." {$oInfo[0]}x{$oInfo[1]}");
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ class Image {
|
|||||||
$iNewWidth,$iNewHeight,$this->iWidth,$this->iHeight);
|
$iNewWidth,$iNewHeight,$this->iWidth,$this->iHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->set_debuglog("imagecopyresized($new,$this->oImage,0,0,0,0,$iNewWidth,"
|
$this->set_debuglog("imagecopyresized($oNewImage,$this->oImage,0,0,0,0,$iNewWidth,"
|
||||||
."$iNewHeight,$this->iWidth,$this->iHeight);");
|
."$iNewHeight,$this->iWidth,$this->iHeight);");
|
||||||
imagedestroy($this->oImage);
|
imagedestroy($this->oImage);
|
||||||
$this->oImage = $oNewImage;
|
$this->oImage = $oNewImage;
|
||||||
@@ -231,7 +231,6 @@ class Image {
|
|||||||
*/
|
*/
|
||||||
function resize_image_border($sBorderColor, $iBorderWidth, $iNewHeight, $iNewWidth)
|
function resize_image_border($sBorderColor, $iBorderWidth, $iNewHeight, $iNewWidth)
|
||||||
{
|
{
|
||||||
|
|
||||||
$r = hexdec(substr($sBorderColor, 1, 2));
|
$r = hexdec(substr($sBorderColor, 1, 2));
|
||||||
$g = hexdec(substr($sBorderColor, 3, 2));
|
$g = hexdec(substr($sBorderColor, 3, 2));
|
||||||
$b = hexdec(substr($sBorderColor, 5, 2));
|
$b = hexdec(substr($sBorderColor, 5, 2));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
// get modules
|
// get modules
|
||||||
ini_set("memory_limit","64M");
|
ini_set("memory_limit","64M");
|
||||||
require(BASE."include/config.php");
|
require_once(BASE."include/config.php");
|
||||||
require(BASE."include/util.php");
|
require(BASE."include/util.php");
|
||||||
require(BASE."include/user.php");
|
require(BASE."include/user.php");
|
||||||
require(BASE."include/session.php");
|
require(BASE."include/session.php");
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once(BASE."include/config.php");
|
||||||
|
|
||||||
function mail_appdb($sEmailList,$sSubject,$sMsg)
|
function mail_appdb($sEmailList,$sSubject,$sMsg)
|
||||||
{
|
{
|
||||||
$sHeaders = "MIME-Version: 1.0\r\n";
|
$sHeaders = "MIME-Version: 1.0\r\n";
|
||||||
|
|||||||
@@ -24,14 +24,17 @@ class maintainer
|
|||||||
if($hResult)
|
if($hResult)
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iMaintainerId = $oRow->maintainerId;
|
if($oRow)
|
||||||
$this->iAppId = $oRow->appId;
|
{
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iMaintainerId = $oRow->maintainerId;
|
||||||
$this->iUserId = $oRow->userId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->sMaintainReason = $oRow->maintainReason;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->bSuperMaintainer = $oRow->superMaintainer;
|
$this->iUserId = $oRow->userId;
|
||||||
$this->aSubmitTime = $oRow->submitTime;
|
$this->sMaintainReason = $oRow->maintainReason;
|
||||||
$this->bQueued = $oRow->queued;
|
$this->bSuperMaintainer = $oRow->superMaintainer;
|
||||||
|
$this->aSubmitTime = $oRow->submitTime;
|
||||||
|
$this->bQueued = $oRow->queued;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +76,8 @@ class maintainer
|
|||||||
{
|
{
|
||||||
$sStatusMessage = "<p>The maintainer was successfully added into the database</p>\n";
|
$sStatusMessage = "<p>The maintainer was successfully added into the database</p>\n";
|
||||||
|
|
||||||
$oApp = new Application($iAppId);
|
$oApp = new Application($this->iAppId);
|
||||||
$oVersion = new Version($iVersionId);
|
$oVersion = new Version($this->iVersionId);
|
||||||
//Send Status Email
|
//Send Status Email
|
||||||
$sEmail = $oUser->sEmail;
|
$sEmail = $oUser->sEmail;
|
||||||
if ($sEmail)
|
if ($sEmail)
|
||||||
|
|||||||
@@ -26,11 +26,13 @@ class Monitor {
|
|||||||
WHERE monitorId = '".$iMonitorId."'";
|
WHERE monitorId = '".$iMonitorId."'";
|
||||||
$hResult = query_appdb($sQuery);
|
$hResult = query_appdb($sQuery);
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iMonitorId = $oRow->monitorId;
|
if($oRow)
|
||||||
$this->iAppId = $oRow->appId;
|
{
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iMonitorId = $oRow->monitorId;
|
||||||
$this->iUserId = $oRow->userId;
|
$this->iAppId = $oRow->appId;
|
||||||
|
$this->iVersionId = $oRow->versionId;
|
||||||
|
$this->iUserId = $oRow->userId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,10 @@ require_once(BASE."include/util.php");
|
|||||||
require_once(BASE."include/version.php");
|
require_once(BASE."include/version.php");
|
||||||
|
|
||||||
$aClean = array(); //array of filtered user input
|
$aClean = array(); //array of filtered user input
|
||||||
$aClean['sReplyText'] = makeSafe( $_REQUEST['sReplyText'] );
|
if(isset($_REQUEST['sReplyText']))
|
||||||
|
$aClean['sReplyText'] = makeSafe( $_REQUEST['sReplyText'] );
|
||||||
|
else
|
||||||
|
$aClean['sReplyText'] = "";
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
/* note class and related functions */
|
/* note class and related functions */
|
||||||
@@ -34,11 +37,14 @@ class Note {
|
|||||||
AND noteId = '?'";
|
AND noteId = '?'";
|
||||||
$hResult = query_parameters($sQuery, $iNoteId);
|
$hResult = query_parameters($sQuery, $iNoteId);
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iNoteId = $oRow->noteId;
|
if($oRow)
|
||||||
$this->iAppId = $oRow->appId;
|
{
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iNoteId = $oRow->noteId;
|
||||||
$this->sTitle = $oRow->noteTitle;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->sDescription = $oRow->noteDesc;
|
$this->iVersionId = $oRow->versionId;
|
||||||
|
$this->sTitle = $oRow->noteTitle;
|
||||||
|
$this->sDescription = $oRow->noteDesc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
$hAppdbLink = null;
|
$hAppdbLink = null;
|
||||||
$hBugzillaLink = null;
|
$hBugzillaLink = null;
|
||||||
|
|
||||||
define(MYSQL_DEADLOCK_ERRNO, 1213);
|
define("MYSQL_DEADLOCK_ERRNO", 1213);
|
||||||
|
|
||||||
function query_appdb($sQuery,$sComment="")
|
function query_appdb($sQuery,$sComment="")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,14 +40,17 @@ class Screenshot {
|
|||||||
if($hResult)
|
if($hResult)
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iScreenshotId = $iScreenshotId;
|
if($oRow)
|
||||||
$this->sDescription = $oRow->description;
|
{
|
||||||
$this->iAppId = $oRow->appId;
|
$this->iScreenshotId = $iScreenshotId;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->sDescription = $oRow->description;
|
||||||
$this->sUrl = $oRow->url;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->bQueued = ($oRow->queued=="true")?true:false;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sUrl = $oRow->url;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->bQueued = ($oRow->queued=="true")?true:false;
|
||||||
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* the number of days a session cookie is flaged to last */
|
/* the number of days a session cookie is flaged to last */
|
||||||
define(SESSION_DAYS_TO_EXPIRE, 2);
|
define("SESSION_DAYS_TO_EXPIRE", 2);
|
||||||
|
|
||||||
class session
|
class session
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,10 @@ class session
|
|||||||
$result = query_parameters("SELECT data FROM session_list WHERE session_id = '?'", $key);
|
$result = query_parameters("SELECT data FROM session_list WHERE session_id = '?'", $key);
|
||||||
if (!$result) { return null; }
|
if (!$result) { return null; }
|
||||||
$oRow = mysql_fetch_object($result);
|
$oRow = mysql_fetch_object($result);
|
||||||
return $oRow->data;
|
if($oRow)
|
||||||
|
return $oRow->data;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write session to DB
|
// write session to DB
|
||||||
|
|||||||
@@ -38,21 +38,24 @@ class testData{
|
|||||||
if($hResult = query_parameters($sQuery, $iTestingId))
|
if($hResult = query_parameters($sQuery, $iTestingId))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iTestingId = $oRow->testingId;
|
if($oRow)
|
||||||
$this->iVersionId = $oRow->versionId;
|
{
|
||||||
$this->sWhatWorks = $oRow->whatWorks;
|
$this->iTestingId = $oRow->testingId;
|
||||||
$this->sWhatDoesnt = $oRow->whatDoesnt;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sWhatNotTested = $oRow->whatNotTested;
|
$this->sWhatWorks = $oRow->whatWorks;
|
||||||
$this->sTestedDate = $oRow->testedDate;
|
$this->sWhatDoesnt = $oRow->whatDoesnt;
|
||||||
$this->iDistributionId = $oRow->distributionId;
|
$this->sWhatNotTested = $oRow->whatNotTested;
|
||||||
$this->sTestedRelease = $oRow->testedRelease;
|
$this->sTestedDate = $oRow->testedDate;
|
||||||
$this->sInstalls = $oRow->installs;
|
$this->iDistributionId = $oRow->distributionId;
|
||||||
$this->sRuns = $oRow->runs;
|
$this->sTestedRelease = $oRow->testedRelease;
|
||||||
$this->sTestedRating = $oRow->testedRating;
|
$this->sInstalls = $oRow->installs;
|
||||||
$this->sComments = $oRow->comments;
|
$this->sRuns = $oRow->runs;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sTestedRating = $oRow->testedRating;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->sComments = $oRow->comments;
|
||||||
$this->sQueued = $oRow->queued;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
|
$this->sQueued = $oRow->queued;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ require_once(BASE."include/version.php");
|
|||||||
require_once(BASE."include/maintainer.php");
|
require_once(BASE."include/maintainer.php");
|
||||||
require_once(BASE."include/util.php");
|
require_once(BASE."include/util.php");
|
||||||
|
|
||||||
define(SUCCESS, 0);
|
define("SUCCESS", 0);
|
||||||
define(USER_CREATE_EXISTS, 1);
|
define("USER_CREATE_EXISTS", 1);
|
||||||
define(USER_CREATE_FAILED, 2);
|
define("USER_CREATE_FAILED", 2);
|
||||||
define(USER_LOGIN_FAILED, 3);
|
define("USER_LOGIN_FAILED", 3);
|
||||||
define(USER_UPDATE_FAILED, 4);
|
define("USER_UPDATE_FAILED", 4);
|
||||||
define(USER_UPDATE_FAILED_EMAIL_EXISTS, 5); /* user updating to an email address that is already in use */
|
define("USER_UPDATE_FAILED_EMAIL_EXISTS", 5); /* user updating to an email address that is already in use */
|
||||||
define(USER_UPDATE_FAILED_NOT_LOGGED_IN, 6); /* user::update() called but user not logged in */
|
define("USER_UPDATE_FAILED_NOT_LOGGED_IN", 6); /* user::update() called but user not logged in */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User class for handling users
|
* User class for handling users
|
||||||
@@ -41,13 +41,16 @@ class User {
|
|||||||
WHERE userId = '?'";
|
WHERE userId = '?'";
|
||||||
$hResult = query_parameters($sQuery, $iUserId);
|
$hResult = query_parameters($sQuery, $iUserId);
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iUserId = $oRow->userid;
|
if($oRow)
|
||||||
$this->sEmail = $oRow->email;
|
{
|
||||||
$this->sRealname = $oRow->realname;
|
$this->iUserId = $oRow->userid;
|
||||||
$this->sStamp = $oRow->stamp;
|
$this->sEmail = $oRow->email;
|
||||||
$this->sDateCreated = $oRow->created;
|
$this->sRealname = $oRow->realname;
|
||||||
$this->sWineRelease = $oRow->CVSrelease;
|
$this->sStamp = $oRow->stamp;
|
||||||
$this->bInactivityWarned = $oRow->inactivity_warned;
|
$this->sDateCreated = $oRow->created;
|
||||||
|
$this->sWineRelease = $oRow->CVSrelease;
|
||||||
|
$this->bInactivityWarned = $oRow->inactivity_warned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this->isLoggedIn();
|
return $this->isLoggedIn();
|
||||||
}
|
}
|
||||||
@@ -65,12 +68,16 @@ class User {
|
|||||||
$hResult = query_parameters($sQuery, $sEmail, $sPassword);
|
$hResult = query_parameters($sQuery, $sEmail, $sPassword);
|
||||||
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iUserId = $oRow->userid;
|
if($oRow)
|
||||||
$this->sEmail = $oRow->email;
|
{
|
||||||
$this->sRealname = $oRow->realname;
|
$this->iUserId = $oRow->userid;
|
||||||
$this->sStamp = $oRow->stamp;
|
$this->sEmail = $oRow->email;
|
||||||
$this->sDateCreated = $oRow->created;
|
$this->sRealname = $oRow->realname;
|
||||||
$this->sWineRelease = $oRow->CVSrelease;
|
$this->sStamp = $oRow->stamp;
|
||||||
|
$this->sDateCreated = $oRow->created;
|
||||||
|
$this->sWineRelease = $oRow->CVSrelease;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->isLoggedIn())
|
if($this->isLoggedIn())
|
||||||
{
|
{
|
||||||
// Update timestamp and clear the inactivity flag if it was set
|
// Update timestamp and clear the inactivity flag if it was set
|
||||||
@@ -740,13 +747,19 @@ class User {
|
|||||||
while($oRow = mysql_fetch_object($hResult))
|
while($oRow = mysql_fetch_object($hResult))
|
||||||
{
|
{
|
||||||
$i = array_search($oRow->userid, $aUserId);
|
$i = array_search($oRow->userid, $aUserId);
|
||||||
if ($aUserId[$i] != array($oRow->userid))
|
|
||||||
|
// if we didn't find this entry in the $aUserId
|
||||||
|
// array then we should add it
|
||||||
|
if($i === false)
|
||||||
{
|
{
|
||||||
$aUserId[$c] = array($oRow->userid);
|
$aUserId[$c] = array($oRow->userid);
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go through the email entries and only add the emails for the users
|
||||||
|
// that want to receive it
|
||||||
if ($c > 0)
|
if ($c > 0)
|
||||||
{
|
{
|
||||||
while(list($index, list($userIdValue)) = each($aUserId))
|
while(list($index, list($userIdValue)) = each($aUserId))
|
||||||
@@ -756,6 +769,7 @@ class User {
|
|||||||
$retval .= $oUser->sEmail." ";
|
$retval .= $oUser->sEmail." ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,19 +45,19 @@ class Version {
|
|||||||
if($hResult = query_parameters($sQuery, $iVersionId))
|
if($hResult = query_parameters($sQuery, $iVersionId))
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iVersionId = $iVersionId;
|
if($oRow)
|
||||||
$this->iAppId = $oRow->appId;
|
{
|
||||||
$this->iCatId = $oRow->catId;
|
$this->iVersionId = $iVersionId;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
$this->sDate = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->sName = $oRow->versionName;
|
$this->sDate = $oRow->submitTime;
|
||||||
$this->sKeywords = $oRow->keywords;
|
$this->sName = $oRow->versionName;
|
||||||
$this->sDescription = $oRow->description;
|
$this->sDescription = $oRow->description;
|
||||||
$this->sTestedRelease = $oRow->maintainer_release;
|
$this->sTestedRelease = $oRow->maintainer_release;
|
||||||
$this->sTestedRating = $oRow->maintainer_rating;
|
$this->sTestedRating = $oRow->maintainer_rating;
|
||||||
$this->sWebpage = $oRow->webPage;
|
$this->sQueued = $oRow->queued;
|
||||||
$this->sQueued = $oRow->queued;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,12 @@ class Version {
|
|||||||
function mailSubmitter($sAction="add")
|
function mailSubmitter($sAction="add")
|
||||||
{
|
{
|
||||||
$aClean = array(); //array of filtered user input
|
$aClean = array(); //array of filtered user input
|
||||||
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
|
||||||
|
// use 'sReplyText' if it is defined, otherwise define the value as an empty string
|
||||||
|
if(isset($_REQUEST['sReplyText']))
|
||||||
|
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
||||||
|
else
|
||||||
|
$aClean['sReplyText'] = "";
|
||||||
|
|
||||||
if($this->iSubmitterId)
|
if($this->iSubmitterId)
|
||||||
{
|
{
|
||||||
@@ -403,12 +408,12 @@ class Version {
|
|||||||
switch($sAction)
|
switch($sAction)
|
||||||
{
|
{
|
||||||
case "add":
|
case "add":
|
||||||
$sSubject = "Submitted version accepted";
|
$sSubject = "Submitted version accepted";
|
||||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted by ".$_SESSION['current']->sRealname.".";
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted by ".$_SESSION['current']->sRealname.".";
|
||||||
$sMsg .= "Administrators Responce:\n";
|
$sMsg .= "Administrators Responce:\n";
|
||||||
break;
|
break;
|
||||||
case "reject":
|
case "reject":
|
||||||
$sSubject = "Submitted version rejected";
|
$sSubject = "Submitted version rejected";
|
||||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected by ".$_SESSION['current']->sRealname.".";
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected by ".$_SESSION['current']->sRealname.".";
|
||||||
$sMsg .= "Clicking on the link in this email will allow you to modify and resubmit the version. ";
|
$sMsg .= "Clicking on the link in this email will allow you to modify and resubmit the version. ";
|
||||||
$sMsg .= "A link to your queue of applications and versions will also show up on the left hand side of the Appdb site once you have logged in. ";
|
$sMsg .= "A link to your queue of applications and versions will also show up on the left hand side of the Appdb site once you have logged in. ";
|
||||||
@@ -416,7 +421,7 @@ class Version {
|
|||||||
$sMsg .= "Reason given:\n";
|
$sMsg .= "Reason given:\n";
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
$sSubject = "Submitted version deleted";
|
$sSubject = "Submitted version deleted";
|
||||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted by ".$_SESSION['current']->sRealname.".";
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted by ".$_SESSION['current']->sRealname.".";
|
||||||
$sMsg .= "Reason given:\n";
|
$sMsg .= "Reason given:\n";
|
||||||
break;
|
break;
|
||||||
@@ -432,7 +437,12 @@ class Version {
|
|||||||
function SendNotificationMail($sAction="add",$sMsg=null)
|
function SendNotificationMail($sAction="add",$sMsg=null)
|
||||||
{
|
{
|
||||||
$aClean = array(); //array of filtered user input
|
$aClean = array(); //array of filtered user input
|
||||||
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
|
||||||
|
// use 'sReplyText' if it is defined, otherwise define the value as an empty string
|
||||||
|
if(isset($_REQUEST['sReplyText']))
|
||||||
|
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
|
||||||
|
else
|
||||||
|
$aClean['sReplyText'] = "";
|
||||||
|
|
||||||
$oApp = new Application($this->iAppId);
|
$oApp = new Application($this->iAppId);
|
||||||
switch($sAction)
|
switch($sAction)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/* TODO: test the rest of the classes we have */
|
/* TODO: test the rest of the classes we have */
|
||||||
|
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
include_once("test_user.php");
|
include_once("test_user.php");
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ function test_application_getWithRating()
|
|||||||
$iItemsPerPage = 50;
|
$iItemsPerPage = 50;
|
||||||
$iOffset = 0;
|
$iOffset = 0;
|
||||||
$sRating = 'Bronze';
|
$sRating = 'Bronze';
|
||||||
$aApps=Application::getWithRating($sRating, $iOffset, $iItemsPerPage);
|
$aApps = Application::getWithRating($sRating, $iOffset, $iItemsPerPage);
|
||||||
$aTest = array();//array to test the uniqueness our query results
|
$aTest = array();//array to test the uniqueness our query results
|
||||||
while(list($i, $iId) = each($aApps)) //cycle through results returned by getWithRating
|
while(list($i, $iId) = each($aApps)) //cycle through results returned by getWithRating
|
||||||
{
|
{
|
||||||
@@ -249,13 +249,13 @@ function create_and_login_user()
|
|||||||
if(!test_application_delete())
|
if(!test_application_delete())
|
||||||
echo "test_application_delete() failed!\n";
|
echo "test_application_delete() failed!\n";
|
||||||
else
|
else
|
||||||
echo "test_application_delete() passed!\n";
|
echo "test_application_delete() passed\n";
|
||||||
|
|
||||||
|
|
||||||
if(!test_application_getWithRating())
|
if(!test_application_getWithRating())
|
||||||
echo "test_application_getWithRating() failed!\n";
|
echo "test_application_getWithRating() failed!\n";
|
||||||
else
|
else
|
||||||
echo "test_application_getWithRating() passed!\n";
|
echo "test_application_getWithRating() passed\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
require_once("path.php");
|
require_once("path.php");
|
||||||
require_once("test_common.php");
|
require_once("test_common.php");
|
||||||
|
|
||||||
DEFINE(TEST_IMAGE_FILENAME, "/images/appdb_montage.jpg");
|
DEFINE("TEST_IMAGE_FILENAME", "/images/appdb_montage.jpg");
|
||||||
DEFINE(TEST_IMAGE_OUTPUT_FILENAME, "/tmp/tmpfile.png");
|
DEFINE("TEST_IMAGE_OUTPUT_FILENAME", "/tmp/tmpfile.png");
|
||||||
DEFINE(TEST_IMAGE_WIDTH, 391);
|
DEFINE("TEST_IMAGE_WIDTH", 391);
|
||||||
DEFINE(TEST_IMAGE_HEIGHT, 266);
|
DEFINE("TEST_IMAGE_HEIGHT", 266);
|
||||||
DEFINE(TEST_IMAGE_WATERMARK, "/images/watermark.png");
|
DEFINE("TEST_IMAGE_WATERMARK", "/images/watermark.png");
|
||||||
|
|
||||||
function test_image_constructor()
|
function test_image_constructor()
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@ function test_image_make_thumbnail()
|
|||||||
from the ratio of the height
|
from the ratio of the height
|
||||||
to width of the original image */
|
to width of the original image */
|
||||||
$iBorderWidth = 20;
|
$iBorderWidth = 20;
|
||||||
$oImage->make_thumb($iWidth, $iHeight, $iBorderWidthm, "#0000FF");
|
$oImage->make_thumb($iWidth, $iHeight, $iBorderWidth, "#0000FF");
|
||||||
|
|
||||||
/* did we get the correct size? */
|
/* did we get the correct size? */
|
||||||
$iActualWidth = $oImage->get_width();
|
$iActualWidth = $oImage->get_width();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function test_query_parameters()
|
|||||||
if(!test_query_parameters())
|
if(!test_query_parameters())
|
||||||
echo "test_query_parameters() failed!\n";
|
echo "test_query_parameters() failed!\n";
|
||||||
else
|
else
|
||||||
echo "test_query_parameters() passed!\n";
|
echo "test_query_parameters() passed\n";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ function test_user_create()
|
|||||||
{
|
{
|
||||||
$oUser->delete();
|
$oUser->delete();
|
||||||
$oUser = new User();
|
$oUser = new User();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
echo "User doesn't already exist\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the user */
|
/* create the user */
|
||||||
$retval = $oUser->create("testemail@somesite.com", "password", "Test user", "20051020");
|
$retval = $oUser->create($test_email, $test_password, "Test user", "20051020");
|
||||||
if($retval != SUCCESS)
|
if($retval != SUCCESS)
|
||||||
{
|
{
|
||||||
if($retval == USER_CREATE_EXISTS)
|
if($retval == USER_CREATE_EXISTS)
|
||||||
@@ -45,7 +48,7 @@ function test_user_create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* try creating the user again, see that we get USER_CREATE_EXISTS */
|
/* try creating the user again, see that we get USER_CREATE_EXISTS */
|
||||||
$retval = $oUser->create("testemail@somesite.com", "password", "Test user", "20051020");
|
$retval = $oUser->create($test_email, $test_password, "Test user", "20051020");
|
||||||
if($retval != USER_CREATE_EXISTS)
|
if($retval != USER_CREATE_EXISTS)
|
||||||
{
|
{
|
||||||
echo "Got '".$retval."' instead of USER_CREATE_EXISTS(".USER_CREATE_EXISTS.")\n";
|
echo "Got '".$retval."' instead of USER_CREATE_EXISTS(".USER_CREATE_EXISTS.")\n";
|
||||||
@@ -68,15 +71,17 @@ function test_user_login()
|
|||||||
$retval = $oUser->login($test_email, $test_password);
|
$retval = $oUser->login($test_email, $test_password);
|
||||||
if($retval != SUCCESS)
|
if($retval != SUCCESS)
|
||||||
{
|
{
|
||||||
|
echo "Test that correct information results in a correct login FAILED\n";
|
||||||
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test that incorrect user results in a login failed */
|
/* test that incorrect user results in a login failed */
|
||||||
$oUser = new User();
|
$oUser = new User();
|
||||||
$retval = $oUser->login("some nutty username", $testpassword);
|
$retval = $oUser->login("some nutty username", $test_password);
|
||||||
if($retval != USER_LOGIN_FAILED)
|
if($retval != USER_LOGIN_FAILED)
|
||||||
{
|
{
|
||||||
|
echo "Test that incorrect user results in a failed login FAILED\n";
|
||||||
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -86,6 +91,7 @@ function test_user_login()
|
|||||||
$retval = $oUser->login($test_email, "some password");
|
$retval = $oUser->login($test_email, "some password");
|
||||||
if($retval != USER_LOGIN_FAILED)
|
if($retval != USER_LOGIN_FAILED)
|
||||||
{
|
{
|
||||||
|
echo "Test that incorrect passowrd results in a login failed FAILED\n";
|
||||||
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
echo "Got '".$retval."' instead of SUCCESS(".SUCCESS.")\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user