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 The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> 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. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
include "root.php";
require_once "resources/require.php"; //includes
require_once "resources/check_auth.php"; include "root.php";
if (permission_exists('device_add')) { require_once "resources/require.php";
//access granted require_once "resources/check_auth.php";
}
else { //check permissions
echo "access denied"; if (permission_exists('device_add')) {
exit; //access granted
} }
else {
echo "access denied";
exit;
}
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
@ -145,12 +149,16 @@ else {
$device["device_keys"] = $device_keys; $device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings; $device["device_settings"] = $device_settings;
//prepare the array
$array['devices'][] = $device;
//copy the device //copy the device
if ($save) { if ($save) {
$orm = new orm; $database = new database;
$orm->name('devices'); $database->app_name = 'devices';
$orm->save($device); $database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
$response = $orm->message; $database->save($array);
$response = $database->message;
$_SESSION["message"] = $text['message-copy']; $_SESSION["message"] = $text['message-copy'];
} }
@ -158,4 +166,4 @@ else {
header("Location: devices.php"); header("Location: devices.php");
return; return;
?> ?>