Update provision.php

This commit is contained in:
FusionPBX
2019-08-12 13:34:37 -06:00
committed by GitHub
parent 2cb2eee07c
commit 7f18d11d8e
+11 -13
View File
@@ -514,22 +514,20 @@ 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 "; $sql .= "WHERE device_mac_address = :mac_address ";
if($provision['http_domain_filter'] == "true") { if ($provision['http_domain_filter'] == "true") {
$sql .= "AND domain_uuid=:domain_uuid "; $sql .= "AND domain_uuid=:domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
} }
$prep_statement_2 = $this->db->prepare(check_sql($sql)); $parameters['mac_address'] = $mac;
if ($prep_statement_2) { $database = new database;
//use the prepared statement $row = $database->select($sql, $parameters, 'row');
$prep_statement_2->bindParam(':mac', $mac); if (is_array($row) && sizeof($row) != 0) {
if($provision['http_domain_filter'] == "true") {
$prep_statement_2->bindParam(':domain_uuid', $domain_uuid);
}
$prep_statement_2->execute();
$row = $prep_statement_2->fetch();
//checks either device enabled //checks either device enabled
if($row['device_enabled'] != 'true'){ if($row['device_enabled'] != 'true'){
if ($_SESSION['provision']['debug']['boolean'] == 'true'){ if ($_SESSION['provision']['debug']['boolean'] == 'true'){
@@ -577,7 +575,7 @@ include "root.php";
$sql .= "WHERE domain_uuid=:domain_uuid "; $sql .= "WHERE domain_uuid=:domain_uuid ";
$sql .= "AND device_enabled='true' "; $sql .= "AND device_enabled='true' ";
$sql .= "limit 1 "; $sql .= "limit 1 ";
$prep_statement_3 = $this->db->prepare(check_sql($sql)); $prep_statement_3 = $this->db->prepare($sql);
if ($prep_statement_3) { if ($prep_statement_3) {
$prep_statement_3->bindParam(':domain_uuid', $domain_uuid); $prep_statement_3->bindParam(':domain_uuid', $domain_uuid);
$prep_statement_3->execute(); $prep_statement_3->execute();
@@ -744,7 +742,7 @@ include "root.php";
} }
//alternate device_uuid //alternate device_uuid
if (strlen($device_uuid) > 0) { if (strlen($device_uuid) > 0 && is_uuid($device_uuid)) {
$sql = "SELECT * FROM v_devices "; $sql = "SELECT * FROM v_devices ";
$sql .= "WHERE device_uuid = '".$device_uuid."' "; $sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "AND device_enabled = 'true' "; $sql .= "AND device_enabled = 'true' ";