Update sip_profile_copy.php

This commit is contained in:
FusionPBX 2017-01-24 04:04:18 -07:00 committed by GitHub
parent 6bdfaafa19
commit 272740c1fc
1 changed files with 114 additions and 74 deletions

View File

@ -17,16 +17,20 @@
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>
*/
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
if (permission_exists('dialplan_add')
|| permission_exists('inbound_route_add')
|| permission_exists('outbound_route_add')
@ -63,21 +67,57 @@ else {
//copy the v_sip_profiles
$sip_profile_uuid_new = uuid();
$sip_profile_enabled = 'true';
$sql = "insert into v_sip_profiles ";
$sql .= "(";
$sql .= "sip_profile_uuid, ";
$sql .= "sip_profile_name, ";
$sql .= "sip_profile_enabled, ";
$sql .= "sip_profile_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$sip_profile_uuid_new."', ";
$sql .= "'".$sip_profile_name."', ";
$sql .= "'".$sip_profile_enabled."', ";
$sql .= "'".$sip_profile_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//get the the sip profile settings
$sql = "select * from v_sip_profile_domains ";
$sql .= "where sip_profile_uuid = '$sip_profile_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();
foreach ($result as &$row) {
$sip_profile_domain_name = $row["sip_profile_domain_name"];
$sip_profile_domain_alias = $row["sip_profile_domain_alias"];
$sip_profile_domain_parse = $row["sip_profile_domain_parse"];
//add the sip profile setting
$sql = "insert into v_sip_profile_domains ";
$sql .= "(";
$sql .= "sip_profile_domain_uuid, ";
$sql .= "sip_profile_uuid, ";
$sql .= "sip_profile_domain_name, ";
$sql .= "sip_profile_domain_alias, ";
$sql .= "sip_profile_domain_parse ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$sip_profile_uuid_new', ";
$sql .= "'$sip_profile_domain_name', ";
$sql .= "'$sip_profile_domain_alias', ";
$sql .= "'$sip_profile_domain_parse' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
unset ($prep_statement);
//get the the sip profile settings
$sql = "select * from v_sip_profile_settings ";
$sql .= "where sip_profile_uuid = '$sip_profile_uuid' ";