\r\n --> \n

Cause all the .php files containing lines ending with \r\n to instead end with \n.

DYI with:

find fusionpbx -type f -name '*.php' -exec dos2unix '{}' \;
This commit is contained in:
Harry G. Coin
2016-04-25 20:30:23 -05:00
parent 89e5ecbcdf
commit 91a92d8e5e
118 changed files with 40760 additions and 40760 deletions
+53 -53
View File
@@ -1,54 +1,54 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//set all lines to enabled (true) where null or empty string
$sql = "update v_device_lines set ";
$sql .= "enabled = 'true' ";
$sql .= "where enabled is null ";
$sql .= "or enabled = '' ";
$db->exec(check_sql($sql));
unset($sql);
//set the device key vendor
$sql = "select * from v_device_keys as k, v_devices as d ";
$sql .= "where d.device_uuid = k.device_uuid ";
$sql .= "and k.device_uuid is not null ";
$sql .= "and k.device_key_vendor is null ";
$s = $db->prepare($sql);
$s->execute();
$device_keys = $s->fetchAll(PDO::FETCH_ASSOC);
foreach ($device_keys as &$row) {
$sql = "update v_device_keys ";
$sql .= "set device_key_vendor = '".$row["device_vendor"]."' ";
$sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n ";
$db->exec(check_sql($sql));
}
unset($device_keys, $sql);
}
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//set all lines to enabled (true) where null or empty string
$sql = "update v_device_lines set ";
$sql .= "enabled = 'true' ";
$sql .= "where enabled is null ";
$sql .= "or enabled = '' ";
$db->exec(check_sql($sql));
unset($sql);
//set the device key vendor
$sql = "select * from v_device_keys as k, v_devices as d ";
$sql .= "where d.device_uuid = k.device_uuid ";
$sql .= "and k.device_uuid is not null ";
$sql .= "and k.device_key_vendor is null ";
$s = $db->prepare($sql);
$s->execute();
$device_keys = $s->fetchAll(PDO::FETCH_ASSOC);
foreach ($device_keys as &$row) {
$sql = "update v_device_keys ";
$sql .= "set device_key_vendor = '".$row["device_vendor"]."' ";
$sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n ";
$db->exec(check_sql($sql));
}
unset($device_keys, $sql);
}
?>
+2347 -2347
View File
File diff suppressed because it is too large Load Diff
+160 -160
View File
@@ -1,161 +1,161 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
?>
+160 -160
View File
@@ -1,161 +1,161 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
?>
+75 -75
View File
@@ -1,76 +1,76 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (isset($_GET["id"])) {
$id = $_GET["id"];
}
//delete the data and subdata
if (is_uuid($id)) {
//delete device profile keys
$sql = "delete from v_device_keys ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//delete device profile
$sql = "delete from v_device_profiles ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//remove device profile uuid from any assigned devices
$sql = "update v_devices set ";
$sql .= "device_profile_uuid = null ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
}
//write the provision files
require_once "app/provision/provision_write.php";
//set the message and redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: device_profiles.php");
return;
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (isset($_GET["id"])) {
$id = $_GET["id"];
}
//delete the data and subdata
if (is_uuid($id)) {
//delete device profile keys
$sql = "delete from v_device_keys ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//delete device profile
$sql = "delete from v_device_profiles ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//remove device profile uuid from any assigned devices
$sql = "update v_devices set ";
$sql .= "device_profile_uuid = null ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
}
//write the provision files
require_once "app/provision/provision_write.php";
//set the message and redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: device_profiles.php");
return;
?>
File diff suppressed because it is too large Load Diff
+176 -176
View File
@@ -1,177 +1,177 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//additional includes
require_once "resources/header.php";
$document['title'] = $text['title-profiles'];
require_once "resources/paging.php";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-profiles']."</b>";
echo " <br /><br />";
echo " ".$text['description-profiles'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>&nbsp;&nbsp;&nbsp;&nbsp;";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by device_profile_name asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
echo th_order_by('enabled', $text['label-profile_enabled'], $order_by, $order);
echo th_order_by('description', $text['label-profile_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo (permission_exists('device_profile_edit')) ? "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."'>".$row['device_profile_name']."</a>" : $row['device_profile_name'];
echo ($row['domain_uuid'] == '') ? "&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: #888; font-size: 80%'>".$text['select-global']."</span>" : null;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_edit')) {
echo "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('device_profile_delete')) {
echo "<a href='device_profile_delete.php?id=".$row['device_profile_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='4'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//additional includes
require_once "resources/header.php";
$document['title'] = $text['title-profiles'];
require_once "resources/paging.php";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-profiles']."</b>";
echo " <br /><br />";
echo " ".$text['description-profiles'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>&nbsp;&nbsp;&nbsp;&nbsp;";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by device_profile_name asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
echo th_order_by('enabled', $text['label-profile_enabled'], $order_by, $order);
echo th_order_by('description', $text['label-profile_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo (permission_exists('device_profile_edit')) ? "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."'>".$row['device_profile_name']."</a>" : $row['device_profile_name'];
echo ($row['domain_uuid'] == '') ? "&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: #888; font-size: 80%'>".$text['select-global']."</span>" : null;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_edit')) {
echo "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('device_profile_delete')) {
echo "<a href='device_profile_delete.php?id=".$row['device_profile_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='4'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>