2012-06-04 16:58:40 +02:00
|
|
|
<?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>
|
2018-07-04 20:02:36 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2016-2018
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//includes
|
|
|
|
|
require_once "root.php";
|
|
|
|
|
require_once "resources/require.php";
|
2020-01-06 20:30:15 +01:00
|
|
|
require_once "resources/check_auth.php";
|
2015-01-22 02:07:37 +01:00
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('sip_profile_add') || permission_exists('sip_profile_edit')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
2015-01-22 01:51:01 +01:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//add multi-lingual support
|
|
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//action add or update
|
2019-08-13 15:32:07 +02:00
|
|
|
if (is_uuid($_REQUEST["id"])) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$action = "update";
|
2019-08-13 15:32:07 +02:00
|
|
|
$sip_profile_uuid = $_REQUEST["id"];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$action = "add";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get http post variables and set them to php variables
|
2017-01-24 12:08:55 +01:00
|
|
|
if (is_array($_POST)) {
|
2019-08-13 15:32:07 +02:00
|
|
|
$sip_profile_uuid = $_POST["sip_profile_uuid"];
|
|
|
|
|
$sip_profile_name = $_POST["sip_profile_name"];
|
|
|
|
|
$sip_profile_hostname = $_POST["sip_profile_hostname"];
|
|
|
|
|
$sip_profile_enabled = $_POST["sip_profile_enabled"];
|
|
|
|
|
$sip_profile_description = $_POST["sip_profile_description"];
|
2019-09-18 18:24:43 +02:00
|
|
|
$sip_profile_domains = $_POST["sip_profile_domains"];
|
|
|
|
|
$sip_profile_settings = $_POST["sip_profile_settings"];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//process the user data and save it to the database
|
|
|
|
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|
|
|
|
|
|
|
|
|
//get the uuid from the POST
|
|
|
|
|
if ($action == "update") {
|
2019-08-13 15:32:07 +02:00
|
|
|
$sip_profile_uuid = $_POST["sip_profile_uuid"];
|
2017-01-24 12:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
2019-09-19 15:36:23 +02:00
|
|
|
//validate the token
|
|
|
|
|
$token = new token;
|
|
|
|
|
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
|
|
|
|
message::add($text['message-invalid_token'],'negative');
|
|
|
|
|
header('Location: sip_profiles.php');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//check for all required data
|
|
|
|
|
$msg = '';
|
2019-08-13 15:32:07 +02:00
|
|
|
//if (strlen($sip_profile_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_uuid']."<br>\n"; }
|
2017-01-24 12:08:55 +01:00
|
|
|
if (strlen($sip_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_name']."<br>\n"; }
|
|
|
|
|
//if (strlen($sip_profile_hostname) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_hostname']."<br>\n"; }
|
|
|
|
|
if (strlen($sip_profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_enabled']."<br>\n"; }
|
|
|
|
|
if (strlen($sip_profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_description']."<br>\n"; }
|
|
|
|
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|
|
|
|
require_once "resources/header.php";
|
|
|
|
|
require_once "resources/persist_form_var.php";
|
|
|
|
|
echo "<div align='center'>\n";
|
|
|
|
|
echo "<table><tr><td>\n";
|
|
|
|
|
echo $msg."<br />";
|
|
|
|
|
echo "</td></tr></table>\n";
|
|
|
|
|
persistformvar($_POST);
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
require_once "resources/footer.php";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-13 15:32:07 +02:00
|
|
|
//add the sip_profile_uuid
|
|
|
|
|
if (!is_uuid($_POST["sip_profile_uuid"])) {
|
|
|
|
|
$sip_profile_uuid = uuid();
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-18 18:24:43 +02:00
|
|
|
//prepare the array
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_name'] = $sip_profile_name;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_hostname'] = $sip_profile_hostname;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_enabled'] = $sip_profile_enabled;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_description'] = $sip_profile_description;
|
|
|
|
|
$y = 0;
|
|
|
|
|
foreach ($sip_profile_domains as $row) {
|
|
|
|
|
if (strlen($row['sip_profile_domain_uuid']) > 0) {
|
|
|
|
|
if (is_uuid($row['sip_profile_domain_uuid'])) {
|
|
|
|
|
$sip_profile_domain_uuid = $row['sip_profile_domain_uuid'];
|
2013-11-13 19:34:11 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
else {
|
|
|
|
|
$sip_profile_domain_uuid = uuid();
|
2013-11-13 19:34:11 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
if (strlen($row["sip_profile_domain_alias"]) > 0) {
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_uuid"] = $sip_profile_uuid;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_uuid"] = $sip_profile_domain_uuid;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_name"] = $row["sip_profile_domain_name"];
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_alias"] = $row["sip_profile_domain_alias"];
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_parse"] = $row["sip_profile_domain_parse"];
|
2013-11-13 19:34:11 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
$y++;
|
|
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
$y = 0;
|
|
|
|
|
foreach ($sip_profile_settings as $row) {
|
|
|
|
|
if (strlen($row['sip_profile_setting_uuid']) > 0) {
|
|
|
|
|
if (is_uuid($row['sip_profile_setting_uuid'])) {
|
|
|
|
|
$sip_profile_setting_uuid = $row['sip_profile_setting_uuid'];
|
2019-08-13 15:32:07 +02:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
else {
|
|
|
|
|
$sip_profile_setting_uuid = uuid();
|
2013-11-13 19:34:11 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
if (strlen($row["sip_profile_setting_name"]) > 0) {
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_uuid"] = $sip_profile_uuid;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_uuid"] = $sip_profile_setting_uuid;
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_name"] = $row["sip_profile_setting_name"];
|
2019-09-19 18:58:38 +02:00
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_value"] = $row["sip_profile_setting_value"];
|
2019-09-18 18:24:43 +02:00
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_enabled"] = $row["sip_profile_setting_enabled"];
|
|
|
|
|
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_description"] = $row["sip_profile_setting_description"];
|
2015-01-16 01:21:02 +01:00
|
|
|
}
|
2019-09-18 18:24:43 +02:00
|
|
|
$y++;
|
|
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
}
|
2019-09-18 18:25:03 +02:00
|
|
|
|
2019-08-13 15:32:07 +02:00
|
|
|
//grant temporary permissions
|
|
|
|
|
$p = new permissions;
|
|
|
|
|
$p->add('sip_profile_domain_add', 'temp');
|
|
|
|
|
$p->add('sip_profile_setting_add', 'temp');
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//save to the data
|
|
|
|
|
$database = new database;
|
|
|
|
|
$database->app_name = 'sip_profiles';
|
2019-08-13 15:32:07 +02:00
|
|
|
$database->app_uuid = '159a8da8-0e8c-a26b-6d5b-19c532b6d470';
|
2017-01-24 12:08:55 +01:00
|
|
|
$database->save($array);
|
|
|
|
|
$message = $database->message;
|
|
|
|
|
|
2019-12-04 00:55:15 +01:00
|
|
|
//get the hostname
|
|
|
|
|
if ($sip_profile_hostname == '') {
|
|
|
|
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
|
|
|
|
if ($fp) {
|
|
|
|
|
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
|
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
}
|
2013-01-16 01:26:48 +01:00
|
|
|
|
2019-08-13 15:32:07 +02:00
|
|
|
//revoke temporary permissions
|
|
|
|
|
$p->delete('sip_profile_domain_add', 'temp');
|
|
|
|
|
$p->delete('sip_profile_setting_add', 'temp');
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//clear the cache
|
|
|
|
|
$cache = new cache;
|
|
|
|
|
$cache->delete("configuration:sofia.conf:".$sip_profile_hostname);
|
2015-01-16 01:21:02 +01:00
|
|
|
|
2017-08-24 04:44:37 +02:00
|
|
|
//save the sip profile xml
|
2017-01-24 12:08:55 +01:00
|
|
|
save_sip_profile_xml();
|
2017-08-24 04:44:37 +02:00
|
|
|
|
|
|
|
|
//apply settings reminder
|
2017-01-24 12:08:55 +01:00
|
|
|
$_SESSION["reload_xml"] = true;
|
2015-07-02 10:09:09 +02:00
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//redirect the user
|
2019-08-13 15:32:07 +02:00
|
|
|
if ($action == "add") {
|
|
|
|
|
message::add($text['message-add']);
|
|
|
|
|
}
|
|
|
|
|
if ($action == "update") {
|
|
|
|
|
message::add($text['message-update']);
|
2017-01-24 12:08:55 +01:00
|
|
|
}
|
2019-08-28 21:08:34 +02:00
|
|
|
header('Location: sip_profile_edit.php?id='.urlencode($sip_profile_uuid));
|
2019-08-13 15:32:07 +02:00
|
|
|
exit;
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//pre-populate the form
|
2017-01-24 12:08:55 +01:00
|
|
|
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
|
2019-08-13 15:32:07 +02:00
|
|
|
$sip_profile_uuid = $_GET["id"];
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql = "select * from v_sip_profiles ";
|
2019-08-13 15:32:07 +02:00
|
|
|
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
|
|
|
|
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$row = $database->select($sql, $parameters, 'row');
|
|
|
|
|
if (is_array($row) && @sizeof($row) != 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$sip_profile_name = $row["sip_profile_name"];
|
2013-11-12 16:56:26 +01:00
|
|
|
$sip_profile_hostname = $row["sip_profile_hostname"];
|
2015-05-02 06:53:45 +02:00
|
|
|
$sip_profile_enabled = $row["sip_profile_enabled"];
|
2017-01-24 12:08:55 +01:00
|
|
|
$sip_profile_description = $row["sip_profile_description"];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2019-08-13 15:32:07 +02:00
|
|
|
unset($sql, $parameters, $row);
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
//get the child data
|
|
|
|
|
$sql = "select * from v_sip_profile_settings ";
|
2019-08-13 15:32:07 +02:00
|
|
|
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
2017-04-13 18:24:48 +02:00
|
|
|
$sql .= "order by sip_profile_setting_name ";
|
2019-08-13 15:32:07 +02:00
|
|
|
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$sip_profile_settings = $database->select($sql, $parameters, 'all');
|
|
|
|
|
unset($sql, $parameters);
|
2017-01-24 12:08:55 +01:00
|
|
|
|
|
|
|
|
//add an empty row
|
|
|
|
|
$x = count($sip_profile_settings);
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_uuid'] = uuid();
|
2017-04-13 18:24:48 +02:00
|
|
|
$sip_profile_settings[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
2017-01-24 12:08:55 +01:00
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_name'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_value'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_enabled'] = '';
|
|
|
|
|
$sip_profile_settings[$x]['sip_profile_setting_description'] = '';
|
|
|
|
|
|
|
|
|
|
//get the child data
|
|
|
|
|
$sql = "select * from v_sip_profile_domains ";
|
2019-08-13 15:32:07 +02:00
|
|
|
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
|
|
|
|
|
$parameters['sip_profile_uuid'] = $sip_profile_uuid;
|
|
|
|
|
$database = new database;
|
|
|
|
|
$sip_profile_domains = $database->select($sql, $parameters, 'all');
|
|
|
|
|
unset($sql, $parameters);
|
2017-01-24 12:08:55 +01:00
|
|
|
|
|
|
|
|
//add an empty row
|
|
|
|
|
$x = count($sip_profile_domains);
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_uuid'] = uuid();
|
2017-04-13 18:24:48 +02:00
|
|
|
$sip_profile_domains[$x]['sip_profile_uuid'] = $sip_profile_uuid;
|
2017-01-24 12:08:55 +01:00
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_name'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_alias'] = '';
|
|
|
|
|
$sip_profile_domains[$x]['sip_profile_domain_parse'] = '';
|
|
|
|
|
|
2019-09-19 15:36:23 +02:00
|
|
|
//create token
|
|
|
|
|
$object = new token;
|
|
|
|
|
$token = $object->create($_SERVER['PHP_SELF']);
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//show the header
|
2020-01-06 20:30:15 +01:00
|
|
|
$document['title'] = $text['title-sip_profile'];
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2017-05-07 09:18:03 +02:00
|
|
|
|
|
|
|
|
//label to form input
|
|
|
|
|
echo "<script language='javascript'>\n";
|
|
|
|
|
echo " function label_to_form(label_id, form_id) {\n";
|
|
|
|
|
echo " if (document.getElementById(label_id) != null) {\n";
|
|
|
|
|
echo " label = document.getElementById(label_id);\n";
|
|
|
|
|
echo " label.parentNode.removeChild(label);\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo " document.getElementById(form_id).style.display='';\n";
|
|
|
|
|
echo " }\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//show the content
|
2017-01-24 12:08:55 +01:00
|
|
|
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-sip_profile']."</b><br><br></td>\n";
|
|
|
|
|
echo "<td width='70%' align='right' valign='top'>\n";
|
|
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='sip_profiles.php'\" value='".$text['button-back']."'>";
|
2019-12-02 22:41:07 +01:00
|
|
|
if ($action == 'update' && (
|
2019-12-01 05:51:20 +01:00
|
|
|
permission_exists('dialplan_add')
|
2019-08-13 15:32:07 +02:00
|
|
|
|| permission_exists('inbound_route_add')
|
|
|
|
|
|| permission_exists('outbound_route_add')
|
2019-12-01 05:51:20 +01:00
|
|
|
|| permission_exists('time_condition_add')
|
|
|
|
|
)) {
|
2019-08-28 21:08:34 +02:00
|
|
|
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var name = prompt('".$text['label-new_sip_profile_name']."'); if (name != null) { window.location='sip_profile_copy.php?id=".urlencode($sip_profile_uuid)."&name=' + name; }\" value='".$text['button-copy']."'>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2014-06-21 09:51:31 +02:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " ".$text['label-sip_profile_name']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
echo " <input class='formfld' type='text' name='sip_profile_name' maxlength='255' value=\"".escape($sip_profile_name)."\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<br />\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo $text['description-sip_profile_name']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td class='vncell' align='left'>\n";
|
|
|
|
|
echo " ".$text['title-sip_profile_domains']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <table>\n";
|
|
|
|
|
echo " <tr>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
echo " <th class='vtable' style='width:80px; text-align: left;'> ".$text['label-sip_profile_domain_name']."</th>\n";
|
2017-05-07 09:43:41 +02:00
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_domain_alias']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_domain_parse']."</th>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </tr>\n";
|
|
|
|
|
$x = 0;
|
2019-08-13 15:32:07 +02:00
|
|
|
foreach ($sip_profile_domains as $row) {
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <tr>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
if (is_uuid($row["sip_profile_domain_uuid"])) {
|
2017-01-24 12:08:55 +01:00
|
|
|
$sip_profile_domain_uuid = $row["sip_profile_domain_uuid"];
|
|
|
|
|
}
|
2019-08-13 15:32:07 +02:00
|
|
|
if (is_uuid($row["sip_profile_uuid"])) {
|
2017-01-24 12:08:55 +01:00
|
|
|
$sip_profile_uuid = $row["sip_profile_uuid"];
|
|
|
|
|
}
|
2019-08-28 21:08:34 +02:00
|
|
|
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_domain_uuid]' value=\"".escape($sip_profile_domain_uuid)."\">\n";
|
|
|
|
|
echo " <input type='hidden' name='sip_profile_domains[$x][sip_profile_uuid]' value=\"".escape($sip_profile_uuid)."\">\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_domain_name_$x','sip_profile_domain_name_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_domain_name_$x'>".escape($row["sip_profile_domain_name"])."</label>\n";
|
|
|
|
|
echo " <input id='sip_profile_domain_name_$x' class='formfld' style='display: none;' type='text' name='sip_profile_domains[$x][sip_profile_domain_name]' maxlength='255' value=\"".escape($row["sip_profile_domain_name"])."\">\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_domain_alias_$x'>".escape($row["sip_profile_domain_alias"])."</label>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <select id='sip_profile_domain_alias_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_alias]'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row["sip_profile_domain_alias"] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row["sip_profile_domain_alias"] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
|
|
|
|
|
echo " </td>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_domain_parse_$x','sip_profile_domain_parse_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_domain_parse_$x'>".escape($row["sip_profile_domain_parse"])."</label>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <select id='sip_profile_domain_parse_$x' class='formfld' style='display: none;' name='sip_profile_domains[$x][sip_profile_domain_parse]'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row["sip_profile_domain_parse"] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row["sip_profile_domain_parse"] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='list_control_icons' style='width: 25px;'>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
if (strlen($row["sip_profile_domain_name"]) > 0) {
|
2019-08-28 21:08:34 +02:00
|
|
|
echo " <a href=\"sip_profile_domain_delete.php?id=".urlencode($row["sip_profile_domain_uuid"])."&sip_profile_domain_uuid=".urlencode($row["sip_profile_domain_uuid"])."&a=delete\" alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">".$v_link_label_delete."</a>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
//convert last empty labels to form elements
|
|
|
|
|
if ($row["sip_profile_domain_name"] == '' && $row["sip_profile_domain_alias"] == '' && $row["sip_profile_domain_parse"] == '') {
|
|
|
|
|
echo "<script>\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_domain_name_$x','sip_profile_domain_name_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_domain_alias_$x','sip_profile_domain_alias_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_domain_parse_$x','sip_profile_domain_parse_$x');\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
|
|
|
|
|
echo " <tr>\n";
|
2017-05-07 09:43:41 +02:00
|
|
|
echo " <td class='vncellreq' align='left'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " ".$text['label-sip_profile_settings']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='vtable' align='left'>\n";
|
|
|
|
|
echo " <table>\n";
|
|
|
|
|
echo " <tr>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
echo " <th class='vtable' style='text-align: left;'> ".$text['label-sip_profile_setting_name']."</th>\n";
|
2017-05-07 09:43:41 +02:00
|
|
|
echo " <th class='vtable' style='text-align: left;'>".$text['label-sip_profile_setting_value']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='width:70px; text-align: left;'>".$text['label-sip_profile_setting_enabled']."</th>\n";
|
|
|
|
|
echo " <th class='vtable' style='text-align: left;'>".$text['label-sip_profile_setting_description']."</th>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </tr>\n";
|
|
|
|
|
$x = 0;
|
2019-08-13 15:32:07 +02:00
|
|
|
foreach ($sip_profile_settings as $row) {
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <tr>\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_setting_uuid]' value=\"".escape($row["sip_profile_setting_uuid"])."\">\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
echo " <input type='hidden' name='sip_profile_settings[$x][sip_profile_uuid]' value=\"".escape($row["sip_profile_uuid"])."\">\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_setting_name_$x','sip_profile_setting_name_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_setting_name_$x'>".escape($row["sip_profile_setting_name"])."</label>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
echo " <input id='sip_profile_setting_name_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_name]' maxlength='255' value=\"".escape($row["sip_profile_setting_name"])."\">\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_setting_value_$x','sip_profile_setting_value_$x');\" nowrap=\"nowrap\">\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
echo " <label id='label_sip_profile_setting_value_$x'>".escape(substr($row["sip_profile_setting_value"],0,22))." </label>\n";
|
|
|
|
|
echo " <input id='sip_profile_setting_value_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_value]' maxlength='255' value=\"".escape($row["sip_profile_setting_value"])."\">\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_setting_enabled_$x','sip_profile_setting_enabled_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_setting_enabled_$x'>".escape($row["sip_profile_setting_enabled"])."</label>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <select id='sip_profile_setting_enabled_$x' class='formfld' style='display: none;' name='sip_profile_settings[$x][sip_profile_setting_enabled].'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <option value=''></option>\n";
|
|
|
|
|
if ($row['sip_profile_setting_enabled'] == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($row['sip_profile_setting_enabled'] == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " </select>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
2017-05-07 09:18:03 +02:00
|
|
|
echo " <td class=\"vtablerow\" style=\"\" onclick=\"label_to_form('label_sip_profile_setting_description_$x','sip_profile_setting_description_$x');\" nowrap=\"nowrap\">\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <label id='label_sip_profile_setting_description_$x'>".escape($row["sip_profile_setting_description"])." </label>\n";
|
|
|
|
|
echo " <input id='sip_profile_setting_description_$x' class='formfld' style='display: none;' type='text' name='sip_profile_settings[$x][sip_profile_setting_description]' maxlength='255' value=\"".escape($row["sip_profile_setting_description"])."\">\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='list_control_icons' style='width: 25px;'>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
if (strlen($row["sip_profile_setting_name"]) > 0) {
|
2019-08-28 21:08:34 +02:00
|
|
|
echo " <a href=\"sip_profile_setting_delete.php?id=".escape($row["sip_profile_setting_uuid"])."&sip_profile_uuid=".urlencode($sip_profile_uuid)."&a=delete\" alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">".$v_link_label_delete."</a>\n";
|
2017-05-07 18:28:39 +02:00
|
|
|
}
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
2019-08-13 15:32:07 +02:00
|
|
|
//convert last empty labels to form elements
|
|
|
|
|
if ($row["sip_profile_setting_name"] == '' && $row["sip_profile_setting_value"] == '' && $row["sip_profile_setting_enabled"] == '' && $row["sip_profile_setting_description"] == '') {
|
|
|
|
|
echo "<script>\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_name_$x','sip_profile_setting_name_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_value_$x','sip_profile_setting_value_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_enabled_$x','sip_profile_setting_enabled_$x');\n";
|
|
|
|
|
echo " label_to_form('label_sip_profile_setting_description_$x','sip_profile_setting_description_$x');\n";
|
|
|
|
|
echo "</script>\n";
|
|
|
|
|
}
|
|
|
|
|
$x++;
|
2017-01-24 12:08:55 +01:00
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
|
2013-11-12 16:56:26 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " ".$text['label-sip_profile_hostname']."\n";
|
2013-11-12 16:56:26 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2018-08-28 04:38:39 +02:00
|
|
|
echo " <input class='formfld' type='text' name='sip_profile_hostname' maxlength='255' value=\"".escape($sip_profile_hostname)."\">\n";
|
2013-11-12 16:56:26 +01:00
|
|
|
echo "<br />\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo $text['description-sip_profile_hostname']."\n";
|
2013-11-12 16:56:26 +01:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2015-05-02 06:53:45 +02:00
|
|
|
echo "<tr>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-sip_profile_enabled']."\n";
|
2015-05-02 06:53:45 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo " <select class='formfld' name='sip_profile_enabled'>\n";
|
|
|
|
|
if ($sip_profile_enabled == "true") {
|
|
|
|
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($sip_profile_enabled == "false") {
|
|
|
|
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </select>\n";
|
2015-05-02 06:53:45 +02:00
|
|
|
echo "<br />\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo $text['description-sip_profile_enabled']."\n";
|
2015-05-02 06:53:45 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
|
|
|
|
echo " ".$text['label-sip_profile_description']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "<td class='vtable' align='left'>\n";
|
2019-08-28 21:08:34 +02:00
|
|
|
echo " <textarea class='formfld' type='text' name='sip_profile_description'>".escape($sip_profile_description)."</textarea>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<br />\n";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo $text['description-sip_profile_description']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2015-05-02 06:53:45 +02:00
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td colspan='2' align='right'>\n";
|
|
|
|
|
if ($action == "update") {
|
2019-09-19 15:36:23 +02:00
|
|
|
echo " <input type='hidden' name='sip_profile_uuid' value='".escape($sip_profile_uuid)."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2019-09-19 15:36:23 +02:00
|
|
|
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
|
|
|
|
echo " <br>\n";
|
|
|
|
|
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "</form>";
|
2017-01-24 12:08:55 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2017-01-24 12:08:55 +01:00
|
|
|
|
2019-08-28 07:50:14 +02:00
|
|
|
?>
|