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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)." ?";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user