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,15 +17,19 @@
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>
*/ */
//includes
include "root.php"; include "root.php";
require_once "resources/require.php"; require_once "resources/require.php";
require_once "resources/check_auth.php"; require_once "resources/check_auth.php";
//check permissions
if (permission_exists('device_add')) { if (permission_exists('device_add')) {
//access granted //access granted
} }
@ -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'];
} }