Update device_copy.php

This commit is contained in:
FusionPBX 2016-10-22 23:44:45 -06:00 committed by GitHub
parent 71c5e4b117
commit f937f58c8a
1 changed files with 24 additions and 16 deletions

View File

@ -17,22 +17,26 @@
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
Portions created by the Initial Developer are Copyright (C) 2008-2016
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;
}
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
@ -145,12 +149,16 @@ else {
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//prepare the array
$array['devices'][] = $device;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$database->save($array);
$response = $database->message;
$_SESSION["message"] = $text['message-copy'];
}
@ -158,4 +166,4 @@ else {
header("Location: devices.php");
return;
?>
?>