ownsApp($appId)) ) { errorpage("Insufficient Privileges!"); exit; } if($HTTP_POST_VARS) { $statusMessage = ''; // commit changes of form to database if($submit1 == "Update Database") { $statusMessage = ''; $appName = addslashes($appName); $description = addslashes($description); $webPage = addslashes($webPage); if (!mysql_query("UPDATE appFamily SET appName = '".$appName."', ". "vendorId = $vendorId, keywords = '".$keywords."', ". "description = '".$description."', ". "webPage = '".$webPage."', ". "catId = $catId". " WHERE appId = $appId")) { $statusMessage = "

Database Error!
".mysql_error()."

\n"; addmsg($statusMessage, "red"); } else addmsg("Database Updated", "green"); } else if($submit1 == "Update URL") { //process added URL if(debugging()) { echo "

$url: $url_desc

"; } if ($url_desc && $url ) { $query = "INSERT INTO appData VALUES (null, $appId, 0, 'url','$url_desc', '$url')"; if(debugging()) { echo "

query: $query

"; } if (mysql_query($query)) { //success addmsg("The URL was successfully added into the database", "green"); } else { //error $statusMessage = "

Database Error!
".mysql_error()."

\n"; addmsg($statusMessage, "red"); } } else if ($url_desc != $url) // not both blank { addmsg("The URL or description was blank. URL not added into the database", "red"); } // Process changed URL's for($i = 0; $i < $rows; $i++) { if(debugging()) { echo "

$adescription[$i]: $aURL[$i]: $adelete[$i] : $aId[$i] : .$aOldDesc[$i]. : $aOldURL[$i]

"; } if ($adelete[$i] == "on") { if(debugging()) { echo "

$adescription[$i]: $aURL[$i]: $adelete[$i] : $aId[$i] : $aOldDesc[$i] : $aOldURL[$i]

"; } $result = mysql_query("DELETE FROM appData WHERE id = '$aId[$i]'"); if(!$result) { //error $statusMessage = "

Database Error!
".mysql_error()." deleting URL ".$aOldDesc[$i]." (".$aOldURL[$i].")

\n"; addmsg($statusMessage, "red"); $i = $rows+1; } else { $statusMessage = "

Successfully deleted URL ".$aOldDesc[$i]." (".$aOldURL[$i].")

\n"; addmsg($statusMessage, "green"); } } else if( $aURL[$i] != $aOldURL[$i] || $adescription[$i] != $aOldDesc[$i]) { if(!$aURL[$i] || !$adescription[$i]) addmsg("The URL or description was blank. URL not changed in the database", "red"); else { if(debugging()) { echo "

$adescription[$i]: $aURL[$i]: $adelete[$i] : $aId[$i] : $aOldDesc[$i] : $aOldURL[$i]

"; } $adescription[$i] = addslashes($adescription[$i]); $aURL[$i] = addslashes($aURL[$i]); if (!mysql_query("UPDATE appData SET description = '".$adescription[$i]."' , url = '".$aURL[$i]."'". " WHERE Id = $aId[$i]")) { //error $statusMessage = "

Database Error!
".mysql_error()." updateing URL ".$aOldDesc[$i]." (".$aOldURL[$i].")

\n"; addmsg($statusMessage, "red"); $i = $rows+1; } else { $statusMessage = "

Successfully updated ".$aOldDesc[$i]." (".$aOldURL[$i].")

\n"; addmsg($statusMessage, "green"); } } } } } } //Show the form for editing the Application Family { $family = new TableVE("edit"); $result = mysql_query("SELECT appId, appName, vendorId, keywords, ". "description, webPage, catId from appFamily WHERE ". "appId = '$appId'"); if(!$result) { errorpage("You must be logged in to edit preferences"); exit; } list($appId, $appName, $vendorId, $keywords, $description, $webPage, $catId) = mysql_fetch_row($result); if(debugging()) { echo "

appName: $appName

"; } // show edit app family form $table = "appFamily"; $query = "SELECT * FROM $table WHERE appId = $appId"; if(debugging()) { echo "

query: $query

"; } apidb_header("Edit Application Family"); echo "
\n"; echo html_frame_start("Data for Application ID $appId", "90%","",0); echo html_table_begin("width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body'"); echo ''; echo 'Name',"\n"; echo 'Vendor'; $family->make_option_list("vendorId", $vendorId, "vendor", "vendorId", "vendorName"); echo '',"\n"; echo 'Keywords',"\n"; echo 'Description', "\n"; echo '',"\n"; echo 'Web Page',"\n"; echo 'Category'; $family->make_option_list("catId", $catId, "appCategory", "catId", "catName"); echo '',"\n"; echo '',"\n"; echo html_table_end(); echo html_frame_end(); // url edit form echo '',"\n"; echo html_frame_start("Edit URL","90%","",0); echo '',"\n"; $i = 0; $result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND type = 'url' AND versionId = 0"); if($result && mysql_num_rows($result) > 0) { echo '',"\n"; while($ob = mysql_fetch_object($result)) { $temp0 = "adelete[".$i."]"; $temp1 = "adescription[".$i."]"; $temp2 = "aURL[".$i."]"; $temp3 = "aId[".$i."]"; $temp4 = "aOldDesc[".$i."]"; $temp5 = "aOldURL[".$i."]"; echo '',"\n"; echo '',"\n"; echo ''; echo ''; echo '',"\n"; $i++; } } else { echo '',"\n"; echo '',"\n"; } echo "\n"; echo ''; echo '',"\n"; echo '',"\n"; echo '',"\n"; echo '
Delete',"\n"; echo 'DescriptionURL
',"\n"; echo '
DescriptionURL
New
',"\n"; echo html_frame_end(); echo html_back_link(1,$apidb_root."appview.php?appId=$appId"); } apidb_footer(); ?>