Update the provision class.
This commit is contained in:
parent
bf0a2b728d
commit
6d249d0b61
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2014
|
||||
Copyright (C) 2014-2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -138,8 +138,16 @@ include "root.php";
|
|||
$mac = $this->mac;
|
||||
$file = $this->file;
|
||||
|
||||
//get the device template
|
||||
if (isset($_REQUEST['template'])) {
|
||||
$device_template = $_REQUEST['template'];
|
||||
$search = array('..', '/./');
|
||||
$device_template = str_replace($search, "", $device_template);
|
||||
$device_template = str_replace('//', '/', $device_template);
|
||||
}
|
||||
|
||||
//remove ../ and slashes in the file name
|
||||
$search = array('..', '/', '\\');
|
||||
$search = array('..', '/', '\\', '/./', '//');
|
||||
$file = str_replace($search, "", $file);
|
||||
|
||||
//get the domain_name
|
||||
|
|
@ -166,9 +174,10 @@ include "root.php";
|
|||
}
|
||||
|
||||
//check to see if the mac_address exists in devices
|
||||
if (!isset($_GET['user_id'])) {
|
||||
if ($this->mac_exists($mac)) {
|
||||
//get the device_template
|
||||
//if (strlen($device_template) == 0) {
|
||||
if (strlen($device_template) == 0) {
|
||||
$sql = "SELECT * FROM v_devices ";
|
||||
$sql .= "WHERE device_mac_address=:mac ";
|
||||
//$sql .= "WHERE device_mac_address= '$mac' ";
|
||||
|
|
@ -191,13 +200,13 @@ include "root.php";
|
|||
$device_profile_uuid = $row["device_profile_uuid"];
|
||||
$device_description = $row["device_description"];
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
//find a template that was defined on another phone and use that as the default.
|
||||
if (strlen($device_template) == 0) {
|
||||
$sql = "SELECT * FROM v_devices ";
|
||||
$sql .= "WHERE device_template LIKE '%/%' ";
|
||||
$sql .= "AND domain_uuid=:domain_uuid ";
|
||||
$sql .= "WHERE domain_uuid=:domain_uuid ";
|
||||
$sql .= "limit 1 ";
|
||||
$prep_statement_3 = $this->db->prepare(check_sql($sql));
|
||||
if ($prep_statement_3) {
|
||||
$prep_statement_3->bindParam(':domain_uuid', $domain_uuid);
|
||||
|
|
@ -285,6 +294,25 @@ include "root.php";
|
|||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the device uuid using the username and password
|
||||
if (isset($_GET['user_id'])) {
|
||||
$sql = "SELECT * FROM v_device_lines ";
|
||||
$sql .= "WHERE user_id = :user_id ";
|
||||
$sql .= "AND password = :password ";
|
||||
$sql .= "AND domain_uuid = :domain_uuid ";
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->bindParam(':user_id', $_GET['user_id']);
|
||||
$prep_statement->bindParam(':password', $_GET['password']);
|
||||
$prep_statement->bindParam(':domain_uuid', $domain_uuid);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$device_uuid = $row['device_uuid'];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//get the device settings table in the provision category and update the provision array
|
||||
$sql = "SELECT * FROM v_device_settings ";
|
||||
|
|
|
|||
Loading…
Reference in New Issue