Update device_vendor_edit.php

This commit is contained in:
FusionPBX 2018-06-29 22:06:07 -06:00 committed by GitHub
parent 4f017f6bc4
commit 06b76347b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 65 additions and 64 deletions

View File

@ -58,14 +58,16 @@
$description = check_str($_POST["description"]); $description = check_str($_POST["description"]);
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the data
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //get the uuid
if ($action == "update") { if ($action == "update") {
$device_vendor_uuid = check_str($_POST["device_vendor_uuid"]); $device_vendor_uuid = check_str($_POST["device_vendor_uuid"]);
} }
//check for all required data //check for all required data
$msg = '';
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; } if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; } if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; } //if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
@ -120,16 +122,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
messages::add($text['message-update']); messages::add($text['message-update']);
header("Location: device_vendors.php"); header("Location: device_vendors.php");
return; return;
} //if ($action == "update") } //if ($action == "update")
} //if ($_POST["persistformvar"] != "true") } //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$device_vendor_uuid = check_str($_GET["id"]); $device_vendor_uuid = check_str($_GET["id"]);
$sql = "select * from v_device_vendors "; $sql = "select * from v_device_vendors ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' "; $sql .= "where device_vendor_uuid = '".$device_vendor_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@ -160,7 +161,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-name']."\n"; echo " ".$text['label-name']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"$name\">\n"; echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"".escape($name)."\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-name']."\n"; echo $text['description-name']."\n";
echo "</td>\n"; echo "</td>\n";
@ -196,7 +197,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-description']."\n"; echo " ".$text['label-description']."\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n"; echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"".escape($description)."\">\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-description']."\n"; echo $text['description-description']."\n";
echo "</td>\n"; echo "</td>\n";
@ -204,7 +205,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n"; echo " <tr>\n";
echo " <td colspan='2' align='right'>\n"; echo " <td colspan='2' align='right'>\n";
if ($action == "update") { if ($action == "update") {
echo " <input type='hidden' name='device_vendor_uuid' value='$device_vendor_uuid'>\n"; echo " <input type='hidden' name='device_vendor_uuid' value='".escape($device_vendor_uuid)."'>\n";
} }
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n"; echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n"; echo " </td>\n";