Update provision.php

This commit is contained in:
FusionPBX
2019-08-21 16:32:14 -06:00
committed by GitHub
parent 1edd5b03c8
commit ead4a8b522
+12 -10
View File
@@ -309,11 +309,11 @@ include "root.php";
} }
//check to see if the mac_address exists in devices //check to see if the mac_address exists in devices
if (strlen($_REQUEST['user_id']) == 0 || strlen($_REQUEST['userid']) == 0) { //if (strlen($_REQUEST['user_id']) == 0 || strlen($_REQUEST['userid']) == 0) {
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) {
$sql = "SELECT * FROM v_devices "; $sql = "SELECT * FROM v_devices ";
$sql .= "WHERE device_mac_address = :mac_address "; $sql .= "WHERE device_mac_address = :mac_address ";
if ($provision['http_domain_filter'] == "true") { if ($provision['http_domain_filter'] == "true") {
@@ -323,6 +323,7 @@ include "root.php";
$parameters['mac_address'] = $mac; $parameters['mac_address'] = $mac;
$database = new database; $database = new database;
$row = $database->select($sql, $parameters, 'row'); $row = $database->select($sql, $parameters, 'row');
unset($parameters);
if (is_array($row) && sizeof($row) != 0) { if (is_array($row) && sizeof($row) != 0) {
@@ -336,15 +337,16 @@ include "root.php";
} }
exit; exit;
} }
//register that we have seen the device //register that we have seen the device
$sql = "UPDATE v_devices "; $sql = "UPDATE v_devices ";
$sql .= "SET device_provisioned_date=:date, device_provisioned_method=:method, device_provisioned_ip=:ip "; $sql .= "SET device_provisioned_date = :device_provisioned_date, device_provisioned_method = :device_provisioned_method, device_provisioned_ip = :device_provisioned_ip ";
$sql .= "WHERE domain_uuid=:domain_uuid AND device_mac_address=:mac "; $sql .= "WHERE domain_uuid = :domain_uuid AND device_mac_address = :device_mac_address ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
$parameters['mac'] = strtolower($mac); $parameters['device_mac_address'] = strtolower($mac);
$parameters['date'] = date("Y-m-d H:i:s"); $parameters['device_provisioned_date'] = date("Y-m-d H:i:s");
$parameters['method'] = (isset($_SERVER["HTTPS"]) ? 'https' : 'http'); $parameters['device_provisioned_method'] = (isset($_SERVER["HTTPS"]) ? 'https' : 'http');
$parameters['ip'] = $_SERVER['REMOTE_ADDR']; $parameters['device_provisioned_ip'] = $_SERVER['REMOTE_ADDR'];
$database = new database; $database = new database;
$database->execute($sql, $parameters); $database->execute($sql, $parameters);
@@ -363,7 +365,7 @@ include "root.php";
$device_description = $row["device_description"]; $device_description = $row["device_description"];
} }
unset($row, $parameters); unset($row, $parameters);
} //}
//find a template that was defined on another phone and use that as the default. //find a template that was defined on another phone and use that as the default.
if (strlen($device_template) == 0) { if (strlen($device_template) == 0) {
@@ -535,7 +537,7 @@ include "root.php";
$p->delete("device_edit", "temp"); $p->delete("device_edit", "temp");
} }
} }
} //}
//alternate device_uuid //alternate device_uuid
if (strlen($device_uuid) > 0 && is_uuid($device_uuid)) { if (strlen($device_uuid) > 0 && is_uuid($device_uuid)) {