diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 86297c8a54..920a68d8d3 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -1,13 +1,13 @@ 0) { //delete the data if (strlen($id)>0) { - $sql = "delete from v_hardware_phones "; + $sql = "delete from v_devices "; $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->execute(); unset($sql); @@ -52,7 +52,7 @@ if (count($_GET)>0) { //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Delete Complete\n"; echo "
\n"; @@ -60,4 +60,3 @@ if (count($_GET)>0) { return; ?> - diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 34b11c56fb..061a053d1b 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2008-2012 All Rights Reserved. + Copyright (C) 2008-2013 All Rights Reserved. Contributor(s): Mark J Crane @@ -27,7 +27,7 @@ require_once "includes/require.php"; //check permissions 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 } else { @@ -38,7 +38,7 @@ require_once "includes/require.php"; //action add or update if (isset($_REQUEST["id"])) { $action = "update"; - $hardware_phone_uuid = check_str($_REQUEST["id"]); + $device_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; @@ -46,52 +46,52 @@ require_once "includes/require.php"; //get the http post values and set them to php variables if (count($_POST)>0) { - $phone_mac_address = check_str($_POST["phone_mac_address"]); - $phone_mac_address = strtolower($phone_mac_address); - $phone_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $phone_mac_address); - $phone_label = check_str($_POST["phone_label"]); - $phone_vendor = check_str($_POST["phone_vendor"]); - $phone_model = check_str($_POST["phone_model"]); - $phone_firmware_version = check_str($_POST["phone_firmware_version"]); - $phone_provision_enable = check_str($_POST["phone_provision_enable"]); - $phone_template = check_str($_POST["phone_template"]); - $phone_username = check_str($_POST["phone_username"]); - $phone_password = check_str($_POST["phone_password"]); - $phone_time_zone = check_str($_POST["phone_time_zone"]); - $phone_description = check_str($_POST["phone_description"]); + $device_mac_address = check_str($_POST["device_mac_address"]); + $device_mac_address = strtolower($device_mac_address); + $device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address); + $device_label = check_str($_POST["device_label"]); + $device_vendor = check_str($_POST["device_vendor"]); + $device_model = check_str($_POST["device_model"]); + $device_firmware_version = check_str($_POST["device_firmware_version"]); + $device_provision_enable = check_str($_POST["device_provision_enable"]); + $device_template = check_str($_POST["device_template"]); + $device_username = check_str($_POST["device_username"]); + $device_password = check_str($_POST["device_password"]); + $device_time_zone = check_str($_POST["device_time_zone"]); + $device_description = check_str($_POST["device_description"]); } //use the mac address to find the vendor - if (strlen($phone_vendor) == 0) { - switch (substr($phone_mac_address, 0, 6)) { + if (strlen($device_vendor) == 0) { + switch (substr($device_mac_address, 0, 6)) { case "00085d": - $phone_vendor = "aastra"; + $device_vendor = "aastra"; break; case "000e08": - $phone_vendor = "linksys"; + $device_vendor = "linksys"; break; case "0004f2": - $phone_vendor = "polycom"; + $device_vendor = "polycom"; break; case "00907a": - $phone_vendor = "polycom"; + $device_vendor = "polycom"; break; case "001873": - $phone_vendor = "cisco"; + $device_vendor = "cisco"; break; case "00045a": - $phone_vendor = "linksys"; + $device_vendor = "linksys"; break; case "000625": - $phone_vendor = "linksys"; + $device_vendor = "linksys"; break; case "001565": - $phone_vendor = "yealink"; + $device_vendor = "yealink"; break; case "000413": - $phone_vendor = "snom"; + $device_vendor = "snom"; default: - $phone_vendor = ""; + $device_vendor = ""; } } @@ -100,21 +100,21 @@ require_once "includes/require.php"; $msg = ''; if ($action == "update") { - $hardware_phone_uuid = check_str($_POST["hardware_phone_uuid"]); + $device_uuid = check_str($_POST["device_uuid"]); } //check for all required data - if (strlen($phone_mac_address) == 0) { $msg .= "Please provide: MAC Address
\n"; } - //if (strlen($phone_label) == 0) { $msg .= "Please provide: Label
\n"; } - //if (strlen($phone_vendor) == 0) { $msg .= "Please provide: Vendor
\n"; } - //if (strlen($phone_model) == 0) { $msg .= "Please provide: Model
\n"; } - //if (strlen($phone_firmware_version) == 0) { $msg .= "Please provide: Firmware Version
\n"; } - //if (strlen($phone_provision_enable) == 0) { $msg .= "Please provide: Enabled
\n"; } - //if (strlen($phone_template) == 0) { $msg .= "Please provide: Template
\n"; } - //if (strlen($phone_username) == 0) { $msg .= "Please provide: Username
\n"; } - //if (strlen($phone_password) == 0) { $msg .= "Please provide: Password
\n"; } - //if (strlen($phone_time_zone) == 0) { $msg .= "Please provide: Time Zone
\n"; } - //if (strlen($phone_description) == 0) { $msg .= "Please provide: Description
\n"; } + if (strlen($device_mac_address) == 0) { $msg .= "Please provide: MAC Address
\n"; } + //if (strlen($device_label) == 0) { $msg .= "Please provide: Label
\n"; } + //if (strlen($device_vendor) == 0) { $msg .= "Please provide: Vendor
\n"; } + //if (strlen($device_model) == 0) { $msg .= "Please provide: Model
\n"; } + //if (strlen($device_firmware_version) == 0) { $msg .= "Please provide: Firmware Version
\n"; } + //if (strlen($device_provision_enable) == 0) { $msg .= "Please provide: Enabled
\n"; } + //if (strlen($device_template) == 0) { $msg .= "Please provide: Template
\n"; } + //if (strlen($device_username) == 0) { $msg .= "Please provide: Username
\n"; } + //if (strlen($device_password) == 0) { $msg .= "Please provide: Password
\n"; } + //if (strlen($device_time_zone) == 0) { $msg .= "Please provide: Time Zone
\n"; } + //if (strlen($device_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; @@ -130,40 +130,40 @@ require_once "includes/require.php"; //add or update the database if ($_POST["persistformvar"] != "true") { - if ($action == "add" && permission_exists('phone_add')) { + if ($action == "add" && permission_exists('device_add')) { //sql add - $hardware_phone_uuid = uuid(); - $sql = "insert into v_hardware_phones "; + $device_uuid = uuid(); + $sql = "insert into v_devices "; $sql .= "("; $sql .= "domain_uuid, "; - $sql .= "hardware_phone_uuid, "; - $sql .= "phone_mac_address, "; - $sql .= "phone_label, "; - $sql .= "phone_vendor, "; - $sql .= "phone_model, "; - $sql .= "phone_firmware_version, "; - $sql .= "phone_provision_enable, "; - $sql .= "phone_template, "; - $sql .= "phone_username, "; - $sql .= "phone_password, "; - $sql .= "phone_time_zone, "; - $sql .= "phone_description "; + $sql .= "device_uuid, "; + $sql .= "device_mac_address, "; + $sql .= "device_label, "; + $sql .= "device_vendor, "; + $sql .= "device_model, "; + $sql .= "device_firmware_version, "; + $sql .= "device_provision_enable, "; + $sql .= "device_template, "; + $sql .= "device_username, "; + $sql .= "device_password, "; + $sql .= "device_time_zone, "; + $sql .= "device_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; - $sql .= "'$hardware_phone_uuid', "; - $sql .= "'$phone_mac_address', "; - $sql .= "'$phone_label', "; - $sql .= "'$phone_vendor', "; - $sql .= "'$phone_model', "; - $sql .= "'$phone_firmware_version', "; - $sql .= "'$phone_provision_enable', "; - $sql .= "'$phone_template', "; - $sql .= "'$phone_username', "; - $sql .= "'$phone_password', "; - $sql .= "'$phone_time_zone', "; - $sql .= "'$phone_description' "; + $sql .= "'$device_uuid', "; + $sql .= "'$device_mac_address', "; + $sql .= "'$device_label', "; + $sql .= "'$device_vendor', "; + $sql .= "'$device_model', "; + $sql .= "'$device_firmware_version', "; + $sql .= "'$device_provision_enable', "; + $sql .= "'$device_template', "; + $sql .= "'$device_username', "; + $sql .= "'$device_password', "; + $sql .= "'$device_time_zone', "; + $sql .= "'$device_description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); @@ -173,7 +173,7 @@ require_once "includes/require.php"; //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; @@ -181,22 +181,22 @@ require_once "includes/require.php"; return; } //if ($action == "add") - if ($action == "update" && permission_exists('phone_edit')) { + if ($action == "update" && permission_exists('device_edit')) { //sql update - $sql = "update v_hardware_phones set "; - $sql .= "phone_mac_address = '$phone_mac_address', "; - $sql .= "phone_label = '$phone_label', "; - $sql .= "phone_vendor = '$phone_vendor', "; - $sql .= "phone_model = '$phone_model', "; - $sql .= "phone_firmware_version = '$phone_firmware_version', "; - $sql .= "phone_provision_enable = '$phone_provision_enable', "; - $sql .= "phone_template = '$phone_template', "; - $sql .= "phone_username = '$phone_username', "; - $sql .= "phone_password = '$phone_password', "; - $sql .= "phone_time_zone = '$phone_time_zone', "; - $sql .= "phone_description = '$phone_description' "; + $sql = "update v_devices set "; + $sql .= "device_mac_address = '$device_mac_address', "; + $sql .= "device_label = '$device_label', "; + $sql .= "device_vendor = '$device_vendor', "; + $sql .= "device_model = '$device_model', "; + $sql .= "device_firmware_version = '$device_firmware_version', "; + $sql .= "device_provision_enable = '$device_provision_enable', "; + $sql .= "device_template = '$device_template', "; + $sql .= "device_username = '$device_username', "; + $sql .= "device_password = '$device_password', "; + $sql .= "device_time_zone = '$device_time_zone', "; + $sql .= "device_description = '$device_description' "; $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)); unset($sql); @@ -205,7 +205,7 @@ require_once "includes/require.php"; //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; @@ -217,26 +217,26 @@ require_once "includes/require.php"; //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { - $hardware_phone_uuid = $_GET["id"]; - $sql = "select * from v_hardware_phones "; + $device_uuid = $_GET["id"]; + $sql = "select * from v_devices "; $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->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $phone_mac_address = $row["phone_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); - $phone_label = $row["phone_label"]; - $phone_vendor = $row["phone_vendor"]; - $phone_model = $row["phone_model"]; - $phone_firmware_version = $row["phone_firmware_version"]; - $phone_provision_enable = $row["phone_provision_enable"]; - $phone_template = $row["phone_template"]; - $phone_username = $row["phone_username"]; - $phone_password = $row["phone_password"]; - $phone_time_zone = $row["phone_time_zone"]; - $phone_description = $row["phone_description"]; + $device_mac_address = $row["device_mac_address"]; + $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); + $device_label = $row["device_label"]; + $device_vendor = $row["device_vendor"]; + $device_model = $row["device_model"]; + $device_firmware_version = $row["device_firmware_version"]; + $device_provision_enable = $row["device_provision_enable"]; + $device_template = $row["device_template"]; + $device_username = $row["device_username"]; + $device_password = $row["device_password"]; + $device_time_zone = $row["device_time_zone"]; + $device_description = $row["device_description"]; } unset ($prep_statement); } @@ -255,17 +255,12 @@ require_once "includes/require.php"; echo "\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } - echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -274,7 +269,7 @@ require_once "includes/require.php"; echo " MAC Address:\n"; echo "\n"; echo "\n"; @@ -285,9 +280,9 @@ require_once "includes/require.php"; echo " Label:\n"; echo "\n"; echo "\n"; echo "\n"; @@ -297,7 +292,7 @@ require_once "includes/require.php"; echo "\n"; echo "\n"; echo "\n"; @@ -348,7 +343,7 @@ require_once "includes/require.php"; echo " Model:\n"; echo "\n"; echo "\n"; @@ -359,7 +354,7 @@ require_once "includes/require.php"; echo " Firmware Version:\n"; echo "\n"; echo "\n"; @@ -371,7 +366,7 @@ require_once "includes/require.php"; echo " Username:\n"; echo "\n"; echo "\n"; @@ -382,7 +377,7 @@ require_once "includes/require.php"; echo " Password:\n"; echo "\n"; echo "\n"; @@ -394,15 +389,15 @@ require_once "includes/require.php"; echo " Enabled:\n"; echo "\n"; echo "\n"; echo "\n"; @@ -419,7 +414,7 @@ require_once "includes/require.php"; echo " Time Zone:\n"; echo "\n"; echo "\n"; @@ -430,7 +425,7 @@ require_once "includes/require.php"; echo " Description:\n"; echo "\n"; echo "\n"; @@ -438,7 +433,7 @@ require_once "includes/require.php"; echo " \n"; echo " \n"; diff --git a/app/devices/devices.php b/app/devices/devices.php index 45536b7b68..ccb69963d7 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -25,7 +25,7 @@ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; -if (permission_exists('phone_view')) { +if (permission_exists('device_view')) { //access granted } else { @@ -46,20 +46,20 @@ echo "
"; echo "
Hardware Phone AddHardware Phone EditDevice
\n"; - echo "The following information is used to provision phones.

