diff --git a/admin/editBundle.php b/admin/editBundle.php
index 9f259a9..7a7895d 100644
--- a/admin/editBundle.php
+++ b/admin/editBundle.php
@@ -21,73 +21,76 @@ function build_app_list()
echo "\n";
}
-
-if($cmd)
+if($_REQUEST['cmd'])
{
- if($cmd == "delete")
+ if($_REQUEST['cmd'] == "delete")
{
- $hResult = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
+ $hResult = query_appdb("DELETE FROM appBundle WHERE appId =".$_REQUEST['appId']." AND bundleId =".$_REQUEST['bundleId']);
if($hResult)
addmsg("App deleted from bundle", "green");
+ else
+ addmsg("Failed to delete app from bundle!", "red");
}
- if($cmd == "add")
+ if($_REQUEST['cmd'] == "add")
{
- $hResult = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
+ $hResult = query_appdb("INSERT INTO appBundle VALUES (".$_REQUEST['bundleId'].", ".$_REQUEST['appId'].")");
if($hResult)
- addmsg("App $appId added to Bundle $bundleId", "green");
+ addmsg("App $appId added to Bundle".$_REQUEST['bundleId'], "green");
}
- redirectref();
- exit;
}
-else
+
+
+apidb_header("Edit Application Bundle");
+
+$hResult = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
+ "WHERE bundleId = ".$_REQUEST['bundleId']." AND appFamily.appId = appBundle.appId");
+
+echo html_frame_start("Apps in this Bundle","300",'',0);
+echo "
\n\n";
+
+echo "\n";
+echo " | Application Name | \n";
+echo " Delete | \n";
+echo "
\n\n";
+
+if($hResult && mysql_num_rows($hResult))
{
- apidb_header("Edit Application Bundle");
-
- $hResult = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
- "WHERE bundleId = $bundleId AND appFamily.appId = appBundle.appId");
-
- if($hResult && mysql_num_rows($hResult))
+ $c = 1;
+ while($oRow = mysql_fetch_object($hResult))
{
- echo html_frame_start("Apps in this Bundle","300",'',0);
- echo "\n\n";
-
- echo "\n";
- echo " | Application Name | \n";
- echo " Delete | \n";
- echo "
\n\n";
-
- $c = 1;
- while($oRow = mysql_fetch_object($hResult))
- {
- //set row color
- if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
+ //set row color
+ if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
- $delete_link = "[delete]";
+ $delete_link = "[appId'>delete]";
- echo "\n";
- echo " | $oRow->appName | \n";
- echo " $delete_link | \n";
- echo "
\n\n";
+ echo "\n";
+ echo " | $oRow->appName | \n";
+ echo " $delete_link | \n";
+ echo "
\n\n";
- $c++;
- }
-
- echo "
\n\n";
- echo html_frame_end();
+ $c++;
}
-
- echo "\n";
-
- apidb_footer();
+} else if($hResult && !mysql_num_rows($hResult))
+{
+ /* indicate to the user that there are no apps in this bundle at the moment */
+ echo "\n";
+ echo " | No applications in this bundle | \n";
+ echo "
\n";
}
+echo "
\n\n";
+echo html_frame_end();
+
+echo "\n";
+
+apidb_footer();
?>