Prevent inserting the a new device if the domain does not exist.
This commit is contained in:
@@ -162,7 +162,7 @@ include "root.php";
|
|||||||
$provision[$key] = $value;
|
$provision[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to see if the mac_address exists in v_devices
|
//check to see if the mac_address exists in devices
|
||||||
if ($this->mac_exists($mac)) {
|
if ($this->mac_exists($mac)) {
|
||||||
//get the device_template
|
//get the device_template
|
||||||
//if (strlen($device_template) == 0) {
|
//if (strlen($device_template) == 0) {
|
||||||
@@ -259,35 +259,37 @@ include "root.php";
|
|||||||
unset($template_list);
|
unset($template_list);
|
||||||
|
|
||||||
//mac address does not exist in the table so add it
|
//mac address does not exist in the table so add it
|
||||||
$device_uuid = uuid();
|
if (strlen($domain_uuid) > 0) {
|
||||||
$sql = "INSERT INTO v_devices ";
|
$device_uuid = uuid();
|
||||||
$sql .= "(";
|
$sql = "INSERT INTO v_devices ";
|
||||||
$sql .= "domain_uuid, ";
|
$sql .= "(";
|
||||||
$sql .= "device_uuid, ";
|
$sql .= "domain_uuid, ";
|
||||||
$sql .= "device_mac_address, ";
|
$sql .= "device_uuid, ";
|
||||||
$sql .= "device_vendor, ";
|
$sql .= "device_mac_address, ";
|
||||||
$sql .= "device_model, ";
|
$sql .= "device_vendor, ";
|
||||||
$sql .= "device_provision_enable, ";
|
$sql .= "device_model, ";
|
||||||
$sql .= "device_template, ";
|
$sql .= "device_provision_enable, ";
|
||||||
$sql .= "device_username, ";
|
$sql .= "device_template, ";
|
||||||
$sql .= "device_password, ";
|
$sql .= "device_username, ";
|
||||||
$sql .= "device_description ";
|
$sql .= "device_password, ";
|
||||||
$sql .= ") ";
|
$sql .= "device_description ";
|
||||||
$sql .= "VALUES ";
|
$sql .= ") ";
|
||||||
$sql .= "(";
|
$sql .= "VALUES ";
|
||||||
$sql .= "'".$domain_uuid."', ";
|
$sql .= "(";
|
||||||
$sql .= "'$device_uuid', ";
|
$sql .= "'".$domain_uuid."', ";
|
||||||
$sql .= "'$mac', ";
|
$sql .= "'$device_uuid', ";
|
||||||
$sql .= "'$device_vendor', ";
|
$sql .= "'$mac', ";
|
||||||
$sql .= "'', ";
|
$sql .= "'$device_vendor', ";
|
||||||
$sql .= "'true', ";
|
$sql .= "'', ";
|
||||||
$sql .= "'$device_template', ";
|
$sql .= "'true', ";
|
||||||
$sql .= "'', ";
|
$sql .= "'$device_template', ";
|
||||||
$sql .= "'', ";
|
$sql .= "'', ";
|
||||||
$sql .= "'auto {$_SERVER['HTTP_USER_AGENT']}' ";
|
$sql .= "'', ";
|
||||||
$sql .= ")";
|
$sql .= "'auto {$_SERVER['HTTP_USER_AGENT']}' ";
|
||||||
$this->db->exec(check_sql($sql));
|
$sql .= ")";
|
||||||
unset($sql);
|
$this->db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get the device settings table in the provision category and update the provision array
|
//get the device settings table in the provision category and update the provision array
|
||||||
@@ -357,7 +359,7 @@ include "root.php";
|
|||||||
$sip_port = $row['sip_port'];
|
$sip_port = $row['sip_port'];
|
||||||
|
|
||||||
//set defaults
|
//set defaults
|
||||||
if (strlen($register_expires) == 0) { $register_expires = "90"; }
|
if (strlen($register_expires) == 0) { $register_expires = "120"; }
|
||||||
if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; }
|
if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; }
|
||||||
if (strlen($sip_port) == 0) {
|
if (strlen($sip_port) == 0) {
|
||||||
if ($line_number == "" || $line_number == "1") {
|
if ($line_number == "" || $line_number == "1") {
|
||||||
|
|||||||
Reference in New Issue
Block a user