Replace direct mysql_xxx() calls with query_xxx() calls. Replace calls to mysql_insert_id()

with calls specific to the appdb or bugzilla database. Fixes a bug where a call to
mysql_insert_id() can potentially retrieve an id from either the bugzilla or appdb database,
depending on whichever database was last opened by mysql_connect().
This commit is contained in:
Chris Morgan
2007-08-03 23:27:25 +00:00
committed by WineHQ
parent 03dca3cabd
commit 6119246b51
54 changed files with 343 additions and 295 deletions

View File

@@ -48,7 +48,7 @@ if(!empty($aClean['sBody']))
{
$hResult = query_parameters("SELECT * FROM appComments WHERE commentId = '?'",
$aClean['iThread']);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow)
{
$mesTitle = "<b>Replying To ...</b> $oRow->subject\n";

View File

@@ -10,7 +10,7 @@ require_once(BASE."include/note.php");
//FIXME: get rid of appId references everywhere, as version is enough.
$sQuery = "SELECT appId FROM appVersion WHERE versionId = '?'";
$hResult = query_parameters($sQuery, $aClean['iVersionId']);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$appId = $oRow->appId;
//check for admin privs

View File

@@ -18,7 +18,7 @@ else
apidb_header("Add Category");
$sQuery = "SELECT catId, catName FROM appCategory WHERE catId!='?'";
$hResult = query_parameters($sQuery, $aClean['iCatId']);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aCatsIds[]=$oRow->catId;
$aCatsNames[]=$oRow->catName;

View File

@@ -111,13 +111,13 @@ if (isset($aClean['sSub']))
FROM appFamily, appVersion, buglinks, bugs.bugs
".$sWhere."
ORDER BY buglinks.bug_id, appName, versionName
LIMIT ".mysql_real_escape_string($offset).", ".mysql_real_escape_string($ItemsPerPage).";";
LIMIT ".query_escape_string($offset).", ".query_escape_string($ItemsPerPage).";";
$c = 0;
if($hResult = query_parameters($sQuery))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oApp = new application($oRow->appId);
$oVersion = new version($oRow->versionId);

View File

@@ -52,14 +52,14 @@ echo "</center>";
$offset = (($currentPage-1) * $ItemsPerPage);
$commentIds = query_parameters("SELECT commentId from appComments ORDER BY ".
"appComments.time ASC LIMIT ?, ?", $offset, $ItemsPerPage);
while ($oRow = mysql_fetch_object($commentIds))
while ($oRow = query_fetch_object($commentIds))
{
$sQuery = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
"commentId, parentId, versionId, userid, subject, body ".
"FROM appComments WHERE commentId = '?'";
$hResult = query_parameters($sQuery, $oRow->commentId);
/* call view_app_comment to display the comment */
$oComment_row = mysql_fetch_object($hResult);
$oComment_row = query_fetch_object($hResult);
Comment::view_app_comment($oComment_row);
}

View File

@@ -38,7 +38,7 @@ if (isset($aClean['sSub']))
$sQuery.= " AND queued='false' ORDER BY realname;";
$hResult = query_parameters($sQuery);
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
{
// no apps
echo html_frame_start("","90%");
@@ -61,7 +61,7 @@ if (isset($aClean['sSub']))
$c = 1;
$oldUserId = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oUser = new User($oRow->userId);
$oApp = new application($oRow->appId);

View File

@@ -37,7 +37,7 @@ if(isset($aClean['sRegenerate']))
{
$sQuery = "SELECT id FROM appData WHERE type = 'screenshot'";
$hResult = query_parameters($sQuery);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
echo "REGENERATING IMAGE ".$oRow->id."<br/>";
$screenshot = new Screenshot($oRow->id);
@@ -100,7 +100,7 @@ $Ids = query_parameters("SELECT * from appData
ORDER BY id ASC LIMIT ?, ?", $offset, $ItemsPerPage);
$c = 1;
echo "<div align=center><table><tr>\n";
while ($oRow = mysql_fetch_object($Ids))
while ($oRow = query_fetch_object($Ids))
{
// display thumbnail
$oVersion = new Version($oRow->versionId);

View File

@@ -121,7 +121,7 @@ if(isset($aClean['sSubmit']))
$hResult = query_parameters($sQuery, $sSearch, $sSearch, $aClean['sOrderBy'],
$aClean['iLimit']);
$i=0;
while($hResult && $oRow = mysql_fetch_object($hResult))
while($hResult && $oRow = query_fetch_object($hResult))
{
$oUser = new User($oRow->userid);
$sAreYouSure = "Are you sure that you want to delete user ".addslashes($oUser->sRealname)." ?";

View File

@@ -11,7 +11,7 @@ function build_app_list()
$hResult = query_parameters("SELECT appId, appName FROM appFamily ORDER BY appName");
echo "<select name=iAppId size=5 onChange='this.form.submit()'>\n";
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
echo "<option value=$oRow->appId>$oRow->appName</option>\n";
}
@@ -55,10 +55,10 @@ echo " <td><font color=white> Application Name </font></td>\n";
echo " <td><font color=white> Delete </font></td>\n";
echo "</tr>\n\n";
if($hResult && mysql_num_rows($hResult))
if($hResult && query_num_rows($hResult))
{
$c = 1;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
//set row color
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
@@ -72,7 +72,7 @@ if($hResult && mysql_num_rows($hResult))
$c++;
}
} else if($hResult && !mysql_num_rows($hResult))
} else if($hResult && !query_num_rows($hResult))
{
/* indicate to the user that there are no apps in this bundle at the moment */
echo "<tr>\n";

View File

@@ -15,7 +15,7 @@ $hResult = maintainer::objectGetEntries(false, false);
echo "Maintainers with a non-zero notification level<br />\n";
$bFoundNonZero = false;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oMaintainer = new maintainer(null, $oRow);
@@ -41,7 +41,7 @@ echo "<br />\n";
// retrieve all of the maintainers
echo "Maintainers with notification iTargetLevel != 0<br />\n";
$hResult = maintainer::objectGetEntries(false, false);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oMaintainer = new maintainer(null, $oRow);

View File

@@ -47,7 +47,7 @@ if(!empty($aClean['sAction']))
$sQuery.= "on appVersion.appId = appFamily.appId ORDER BY appFamily.appName, appFamily.appId, appVersion.versionName;";
$hResult = query_parameters($sQuery);
$currentAppId = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
/* if the version ids differ then we should start a row with a new application */
/* and the version that matches with it */

View File

@@ -37,7 +37,7 @@ function display_bundle($iAppId)
$hResult = query_parameters("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
"WHERE appFamily.queued='false' AND bundleId = '?' AND appBundle.appId = appFamily.appId",
$iAppId);
if(!$hResult || mysql_num_rows($hResult) == 0)
if(!$hResult || query_num_rows($hResult) == 0)
{
return; // do nothing
}
@@ -51,7 +51,7 @@ function display_bundle($iAppId)
echo "</tr>\n\n";
$c = 0;
while($ob = mysql_fetch_object($hResult))
while($ob = query_fetch_object($hResult))
{
$oApp = new application($ob->appId);
//set row color

View File

@@ -37,8 +37,8 @@ else
$hResult = query_parameters($sQuery, "downloadurl", $sLicense);
}
if($hResult && mysql_num_rows($hResult))
$num = mysql_num_rows($hResult);
if($hResult && query_num_rows($hResult))
$num = query_num_rows($hResult);
$iNumPages = isset($num) ? ceil($num/$aClean['iNumVersions']) : 0;
@@ -108,7 +108,7 @@ if(!$sLicense)
$aClean['iNumVersions']);
}
if($hResult && mysql_num_rows($hResult))
if($hResult && query_num_rows($hResult))
{
echo html_frame_start("", "90%");
@@ -127,7 +127,7 @@ if($hResult && mysql_num_rows($hResult))
$oTableRow->SetClass("color4");
$oTable->AddRow($oTableRow);
for($iIndex = 1; $oRow = mysql_fetch_object($hResult); $iIndex++)
for($iIndex = 1; $oRow = query_fetch_object($hResult); $iIndex++)
{
$oVersion = new version($oRow->versionId);

View File

@@ -52,7 +52,7 @@ function inactiveUserCheck()
$hUsersToWarn = unwarnedAndInactiveSince(6);
if($hUsersToWarn)
{
while($oRow = mysql_fetch_object($hUsersToWarn))
while($oRow = query_fetch_object($hUsersToWarn))
{
$oUser = new User($oRow->userid);
@@ -73,7 +73,7 @@ function inactiveUserCheck()
$hUsersToDelete = warnedSince(1);
if($hUsersToDelete)
{
while($oRow = mysql_fetch_object($hUsersToDelete))
while($oRow = query_fetch_object($hUsersToDelete))
{
$oUser = new User($oRow->userid);
if(!$oUser->hasDataAssociated())
@@ -179,11 +179,11 @@ function orphanVersionCheck()
$sMsg.= "this sql command '".$sQuery."'\r\n";
/* don't report anything if no orphans are found */
if(mysql_num_rows($hResult) == 0)
if(query_num_rows($hResult) == 0)
return;
$sMsg .= "versionId/name\r\n";
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$sMsg .= $oRow->versionId."/".$oRow->versionName."\r\n";
}
@@ -209,7 +209,7 @@ function orphanSessionMessagesCheck()
$sQuery = "SELECT count(*) as cnt from sessionMessages where TO_DAYS(NOW()) - TO_DAYS(time) > ?";
$hResult = query_parameters($sQuery, $iSessionMessageDayLimit);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$iMessages = $oRow->cnt;
$sMsg = "Found ".$iMessages." that have been orphaned in the sessionMessages table for longer than ".$iSessionMessageDayLimit." days\r\n";
@@ -237,7 +237,7 @@ function orphanSessionListCheck()
$sQuery = "SELECT count(*) as cnt from session_list where TO_DAYS(NOW()) - TO_DAYS(stamp) > ?";
$hResult = query_parameters($sQuery, SESSION_DAYS_TO_EXPIRE + 2);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$iMessages = $oRow->cnt;
$sMsg = "Found ".$iMessages." sessions that have expired after ".(SESSION_DAYS_TO_EXPIRE + 2)." days\r\n";
@@ -272,7 +272,7 @@ function getMissingScreenshotArray()
$hResult = Screenshot::objectGetEntries(false, false);
// go through each screenshot
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$iScreenshotId = $oRow->id;
$oScreenshot = new Screenshot($iScreenshotId);

View File

@@ -37,7 +37,7 @@ class appData
if(!$oRow)
{
$hResult = query_parameters("SELECT * FROM appData WHERE id = '?'", $iId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -126,7 +126,7 @@ class appData
ORDER BY appData.id",
$iUserId, $bQueued ? "true" : "false");
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return false;
$sReturn = html_table_begin("width=\"100%\" align=\"center\"");
@@ -137,7 +137,7 @@ class appData
"Submission Date"),
"color4");
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
if($oRow->versionId)
{
@@ -180,7 +180,7 @@ class appData
versionId = '?' AND TYPE = '?' AND queued = '?'",
$iAppId, $iVersionId, $sType, $sQueued);
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return FALSE;
return $hResult;
@@ -297,7 +297,7 @@ class appData
if(!$hResult)
return FALSE;
for($iCount = 0; $oRow = mysql_fetch_object($hResult);)
for($iCount = 0; $oRow = query_fetch_object($hResult);)
$iCount += $oRow->count;
return $iCount;

View File

@@ -6,9 +6,9 @@ function log_category_visit($catId)
$result = query_parameters("SELECT * FROM catHitStats WHERE ip = '?' AND catId = '?'",
$REMOTE_ADDR, $catId);
if($result && mysql_num_rows($result) == 1)
if($result && query_num_rows($result) == 1)
{
$oStatsRow = mysql_fetch_object($result);
$oStatsRow = query_fetch_object($result);
query_parameters("UPDATE catHitStats SET count = count + 1 WHERE catHitId = '?'",
$oStatsRow->catHitId);
} else
@@ -25,9 +25,9 @@ function log_application_visit($appId)
$result = query_parameters("SELECT * FROM appHitStats WHERE ip = '?' AND appId = '?'",
$REMOTE_ADDR, $appId);
if($result && mysql_num_rows($result) == 1)
if($result && query_num_rows($result) == 1)
{
$stats = mysql_fetch_object($result);
$stats = query_fetch_object($result);
query_parameters("UPDATE appHitStats SET count = count + 1 WHERE appHitId = '?'",
$stats->appHitId);
} else

View File

@@ -56,7 +56,7 @@ class Application {
FROM appFamily
WHERE appId = '?'";
if($hResult = query_parameters($sQuery, $iAppId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -89,7 +89,7 @@ class Application {
}
if($hResult)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$this->aVersionsIds[] = $oRow->versionId;
}
@@ -132,7 +132,7 @@ class Application {
$this->mustBeQueued() ? "true" : "false");
if($hResult)
{
$this->iAppId = mysql_insert_id();
$this->iAppId = query_appdb_insert_id();
$this->application($this->iAppId);
$this->SendNotificationMail(); // Only administrators will be mailed as no supermaintainers exist for this app.
@@ -246,7 +246,7 @@ class Application {
//FIXME: how to deal with concurrency issues such as
// if a new version was added during this deletion?
$hResult = $this->_internal_retrieve_all_versions();
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$iVersionId = $oRow->versionId;
$oVersion = new Version($iVersionId);
@@ -263,7 +263,7 @@ class Application {
if($hResult = query_parameters($sQuery, $this->iAppId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aUrlsIds[] = $oRow->id;
}
@@ -315,9 +315,9 @@ class Application {
/* Unqueue matching super maintainer request */
$hResultMaint = query_parameters("SELECT maintainerId FROM appMaintainers WHERE userId = '?' AND appId = '?'", $this->iSubmitterId, $this->iAppId);
if($hResultMaint && mysql_num_rows($hResultMaint))
if($hResultMaint && query_num_rows($hResultMaint))
{
$oMaintainerRow = mysql_fetch_object($hResultMaint);
$oMaintainerRow = query_fetch_object($hResultMaint);
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
$oMaintainer->unQueue("OK");
}
@@ -420,7 +420,7 @@ class Application {
if($hResult = query_parameters($sQuery, $sRating))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
return $oRow->total;
}
@@ -436,7 +436,7 @@ class Application {
if($hResult = query_parameters($sQuery, $sRating, $iOffset, $iItemsPerPage))
{
while($aRow = mysql_fetch_row($hResult))
while($aRow = query_fetch_row($hResult))
{
array_push($aApps, $aRow[0]);
}
@@ -764,9 +764,9 @@ class Application {
if(!$appId) return null;
$result = query_parameters("SELECT appName FROM appFamily WHERE appId = '?'",
$appId);
if(!$result || mysql_num_rows($result) != 1)
if(!$result || query_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
$ob = query_fetch_object($result);
return $ob->appName;
}
@@ -781,7 +781,7 @@ class Application {
queued = '?'
ORDER BY appId", $iUserId, $bQueued ? "true" : "false");
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return false;
$oTable = new Table();
@@ -796,7 +796,7 @@ class Application {
$oTableRow->SetClass("color4");
$oTable->SetHeader($oTableRow);
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
$oVendor = new vendor($oRow->vendorId);
@@ -1013,7 +1013,7 @@ class Application {
if(!$hResult)
return FALSE;
if(!$oRow = mysql_fetch_object($hResult))
if(!$oRow = query_fetch_object($hResult))
return FALSE;
return $oRow->count;

View File

@@ -30,7 +30,7 @@ class application_queue
$hResult = query_parameters($sQuery, $this->oApp->iAppId);
if($hResult)
{
if($oRow = mysql_fetch_object($hResult))
if($oRow = query_fetch_object($hResult))
$iVersionId = $oRow->versionId;
}
}
@@ -230,7 +230,7 @@ class application_queue
return FALSE;
/* There's no point in displaying an empty table */
if($hResult === null ||mysql_num_rows($hResult) == 0)
if($hResult === null || (query_num_rows($hResult) == 0))
{
echo "No matches.<br />\n";
return;
@@ -256,7 +256,7 @@ class application_queue
echo "<table cellpadding='5px'>";
echo html_tr($aHeader, "color4");
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
{
$oApp = new application($oRow->appId);
$aCells = array(

View File

@@ -39,7 +39,7 @@ class Bug {
AND linkid = '?'";
if($hResult = query_parameters($sQuery, $iLinkId))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$this->iLinkId = $iLinkId;
$this->iAppId = $oRow->appId;
$this->iBug_id = $oRow->bug_id;
@@ -55,7 +55,7 @@ class Bug {
WHERE bug_id = ".$this->iBug_id;
if($hResult = query_bugzilladb($sQuery))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$this->sShort_desc = $oRow->short_desc;
$this->sBug_status = $oRow->bug_status;
$this->sResolution = $oRow->resolution;
@@ -95,7 +95,7 @@ class Bug {
$sQuery = "SELECT *
FROM bugs
WHERE bug_id = ".$this->iBug_id;
if(mysql_num_rows(query_bugzilladb($sQuery, "checking bugzilla")) == 0)
if(query_num_rows(query_bugzilladb($sQuery, "checking bugzilla")) == 0)
{
addmsg("There is no bug in Bugzilla with that bug number.", "red");
return false;
@@ -108,7 +108,7 @@ class Bug {
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
if($oRow->bug_id == $this->iBug_id)
{
@@ -129,7 +129,7 @@ class Bug {
$this->bQueued ? "true":"false");
if($hResult)
{
$this->iLinkId = mysql_insert_id();
$this->iLinkId = query_bugzilla_insert_id();
$this->SendNotificationMail();
@@ -259,7 +259,7 @@ class Bug {
{
$hResult = query_parameters("SELECT appFamily.appName, buglinks.versionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id FROM buglinks, appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND buglinks.versionId = appVersion.versionId AND buglinks.queued = '?' AND buglinks.submitterId = '?' ORDER BY buglinks.versionId", $bQueued ? "true" : "false", $iUserId);
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return FALSE;
$sReturn = html_table_begin("width=\"100%\" align=\"center\"");
@@ -272,7 +272,7 @@ class Bug {
"Submit time"),
"color4");
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
$oBug = new Bug($oRow->bug_id);
$sReturn .= html_tr(array(

View File

@@ -31,7 +31,7 @@ class Category {
WHERE catId = '?' ORDER BY catName;";
if($hResult = query_parameters($sQuery, $iCatId))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow)
{
$this->iCatId = $iCatId;
@@ -50,7 +50,7 @@ class Category {
AND queued = 'false' ORDER BY appName";
if($hResult = query_parameters($sQuery, $iCatId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$this->aApplicationsIds[] = $oRow->appId;
}
@@ -64,7 +64,7 @@ class Category {
WHERE catParent = '?' ORDER BY catName;";
if($hResult = query_parameters($sQuery, $iCatId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$this->aSubcatsIds[] = $oRow->catId;
}
@@ -83,7 +83,7 @@ class Category {
$sName, $sDescription, $iParentId);
if($hResult)
{
$this->iCatId = mysql_insert_id();
$this->iCatId = query_appdb_insert_id();
$this->category($this->iCatId);
return true;
}
@@ -171,9 +171,9 @@ class Category {
{
$hResult = query_parameters("SELECT catName, catId, catParent FROM appCategory WHERE catId = '?'",
$iCatId);
if(!$hResult || mysql_num_rows($hResult) != 1)
if(!$hResult || query_num_rows($hResult) != 1)
break;
$oCatRow = mysql_fetch_object($hResult);
$oCatRow = query_fetch_object($hResult);
$aPath[] = array($oCatRow->catId, $oCatRow->catName);
$iCatId = $oCatRow->catParent;
}

View File

@@ -36,7 +36,7 @@ class Comment {
WHERE appComments.versionId = appVersion.versionId
AND commentId = '?'";
$hResult = query_parameters($sQuery, $iCommentId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$this->iCommentId = $oRow->commentId;
$this->iParentId = $oRow->parentId;
$this->iAppId = $oRow->appId;
@@ -68,7 +68,7 @@ class Comment {
if($hResult)
{
$this->comment(mysql_insert_id());
$this->comment(query_appdb_insert_id());
$sEmail = User::get_notify_email_address_list($this->iAppId, $this->iVersionId);
$sEmail .= $this->oOwner->sEmail." ";
@@ -203,7 +203,7 @@ class Comment {
$hResult = query_parameters($sQuery, $iVersionId);
if(!$hResult) return 0;
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->cnt;
}
@@ -275,8 +275,8 @@ class Comment {
}
/* escape input so we can use query_appdb() without concern */
$iVersionId = mysql_real_escape_string($iVersionId);
$iParentId = mysql_real_escape_string($iParentId);
$iVersionId = query_escape_string($iVersionId);
$iParentId = query_escape_string($iParentId);
$sExtra = "";
@@ -300,11 +300,11 @@ class Comment {
*/
function do_display_comments_nested($hResult)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
Comment::view_app_comment($oRow);
$hResult2 = Comment::grab_comments($oRow->versionId, $oRow->commentId);
if($hResult && mysql_num_rows($hResult2))
if($hResult && query_num_rows($hResult2))
{
echo "<blockquote>\n";
Comment::do_display_comments_nested($hResult2);
@@ -328,7 +328,7 @@ class Comment {
if (!$is_main)
echo "<ul>\n";
while ($oRow = mysql_fetch_object($hResult))
while ($oRow = query_fetch_object($hResult))
{
if ($is_main)
{
@@ -340,7 +340,7 @@ class Comment {
}
$hResult2 = Comment::grab_comments($oRow->versionId, $oRow->commentId);
if ($hResult2 && mysql_num_rows($hResult2))
if ($hResult2 && query_num_rows($hResult2))
{
echo "<blockquote>\n";
Comment::do_display_comments_threaded($hResult2, 0);
@@ -367,7 +367,7 @@ class Comment {
$hResult = Comment::grab_comments($versionId);
if ($hResult)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
Comment::view_app_comment($oRow);
}
@@ -380,7 +380,7 @@ class Comment {
// count posts
$hResult = query_parameters("SELECT commentId FROM appComments WHERE versionId = '?'", $versionId);
$messageCount = mysql_num_rows($hResult);
$messageCount = query_num_rows($hResult);
//start comment format table
echo html_frame_start("","98%",'',0);

View File

@@ -30,7 +30,7 @@ class distribution {
FROM distributions
WHERE distributionId = '?'";
if($hResult = query_parameters($sQuery, $iDistributionId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -69,7 +69,7 @@ class distribution {
if($hResult = query_parameters($sQuery, $this->iDistributionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$this->aTestingIds[] = $oRow->testingId;
}
@@ -85,9 +85,9 @@ class distribution {
WHERE name = '?'";
$hResult = query_parameters($sQuery, $this->sName);
if($hResult && $oRow = mysql_fetch_object($hResult))
if($hResult && $oRow = query_fetch_object($hResult))
{
if(mysql_num_rows($hResult))
if(query_num_rows($hResult))
{
addmsg("There was an existing distribution called ".$this->sName.".", "red");
$this->distribution($oRow->distributionId);
@@ -108,7 +108,7 @@ class distribution {
$this->mustBeQueued() ? "true" : "false");
if($hResult)
{
$this->iDistributionId = mysql_insert_id();
$this->iDistributionId = query_appdb_insert_id();
$this->distribution($this->iDistributionId);
$this->SendNotificationMail();
return true;
@@ -397,7 +397,7 @@ class distribution {
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_dists;
}
return 0;
@@ -414,7 +414,7 @@ class distribution {
echo "<select name='$varname'>\n";
echo "<option value=\"\">Choose ...</option>\n";
while(list($name, $value) = mysql_fetch_row($hResult))
while(list($name, $value) = query_fetch_row($hResult))
{
if($value == $cvalue)
echo "<option value=$value selected>$name\n";

View File

@@ -28,8 +28,8 @@ class downloadurl
submitTime, submitterId, queued FROM appData WHERE id = '?'",
$iId);
if($hResult && mysql_num_rows($hResult))
$oRow = mysql_fetch_object($hResult);
if($hResult && query_num_rows($hResult))
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -52,7 +52,7 @@ class downloadurl
// we're appending, so initialize it
$sReturn = '';
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
{
$sReturn .= html_tr(array(
"<b>Free Download</b>",
@@ -104,7 +104,7 @@ class downloadurl
if($hResult)
{
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
$sReturn .= html_tr(array(
"<input type=\"checkbox\" name=\"bRemove$oRow->id\" ".
@@ -146,7 +146,7 @@ class downloadurl
"downloadurl", $aValues["iVersionId"])))
return FALSE;
if(!($oRow = mysql_fetch_object($hResult)))
if(!($oRow = query_fetch_object($hResult)))
return FALSE;
$num = $oRow->num;
@@ -157,7 +157,7 @@ class downloadurl
if(!$hResult = appData::getData($aValues["iVersionId"], "downloadurl"))
return FALSE;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oDownloadurl = new downloadurl($oRow->id);
@@ -258,7 +258,7 @@ class downloadurl
$hResult = appData::getData($iVersionId, "downloadurl",
TRUE, TRUE, TRUE))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$sDownloadUrlUrl = $oRow->url;
$sDownloadUrlDescription = $oRow->description;
}
@@ -305,7 +305,7 @@ class downloadurl
"NOW()",
$_SESSION['current']->iUserId);
$this->iId = mysql_insert_id();
$this->iId = query_appdb_insert_id();
if(!$hResult)
return FALSE;
@@ -339,7 +339,7 @@ class downloadurl
$iId = null;
if($hResult = appData::getData($iVersionId, "downloadurl", TRUE, TRUE))
{
$oObject = mysql_fetch_object($hResult);
$oObject = query_fetch_object($hResult);
$iId = $oObject->id;
}

View File

@@ -47,7 +47,7 @@ class error_log
{
$sQuery = "SELECT count(*) as cnt FROM error_log WHERE deleted = '0'";
$hResult = query_parameters($sQuery);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->cnt;
}
@@ -70,7 +70,7 @@ class error_log
$hResult = query_parameters($sQuery);
$bEmpty = false;
if(mysql_num_rows($hResult) == 0)
if(query_num_rows($hResult) == 0)
$bEmpty = true;
$sMsg = "Log entries:\r\n";
@@ -82,7 +82,7 @@ class error_log
$sMsg.="----------------------------------\r\n\r\n";
/* append each log entry to $sMsg */
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$sMsg.=$oRow->submitTime." ".$oRow->userid." ".$oRow->type."\r\n";
$sMsg.= "---------------------\r\n";

View File

@@ -28,12 +28,12 @@ if(get_magic_quotes_gpc())
echo "if magic quotes is enabled. ";
echo "Ooooooh you say.<br/>";
echo "<i>\"Aren't magic quotes a convienent way to protect my php code from sql injection attacks?\"</i><br/><br/>";
echo "No! <b>addslashes()</b> isn't adequate. You should use <b>mysql_real_escape_string()</b> or some other function";
echo "No! <b>addslashes()</b> isn't adequate. You should use <b>query_escape_string()</b> or some other function";
echo " that will handle multi-byte characters. See <a href=\"http://shiflett.org/archive/184\">this article</a>";
echo " for a way to exploit <b>addslash()</b>ed parameters.<br/><br/>";
echo "A second reason is that with magic quotes enabled, due to the use of <b>mysql_real_escape_string()</b> to";
echo "A second reason is that with magic quotes enabled, due to the use of <b>query_escape_string()</b> to";
echo " protect from sql injection attacks we'll end up with variables that have been addslash()ed and";
echo " <b>mysql_real_escape_string()</b>ed. So you end up having to call stripslashes() on EVERY variable. ";
echo " <b>query_escape_string()</b>ed. So you end up having to call stripslashes() on EVERY variable. ";
exit;
}
@@ -250,25 +250,16 @@ function pHttpDate($sDate) {
/**
* msgs will be displayed on the Next page view of the same user
*/
function addmsg($text, $color = "black")
function addmsg($shText, $color = "black")
{
global $hAppdbLink;
if(!is_resource($hAppdbLink))
{
// The last argument makes sure we are really opening a new connection
$hAppdbLink = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS,true);
mysql_select_db(APPS_DB, $hAppdbLink);
}
if($color)
$text = "<font color='$color'> $text </font>\n";
$shText = "<font color='$color'> $shText </font>\n";
$sQuery = "INSERT INTO sessionMessages VALUES (null, ?, '?', '?')";
if (!query_parameters($sQuery, "NOW()", session_id(), $text))
if (!query_parameters($sQuery, "NOW()", session_id(), $shText))
{
echo "An error has occurred in addmsg()";
echo $text;
echo $shText;
}
}
@@ -289,7 +280,7 @@ function dumpmsgbuffer()
if(!$hResult)
return;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
echo html_frame_start("","300","",5);
echo "<div align=center> $oRow->message </div>";

View File

@@ -62,7 +62,7 @@ class queuedEntries
// this application or unqueued versions depending on which user we were
$hResult = $oApp->_internal_retrieve_all_versions();
while($oVersionRow = mysql_fetch_object($hResult))
while($oVersionRow = query_fetch_object($hResult))
{
if($bDebugOutputEnabled)
{
@@ -108,7 +108,7 @@ class queuedEntries
$hResult = query_parameters($sQuery, $iVersionId, "true");
// go through the test results looking for the oldest queued data
while($oTestingRow = mysql_fetch_object($hResult))
while($oTestingRow = query_fetch_object($hResult))
{
if($bDebugOutputEnabled)
echo "\tQueued TestData found\n";
@@ -124,7 +124,7 @@ class queuedEntries
// queued screenshots
$sQuery = "select * from appData where type = 'screenshot' and versionId = '?' and queued = '?'";
$hResult = query_parameters($sQuery, $iVersionId, "true");
while($oScreenshotRow = mysql_fetch_object($hResult))
while($oScreenshotRow = query_fetch_object($hResult))
{
$oScreenshot = new Screenshot(null, $oScreenshotRow);
@@ -187,7 +187,7 @@ class maintainer
$sQuery = "SELECT * FROM appMaintainers WHERE maintainerId = '?'";
$hResult = query_parameters($sQuery, $iMaintainerId);
if($hResult)
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -219,8 +219,8 @@ class maintainer
$this->iUserId, $this->sMaintainReason,
$this->bSuperMaintainer, "NOW()", $this->mustBeQueued() ? "true" : "false");
/* this objects id is the insert id returned by mysql */
$this->iMaintainerId = mysql_insert_id();
/* this objects id is the insert id returned by the database */
$this->iMaintainerId = query_appdb_insert_id();
/* If this is a non-queued maintainer submission, remove the user's non-
super maintainer entries for the application's versions. This check is
@@ -469,7 +469,7 @@ class maintainer
$hResult = query_parameters($sQuery, $oUser->iUserId, $bSuperMaintainer ? "1" : "0", "false");
if(!$hResult)
return 0;
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->cnt;
}
@@ -483,12 +483,12 @@ class maintainer
"appFamily, appMaintainers WHERE appFamily.appId = appMaintainers.appId ".
"AND userId = '?' AND appMaintainers.queued = '?' ORDER BY appName",
$oUser->iUserId, "false");
if(!$hResult || mysql_num_rows($hResult) == 0)
if(!$hResult || query_num_rows($hResult) == 0)
return NULL;
$aAppsMaintained = array();
$c = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aAppsMaintained[$c] = array($oRow->appId, $oRow->versionId, $oRow->superMaintainer);
$c++;
@@ -528,7 +528,7 @@ class maintainer
$bQueued ? "true" : "false")))
return FALSE;
for($iCount = 0; $oRow = mysql_fetch_object($hResult);)
for($iCount = 0; $oRow = query_fetch_object($hResult);)
$iCount += $oRow->count;
return $iCount;
@@ -539,7 +539,7 @@ class maintainer
{
$sQuery = "SELECT count(*) as maintainers FROM appMaintainers where queued='false'";
$hResult = query_parameters($sQuery);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->maintainers;
}
@@ -547,7 +547,7 @@ class maintainer
function getNumberOfMaintainers()
{
$hResult = query_parameters("SELECT DISTINCT userId FROM appMaintainers WHERE queued='false';");
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
function isUserMaintainer($oUser, $iVersionId = null)
@@ -570,7 +570,7 @@ class maintainer
if(!$hResult)
return false;
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
function isUserSuperMaintainer($oUser, $iAppId = null)
@@ -586,7 +586,7 @@ class maintainer
}
if(!$hResult)
return false;
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
/* if given an appid or a version id return a handle for a query that has */
@@ -637,7 +637,7 @@ class maintainer
$hResult = query_parameters($sQuery, $iAppId, "false");
$aUserIds = array();
$c = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aUserIds[$c] = $oRow->userId;
$c++;
@@ -1182,10 +1182,10 @@ class maintainer
// retrieve all of the maintainers
$hResult = maintainer::objectGetEntries(false, false);
// echo "Processing ".mysql_num_rows($hResult)." maintainers\n";
// echo "Processing ".query_num_rows($hResult)." maintainers\n";
// notify this user, the maintainer, of queued data, if any exists
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oMaintainer = new maintainer(null, $oRow);
$oMaintainer->notifyMaintainerOfQueuedData();

View File

@@ -30,7 +30,7 @@ class Monitor {
FROM appMonitors
WHERE monitorId = '".$iMonitorId."'";
$hResult = query_appdb($sQuery);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -51,7 +51,7 @@ class Monitor {
WHERE userId = '".$iUserId."'
AND versionId = '".$iVersionId."'";
$hResult = query_appdb($sQuery);
if( $oRow = mysql_fetch_object($hResult) )
if( $oRow = query_fetch_object($hResult) )
{
$this->iMonitorId = $oRow->monitorId;
$this->iAppId = $oRow->appId;
@@ -83,7 +83,7 @@ class Monitor {
if($hResult)
{
$this->Monitor(mysql_insert_id());
$this->Monitor(query_appdb_insert_id());
$sWhatChanged = "New monitor\n\n";
$this->SendNotificationMail("add", $sWhatChanged);
return true;
@@ -228,7 +228,7 @@ class Monitor {
if(!$hResult)
return FALSE;
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if(!$oRow)
return FALSE;
@@ -247,12 +247,12 @@ class Monitor {
{
$hResult = query_parameters("SELECT appId, versionId FROM appMonitors WHERE userId = '?'", $oUser->iUserId);
if(!$hResult || mysql_num_rows($hResult) == 0)
if(!$hResult || query_num_rows($hResult) == 0)
return NULL;
$aVersionsMonitored = array();
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
$aVersionsMonitored[$i] = array($oRow->appId, $oRow->versionId);
return $aVersionsMonitored;

View File

@@ -31,7 +31,7 @@ class Note {
{
$sQuery = "SELECT * FROM appNotes WHERE noteId = '?'";
if($hResult = query_parameters($sQuery, $iNoteId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -64,7 +64,7 @@ class Note {
if($hResult)
{
$this->note(mysql_insert_id());
$this->note(query_appdb_insert_id());
$sWhatChanged = "Description is:\n".$this->shDescription.".\n\n";
$this->SendNotificationMail("add", $sWhatChanged);
return true;

View File

@@ -114,7 +114,7 @@ class ObjectManager
}
/* did we get any entries? */
if(!$hResult || mysql_num_rows($hResult) == 0)
if(!$hResult || query_num_rows($hResult) == 0)
{
switch($this->getQueueString($this->bIsQueue, $this->bIsRejected))
{
@@ -142,7 +142,7 @@ class ObjectManager
$this->outputHeader("color4");
/* output each entry */
for($iCount = 0; $oRow = mysql_fetch_object($hResult); $iCount++)
for($iCount = 0; $oRow = query_fetch_object($hResult); $iCount++)
{
$oObject = new $this->sClass(null, $oRow);
@@ -392,7 +392,7 @@ class ObjectManager
"Move here"),
"color4");
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
{
$oCandidate = new $this->sClass(null, $oRow);
if($oCandidate->objectGetId() == $this->iId)

View File

@@ -4,14 +4,14 @@ $hBugzillaLink = null;
define("MYSQL_DEADLOCK_ERRNO", 1213);
function query_appdb($sQuery,$sComment="")
function query_appdb($sQuery, $sComment="")
{
global $hAppdbLink;
if(!is_resource($hAppdbLink))
{
// The last argument makes sure we are really opening a new connection
$hAppdbLink = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS,true);
$hAppdbLink = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS, true);
mysql_select_db(APPS_DB, $hAppdbLink);
}
@@ -77,7 +77,7 @@ function query_parameters()
if(!is_resource($hAppdbLink))
{
// The last argument makes sure we are really opening a new connection
$hAppdbLink = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS,true);
$hAppdbLink = mysql_connect(APPS_DBHOST, APPS_DBUSER, APPS_DBPASS, true);
mysql_select_db(APPS_DB, $hAppdbLink);
}
@@ -159,4 +159,61 @@ function query_error($sQuery, $sComment="")
$bInQueryError = false; // clear variable upon exit
}
function query_fetch_row($hResult)
{
return mysql_fetch_row($hResult);
}
function query_fetch_object($hResult)
{
return mysql_fetch_object($hResult);
}
function query_appdb_insert_id()
{
global $hAppdbLink;
return mysql_insert_id($hAppdbLink);
}
function query_bugzilla_insert_id()
{
global $hBugzillaLink;
return mysql_insert_id($hBugzillaLink);
}
function query_num_rows($hResult)
{
return mysql_num_rows($hResult);
}
function query_escape_string($sString)
{
return mysql_real_escape_string($sString);
}
function query_field_type($hResult, $iFieldOffset)
{
return mysql_field_type($hResult, $iFieldOffset);
}
function query_field_name($hResult, $iFieldOffset)
{
return mysql_field_name($hResult, $iFieldOffset);
}
function query_field_len($hResult, $ifieldOffset)
{
return mysql_field_len($hResult, $iFieldOffset);
}
function query_field_flags($hResult, $iFieldOffset)
{
return mysql_field_flags($hResult, $iFieldOffset);
}
function query_fetch_field($hResult, $iFieldOffset)
{
return mysql_fetch_field($hResult, $iFieldOffset);
}
?>

View File

@@ -47,7 +47,7 @@ class screenshot
AND id = '?'
AND type = 'screenshot'", $iScreenshotId);
if($hResult)
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -80,7 +80,7 @@ class screenshot
$_SESSION['current']->iUserId);
if($hResult)
{
$this->iScreenshotId = mysql_insert_id();
$this->iScreenshotId = query_appdb_insert_id();
/* make sure we supply the full path to move_uploaded_file() */
$moveToPath = appdb_fullpath("data/screenshots/originals/").$this->iScreenshotId;
@@ -432,12 +432,12 @@ class screenshot
if($bFormatting)
$sImgFile .= '<center>';
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
{
$sImgFile.= '<img src="images/no_screenshot.png" alt="No Screenshot" />';
} else
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$sImgFile.= '<img src="appimage.php?bThumbnail=true&amp;iId='.$oRow->id.'" alt="'.$oRow->description.'" />';
}
@@ -451,7 +451,7 @@ class screenshot
$sZoomIcon = Screenshot::get_zoomicon_overlay();
/* we have screenshots */
if(mysql_num_rows($hResult))
if(query_num_rows($hResult))
{
if($iVersionId)
$sImg .= "<a href='screenshots.php?iAppId=$iAppId&amp;iVersionId=$iVersionId'>".$sImgFile.$sZoomIcon."<center>View/Submit&nbsp;Screenshot</center></a>";

View File

@@ -2,7 +2,7 @@
/*
* session.php - session handler functions
* sessions are stored in a mysql table
* sessions are stored in a database table
*/
/* the number of days a session cookie is flaged to last */
@@ -72,7 +72,7 @@ class session
{
$result = query_parameters("SELECT data FROM session_list WHERE session_id = '?'", $key);
if (!$result) { return null; }
$oRow = mysql_fetch_object($result);
$oRow = query_fetch_object($result);
if($oRow)
return $oRow->data;
else

View File

@@ -20,19 +20,19 @@ class TableVE {
function test($query)
{
$hResult = query_appdb($query);
$nfields = mysql_num_fields($hResult);
$nrows = mysql_num_rows($hResult);
$table = mysql_field_table($hResult, 0);
$nfields = query_num_fields($hResult);
$nrows = query_num_rows($hResult);
$table = query_field_table($hResult, 0);
echo "Table: $table <br> Fields: $nfields <br> Rows: $nrows <br> <br>\n";
$i = 0;
while($i < $nfields)
{
$type = mysql_field_type($hResult, $i);
$name = mysql_field_name($hResult, $i);
$len = mysql_field_len($hResult, $i);
$flags = mysql_field_flags($hResult, $i);
$type = query_field_type($hResult, $i);
$name = query_field_name($hResult, $i);
$len = query_field_len($hResult, $i);
$flags = query_field_flags($hResult, $i);
echo "$type | $name | $len | $flags <br>\n";
$i++;
@@ -46,7 +46,7 @@ class TableVE {
function create($query, $table, $idcolumn)
{
$hResult = query_appdb($query);
$id = mysql_insert_id();
$id = query_appdb_insert_id();
$new_query = "SELECT * FROM $table WHERE $idcolumn = $id";
$this->edit($new_query);
@@ -60,7 +60,7 @@ class TableVE {
$nrows = 0;
$hResult = query_appdb($query);
$nrows = mysql_num_rows($hResult);
$nrows = query_num_rows($hResult);
if(debugging())
{
@@ -76,8 +76,8 @@ class TableVE {
function view_entry($hResult, $num)
{
$nfields = mysql_num_fields($hResult);
$fields = mysql_fetch_array($hResult, MYSQL_BOTH);
$nfields = query_num_fields($hResult);
$fields = query_fetch_array($hResult, MYSQL_BOTH);
$titleValue = $fields[$this->titleField];
$titleText = $this->titleText;
@@ -98,7 +98,7 @@ class TableVE {
for($i = 0; $i < $nfields; $i++)
{
$field = mysql_fetch_field($hResult, $i);
$field = query_fetch_field($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
@@ -121,7 +121,7 @@ class TableVE {
function edit($query)
{
$hResult = query_appdb($query);
$nrows = mysql_num_rows($hResult);
$nrows = query_num_rows($hResult);
echo "<form method=post action='".$_SERVER['PHP_SELF']."'>\n";
@@ -141,8 +141,8 @@ class TableVE {
function edit_entry($hResult)
{
$nfields = mysql_num_fields($hResult);
$fields = mysql_fetch_array($hResult);
$nfields = query_num_fields($hResult);
$fields = query_fetch_array($hResult);
echo html_frame_start(ucfirst($this->mode),"80%","",0);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>\n";
@@ -151,8 +151,8 @@ class TableVE {
for($i = 0; $i < $nfields; $i++)
{
global $testvar;
$field = mysql_fetch_field($hResult, $i);
$len = mysql_field_len($hResult, $i);
$field = query_fetch_field($hResult, $i);
$len = query_field_len($hResult, $i);
if(ereg("^impl_(.+)$", $field->table, $arr))
{
@@ -189,7 +189,7 @@ class TableVE {
$sStr.= "<select name='$sVarname'>\n";
$sStr.= "<option value=0>Choose ...</option>\n";
while(list($iId, $sName) = mysql_fetch_row($hResult))
while(list($iId, $sName) = query_fetch_row($hResult))
{
if ($sName == "NONAME")
continue;

View File

@@ -37,7 +37,7 @@ class testData{
FROM testResults
WHERE testingId = '?'";
if($hResult = query_parameters($sQuery, $iTestingId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -83,7 +83,7 @@ class testData{
if($hResult)
{
$this->iTestingId = mysql_insert_id();
$this->iTestingId = query_appdb_insert_id();
$this->testData($this->iTestingId);
$this->SendNotificationMail();
return true;
@@ -446,8 +446,8 @@ class testData{
global $aClean;
/* escape input parameters */
$link = mysql_real_escape_string($link);
$iDisplayLimit = mysql_real_escape_string($iDisplayLimit);
$link = query_escape_string($link);
$iDisplayLimit = query_escape_string($iDisplayLimit);
$sShowAll = isset($aClean['sShowAll']) ? $aClean['sShowAll'] : false;
@@ -465,7 +465,7 @@ class testData{
if(!$hResult)
return;
$rowsUsed = mysql_num_rows($hResult);
$rowsUsed = query_num_rows($hResult);
if($rowsUsed == 0)
return;
@@ -493,7 +493,7 @@ class testData{
$oTable->SetHeader($oTableRowHeader);
$iIndex = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oTest = new testData($oRow->testingId);
$oVersion = new Version($oTest->iVersionId);
@@ -601,7 +601,7 @@ class testData{
if(!$hResult)
return 0;
if(!$oRow = mysql_fetch_object($hResult))
if(!$oRow = query_fetch_object($hResult))
return 0;
return $oRow->testingId;
@@ -799,7 +799,7 @@ class testData{
{
$hResult = query_parameters("SELECT testResults.versionId, testResults.testedDate, testResults.testedRelease, testResults.testedRating, testResults.submitTime, appFamily.appName, appVersion.versionName from testResults, appFamily, appVersion WHERE testResults.versionId = appVersion.versionId AND appVersion.appId = appFamily.appId AND (appFamily.queued = '?' OR appVersion.queued = '?') AND testResults.submitterId = '?' AND testResults.queued = '?' ORDER BY testResults.testingId", "false", "false", $iUserId, $bQueued ? "true" : "false");
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return false;
$sReturn = html_table_begin("width=\"100%\" align=\"center\"");
@@ -810,7 +810,7 @@ class testData{
"Submission Date"),
"color4");
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
$sReturn .= html_tr(array(
version::fullNameLink($oRow->versionId),
$oRow->testedRating,
@@ -834,7 +834,7 @@ class testData{
$hResult = query_parameters($sQuery, $iVersionId, 'false');
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->cnt;
}
@@ -901,7 +901,7 @@ class testData{
if(!$hResult)
return FALSE;
if(!$oRow = mysql_fetch_object($hResult))
if(!$oRow = query_fetch_object($hResult))
return FALSE;
return $oRow->count;
@@ -1014,7 +1014,7 @@ class testData{
$oUser = new user($this->iSubmitterId);
$hMaintainers = maintainer::getMaintainersForAppIdVersionId(null, $this->iVersionId);
$bHasMaintainer = (mysql_num_rows($hMaintainers) == 0) ? false : true;
$bHasMaintainer = (query_num_rows($hMaintainers) == 0) ? false : true;
$oTableRow = new TableRow();
$oTableRow->AddCell(new TableCell(print_date(mysqldatetime_to_unixtimestamp($this->sSubmitTime))));

View File

@@ -33,7 +33,7 @@ class Url {
WHERE type = 'url'
AND id = '?'";
$hResult = query_parameters($sQuery, $iUrlId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
// we are working on an existing url
@@ -77,7 +77,7 @@ class Url {
return false;
}
$this->iUrlId = mysql_insert_id();
$this->iUrlId = query_appdb_insert_id();
$this->url($this->iUrlId,$this->bQueued);
if(!$bSilent)
@@ -299,7 +299,7 @@ class Url {
if($hResult)
{
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
$sReturn .= html_tr(array(
"<input type=\"checkbox\" name=\"bRemove$oRow->id\" ".
@@ -360,7 +360,7 @@ class Url {
return FALSE;
}
if(!($oRow = mysql_fetch_object($hResult)))
if(!($oRow = query_fetch_object($hResult)))
return FALSE;
$num = $oRow->num;
@@ -378,7 +378,7 @@ class Url {
return FALSE;
}
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$url = new url($oRow->id);
@@ -485,7 +485,7 @@ class Url {
return FALSE;
}
for($i = 0; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
{
// create a url object
$oUrl = new Url(null, $oRow);

View File

@@ -40,7 +40,7 @@ class User {
FROM user_list
WHERE userId = '?'";
$hResult = query_parameters($sQuery, $iUserId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow)
{
$this->iUserId = $oRow->userid;
@@ -81,7 +81,7 @@ class User {
{
$hResult = query_parameters($sQuery.$sMysqlSHAPasswordPart,
$sEmail, $sPassword);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
// if we aren't logged in yet
@@ -90,7 +90,7 @@ class User {
{
$hResult = query_parameters($sQuery.$sMysqlPasswordPart,
$sEmail, $sPassword);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow) $bUsedOldStylePassword = true;
}
@@ -107,7 +107,7 @@ class User {
{
$hResult = query_parameters($sQuery.$sMysql40xPasswordPart,
$sEmail, $sPassword);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow) $bUsedOldStylePassword = true;
}
}
@@ -265,9 +265,9 @@ class User {
$hResult = query_parameters("SELECT * FROM user_prefs WHERE userid = '?' AND name = '?'",
$this->iUserId, $sKey);
if(!$hResult || mysql_num_rows($hResult) == 0)
if(!$hResult || query_num_rows($hResult) == 0)
return $sDef;
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->value;
}
@@ -300,7 +300,7 @@ class User {
$this->iUserId, $sPriv);
if(!$hResult)
return false;
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
@@ -373,7 +373,7 @@ class User {
WHERE submitterId = '?'
AND appId = '?'",
$this->iUserId, $iAppId);
if(mysql_num_rows($hResult))
if(query_num_rows($hResult))
return true;
else
return false;
@@ -386,7 +386,7 @@ class User {
AND appVersion.submitterId = '?'
AND appVersion.versionId = '?'",
$this->iUserId, $iVersionId);
if(mysql_num_rows($hResult))
if(query_num_rows($hResult))
return true;
else
return false;
@@ -398,7 +398,7 @@ class User {
{
$hResult = query_parameters("SELECT count(userId) as c FROM appComments WHERE userId = '?'",
$this->iUserId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow->c != 0) return true;
if($this->isMaintainer() || $this->isSuperMaintainer())
@@ -406,7 +406,7 @@ class User {
$hResult = query_parameters("SELECT count(userId) as c FROM appVotes WHERE userId = '?'",
$this->iUserId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow->c != 0) return true;
return false;
@@ -468,12 +468,12 @@ class User {
{
$hResult = query_parameters("SELECT userid FROM user_list WHERE email = '?'",
$sEmail);
if(!$hResult || mysql_num_rows($hResult) != 1)
if(!$hResult || query_num_rows($hResult) != 1)
{
return 0;
} else
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->userid;
}
}
@@ -485,7 +485,7 @@ class User {
function objectGetEntriesCount($bQueued = null, $bRejected = null)
{
$hResult = query_parameters("SELECT count(*) as num_users FROM user_list;");
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_users;
}
@@ -496,7 +496,7 @@ class User {
{
$hResult = query_parameters("SELECT count(*) as num_users FROM user_list WHERE stamp >= DATE_SUB(CURDATE(), interval '?' day);",
$days);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_users;
}
@@ -508,7 +508,7 @@ class User {
{
/* retrieve the number of users that have been warned and are pending deletion */
$hResult = query_parameters("select count(*) as count from user_list where inactivity_warned = 'true'");
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->count;
}
@@ -527,9 +527,9 @@ class User {
if($hResult)
{
if(mysql_num_rows($hResult) > 0)
if(query_num_rows($hResult) > 0)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
$aUserId[] = $oRow->userId;
}
}
@@ -560,9 +560,9 @@ class User {
}
if($hResult)
{
if(mysql_num_rows($hResult) > 0)
if(query_num_rows($hResult) > 0)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
$aUserId[] = $oRow->userId;
}
}
@@ -571,9 +571,9 @@ class User {
* Retrieve administrators.
*/
$hResult = query_parameters("SELECT * FROM user_privs WHERE priv = 'admin'");
if(mysql_num_rows($hResult) > 0)
if(query_num_rows($hResult) > 0)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$i = array_search($oRow->userid, $aUserId);

View File

@@ -176,7 +176,7 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
// TODO: if we ever get a reasonable way to order the list replace this code
// with that
$aVersions = array();
while(list($sValue) = mysql_fetch_row($hResult))
while(list($sValue) = query_fetch_row($hResult))
{
// exclude unspecified versions and the "CVS" version
if(($sValue != "unspecified") && ($sValue != "CVS"))
@@ -246,7 +246,7 @@ function make_maintainer_rating_list($varname, $cvalue)
function getNumberOfComments()
{
$hResult = query_parameters("SELECT count(*) as num_comments FROM appComments;");
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_comments;
}
@@ -256,7 +256,7 @@ function getNumberOfQueuedBugLinks()
$hResult = query_parameters("SELECT count(*) as num_buglinks FROM buglinks WHERE queued='true';");
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_buglinks;
}
return 0;
@@ -268,7 +268,7 @@ function getNumberOfBugLinks()
$hResult = query_parameters("SELECT count(*) as num_buglinks FROM buglinks;");
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return $oRow->num_buglinks;
}
return 0;
@@ -316,8 +316,8 @@ function outputTopXRow($oRow)
function outputTopXRowAppsFromRating($sRating, $iNumApps)
{
/* clean the input values so we can continue to use query_appdb() */
$sRating = mysql_real_escape_string($sRating);
$iNumApps = mysql_real_escape_string($iNumApps);
$sRating = query_escape_string($sRating);
$iNumApps = query_escape_string($iNumApps);
/* list of versionIds we've already output, so we don't output */
/* them again when filling in any empty spots in the list */
@@ -331,8 +331,8 @@ function outputTopXRowAppsFromRating($sRating, $iNumApps)
ORDER BY c DESC
LIMIT ?";
$hResult = query_parameters($sQuery, $sRating, $iNumApps);
$iNumApps -= mysql_num_rows($hResult); /* take away the rows we are outputting here */
while($oRow = mysql_fetch_object($hResult))
$iNumApps -= query_num_rows($hResult); /* take away the rows we are outputting here */
while($oRow = query_fetch_object($hResult))
{
/* keep track of the apps we've already output */
$aVersionId[] = $oRow->versionId;
@@ -358,7 +358,7 @@ function outputTopXRowAppsFromRating($sRating, $iNumApps)
/* get the list that will fill the empty spots */
$hResult = query_appdb($sQuery);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
outputTopXRow($oRow);
}
@@ -457,13 +457,13 @@ function searchForApplication($search_words)
$sQuery = "SELECT vendorId from vendor where vendorName LIKE '%?%'
OR vendorURL LIKE '%?%'";
$hResult = query_parameters($sQuery, $value, $value);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
array_push($vendorIdArray, $oRow->vendorId);
}
}
$search_words = str_replace(' ', '%', mysql_real_escape_string($search_words));
$search_words = str_replace(' ', '%', query_escape_string($search_words));
/* base query */
$sQuery = "SELECT *
@@ -477,7 +477,7 @@ function searchForApplication($search_words)
/* append to the query any vendors that we matched with */
foreach($vendorIdArray as $key=>$value)
{
$sQuery.=" OR appFamily.vendorId=".mysql_real_escape_string($value);
$sQuery.=" OR appFamily.vendorId=".query_escape_string($value);
}
$sQuery.=" ) ORDER BY appName";
@@ -497,7 +497,7 @@ function searchForApplicationFuzzy($search_words, $minMatchingPercent)
/* add on all of the like matches that we can find */
$hResult = searchForApplication($search_words);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
array_push($excludeAppIdArray, $oRow->appId);
}
@@ -506,7 +506,7 @@ function searchForApplicationFuzzy($search_words, $minMatchingPercent)
$sQuery = "SELECT appName, appId FROM appFamily WHERE queued = 'false'";
foreach ($excludeAppIdArray as $key=>$value)
{
$sQuery.=" AND appId != '".mysql_real_escape_string($value)."'";
$sQuery.=" AND appId != '".query_escape_string($value)."'";
}
$sQuery.=";";
@@ -514,7 +514,7 @@ function searchForApplicationFuzzy($search_words, $minMatchingPercent)
$search_words = strtoupper($search_words);
$hResult = query_appdb($sQuery);
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oRow->appName = strtoupper($oRow->appName); /* convert the appname to upper case */
similar_text($oRow->appName, $search_words, $similarity_pst);
@@ -535,11 +535,11 @@ function searchForApplicationFuzzy($search_words, $minMatchingPercent)
{
if($firstEntry == true)
{
$sQuery.="appId='".mysql_real_escape_string($value)."'";
$sQuery.="appId='".query_escape_string($value)."'";
$firstEntry = false;
} else
{
$sQuery.=" OR appId='".mysql_real_escape_string($value)."'";
$sQuery.=" OR appId='".query_escape_string($value)."'";
}
}
$sQuery.=" ORDER BY appName;";
@@ -550,7 +550,7 @@ function searchForApplicationFuzzy($search_words, $minMatchingPercent)
function outputSearchTableForhResult($search_words, $hResult)
{
if(($hResult == null) || (mysql_num_rows($hResult) == 0))
if(($hResult == null) || (query_num_rows($hResult) == 0))
{
// do something
echo html_frame_start("","98%");
@@ -568,7 +568,7 @@ function outputSearchTableForhResult($search_words, $hResult)
echo "</tr>\n\n";
$c = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oApp = new application($oRow->appId);
//skip if a NONAME
@@ -580,7 +580,7 @@ function outputSearchTableForhResult($search_words, $hResult)
//count versions
$hResult2 = query_parameters("SELECT count(*) as versions FROM appVersion WHERE appId = '?' AND versionName != 'NONAME' and queued = 'false'",
$oRow->appId);
$y = mysql_fetch_object($hResult2);
$y = query_fetch_object($hResult2);
//display row
echo "<tr class=$bgcolor>\n";

View File

@@ -31,7 +31,7 @@ class Vendor {
FROM vendor
WHERE vendorId = '?'";
if($hResult = query_parameters($sQuery, $iVendorId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -50,7 +50,7 @@ class Vendor {
WHERE vendorId = '?'";
if($hResult = query_parameters($sQuery, $this->iVendorId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$this->aApplicationsIds[] = $oRow->appId;
}
@@ -71,9 +71,9 @@ class Vendor {
/* Check for duplicates */
$hResult = query_parameters("SELECT * FROM vendor WHERE vendorName = '?'",
$this->sName);
if($hResult && $oRow = mysql_fetch_object($hResult))
if($hResult && $oRow = query_fetch_object($hResult))
{
if(mysql_num_rows($hResult))
if(query_num_rows($hResult))
{
$this->vendor($oRow->vendorId);
@@ -89,7 +89,7 @@ class Vendor {
$this->mustBeQueued() ? "true" : "false");
if($hResult)
{
$this->iVendorId = mysql_insert_id();
$this->iVendorId = query_appdb_insert_id();
$this->vendor($this->iVendorId);
return true;
}
@@ -355,7 +355,7 @@ class Vendor {
if(!$hResult)
return FALSE;
if(!$oRow = mysql_fetch_object($hResult))
if(!$oRow = query_fetch_object($hResult))
return FALSE;
return $oRow->count;

View File

@@ -55,7 +55,7 @@ class version {
FROM appVersion
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $iVersionId))
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
}
if($oRow)
@@ -96,7 +96,7 @@ class version {
if($hResult)
{
$this->iVersionId = mysql_insert_id();
$this->iVersionId = query_appdb_insert_id();
$this->Version($this->iVersionId);
$this->SendNotificationMail();
@@ -226,7 +226,7 @@ class version {
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aNotesIds[] = $oRow->noteId;
}
@@ -247,7 +247,7 @@ class version {
WHERE versionId = '?'";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aCommentsIds[] = $oRow->commentId;
}
@@ -269,7 +269,7 @@ class version {
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
if($oRow->type="image")
$aScreenshotsIds[] = $oRow->id;
@@ -307,7 +307,7 @@ class version {
ORDER BY testingId";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aTestingIds[] = $oRow->testingId;
}
@@ -328,7 +328,7 @@ class version {
ORDER BY monitorId";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aMonitorIds[] = $oRow->monitorId;
}
@@ -391,9 +391,9 @@ class version {
appMaintainers WHERE userId = '?' AND versionId = '?'",
$this->iSubmitterId, $this->iVersionId);
if($hResultMaint && mysql_num_rows($hResultMaint))
if($hResultMaint && query_num_rows($hResultMaint))
{
$oMaintainerRow = mysql_fetch_object($hResultMaint);
$oMaintainerRow = query_fetch_object($hResultMaint);
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
$oMaintainer->unQueue("OK");
}
@@ -569,7 +569,7 @@ class version {
ORDER BY bug_id";
if($hResult = query_parameters($sQuery, $this->iVersionId))
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aBuglinkIds[] = $oRow->linkId;
}
@@ -1014,7 +1014,7 @@ class version {
$hNotes = query_parameters("SELECT noteId FROM appNotes WHERE versionId = '?'",
$this->iVersionId);
while( $oRow = mysql_fetch_object($hNotes) )
while( $oRow = query_fetch_object($hNotes) )
{
$oNote = new Note($oRow->noteId);
$oNote->display();
@@ -1029,9 +1029,9 @@ class version {
if(!$versionId) return null;
$result = query_parameters("SELECT versionName FROM appVersion WHERE versionId = '?'",
$versionId);
if(!$result || mysql_num_rows($result) != 1)
if(!$result || query_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
$ob = query_fetch_object($result);
return $ob->versionName;
}
@@ -1046,10 +1046,10 @@ class version {
AND versionId = '?'",
$iVersionId);
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return FALSE;
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
return "$oRow->appName $oRow->versionName";
}
@@ -1183,7 +1183,7 @@ class version {
$hResult = Maintainer::getMaintainersForAppIdVersionId(null, $this->iVersionId);
$iCount = 0;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$aMaintainers[$iCount] = $oRow->userId;
$iCount++;
@@ -1197,7 +1197,7 @@ class version {
{
$hResult = query_parameters("SELECT appFamily.appName, appVersion.versionName, appVersion.description, appVersion.versionId, appVersion.submitTime FROM appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND appVersion.submitterId = '?' AND appVersion.queued = '?' AND appFamily.queued = '?'", $iUserId, $bQueued ? "true" : "false", "false");
if(!$hResult || !mysql_num_rows($hResult))
if(!$hResult || !query_num_rows($hResult))
return false;
$oTable = new Table();
@@ -1212,7 +1212,7 @@ class version {
$oTableRow->SetClass("color4");
$oTable->SetHeader($oTableRow);
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{
$oTableRow = new TableRow();
$oTableRow->AddTextCell(version::fullNameLink($oRow->versionId));
@@ -1343,7 +1343,7 @@ class version {
if(!$hResult)
return FALSE;
if(!$oRow = mysql_fetch_object($hResult))
if(!$oRow = query_fetch_object($hResult))
return FALSE;
return $oRow->count;
@@ -1546,7 +1546,7 @@ class version {
if(!$hResult)
return FALSE;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oTestData = new testData($oRow->testingId);
$oTestData->iVersionId = $iNewId;
@@ -1563,7 +1563,7 @@ class version {
if(!$hResult)
return FALSE;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oAppData = new appData($oRow->testingId);
$oAppData->iVersionId = $iNewId;

View File

@@ -27,7 +27,7 @@ class version_queue
$hResult = appData::getData($iVersionId, "downloadurl",
TRUE, TRUE, TRUE))
{
if($oRow = mysql_fetch_object($hResult))
if($oRow = query_fetch_object($hResult))
$iDownloadUrlId = $oRow->id;
}
}

View File

@@ -17,7 +17,7 @@ function vote_count($iVersionId, $iUserId = null)
}
$hResult = query_parameters("SELECT * FROM appVotes WHERE versionId = '?' AND userId = '?'",
$iVersionId, $iUserId);
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
@@ -34,7 +34,7 @@ function vote_count_user_total($iUserId = null)
return 0;
}
$hResult = query_parameters("SELECT * FROM appVotes WHERE userId = '?'", $iUserId);
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
@@ -45,7 +45,7 @@ function vote_count_version_total($iVersionId)
{
$hResult = query_parameters("SELECT * FROM appVotes WHERE versionId = '?'",
$iVersionId);
return mysql_num_rows($hResult);
return query_num_rows($hResult);
}
@@ -105,7 +105,7 @@ function vote_get_user_votes($iUserId = null)
return array();
$obs = array();
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
$obs[$oRow->slot] = $oRow;
return $obs;
}
@@ -198,7 +198,7 @@ function is_vote_in_slot($iSlot, $iUserId = null)
$sQuery = "SELECT COUNT(*) as count from appVotes WHERE userId = '?' AND slot = '?'";
if($hResult = query_parameters($sQuery, $iUserId, $iSlot))
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow->count != 0)
return true;
else

View File

@@ -62,7 +62,7 @@ if(!$_SESSION['current']->isLoggedIn())
"FROM appVotes ".
"GROUP BY versionId ORDER BY count DESC LIMIT 1";
$hResult = query_parameters($voteQuery);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
echo "There are <b>$iNumApps</b> applications currently in the database";

View File

@@ -32,7 +32,7 @@ function build_prefs_list($oUser)
$aTableRows = array();
$hResult = query_parameters("SELECT * FROM prefs_list ORDER BY id");
while($hResult && $r = mysql_fetch_object($hResult))
while($hResult && $r = query_fetch_object($hResult))
{
// skip admin options
if(!$_SESSION['current']->hasPriv("admin"))

View File

@@ -60,7 +60,7 @@ apidb_header("Screenshots");
$oApp = new Application($aClean['iAppId']);
$oVersion = new Version($aClean['iVersionId']);
if($hResult && mysql_num_rows($hResult))
if($hResult && query_num_rows($hResult))
{
echo html_frame_start("Screenshot Gallery for ".$oApp->sName." ".$oVersion->sName,500);
@@ -72,7 +72,7 @@ if($hResult && mysql_num_rows($hResult))
$bUserIsMaintainerOfVersion = false;
echo "<div align=center><table><tr>\n";
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
// if the current version changed then update the current version
// and close the previous html frame if this isn't the

View File

@@ -117,7 +117,7 @@ class table_counts
{
$sQuery = "select count(*) as cnt from ?;";
$hResult = query_parameters($sQuery, $sTable);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$this->aTableCounts[] = $oRow->cnt;
}

View File

@@ -62,7 +62,7 @@ function test_application_delete()
if($hResult = query_parameters($sQuery, $iAppId))
{
$iRows = mysql_num_rows($hResult);
$iRows = query_num_rows($hResult);
if($iRows > 0)
{
echo "Found '".$iRows."' versions for this application left over!";

View File

@@ -555,7 +555,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
/* The application should have one maintainer */
$iExpected = 1;
$iReceived = mysql_num_rows($hResult);
$iReceived = query_num_rows($hResult);
if($iExpected != $iReceived)
{
error("Got super maintainer count of $iReceived instead of $iExpected!");
@@ -575,7 +575,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
/* The version should have one maintainer */
$iExpected = 1;
$iReceived = mysql_num_rows($hResult);
$iReceived = query_num_rows($hResult);
if($iExpected != $iReceived)
{
error("Got maintainer count of $iReceived instead of $iExpected!");
@@ -614,7 +614,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
/* The first version should have one maintainer */
$iExpected = 1;
$iReceived = mysql_num_rows($hResult);
$iReceived = query_num_rows($hResult);
if($iExpected != $iReceived)
{
error("Got maintainer count of $iReceived instead of $iExpected!");
@@ -634,7 +634,7 @@ function test_maintainer_getMaintainersForAppIdVersionId()
/* The second version should have 1 maintainer */
$iExpected = 1;
$iReceived = mysql_num_rows($hResult);
$iReceived = query_num_rows($hResult);
if($iExpected != $iReceived)
{
error("Got maintainer count of $iReceived instead of $iExpected!");

View File

@@ -130,7 +130,7 @@ class notifyContainer
{
$sQuery2 = "select * from appMaintainers where maintainerId = '?'";
$hResult = query_parameters($sQuery2, $this->oMaintainer->iMaintainerId);
$oObject = mysql_fetch_object($hResult);
$oObject = query_fetch_object($hResult);
print_r($oObject);
}
@@ -317,7 +317,7 @@ function test_maintainer_notifyLevel_2_to_3($bTestAsMaintainer)
// check to make sure the maintainer doesn't exist
$sQuery = "select count(*) as cnt from appMaintainers where maintainerId = '?'";
$hResult = query_parameters($sQuery, $oNotifyContainer->oMaintainer->iMaintainerId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($oRow->cnt != 0)
{
$bSuccess = false;

View File

@@ -54,15 +54,15 @@ function test_class($sClassName, $aTestMethods)
if(!$hResult)
{
error("Got '$hResult' instead of a valid MySQL handle");
error("Got '$hResult' instead of a valid query handle");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
return FALSE;
}
if(!($oRow = mysql_fetch_object($hResult)))
if(!($oRow = query_fetch_object($hResult)))
{
error("Failed to fetch MySQL object");
error("Failed to fetch query object");
error("FAILED\t\t$sClassName::$sClassName");
$oTestObject->delete();
return FALSE;
@@ -111,7 +111,7 @@ function test_class($sClassName, $aTestMethods)
/* Should return 1 or more, since there may be entries present already */
$iExpected = 1;
$hResult = $oTestObject->objectGetEntries(false, false);
$iReceived = mysql_num_rows($hResult);
$iReceived = query_num_rows($hResult);
if($iExpected > $iReceived)
{
error("Got $iReceived instead of >= $iExpected");
@@ -223,7 +223,7 @@ function create_object($sClassName, $oUser)
error("FAILED\t\t$sClassName to create screenshot entry");
return FALSE;
}
$oTestObject->iScreenshotId = mysql_insert_id();
$oTestObject->iScreenshotId = query_appdb_insert_id();
}
return $oTestObject;

View File

@@ -30,7 +30,7 @@ function test_query_parameters()
return false;
}
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$iUserCount = $oRow->count;
/* see that '~' strings are replaced with parameters */
@@ -41,7 +41,7 @@ function test_query_parameters()
$hResult = query_parameters($sQuery, "user_list", "1' OR 1='1");
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($iUserCount != $oRow->count)
{
echo "sQuery of '".$sQuery."' returned ".$oRow->count." entries instead of the expected ".$iUserCount."\n";
@@ -88,7 +88,7 @@ function test_query_parameters()
* properly with slashes in the query, they were incorrectly being recognized
* as tokens that should be replaced with parameters
*/
$sQuery = "SELECT count(*) as count, '".mysql_real_escape_string("\r\n")."' as x from ?";
$sQuery = "SELECT count(*) as count, '".query_escape_string("\r\n")."' as x from ?";
$hResult = query_parameters($sQuery, "user_list");
if(!$hResult)
{

View File

@@ -19,13 +19,13 @@ function test_user_password_migration()
// generate the SHA1() of the users password
$sQuery = "select SHA1('?') as password;";
$hResult = query_parameters($sQuery, $sTestPassword);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$sTestUserPasswordSHA1 = $oRow->password;
// test that the user was created with the sha1 hash of their password
$sQuery = "select password from user_list where userid = '?';";
$hResult = query_parameters($sQuery, $oUser->iUserId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($sTestUserPasswordSHA1 != $oRow->password)
{
error("sTestUserPasswordSHA1 $sTestUserPasswordSHA1 doesn't match oRow->password of $oRow->password after user::create()");
@@ -56,7 +56,7 @@ function test_user_password_migration()
// after the user was logged in
$sQuery = "select password from user_list where userid = '?';";
$hResult = query_parameters($sQuery, $oUser->iUserId);
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
if($sTestUserPasswordSHA1 != $oRow->password)
{
error("sTestUserPasswordSHA1 $sTestUserPasswordSHA1 doesn't match oRow->password of $oRow->password");

View File

@@ -59,7 +59,7 @@ echo "</center>";
$Ids = appData::objectGetEntries(false, false, $ItemsPerPage, $offset, "screenshot");
$c = 1;
echo "<div align=center><table><tr>\n";
while ($oRow = mysql_fetch_object($Ids))
while ($oRow = query_fetch_object($Ids))
{
// display thumbnail
$oVersion = new version($oRow->versionId);

View File

@@ -42,14 +42,14 @@ if(!is_numeric($aClean['iBugId']))
if($hResult)
{
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$oApp = new application($oRow->appId);
$oVersion = new version($oRow->versionId);
$sDownloadUrls = "";
if($hDownloadUrls = appData::getData($oRow->versionId, "downloadurl"))
{
while($oDownloadUrl = mysql_fetch_object($hDownloadUrls))
while($oDownloadUrl = query_fetch_object($hDownloadUrls))
$sDownloadUrls .= "<a href=\"$oDownloadUrl->url\">".
"$oDownloadUrl->description</a><br />";
}

View File

@@ -56,7 +56,7 @@ if(!empty($aClean['iCategoryId']))
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
$oRow = query_fetch_object($hResult);
$catParent = $oRow->catParent;
array_push($cat_array, "$currentCatId");
@@ -174,7 +174,7 @@ if($hResult)
$oTable->AddRow($oTableRow);
$c = 1;
while($oRow = mysql_fetch_object($hResult))
while($oRow = query_fetch_object($hResult))
{
$sColor = ($c % 2) ? "color0" : "color1";