Rename the hardware phones to devices.

This commit is contained in:
Mark Crane 2013-03-20 16:53:37 +00:00
parent 3ce7d717ca
commit 648ef006cc
4 changed files with 225 additions and 177 deletions

View File

@ -1,13 +1,13 @@
<?php <?php
//application details //application details
$apps[$x]['name'] = "Phones"; $apps[$x]['name'] = "Devices";
$apps[$x]['uuid'] = '4efa1a1a-32e7-bf83-534b-6c8299958a8e'; $apps[$x]['uuid'] = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$apps[$x]['category'] = 'Switch';; $apps[$x]['category'] = 'Switch';;
$apps[$x]['subcategory'] = ''; $apps[$x]['subcategory'] = '';
$apps[$x]['version'] = ''; $apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1'; $apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com'; $apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en-us'] = 'Phone provisioning list.'; $apps[$x]['description']['en-us'] = 'Devices for provisioning.';
$apps[$x]['description']['es-mx'] = ''; $apps[$x]['description']['es-mx'] = '';
$apps[$x]['description']['de'] = ''; $apps[$x]['description']['de'] = '';
$apps[$x]['description']['de-ch'] = ''; $apps[$x]['description']['de-ch'] = '';
@ -19,7 +19,7 @@
$apps[$x]['description']['pt-br'] = ''; $apps[$x]['description']['pt-br'] = '';
//menu details //menu details
$apps[$x]['menu'][0]['title']['en-us'] = 'Phones'; $apps[$x]['menu'][0]['title']['en-us'] = 'Devices';
$apps[$x]['menu'][0]['title']['es-mx'] = ''; $apps[$x]['menu'][0]['title']['es-mx'] = '';
$apps[$x]['menu'][0]['title']['de'] = ''; $apps[$x]['menu'][0]['title']['de'] = '';
$apps[$x]['menu'][0]['title']['de-ch'] = ''; $apps[$x]['menu'][0]['title']['de-ch'] = '';
@ -32,40 +32,42 @@
$apps[$x]['menu'][0]['uuid'] = 'f9dce498-b7f9-740f-e592-9e8ff3dac2a0'; $apps[$x]['menu'][0]['uuid'] = 'f9dce498-b7f9-740f-e592-9e8ff3dac2a0';
$apps[$x]['menu'][0]['parent_uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55'; $apps[$x]['menu'][0]['parent_uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
$apps[$x]['menu'][0]['category'] = 'internal'; $apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/hardware_phones/hardware_phones.php'; $apps[$x]['menu'][0]['path'] = '/app/devices/devices.php';
$apps[$x]['menu'][0]['groups'][] = 'admin'; $apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin'; $apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details //permission details
$apps[$x]['permissions'][0]['name'] = 'phone_view'; $apps[$x]['permissions'][0]['name'] = 'device_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin'; $apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin'; $apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'phone_add'; $apps[$x]['permissions'][1]['name'] = 'device_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin'; $apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin'; $apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'phone_edit'; $apps[$x]['permissions'][2]['name'] = 'device_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin'; $apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin'; $apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'phone_delete'; $apps[$x]['permissions'][3]['name'] = 'device_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin'; $apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin'; $apps[$x]['permissions'][3]['groups'][] = 'superadmin';
//schema details //schema details
$y = 0; //table array index $y = 0; //table array index
$z = 0; //field array index $z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_hardware_phones'; $apps[$x]['db'][$y]['table'] = 'v_devices';
//$apps[$x]['db'][$y]['table']['deprecated'] = 'v_hardware_phones';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'hardware_phone_id'; $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'hardware_device_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer'; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT'; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'hardware_phone_uuid'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_uuid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'hardware_device_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
@ -86,47 +88,99 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_mac_address'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_mac_address';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_mac_address';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_label'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_label';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_label';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_vendor'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_vendor';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_vendor';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_model'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_model';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_model';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_firmware_version'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_firmware_version';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_firmware_version';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_provision_enable'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_provision_enable';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_provision_enable';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_template'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_template';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_template';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_username'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_username';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_username';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_password'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_password';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_password';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_time_zone'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_time_zone';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_time_zone';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_description'; $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'device_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'phone_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_device_extensions';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_extension_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_devices';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'device_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'extension_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_extensions';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'extension_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_line';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';

View File

@ -39,9 +39,9 @@ if (count($_GET)>0) {
//delete the data //delete the data
if (strlen($id)>0) { if (strlen($id)>0) {
$sql = "delete from v_hardware_phones "; $sql = "delete from v_devices ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hardware_phone_uuid = '$id' "; $sql .= "and device_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
@ -52,7 +52,7 @@ if (count($_GET)>0) {
//redirect the user //redirect the user
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hardware_phones.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=devices.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Delete Complete\n"; echo "Delete Complete\n";
echo "</div>\n"; echo "</div>\n";
@ -60,4 +60,3 @@ if (count($_GET)>0) {
return; return;
?> ?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved. Copyright (C) 2008-2013 All Rights Reserved.
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
@ -27,7 +27,7 @@ require_once "includes/require.php";
//check permissions //check permissions
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('phone_add') || permission_exists('phone_edit')) { if (permission_exists('device_add') || permission_exists('device_edit')) {
//access granted //access granted
} }
else { else {
@ -38,7 +38,7 @@ require_once "includes/require.php";
//action add or update //action add or update
if (isset($_REQUEST["id"])) { if (isset($_REQUEST["id"])) {
$action = "update"; $action = "update";
$hardware_phone_uuid = check_str($_REQUEST["id"]); $device_uuid = check_str($_REQUEST["id"]);
} }
else { else {
$action = "add"; $action = "add";
@ -46,52 +46,52 @@ require_once "includes/require.php";
//get the http post values and set them to php variables //get the http post values and set them to php variables
if (count($_POST)>0) { if (count($_POST)>0) {
$phone_mac_address = check_str($_POST["phone_mac_address"]); $device_mac_address = check_str($_POST["device_mac_address"]);
$phone_mac_address = strtolower($phone_mac_address); $device_mac_address = strtolower($device_mac_address);
$phone_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $phone_mac_address); $device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address);
$phone_label = check_str($_POST["phone_label"]); $device_label = check_str($_POST["device_label"]);
$phone_vendor = check_str($_POST["phone_vendor"]); $device_vendor = check_str($_POST["device_vendor"]);
$phone_model = check_str($_POST["phone_model"]); $device_model = check_str($_POST["device_model"]);
$phone_firmware_version = check_str($_POST["phone_firmware_version"]); $device_firmware_version = check_str($_POST["device_firmware_version"]);
$phone_provision_enable = check_str($_POST["phone_provision_enable"]); $device_provision_enable = check_str($_POST["device_provision_enable"]);
$phone_template = check_str($_POST["phone_template"]); $device_template = check_str($_POST["device_template"]);
$phone_username = check_str($_POST["phone_username"]); $device_username = check_str($_POST["device_username"]);
$phone_password = check_str($_POST["phone_password"]); $device_password = check_str($_POST["device_password"]);
$phone_time_zone = check_str($_POST["phone_time_zone"]); $device_time_zone = check_str($_POST["device_time_zone"]);
$phone_description = check_str($_POST["phone_description"]); $device_description = check_str($_POST["device_description"]);
} }
//use the mac address to find the vendor //use the mac address to find the vendor
if (strlen($phone_vendor) == 0) { if (strlen($device_vendor) == 0) {
switch (substr($phone_mac_address, 0, 6)) { switch (substr($device_mac_address, 0, 6)) {
case "00085d": case "00085d":
$phone_vendor = "aastra"; $device_vendor = "aastra";
break; break;
case "000e08": case "000e08":
$phone_vendor = "linksys"; $device_vendor = "linksys";
break; break;
case "0004f2": case "0004f2":
$phone_vendor = "polycom"; $device_vendor = "polycom";
break; break;
case "00907a": case "00907a":
$phone_vendor = "polycom"; $device_vendor = "polycom";
break; break;
case "001873": case "001873":
$phone_vendor = "cisco"; $device_vendor = "cisco";
break; break;
case "00045a": case "00045a":
$phone_vendor = "linksys"; $device_vendor = "linksys";
break; break;
case "000625": case "000625":
$phone_vendor = "linksys"; $device_vendor = "linksys";
break; break;
case "001565": case "001565":
$phone_vendor = "yealink"; $device_vendor = "yealink";
break; break;
case "000413": case "000413":
$phone_vendor = "snom"; $device_vendor = "snom";
default: default:
$phone_vendor = ""; $device_vendor = "";
} }
} }
@ -100,21 +100,21 @@ require_once "includes/require.php";
$msg = ''; $msg = '';
if ($action == "update") { if ($action == "update") {
$hardware_phone_uuid = check_str($_POST["hardware_phone_uuid"]); $device_uuid = check_str($_POST["device_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($phone_mac_address) == 0) { $msg .= "Please provide: MAC Address<br>\n"; } if (strlen($device_mac_address) == 0) { $msg .= "Please provide: MAC Address<br>\n"; }
//if (strlen($phone_label) == 0) { $msg .= "Please provide: Label<br>\n"; } //if (strlen($device_label) == 0) { $msg .= "Please provide: Label<br>\n"; }
//if (strlen($phone_vendor) == 0) { $msg .= "Please provide: Vendor<br>\n"; } //if (strlen($device_vendor) == 0) { $msg .= "Please provide: Vendor<br>\n"; }
//if (strlen($phone_model) == 0) { $msg .= "Please provide: Model<br>\n"; } //if (strlen($device_model) == 0) { $msg .= "Please provide: Model<br>\n"; }
//if (strlen($phone_firmware_version) == 0) { $msg .= "Please provide: Firmware Version<br>\n"; } //if (strlen($device_firmware_version) == 0) { $msg .= "Please provide: Firmware Version<br>\n"; }
//if (strlen($phone_provision_enable) == 0) { $msg .= "Please provide: Enabled<br>\n"; } //if (strlen($device_provision_enable) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($phone_template) == 0) { $msg .= "Please provide: Template<br>\n"; } //if (strlen($device_template) == 0) { $msg .= "Please provide: Template<br>\n"; }
//if (strlen($phone_username) == 0) { $msg .= "Please provide: Username<br>\n"; } //if (strlen($device_username) == 0) { $msg .= "Please provide: Username<br>\n"; }
//if (strlen($phone_password) == 0) { $msg .= "Please provide: Password<br>\n"; } //if (strlen($device_password) == 0) { $msg .= "Please provide: Password<br>\n"; }
//if (strlen($phone_time_zone) == 0) { $msg .= "Please provide: Time Zone<br>\n"; } //if (strlen($device_time_zone) == 0) { $msg .= "Please provide: Time Zone<br>\n"; }
//if (strlen($phone_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (strlen($device_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php"; require_once "includes/header.php";
require_once "includes/persistformvar.php"; require_once "includes/persistformvar.php";
@ -130,40 +130,40 @@ require_once "includes/require.php";
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('phone_add')) { if ($action == "add" && permission_exists('device_add')) {
//sql add //sql add
$hardware_phone_uuid = uuid(); $device_uuid = uuid();
$sql = "insert into v_hardware_phones "; $sql = "insert into v_devices ";
$sql .= "("; $sql .= "(";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "hardware_phone_uuid, "; $sql .= "device_uuid, ";
$sql .= "phone_mac_address, "; $sql .= "device_mac_address, ";
$sql .= "phone_label, "; $sql .= "device_label, ";
$sql .= "phone_vendor, "; $sql .= "device_vendor, ";
$sql .= "phone_model, "; $sql .= "device_model, ";
$sql .= "phone_firmware_version, "; $sql .= "device_firmware_version, ";
$sql .= "phone_provision_enable, "; $sql .= "device_provision_enable, ";
$sql .= "phone_template, "; $sql .= "device_template, ";
$sql .= "phone_username, "; $sql .= "device_username, ";
$sql .= "phone_password, "; $sql .= "device_password, ";
$sql .= "phone_time_zone, "; $sql .= "device_time_zone, ";
$sql .= "phone_description "; $sql .= "device_description ";
$sql .= ")"; $sql .= ")";
$sql .= "values "; $sql .= "values ";
$sql .= "("; $sql .= "(";
$sql .= "'$domain_uuid', "; $sql .= "'$domain_uuid', ";
$sql .= "'$hardware_phone_uuid', "; $sql .= "'$device_uuid', ";
$sql .= "'$phone_mac_address', "; $sql .= "'$device_mac_address', ";
$sql .= "'$phone_label', "; $sql .= "'$device_label', ";
$sql .= "'$phone_vendor', "; $sql .= "'$device_vendor', ";
$sql .= "'$phone_model', "; $sql .= "'$device_model', ";
$sql .= "'$phone_firmware_version', "; $sql .= "'$device_firmware_version', ";
$sql .= "'$phone_provision_enable', "; $sql .= "'$device_provision_enable', ";
$sql .= "'$phone_template', "; $sql .= "'$device_template', ";
$sql .= "'$phone_username', "; $sql .= "'$device_username', ";
$sql .= "'$phone_password', "; $sql .= "'$device_password', ";
$sql .= "'$phone_time_zone', "; $sql .= "'$device_time_zone', ";
$sql .= "'$phone_description' "; $sql .= "'$device_description' ";
$sql .= ")"; $sql .= ")";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
@ -173,7 +173,7 @@ require_once "includes/require.php";
//redirect the user //redirect the user
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hardware_phones.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=devices.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Add Complete\n"; echo "Add Complete\n";
echo "</div>\n"; echo "</div>\n";
@ -181,22 +181,22 @@ require_once "includes/require.php";
return; return;
} //if ($action == "add") } //if ($action == "add")
if ($action == "update" && permission_exists('phone_edit')) { if ($action == "update" && permission_exists('device_edit')) {
//sql update //sql update
$sql = "update v_hardware_phones set "; $sql = "update v_devices set ";
$sql .= "phone_mac_address = '$phone_mac_address', "; $sql .= "device_mac_address = '$device_mac_address', ";
$sql .= "phone_label = '$phone_label', "; $sql .= "device_label = '$device_label', ";
$sql .= "phone_vendor = '$phone_vendor', "; $sql .= "device_vendor = '$device_vendor', ";
$sql .= "phone_model = '$phone_model', "; $sql .= "device_model = '$device_model', ";
$sql .= "phone_firmware_version = '$phone_firmware_version', "; $sql .= "device_firmware_version = '$device_firmware_version', ";
$sql .= "phone_provision_enable = '$phone_provision_enable', "; $sql .= "device_provision_enable = '$device_provision_enable', ";
$sql .= "phone_template = '$phone_template', "; $sql .= "device_template = '$device_template', ";
$sql .= "phone_username = '$phone_username', "; $sql .= "device_username = '$device_username', ";
$sql .= "phone_password = '$phone_password', "; $sql .= "device_password = '$device_password', ";
$sql .= "phone_time_zone = '$phone_time_zone', "; $sql .= "device_time_zone = '$device_time_zone', ";
$sql .= "phone_description = '$phone_description' "; $sql .= "device_description = '$device_description' ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hardware_phone_uuid = '$hardware_phone_uuid'"; $sql .= "and device_uuid = '$device_uuid'";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
@ -205,7 +205,7 @@ require_once "includes/require.php";
//redirect the user //redirect the user
require_once "includes/header.php"; require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hardware_phones.php\">\n"; echo "<meta http-equiv=\"refresh\" content=\"2;url=devices.php\">\n";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "Update Complete\n"; echo "Update Complete\n";
echo "</div>\n"; echo "</div>\n";
@ -217,26 +217,26 @@ require_once "includes/require.php";
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$hardware_phone_uuid = $_GET["id"]; $device_uuid = $_GET["id"];
$sql = "select * from v_hardware_phones "; $sql = "select * from v_devices ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hardware_phone_uuid = '$hardware_phone_uuid' "; $sql .= "and device_uuid = '$device_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);
foreach ($result as &$row) { foreach ($result as &$row) {
$phone_mac_address = $row["phone_mac_address"]; $device_mac_address = $row["device_mac_address"];
$phone_mac_address = substr($phone_mac_address, 0,2).'-'.substr($phone_mac_address, 2,2).'-'.substr($phone_mac_address, 4,2).'-'.substr($phone_mac_address, 6,2).'-'.substr($phone_mac_address, 8,2).'-'.substr($phone_mac_address, 10,2); $device_mac_address = substr($device_mac_address, 0,2).'-'.substr($device_mac_address, 2,2).'-'.substr($device_mac_address, 4,2).'-'.substr($device_mac_address, 6,2).'-'.substr($device_mac_address, 8,2).'-'.substr($device_mac_address, 10,2);
$phone_label = $row["phone_label"]; $device_label = $row["device_label"];
$phone_vendor = $row["phone_vendor"]; $device_vendor = $row["device_vendor"];
$phone_model = $row["phone_model"]; $device_model = $row["device_model"];
$phone_firmware_version = $row["phone_firmware_version"]; $device_firmware_version = $row["device_firmware_version"];
$phone_provision_enable = $row["phone_provision_enable"]; $device_provision_enable = $row["device_provision_enable"];
$phone_template = $row["phone_template"]; $device_template = $row["device_template"];
$phone_username = $row["phone_username"]; $device_username = $row["device_username"];
$phone_password = $row["phone_password"]; $device_password = $row["device_password"];
$phone_time_zone = $row["phone_time_zone"]; $device_time_zone = $row["device_time_zone"];
$phone_description = $row["phone_description"]; $device_description = $row["device_description"];
} }
unset ($prep_statement); unset ($prep_statement);
} }
@ -255,17 +255,12 @@ require_once "includes/require.php";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
if ($action == "add") { echo "<td align='left' width='30%' nowrap='nowrap' align='left'><b>Device</b></td>\n";
echo "<td align='left' width='30%' nowrap='nowrap' align='left'><b>Hardware Phone Add</b></td>\n"; echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='devices.php'\" value='Back'></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap' align='left'><b>Hardware Phone Edit</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='hardware_phones.php'\" value='Back'></td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td colspan='2' align='left'>\n"; echo "<td colspan='2' align='left'>\n";
echo "The following information is used to provision phones.<br /><br />\n"; echo "The following information is used to provision endpoints.<br /><br />\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@ -274,7 +269,7 @@ require_once "includes/require.php";
echo " MAC Address:\n"; echo " MAC Address:\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='phone_mac_address' maxlength='255' value=\"$phone_mac_address\">\n"; echo " <input class='formfld' type='text' name='device_mac_address' maxlength='255' value=\"$device_mac_address\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the MAC address.\n"; echo "Enter the MAC address.\n";
echo "</td>\n"; echo "</td>\n";
@ -285,9 +280,9 @@ require_once "includes/require.php";
echo " Label:\n"; echo " Label:\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='phone_label' maxlength='255' value=\"$phone_label\">\n"; echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the phone label.\n"; echo "Enter the device label.\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@ -297,7 +292,7 @@ require_once "includes/require.php";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo "<select id='phone_template' name='phone_template' class='formfld'>\n"; echo "<select id='device_template' name='device_template' class='formfld'>\n";
echo "<option value=''></option>\n"; echo "<option value=''></option>\n";
$temp_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/provision"; $temp_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/provision";
if($dh = opendir($temp_dir)) { if($dh = opendir($temp_dir)) {
@ -309,7 +304,7 @@ require_once "includes/require.php";
while($dir_sub = readdir($dh_sub)) { while($dir_sub = readdir($dh_sub)) {
if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') { if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') {
if(is_dir($temp_dir . '/' . $dir .'/'. $dir_sub)) { if(is_dir($temp_dir . '/' . $dir .'/'. $dir_sub)) {
if ($phone_template == $dir."/".$dir_sub) { if ($device_template == $dir."/".$dir_sub) {
echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n"; echo "<option value='".$dir."/".$dir_sub."' selected='selected'>".$dir."/".$dir_sub."</option>\n";
} }
else { else {
@ -337,7 +332,7 @@ require_once "includes/require.php";
echo " Vendor:\n"; echo " Vendor:\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='phone_vendor' maxlength='255' value=\"$phone_vendor\">\n"; echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the vendor name.\n"; echo "Enter the vendor name.\n";
echo "</td>\n"; echo "</td>\n";
@ -348,7 +343,7 @@ require_once "includes/require.php";
echo " Model:\n"; echo " Model:\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='phone_model' maxlength='255' value=\"$phone_model\">\n"; echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the model number.\n"; echo "Enter the model number.\n";
echo "</td>\n"; echo "</td>\n";
@ -359,7 +354,7 @@ require_once "includes/require.php";
echo " Firmware Version:\n"; echo " Firmware Version:\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='phone_firmware_version' maxlength='255' value=\"$phone_firmware_version\">\n"; echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the firmware version.\n"; echo "Enter the firmware version.\n";
echo "</td>\n"; echo "</td>\n";
@ -371,7 +366,7 @@ require_once "includes/require.php";
echo " Username:\n"; echo " Username:\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='phone_username' maxlength='255' value=\"$phone_username\">\n"; echo " <input class='formfld' type='text' name='device_username' maxlength='255' value=\"$device_username\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the username.\n"; echo "Enter the username.\n";
echo "</td>\n"; echo "</td>\n";
@ -382,7 +377,7 @@ require_once "includes/require.php";
echo " Password:\n"; echo " Password:\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='phone_password' maxlength='255' value=\"$phone_password\">\n"; echo " <input class='formfld' type='text' name='device_password' maxlength='255' value=\"$device_password\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the password.\n"; echo "Enter the password.\n";
echo "</td>\n"; echo "</td>\n";
@ -394,15 +389,15 @@ require_once "includes/require.php";
echo " Enabled:\n"; echo " Enabled:\n";
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='phone_provision_enable'>\n"; echo " <select class='formfld' name='device_provision_enable'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if ($phone_provision_enable == "true" || strlen($phone_provision_enable) == 0) { if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) {
echo " <option value='true' selected >true</option>\n"; echo " <option value='true' selected >true</option>\n";
} }
else { else {
echo " <option value='true'>true</option>\n"; echo " <option value='true'>true</option>\n";
} }
if ($phone_provision_enable == "false") { if ($device_provision_enable == "false") {
echo " <option value='false' selected >false</option>\n"; echo " <option value='false' selected >false</option>\n";
} }
else { else {
@ -410,7 +405,7 @@ require_once "includes/require.php";
} }
echo " </select>\n"; echo " </select>\n";
echo "<br />\n"; echo "<br />\n";
echo "Enable or disable provisioning for this phone.\n"; echo "Enable or disable provisioning for this device.\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@ -419,7 +414,7 @@ require_once "includes/require.php";
echo " Time Zone:\n"; echo " Time Zone:\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='phone_time_zone' maxlength='255' value=\"$phone_time_zone\">\n"; echo " <input class='formfld' type='text' name='device_time_zone' maxlength='255' value=\"$device_time_zone\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the time zone.\n"; echo "Enter the time zone.\n";
echo "</td>\n"; echo "</td>\n";
@ -430,7 +425,7 @@ require_once "includes/require.php";
echo " Description:\n"; echo " 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='phone_description' maxlength='255' value=\"$phone_description\">\n"; echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
echo "<br />\n"; echo "<br />\n";
echo "Enter the description.\n"; echo "Enter the description.\n";
echo "</td>\n"; echo "</td>\n";
@ -438,7 +433,7 @@ require_once "includes/require.php";
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='hardware_phone_uuid' value='$hardware_phone_uuid'>\n"; echo " <input type='hidden' name='device_uuid' value='$device_uuid'>\n";
} }
echo " <input type='submit' name='submit' class='btn' value='Save'>\n"; echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n"; echo " </td>\n";

View File

@ -25,7 +25,7 @@
require_once "root.php"; require_once "root.php";
require_once "includes/require.php"; require_once "includes/require.php";
require_once "includes/checkauth.php"; require_once "includes/checkauth.php";
if (permission_exists('phone_view')) { if (permission_exists('device_view')) {
//access granted //access granted
} }
else { else {
@ -46,20 +46,20 @@ echo " <br>";
echo "<table width='100%' border='0'>\n"; echo "<table width='100%' border='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td width='50%' nowrap='nowrap' align='left'><b>Hardware Phone List</b></td>\n"; echo "<td width='50%' nowrap='nowrap' align='left'><b>Devices</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n"; echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td colspan='2' align='left'>\n"; echo "<td colspan='2' align='left'>\n";
echo "Phones in this list are automatically added to the list when they contact the provisioning \n"; echo "Devices in this list are added to the list when they contact the provisioning \n";
echo "server or added manually by an administrator. \n"; echo "server or added manually by an administrator. \n";
echo "Items in this list can be assigned from the extensions page.<br /><br />\n"; echo "Items in this list are assigned from the extensions page.<br /><br />\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "</tr></table>\n"; echo "</tr></table>\n";
$sql = "select * from v_hardware_phones "; $sql = "select * from v_devices ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
@ -74,7 +74,7 @@ if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
$sql = "select * from v_hardware_phones "; $sql = "select * from v_devices ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= " limit $rows_per_page offset $offset "; $sql .= " limit $rows_per_page offset $offset ";
@ -91,37 +91,37 @@ $row_style["1"] = "row_style1";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo th_order_by('phone_mac_address', 'MAC Address', $order_by, $order); echo th_order_by('device_mac_address', 'MAC Address', $order_by, $order);
echo th_order_by('phone_template', 'Template', $order_by, $order); echo th_order_by('device_template', 'Template', $order_by, $order);
echo th_order_by('phone_vendor', 'Vendor', $order_by, $order); echo th_order_by('device_vendor', 'Vendor', $order_by, $order);
//echo th_order_by('phone_model', 'Model', $order_by, $order); //echo th_order_by('device_model', 'Model', $order_by, $order);
echo th_order_by('phone_provision_enable', 'Enabled', $order_by, $order); echo th_order_by('device_provision_enable', 'Enabled', $order_by, $order);
echo th_order_by('phone_description', 'Description', $order_by, $order); echo th_order_by('device_description', 'Description', $order_by, $order);
echo "<td align='right' width='42'>\n"; echo "<td align='right' width='42'>\n";
if (permission_exists('phone_add')) { if (permission_exists('device_add')) {
echo " <a href='hardware_phone_edit.php' alt='add'>$v_link_label_add</a>\n"; echo " <a href='device_edit.php' alt='add'>$v_link_label_add</a>\n";
} }
echo "</td>\n"; echo "</td>\n";
echo "<tr>\n"; echo "<tr>\n";
if ($result_count > 0) { //no results if ($result_count > 0) { //no results
foreach($result as $row) { foreach($result as $row) {
$phone_mac_address = $row[phone_mac_address]; $device_mac_address = $row[device_mac_address];
$phone_mac_address = substr($phone_mac_address, 0,2).'-'.substr($phone_mac_address, 2,2).'-'.substr($phone_mac_address, 4,2).'-'.substr($phone_mac_address, 6,2).'-'.substr($phone_mac_address, 8,2).'-'.substr($phone_mac_address, 10,2); $device_mac_address = substr($device_mac_address, 0,2).'-'.substr($device_mac_address, 2,2).'-'.substr($device_mac_address, 4,2).'-'.substr($device_mac_address, 6,2).'-'.substr($device_mac_address, 8,2).'-'.substr($device_mac_address, 10,2);
echo "<tr >\n"; echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$phone_mac_address."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$device_mac_address."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['phone_template']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_template']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['phone_vendor']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_vendor']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['phone_mode'l]."&nbsp;</td>\n"; //echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_mode'l]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' width='10px'>".$row['phone_provision_enable']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."' width='10px'>".$row['device_provision_enable']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['phone_description']."&nbsp;</td>\n"; echo " <td valign='top' class='row_stylebg'>".$row['device_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n"; echo " <td valign='top' align='right'>\n";
if (permission_exists('phone_edit')) { if (permission_exists('device_edit')) {
echo " <a href='hardware_phone_edit.php?id=".$row['hardware_phone_uuid']."' alt='edit'>$v_link_label_edit</a>\n"; echo " <a href='device_edit.php?id=".$row['device_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
} }
if (permission_exists('phone_delete')) { if (permission_exists('device_delete')) {
echo " <a href='hardware_phone_delete.php?id=".$row['hardware_phone_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n"; echo " <a href='hardware_device_delete.php?id=".$row['device_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo "</tr>\n"; echo "</tr>\n";
@ -137,8 +137,8 @@ echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n"; echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n"; echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n"; echo " <td width='33.3%' align='right'>\n";
if (permission_exists('phone_add')) { if (permission_exists('device_add')) {
echo " <a href='hardware_phone_edit.php' alt='add'>$v_link_label_add</a>\n"; echo " <a href='device_edit.php' alt='add'>$v_link_label_add</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";