\n"; + echo "The following information is used to provision endpoints.

\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the MAC address.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo "Enter the phone label.\n"; + echo "Enter the device label.\n"; echo "
\n"; - echo "\n"; echo "\n"; $temp_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/includes/templates/provision"; if($dh = opendir($temp_dir)) { @@ -309,7 +304,7 @@ require_once "includes/require.php"; while($dir_sub = readdir($dh_sub)) { if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') { if(is_dir($temp_dir . '/' . $dir .'/'. $dir_sub)) { - if ($phone_template == $dir."/".$dir_sub) { + if ($device_template == $dir."/".$dir_sub) { echo "\n"; } else { @@ -337,7 +332,7 @@ require_once "includes/require.php"; echo " Vendor:\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the vendor name.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the model number.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the firmware version.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the username.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the password.\n"; echo "
\n"; - echo " \n"; echo " \n"; - if ($phone_provision_enable == "true" || strlen($phone_provision_enable) == 0) { + if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) { echo " \n"; } else { echo " \n"; } - if ($phone_provision_enable == "false") { + if ($device_provision_enable == "false") { echo " \n"; } else { @@ -410,7 +405,7 @@ require_once "includes/require.php"; } echo " \n"; echo "
\n"; - echo "Enable or disable provisioning for this phone.\n"; + echo "Enable or disable provisioning for this device.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the time zone.\n"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo "Enter the description.\n"; echo "
\n"; if ($action == "update") { - echo " \n"; + echo " \n"; } echo " \n"; echo "
\n"; echo "\n"; -echo "\n"; +echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Hardware Phone ListDevices 
\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 "Items in this list can be assigned from the extensions page.

\n"; +echo "Items in this list are assigned from the extensions page.

\n"; echo "
\n"; -$sql = "select * from v_hardware_phones "; +$sql = "select * from v_devices "; $sql .= "where domain_uuid = '$domain_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } $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); $offset = $rows_per_page * $page; -$sql = "select * from v_hardware_phones "; +$sql = "select * from v_devices "; $sql .= "where domain_uuid = '$domain_uuid' "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } $sql .= " limit $rows_per_page offset $offset "; @@ -91,37 +91,37 @@ $row_style["1"] = "row_style1"; echo "
\n"; echo "\n"; echo "\n"; -echo th_order_by('phone_mac_address', 'MAC Address', $order_by, $order); -echo th_order_by('phone_template', 'Template', $order_by, $order); -echo th_order_by('phone_vendor', 'Vendor', $order_by, $order); -//echo th_order_by('phone_model', 'Model', $order_by, $order); -echo th_order_by('phone_provision_enable', 'Enabled', $order_by, $order); -echo th_order_by('phone_description', 'Description', $order_by, $order); +echo th_order_by('device_mac_address', 'MAC Address', $order_by, $order); +echo th_order_by('device_template', 'Template', $order_by, $order); +echo th_order_by('device_vendor', 'Vendor', $order_by, $order); +//echo th_order_by('device_model', 'Model', $order_by, $order); +echo th_order_by('device_provision_enable', 'Enabled', $order_by, $order); +echo th_order_by('device_description', 'Description', $order_by, $order); echo "\n"; echo "\n"; if ($result_count > 0) { //no results foreach($result as $row) { - $phone_mac_address = $row[phone_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 = $row[device_mac_address]; + $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 "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - //echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + //echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo "\n"; @@ -137,8 +137,8 @@ echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n";
\n"; -if (permission_exists('phone_add')) { - echo " $v_link_label_add\n"; +if (permission_exists('device_add')) { + echo " $v_link_label_add\n"; } echo "
".$phone_mac_address." ".$row['phone_template']." ".$row['phone_vendor']." ".$row['phone_mode'l]." ".$row['phone_provision_enable']." ".$row['phone_description']." ".$device_mac_address." ".$row['device_template']." ".$row['device_vendor']." ".$row['device_mode'l]." ".$row['device_provision_enable']." ".$row['device_description']." \n"; - if (permission_exists('phone_edit')) { - echo " $v_link_label_edit\n"; + if (permission_exists('device_edit')) { + echo " $v_link_label_edit\n"; } - if (permission_exists('phone_delete')) { - echo " $v_link_label_delete\n"; + if (permission_exists('device_delete')) { + echo " $v_link_label_delete\n"; } echo "
 $paging_controls\n"; -if (permission_exists('phone_add')) { - echo " $v_link_label_add\n"; +if (permission_exists('device_add')) { + echo " $v_link_label_add\n"; } echo "