- replaced mysql_query() with query_appdb()
- removed opendb() - removed query_userdb() - removed error handling from the code as it is done with query_appdb()
This commit is contained in:
@@ -24,7 +24,7 @@ else
|
||||
$table = "appFamily";
|
||||
$query = "INSERT INTO $table VALUES(0, 'NONAME', 0, null, null, null, $catId)";
|
||||
|
||||
mysql_query("DELETE FROM $table WHERE appName = 'NONAME'");
|
||||
query_appdb("DELETE FROM $table WHERE appName = 'NONAME'");
|
||||
|
||||
if(debugging()) { echo "<p align=center><b>query:</b> $query </p>"; }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ if($_REQUEST['sub'] == "Submit")
|
||||
addslashes($_REQUEST['noteTitle'])."', '".
|
||||
addslashes($_REQUEST['noteDesc'])."', ".
|
||||
"{$_REQUEST['appId']}, {$_REQUEST['versionId']})";
|
||||
if (mysql_query($query))
|
||||
if (query_appdb($query))
|
||||
{
|
||||
// successful
|
||||
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||
|
||||
@@ -31,7 +31,7 @@ else
|
||||
$table = "appVersion";
|
||||
$query = "INSERT INTO $table VALUES(0, $appId, 'NONAME', null, null, null, 0.0, 0.0)";
|
||||
|
||||
mysql_query("DELETE FROM $table WHERE versionName = 'NONAME'");
|
||||
query_appdb("DELETE FROM $table WHERE versionName = 'NONAME'");
|
||||
|
||||
if(debugging())
|
||||
echo "$query <br /><br />\n";
|
||||
|
||||
@@ -28,7 +28,7 @@ else
|
||||
$table = "appCategory";
|
||||
$query = "INSERT INTO $table VALUES(0, 'NONAME', null, 0)";
|
||||
|
||||
mysql_query("DELETE FROM $table WHERE catName = 'NONAME'");
|
||||
query_appdb("DELETE FROM $table WHERE catName = 'NONAME'");
|
||||
|
||||
if(debugging())
|
||||
echo "$query <br /><br />\n";
|
||||
|
||||
@@ -28,7 +28,7 @@ else
|
||||
$table = "vendor";
|
||||
$query = "INSERT INTO $table VALUES(0, 'NONAME', null)";
|
||||
|
||||
mysql_query("DELETE FROM $table WHERE vendorName = 'NONAME'");
|
||||
query_appdb("DELETE FROM $table WHERE vendorName = 'NONAME'");
|
||||
|
||||
if(debugging())
|
||||
echo "$query <br /><br />\n";
|
||||
|
||||
@@ -22,10 +22,10 @@ if(!havepriv("admin"))
|
||||
if (!$_REQUEST['queueId'])
|
||||
{
|
||||
//get available appData
|
||||
$str_query = "SELECT * from appDataQueue;";
|
||||
$result = mysql_query($str_query);
|
||||
$sQuery = "SELECT * from appDataQueue;";
|
||||
$hResult = query_appdb($sQuery);
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
if(!$hResult || !mysql_num_rows($hResult))
|
||||
{
|
||||
//no appData in queue
|
||||
echo html_frame_start("","90%");
|
||||
@@ -55,7 +55,7 @@ if (!$_REQUEST['queueId'])
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c = 1;
|
||||
while($ob = mysql_fetch_object($result))
|
||||
while($ob = mysql_fetch_object($hResult))
|
||||
{
|
||||
if($_SESSION['current']->is_maintainer($ob->queueappId,
|
||||
$ob->queueversionId)
|
||||
@@ -90,9 +90,9 @@ if (!$_REQUEST['queueId'])
|
||||
exit;
|
||||
}
|
||||
|
||||
$str_request="SELECT * FROM appDataQueue WHERE queueId='".$_REQUEST['queueId']."'";
|
||||
$res_result=mysql_query($str_request);
|
||||
$obj_row=mysql_fetch_object($res_result);
|
||||
$sQuery="SELECT * FROM appDataQueue WHERE queueId='".$_REQUEST['queueId']."'";
|
||||
$hResult=query_appdb($sQuery);
|
||||
$obj_row=mysql_fetch_object($hResult);
|
||||
|
||||
if(!$_REQUEST['sub']=="inside_form")
|
||||
{
|
||||
@@ -168,16 +168,16 @@ if (!$_REQUEST['queueId'])
|
||||
|
||||
if($obj_row->type == "image")
|
||||
{
|
||||
$str_query = "INSERT INTO appData VALUES (null, ".$obj_row->appId.", ".$obj_row->versionId.", 'image', ".
|
||||
$sQuery = "INSERT INTO appData VALUES (null, ".$obj_row->appId.", ".$obj_row->versionId.", 'image', ".
|
||||
"'".addslashes($_REQUEST['description'])."', '')";
|
||||
mysql_query($str_query);
|
||||
query_appdb($sQuery);
|
||||
$int_id = mysql_insert_id();
|
||||
|
||||
// we move the content in the live directory
|
||||
rename("../data/queued/screenshots/".$obj_row->queueId, "../data/screenshots/".$int_id);
|
||||
|
||||
// we have to update the entry now that we know its name
|
||||
$str_query = "UPDATE appData SET url = '".$int_id."' WHERE id = '".$int_id."'";
|
||||
$sQuery = "UPDATE appData SET url = '".$int_id."' WHERE id = '".$int_id."'";
|
||||
|
||||
}
|
||||
elseif ($obj_row->type == "url") {
|
||||
@@ -187,23 +187,16 @@ if (!$_REQUEST['queueId'])
|
||||
|
||||
if(debugging()) addmsg("<p align=center><b>query:</b> $query </p>","green");
|
||||
|
||||
if (mysql_query($str_query))
|
||||
if (query_appdb($sQuery))
|
||||
{
|
||||
$statusMessage = "<p>The application data was successfully added into the database</p>\n";
|
||||
|
||||
//delete the item from the queue
|
||||
mysql_query("DELETE from appDataQueue where queueId = ".$obj_row->queueId.";");
|
||||
|
||||
$goodtogo = 1; /* set to 1 so we send the response email */
|
||||
} else
|
||||
{
|
||||
//error
|
||||
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
||||
}
|
||||
|
||||
//Send Status Email
|
||||
if (lookupEmail($obj_row->userId) && $goodtogo)
|
||||
{
|
||||
query_appdb("DELETE from appDataQueue where queueId = ".$obj_row->queueId.";");
|
||||
|
||||
//Send Status Email
|
||||
if (lookupEmail($obj_row->userId))
|
||||
{
|
||||
$ms = "Application Data Request Report\n";
|
||||
$ms .= "----------------------------------\n\n";
|
||||
$ms .= "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." has been accepted. ";
|
||||
@@ -213,11 +206,12 @@ if (!$_REQUEST['queueId'])
|
||||
$ms .= "-The AppDB admins\n";
|
||||
|
||||
mail(stripslashes(lookupEmail($obj_row->userId)),'[AppDB] Application Data Request Report',$ms);
|
||||
}
|
||||
}
|
||||
|
||||
//done
|
||||
echo html_frame_start("Submit App Data","600");
|
||||
echo "<p><b>$statusMessage</b></p>\n";
|
||||
//done
|
||||
echo html_frame_start("Submit App Data","600");
|
||||
echo "<p><b>$statusMessage</b></p>\n";
|
||||
}
|
||||
} elseif ($_REQUEST['reject'])
|
||||
{
|
||||
if (lookupEmail($obj_row->userId))
|
||||
@@ -233,17 +227,12 @@ if (!$_REQUEST['queueId'])
|
||||
}
|
||||
|
||||
//delete main item
|
||||
$str_query = "DELETE from appDataQueue where queueId = ".$obj_row->queueId.";";
|
||||
$sQuery = "DELETE from appDataQueue where queueId = ".$obj_row->queueId.";";
|
||||
unlink("../data/queued/screenshots/".$obj_row->queueId);
|
||||
|
||||
$result = mysql_query($str_query);
|
||||
$hResult = query_appdb($sQuery);
|
||||
echo html_frame_start("Delete application data submission",400,"",0);
|
||||
if(!$result)
|
||||
{
|
||||
//error
|
||||
echo "<p>Internal Error: unable to delete selected maintainer application!</p>\n";
|
||||
}
|
||||
else
|
||||
if($result)
|
||||
{
|
||||
//success
|
||||
echo "<p>Application data was successfully deleted from the Queue.</p>\n";
|
||||
|
||||
@@ -27,7 +27,7 @@ if ($_REQUEST['sub'])
|
||||
{
|
||||
//get data
|
||||
$query = "SELECT * from appQueue where queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
$ob = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ if ($_REQUEST['sub'])
|
||||
//category
|
||||
|
||||
$query = "select * from appCategory where catId = '$ob->queueCatId';";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
if($result)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result);
|
||||
@@ -143,7 +143,7 @@ if ($_REQUEST['sub'])
|
||||
// Use the first match if we found one and clear out the vendor field,
|
||||
// otherwise don't pick a vendor
|
||||
$query = "select * from vendor where vendorname = '$ob->queueVendor';";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
$checkvendor = 0;
|
||||
if($result)
|
||||
{
|
||||
@@ -154,7 +154,7 @@ if ($_REQUEST['sub'])
|
||||
{
|
||||
// try for a partial match
|
||||
$query = "select * from vendor where vendorname like '%$ob->queueVendor%';";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
if($result)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result);
|
||||
@@ -236,7 +236,7 @@ if ($_REQUEST['sub'])
|
||||
//get the id of the app just added
|
||||
$_REQUEST['appParent'] = mysql_insert_id();
|
||||
//delete queue item
|
||||
mysql_query("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
query_appdb("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
|
||||
//set ver if not set
|
||||
if (!$_REQUEST['queueVersion'])
|
||||
@@ -294,7 +294,7 @@ if ($_REQUEST['sub'])
|
||||
$_REQUEST['appVersion'] = mysql_insert_id();
|
||||
$statusMessage = "<p>The application ".$_REQUEST['queueName']." was successfully added into the database</p>\n";
|
||||
addmsg($statusMessage,"Green");
|
||||
mysql_query("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
query_appdb("DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
$goodtogo = 1;
|
||||
|
||||
}
|
||||
@@ -360,12 +360,10 @@ if ($_REQUEST['sub'])
|
||||
{
|
||||
//delete main item
|
||||
$query = "DELETE from appQueue where queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query, "unable to delete selected application!");
|
||||
if(!$result)
|
||||
{
|
||||
//error
|
||||
addmsg("Internal Error: unable to delete selected application!", "red");
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -413,7 +411,7 @@ else
|
||||
"queueVersion, queueEmail, queueCatId,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"from appQueue;";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
@@ -454,7 +452,7 @@ else
|
||||
if ($ob->queueCatId == -1)
|
||||
{
|
||||
$query2 = "select * from appFamily where appId = '$ob->queueName';";
|
||||
$result2 = mysql_query($query2);
|
||||
$result2 = query_appdb($query2);
|
||||
if($result2)
|
||||
{
|
||||
$ob2 = mysql_fetch_object($result2);
|
||||
|
||||
@@ -93,14 +93,14 @@ echo "</center>";
|
||||
|
||||
/* query for all of the commentId's, ordering by their time in reverse order */
|
||||
$offset = $currentPage * $commentsPerPage;
|
||||
$commentIds = mysql_query("SELECT commentId from appComments ORDER BY ".
|
||||
$commentIds = query_appdb("SELECT commentId from appComments ORDER BY ".
|
||||
"appComments.time ASC LIMIT $offset, $commentsPerPage;");
|
||||
while ($ob = mysql_fetch_object($commentIds))
|
||||
{
|
||||
$qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
|
||||
"commentId, parentId, appId, versionId, userid, subject, body ".
|
||||
"FROM appComments WHERE commentId = $ob->commentId;";
|
||||
$result = mysql_query($qstring);
|
||||
$result = query_appdb($qstring);
|
||||
|
||||
/* call view_app_comment to display the comment */
|
||||
$comment_ob = mysql_fetch_object($result);
|
||||
|
||||
@@ -24,7 +24,7 @@ if ($_REQUEST['sub'])
|
||||
"userId, maintainReason, superMaintainer,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"FROM appMaintainerQueue WHERE queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
$ob = mysql_fetch_object($result);
|
||||
mysql_free_result($result);
|
||||
}
|
||||
@@ -167,10 +167,6 @@ if ($_REQUEST['sub'])
|
||||
}
|
||||
else if ($_REQUEST['add'] && $_REQUEST['queueId'])
|
||||
{
|
||||
//add this user, app and version to the database
|
||||
$statusMessage = "";
|
||||
$goodtogo = 0;
|
||||
|
||||
// insert the new entry into the maintainers list
|
||||
$query = "INSERT into appMaintainers VALUES(null,".
|
||||
"$ob->appId,".
|
||||
@@ -179,23 +175,16 @@ if ($_REQUEST['sub'])
|
||||
"$ob->superMaintainer,".
|
||||
"NOW());";
|
||||
|
||||
if (mysql_query($query))
|
||||
if (query_appdb($query))
|
||||
{
|
||||
$statusMessage = "<p>The maintainer was successfully added into the database</p>\n";
|
||||
|
||||
//delete the item from the queue
|
||||
mysql_query("DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
|
||||
$goodtogo = 1; /* set to 1 so we send the response email */
|
||||
} else
|
||||
{
|
||||
//error
|
||||
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
|
||||
}
|
||||
|
||||
//Send Status Email
|
||||
if (lookupEmail($ob->userId) && $goodtogo)
|
||||
{
|
||||
query_appdb("DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";");
|
||||
|
||||
//Send Status Email
|
||||
if (lookupEmail($ob->userId))
|
||||
{
|
||||
$ms = "Application Maintainer Request Report\n";
|
||||
$ms .= "----------------------------------\n\n";
|
||||
$ms .= "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." has been accepted. ";
|
||||
@@ -205,10 +194,11 @@ if ($_REQUEST['sub'])
|
||||
$ms .= "-The AppDB admins\n";
|
||||
|
||||
mail(stripslashes(lookupEmail($ob->userId)),'[AppDB] Maintainer Request Report',$ms);
|
||||
}
|
||||
}
|
||||
|
||||
//done
|
||||
addmsg("<p><b>$statusMessage</b></p>", 'green');
|
||||
//done
|
||||
addmsg("<p><b>$statusMessage</b></p>", 'green');
|
||||
}
|
||||
}
|
||||
else if (($_REQUEST['reject'] || ($_REQUEST['sub'] == 'reject')) && $_REQUEST['queueId'])
|
||||
{
|
||||
@@ -226,14 +216,9 @@ if ($_REQUEST['sub'])
|
||||
|
||||
//delete main item
|
||||
$query = "DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query,"unable to delete selected maintainer application");
|
||||
echo html_frame_start("Delete maintainer application",400,"",0);
|
||||
if(!$result)
|
||||
{
|
||||
//error
|
||||
echo "<p>Internal Error: unable to delete selected maintainer application!</p>\n";
|
||||
}
|
||||
else
|
||||
if($result)
|
||||
{
|
||||
//success
|
||||
echo "<p>Maintainer application was successfully deleted from the Queue.</p>\n";
|
||||
@@ -258,7 +243,7 @@ if ($_REQUEST['sub'])
|
||||
"superMaintainer,".
|
||||
"UNIX_TIMESTAMP(submitTime) as submitTime ".
|
||||
"from appMaintainerQueue;";
|
||||
$result = mysql_query($query);
|
||||
$result = query_appdb($query);
|
||||
|
||||
if(!$result || !mysql_num_rows($result))
|
||||
{
|
||||
|
||||
@@ -250,7 +250,7 @@ else
|
||||
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
|
||||
|
||||
$i = 0;
|
||||
$result = mysql_query("SELECT * FROM appData WHERE appId = $ob->appId AND type = 'url' AND versionId = 0");
|
||||
$result = query_appdb("SELECT * FROM appData WHERE appId = $ob->appId AND type = 'url' AND versionId = 0");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
|
||||
|
||||
@@ -11,7 +11,7 @@ if(!havepriv("admin"))
|
||||
|
||||
function build_app_list()
|
||||
{
|
||||
$result = mysql_query("SELECT appId, appName FROM appFamily ORDER BY appName");
|
||||
$result = query_appdb("SELECT appId, appName FROM appFamily ORDER BY appName");
|
||||
|
||||
echo "<select name=appId size=5 onChange='this.form.submit()'>\n";
|
||||
while($ob = mysql_fetch_object($result))
|
||||
@@ -26,7 +26,7 @@ if($cmd)
|
||||
{
|
||||
if($cmd == "delete")
|
||||
{
|
||||
$result = mysql_query("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
|
||||
$result = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
|
||||
if($result)
|
||||
addmsg("App deleted from bundle", "green");
|
||||
else
|
||||
@@ -34,7 +34,7 @@ if($cmd)
|
||||
}
|
||||
if($cmd == "add")
|
||||
{
|
||||
$result = mysql_query("INSERT INTO appBundle VALUES ($bundleId, $appId)");
|
||||
$result = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
|
||||
if($result)
|
||||
addmsg("App $appId added to Bundle $bundleId", "green");
|
||||
else
|
||||
@@ -47,7 +47,7 @@ else
|
||||
{
|
||||
apidb_header("Edit Application Bundle");
|
||||
|
||||
$result = mysql_query("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
|
||||
$result = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
|
||||
"WHERE bundleId = $bundleId AND appFamily.appId = appBundle.appId");
|
||||
|
||||
if($result && mysql_num_rows($result))
|
||||
|
||||
Reference in New Issue
Block a user