Merge branch '5.3' into bugfix/fix-false-comparison
This commit is contained in:
commit
11278e6709
|
|
@ -74,7 +74,7 @@
|
|||
$array['access_controls'][0]['access_control_name'] = $access_control_name;
|
||||
$array['access_controls'][0]['access_control_default'] = $access_control_default;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('access_control_add', 'temp');
|
||||
|
||||
$database->app_name = 'access_controls';
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
$array['access_control_nodes'][0]['node_cidr'] = $node_cidr;
|
||||
$array['access_control_nodes'][0]['node_description'] = $node_description;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('access_control_node_add', 'temp');
|
||||
|
||||
$database->app_name = 'access_controls';
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ if (!class_exists('access_controls')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('access_control_node_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -236,7 +236,7 @@ if (!class_exists('access_controls')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('access_control_node_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
//update the status
|
||||
if (permission_exists("user_setting_edit")) {
|
||||
//add the user_edit permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("user_edit", "temp");
|
||||
|
||||
//update the database user_status
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
}
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@
|
|||
$array['dialplans'][$index]['dialplan_enabled'] = 'true';
|
||||
}
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
$database->save($array);
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ if (!class_exists('call_block')) {
|
|||
unset($rows, $parameters);
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "call_center";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "record_name";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "\${sip_from_user}-\${sip_to_user}-\${strftime(%Y)}\${strftime(%b)}\${strftime(%d)}.\${record_ext}";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "\${sip_from_user}-\${sip_to_user}-\${strftime(%Y)}\${strftime(%b)}\${strftime(%d)}-\${uuid}.\${record_ext}";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Custom name for call recording. Options: \${record_ext}, \${sip_from_user}, \${sip_to_user}, \${caller_id_number}, \${uuid}";
|
||||
$y++;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ if ($domains_processed == 1) {
|
|||
}
|
||||
|
||||
if (!empty($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_tier_edit', 'temp');
|
||||
|
||||
$database->app_name = 'call_centers';
|
||||
|
|
@ -168,7 +168,7 @@ if ($domains_processed == 1) {
|
|||
//save the array to the database
|
||||
if (!empty($array)) {
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
|
|
|
|||
|
|
@ -42,36 +42,14 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//connect to the database
|
||||
$database = new database;
|
||||
|
||||
//set the defaults
|
||||
$agent_id = '';
|
||||
$agent_name = '';
|
||||
$agent_password = '';
|
||||
|
||||
//check for duplicates
|
||||
if (!empty($_GET["check"]) && $_GET["check"] == 'duplicate') {
|
||||
//agent id
|
||||
if (!empty($_GET["agent_id"])) {
|
||||
$sql = "select agent_name ";
|
||||
$sql .= "from v_call_center_agents ";
|
||||
$sql .= "where agent_id = :agent_id ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
if (!empty($_GET["agent_uuid"]) && is_uuid($_GET["agent_uuid"])) {
|
||||
$sql .= " and call_center_agent_uuid <> :call_center_agent_uuid ";
|
||||
$parameters['call_center_agent_uuid'] = $_GET["agent_uuid"];
|
||||
}
|
||||
$parameters['agent_id'] = $_GET["agent_id"];
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row) && !empty($row['agent_name'])) {
|
||||
echo $text['message-duplicate_agent_id'].(if_group("superadmin") ? ": ".$row["agent_name"] : null);
|
||||
}
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
|
|
@ -81,6 +59,14 @@
|
|||
$action = "add";
|
||||
}
|
||||
|
||||
//get the users array
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by username asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (!empty($_POST)) {
|
||||
$call_center_agent_uuid = $_POST["call_center_agent_uuid"] ?? null;
|
||||
|
|
@ -151,15 +137,6 @@
|
|||
$call_center_agent_uuid = uuid();
|
||||
}
|
||||
|
||||
//get the users array
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by username asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//change the contact string to loopback - Not recommended added for backwards comptability causes multiple problems
|
||||
if ($_SESSION['call_center']['agent_contact_method']['text'] == 'loopback') {
|
||||
$agent_contact = str_replace("user/", "loopback/", $agent_contact);
|
||||
|
|
@ -193,11 +170,9 @@
|
|||
}
|
||||
|
||||
//save to the data
|
||||
$database = new database;
|
||||
$database->app_name = 'call_center';
|
||||
$database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||
$database->save($array);
|
||||
//$message = $database->message;
|
||||
|
||||
//syncrhonize configuration
|
||||
save_call_center_xml();
|
||||
|
|
@ -295,7 +270,6 @@
|
|||
$sql .= "and call_center_agent_uuid = :call_center_agent_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['call_center_agent_uuid'] = $call_center_agent_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row)) {
|
||||
$call_center_agent_uuid = $row["call_center_agent_uuid"];
|
||||
|
|
@ -338,47 +312,12 @@
|
|||
if ($action == "update") {
|
||||
$document['title'] = $text['title-call_center_agent_edit'];
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//get the list of users for this domain
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and user_enabled = 'true' ";
|
||||
$sql .= "order by username asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//javascript to check for duplicates
|
||||
?>
|
||||
<script language="javascript">
|
||||
function check_duplicates() {
|
||||
//check agent id
|
||||
var agent_id = document.getElementById('agent_id').value;
|
||||
$("#duplicate_agent_id_response").load("call_center_agent_edit.php?check=duplicate&agent_id="+agent_id+"&agent_uuid=<?php echo escape($call_center_agent_uuid ?? ''); ?>", function() {
|
||||
var duplicate_agent_id = false;
|
||||
if ($("#duplicate_agent_id_response").html() != '') {
|
||||
$('#agent_id').addClass('formfld_highlight_bad');
|
||||
display_message($("#duplicate_agent_id_response").html(), 'negative'<?php if (if_group("superadmin")) { echo ', 3000'; } ?>);
|
||||
duplicate_agent_id = true;
|
||||
}
|
||||
else {
|
||||
$("#duplicate_agent_id_response").html('');
|
||||
$('#agent_id').removeClass('formfld_highlight_bad');
|
||||
duplicate_agent_id = false;
|
||||
}
|
||||
|
||||
if (duplicate_agent_id == false) {
|
||||
document.getElementById('frm').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
//show the content
|
||||
echo "<form method='post' name='frm' id='frm' onsubmit='check_duplicates(); return false;'>\n";
|
||||
echo "<form method='post' name='frm' id='frm' onsubmit=''>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'>";
|
||||
|
|
@ -404,21 +343,6 @@
|
|||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='agent_name' maxlength='255' value=\"".escape($agent_name)."\" />\n";
|
||||
/*
|
||||
echo "<select id=\"agent_name\" name=\"agent_name\" class='formfld'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
if (is_array($users)) {
|
||||
foreach($users as $field) {
|
||||
if ($field[username] == $agent_name) {
|
||||
echo "<option value='".escape($field[username])."' selected='selected'>".escape($field[username])."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".escape($field[username])."'>".escape($field[username])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
*/
|
||||
echo "<br />\n";
|
||||
echo $text['description-agent_name']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -467,7 +391,6 @@
|
|||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='number' name='agent_id' id='agent_id' maxlength='255' min='1' step='1' value='".escape($agent_id)."'>\n";
|
||||
echo " <div style='display: none;' id='duplicate_agent_id_response'></div>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-agent_id']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@
|
|||
$array['users'][0]['user_status'] = $row['agent_status'];
|
||||
$array['users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('user_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2024
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2025
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -42,6 +42,10 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//initialize database and settings
|
||||
$database = database::new();
|
||||
$settings = new settings(['database' => $database, $_SESSION['domain_uuid'] ?? '', $_SESSION['user_uuid'] ?? '']);
|
||||
|
||||
//set the defaults
|
||||
$queue_name = '';
|
||||
$queue_extension = '';
|
||||
|
|
@ -61,24 +65,24 @@
|
|||
$action = "add";
|
||||
}
|
||||
|
||||
//get the domain_uuid
|
||||
//get the domain details
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
$domain_name = $_SESSION['domain_name'];
|
||||
|
||||
//initialize the destinations object
|
||||
//initialize the destination object
|
||||
$destination = new destinations;
|
||||
|
||||
//get total call center queues count from the database, check limit, if defined
|
||||
if ($action == 'add') {
|
||||
if (!empty($_SESSION['limit']['call_center_queues']['numeric'])) {
|
||||
if (!empty($settings->get('limit','call_center_queues', ''))) {
|
||||
$sql = "select count(*) from v_call_center_queues ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$total_call_center_queues = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_call_center_queues >= $_SESSION['limit']['call_center_queues']['numeric']) {
|
||||
message::add($text['message-maximum_queues'].' '.$_SESSION['limit']['call_center_queues']['numeric'], 'negative');
|
||||
if ($total_call_center_queues >= $settings->get('limit','call_center_queues', 0)) {
|
||||
message::add($text['message-maximum_queues'].' '.$settings->get('limit','call_center_queues', ''), 'negative');
|
||||
header('Location: call_center_queues.php');
|
||||
return;
|
||||
}
|
||||
|
|
@ -124,7 +128,7 @@
|
|||
$queue_context = $_POST["queue_context"];
|
||||
}
|
||||
else if ($action == 'add') {
|
||||
$queue_context = $_SESSION['domain_name'];
|
||||
$queue_context = $domain_name;
|
||||
}
|
||||
|
||||
//remove invalid characters
|
||||
|
|
@ -149,7 +153,6 @@
|
|||
$sql .= "and t.call_center_queue_uuid = q.call_center_queue_uuid; ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['call_center_tier_uuid'] = $call_center_tier_uuid;
|
||||
$database = new database;
|
||||
$tiers = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -168,7 +171,7 @@
|
|||
if ($esl->is_connected()) {
|
||||
//callcenter_config tier del [queue_name] [agent_name]
|
||||
if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid)) {
|
||||
$cmd = "callcenter_config tier del ".$queue_extension."@".$_SESSION['domain_name']." ".$call_center_agent_uuid;
|
||||
$cmd = "callcenter_config tier del ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
}
|
||||
|
|
@ -178,10 +181,9 @@
|
|||
$array['call_center_tiers'][0]['call_center_tier_uuid'] = $call_center_tier_uuid;
|
||||
$array['call_center_tiers'][0]['domain_uuid'] = $domain_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_tier_delete', 'temp');
|
||||
|
||||
$database = new database;
|
||||
$database->app_name = 'call_centers';
|
||||
$database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||
$database->delete($array);
|
||||
|
|
@ -205,7 +207,6 @@
|
|||
$sql = "select * from v_call_center_queues ";
|
||||
$sql .= "where call_center_queue_uuid = :call_center_queue_uuid ";
|
||||
$parameters['call_center_queue_uuid'] = $call_center_queue_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row)) {
|
||||
//if (!permission_exists('call_center_queue_domain')) {
|
||||
|
|
@ -298,8 +299,8 @@
|
|||
|
||||
//add the recording path if needed
|
||||
if (!empty($queue_greeting)) {
|
||||
if (file_exists($_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting)) {
|
||||
$queue_greeting_path = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$queue_greeting;
|
||||
if (file_exists($settings->get('switch','recordings', '').'/'.$domain_name.'/'.$queue_greeting)) {
|
||||
$queue_greeting_path = $settings->get('switch','recordings', '').'/'.$domain_name.'/'.$queue_greeting;
|
||||
}
|
||||
else {
|
||||
$queue_greeting_path = trim($queue_greeting);
|
||||
|
|
@ -371,8 +372,8 @@
|
|||
|
||||
//add definable export variables can be set in default settings
|
||||
$export_variables = 'call_center_queue_uuid,sip_h_Alert-Info';
|
||||
if (!empty($_SESSION['call_center']['export_vars'])) {
|
||||
foreach ($_SESSION['call_center']['export_vars'] as $export_variable) {
|
||||
if (!empty($settings->get('call_center','export_vars', []))) {
|
||||
foreach ($settings->get('call_center','export_vars', []) as $export_variable) {
|
||||
$export_variables .= ','.$export_variable;
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +414,7 @@
|
|||
if (!empty($queue_cc_exit_keys)) {
|
||||
$dialplan_xml .= " <action application=\"set\" data=\"cc_exit_keys=".xml::sanitize($queue_cc_exit_keys)."\"/>\n";
|
||||
}
|
||||
$dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($queue_extension)."@".$_SESSION["domain_name"]."\"/>\n";
|
||||
$dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($queue_extension)."@".$domain_name."\"/>\n";
|
||||
if ($destination->valid($queue_timeout_app.':'.$queue_timeout_data)) {
|
||||
$dialplan_xml .= " <action application=\"".xml::sanitize($queue_timeout_app)."\" data=\"".xml::sanitize($queue_timeout_data)."\"/>\n";
|
||||
}
|
||||
|
|
@ -434,12 +435,11 @@
|
|||
$array['dialplans'][0]["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
//save to the data
|
||||
$database = new database;
|
||||
$database->app_name = 'call_centers';
|
||||
$database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||
$database->save($array);
|
||||
|
|
@ -457,7 +457,7 @@
|
|||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
|
|
@ -496,19 +496,19 @@
|
|||
*/
|
||||
//add the agent
|
||||
if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid) && is_numeric($tier_level) && is_numeric($tier_position)) {
|
||||
$cmd = "callcenter_config tier add ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position;
|
||||
$cmd = "callcenter_config tier add ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
//agent set level
|
||||
if (is_numeric($queue_extension) && is_numeric($tier_level)) {
|
||||
$cmd = "callcenter_config tier set level ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level;
|
||||
$cmd = "callcenter_config tier set level ".$queue_extension."@".$domain_name." ".$call_center_agent_uuid." ".$tier_level;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
//agent set position
|
||||
if (is_numeric($queue_extension) && is_numeric($tier_position)) {
|
||||
$cmd = "callcenter_config tier set position ".$queue_extension."@".$_SESSION["domain_name"]." ".$tier_position;
|
||||
$cmd = "callcenter_config tier set position ".$queue_extension."@".$domain_name." ".$tier_position;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
|
|
@ -538,7 +538,6 @@
|
|||
$sql .= "and call_center_queue_uuid = :call_center_queue_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['call_center_queue_uuid'] = $call_center_queue_uuid;
|
||||
$database = new database;
|
||||
$call_center_queues = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -587,17 +586,16 @@
|
|||
$sql .= "order by tier_level asc, tier_position asc, a.agent_name asc";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['call_center_queue_uuid'] = $call_center_queue_uuid ?? null;
|
||||
$database = new database;
|
||||
$tiers = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//add an empty row to the tiers array
|
||||
if (count($tiers) == 0) {
|
||||
$rows = $_SESSION['call_center']['agent_add_rows']['numeric'] ?? null;
|
||||
$rows = $settings->get('call_center','agent_add_rows', null);
|
||||
$id = 0;
|
||||
}
|
||||
if (count($tiers) > 0) {
|
||||
$rows = $_SESSION['call_center']['agent_edit_rows']['numeric'];
|
||||
$rows = $settings->get('call_center','agent_edit_rows', null);
|
||||
$id = count($tiers)+1;
|
||||
}
|
||||
for ($x = 0; $x < $rows; $x++) {
|
||||
|
|
@ -615,7 +613,6 @@
|
|||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by agent_name asc";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$agents = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -624,6 +621,7 @@
|
|||
$audio_files[0] = $sounds->get();
|
||||
unset($sounds);
|
||||
|
||||
//get the list of sounds
|
||||
if (permission_exists('call_center_announce_sound')) {
|
||||
$sounds = new sounds;
|
||||
$sounds->sound_types = ['recordings'];
|
||||
|
|
@ -646,7 +644,7 @@
|
|||
if (empty($queue_tier_rule_no_agent_no_wait)) { $queue_tier_rule_no_agent_no_wait = "true"; }
|
||||
if (empty($queue_discard_abandoned_after)) { $queue_discard_abandoned_after = "900"; }
|
||||
if (empty($queue_abandoned_resume_allowed)) { $queue_abandoned_resume_allowed = "false"; }
|
||||
if (empty($queue_context)) { $queue_context = $_SESSION['domain_name']; }
|
||||
if (empty($queue_context)) { $queue_context = $domain_name; }
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
|
@ -667,12 +665,8 @@
|
|||
}
|
||||
|
||||
//set the record_template
|
||||
if (empty($_SESSION['call_center']['record_name']['text'])) {
|
||||
$record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}";
|
||||
}
|
||||
else {
|
||||
$record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".$_SESSION['call_center']['record_name']['text'];
|
||||
}
|
||||
$record_template = $settings->get('switch','recordings', '')."/".$domain_name."/archive/";
|
||||
$record_template .= $settings->get('call_center','record_name', "\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}");
|
||||
|
||||
//show the content
|
||||
if (permission_exists('recording_play') || permission_exists('recording_download')) {
|
||||
|
|
@ -757,7 +751,7 @@
|
|||
}
|
||||
echo "</div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'call_center_queues.php']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme','button_icon_back', ''),'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'call_center_queues.php']);
|
||||
|
||||
if ($action == "update") {
|
||||
if (permission_exists('call_center_wallboard')) {
|
||||
|
|
@ -765,10 +759,10 @@
|
|||
}
|
||||
//echo button::create(['type'=>'button','label'=>$text['button-stop'],'icon'=>$_SESSION['theme']['button_icon_stop'],'link'=>'cmd.php?cmd=unload&id='.urlencode($call_center_queue_uuid)]);
|
||||
//echo button::create(['type'=>'button','label'=>$text['button-start'],'icon'=>$_SESSION['theme']['button_icon_start'],'link'=>'cmd.php?cmd=load&id='.urlencode($call_center_queue_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-reload'],'icon'=>$_SESSION['theme']['button_icon_reload'],'link'=>'cmd.php?cmd=reload&id='.urlencode($call_center_queue_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/call_center_active/call_center_active.php?queue_name='.urlencode($call_center_queue_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-reload'],'icon'=>$settings->get('theme','button_icon_reload', ''),'link'=>'cmd.php?cmd=reload&id='.urlencode($call_center_queue_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$settings->get('theme','button_icon_view', ''),'style'=>'margin-right: 15px;','link'=>PROJECT_PATH.'/app/call_center_active/call_center_active.php?queue_name='.urlencode($call_center_queue_uuid)]);
|
||||
}
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$settings->get('theme','button_icon_save', ''),'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
|
@ -791,7 +785,7 @@
|
|||
echo " ".$text['label-extension']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='number' name='queue_extension' maxlength='255' min='0' step='1' value=\"".escape($queue_extension)."\" required='required' placeholder=\"".($_SESSION['call_center']['extension_range']['text'] ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='number' name='queue_extension' maxlength='255' min='0' step='1' value=\"".escape($queue_extension)."\" required='required' placeholder=\"".$settings->get('call_center','extension_range', '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -818,8 +812,8 @@
|
|||
if ($key == 'recordings') {
|
||||
if (
|
||||
!empty($instance_value) &&
|
||||
($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
($instance_value == $row["value"] || $instance_value == $settings->get('switch','recordings', '')."/".$domain_name.'/'.$row["value"]) &&
|
||||
file_exists($settings->get('switch','recordings', '')."/".$domain_name.'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
|
||||
|
|
@ -862,7 +856,7 @@
|
|||
case 'ogg' : $mime_type = 'audio/ogg'; break;
|
||||
}
|
||||
echo "<audio id='recording_audio_".$instance_id."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".$instance_id."')\" onended=\"recording_reset('".$instance_id."');\" src='".($playable ?? '')."' type='".($mime_type ?? '')."'></audio>";
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]);
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$settings->get('theme','button_icon_play', ''),'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]);
|
||||
unset($playable, $mime_type);
|
||||
}
|
||||
echo "<br />\n";
|
||||
|
|
@ -1318,8 +1312,8 @@
|
|||
if ($key == 'recordings') {
|
||||
if (
|
||||
!empty($instance_value) &&
|
||||
($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
($instance_value == $row["value"] || $instance_value == $settings->get('switch','recordings', '')."/".$domain_name.'/'.$row["value"]) &&
|
||||
file_exists($settings->get('switch','recordings', '')."/".$domain_name.'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
|
||||
|
|
@ -1362,7 +1356,7 @@
|
|||
case 'ogg' : $mime_type = 'audio/ogg'; break;
|
||||
}
|
||||
echo "<audio id='recording_audio_".$instance_id."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".$instance_id."')\" onended=\"recording_reset('".$instance_id."');\" src='".($playable ?? '')."' type='".($mime_type ?? '')."'></audio>";
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]);
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$settings->get('theme','button_icon_play', ''),'id'=>'recording_button_'.$instance_id,'style'=>'display: '.(!empty($mime_type) ? 'inline' : 'none'),'onclick'=>"recording_play('".$instance_id."', document.getElementById('".$instance_id."').value, document.getElementById('".$instance_id."').options[document.getElementById('".$instance_id."').selectedIndex].parentNode.getAttribute('data-type'))"]);
|
||||
unset($playable, $mime_type);
|
||||
}
|
||||
echo "<br />\n";
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
$array['dialplan_details'][0]['domain_uuid'] = $this->domain_uuid;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
|
|
@ -216,7 +216,7 @@
|
|||
$array["dialplans"][0] = $dialplan;
|
||||
|
||||
//add temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", 'temp');
|
||||
$p->add("dialplan_detail_add", 'temp');
|
||||
$p->add("dialplan_edit", 'temp');
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
$array['call_center_queues'][0]['dialplan_uuid'] = $this->dialplan_uuid;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_queue_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -349,7 +349,7 @@
|
|||
}
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_tier_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
|
@ -446,7 +446,7 @@
|
|||
}
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_tier_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -578,7 +578,7 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('call_center_tier_add', 'temp');
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@
|
|||
$array["call_flows"][$i]["call_flow_description"] = $call_flow_description;
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ if (!class_exists('call_flows')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ if (!class_exists('call_flows')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -374,7 +374,7 @@ if (!class_exists('call_flows')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@
|
|||
}
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("extension_edit", "temp");
|
||||
|
||||
//save the data
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
}
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_add', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -214,7 +214,7 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
$array['extensions'][0]['do_not_disturb'] = $this->enabled;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -226,7 +226,7 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
$array['follow_me'][0]['follow_me_enabled'] = $this->follow_me_enabled;
|
||||
$array['follow_me'][0]['follow_me_ignore_busy'] = $this->follow_me_ignore_busy;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('follow_me_add', 'temp');
|
||||
//execute insert
|
||||
$database = new database;
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
$array['follow_me'][0]['follow_me_enabled'] = $this->follow_me_enabled;
|
||||
$array['follow_me'][0]['follow_me_ignore_busy'] = $this->follow_me_ignore_busy;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('follow_me_add', 'temp');
|
||||
//execute update
|
||||
$database = new database;
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
//delete related follow me destinations
|
||||
$array['follow_me_destinations'][0]['follow_me_uuid'] = $this->follow_me_uuid;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('follow_me_destination_delete', 'temp');
|
||||
//execute delete
|
||||
$database = new database;
|
||||
|
|
@ -210,7 +210,7 @@
|
|||
}
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('follow_me_destination_add', 'temp');
|
||||
//execute insert
|
||||
$database = new database;
|
||||
|
|
@ -234,7 +234,7 @@
|
|||
$extension_uuid = $result[0]['extension_uuid'];
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("follow_me_edit", 'temp');
|
||||
$p->add("extension_edit", 'temp');
|
||||
|
||||
|
|
@ -389,7 +389,7 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
$p->add('follow_me_edit', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@
|
|||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'call_recording_download';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'call_recording_transcribe';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y = 0;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "95cb740e-e377-4852-8894-06441c61e78b";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings";
|
||||
|
|
@ -42,4 +45,13 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "90";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of days to retain the maintenance logs in the database.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "e329db05-2967-422a-a71f-d0175b083828";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "call_recordings";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "record_extension";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "mp3";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Call recording file format options: wav, mp3";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,356 +1,334 @@
|
|||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2024
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('call_recording_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', 'false');
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//set additional variables
|
||||
$search = $_GET["search"] ?? '';
|
||||
$show = $_GET["show"] ?? '';
|
||||
|
||||
//get the http post data
|
||||
if (!empty($_POST['call_recordings']) && is_array($_POST['call_recordings'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$call_recordings = $_POST['call_recordings'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if (!empty($action) && is_array($call_recordings) && @sizeof($call_recordings) != 0) {
|
||||
switch ($action) {
|
||||
case 'download':
|
||||
if (permission_exists('call_recording_download')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->download($call_recordings);
|
||||
}
|
||||
break;
|
||||
case 'transcribe':
|
||||
if (permission_exists('call_recording_download')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->transcribe($call_recordings);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->delete($call_recordings);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header('Location: call_recordings.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//add the search string
|
||||
if (!empty($search)) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
//set the time zone
|
||||
if (!empty($_SESSION['domain']['time_zone']['name'])) {
|
||||
$time_zone = $_SESSION['domain']['time_zone']['name'];
|
||||
}
|
||||
else {
|
||||
$time_zone = date_default_timezone_get();
|
||||
}
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//get the count
|
||||
//$sql = "select count(*) ";
|
||||
//$sql .= "from view_call_recordings ";
|
||||
//$sql .= "where true ";
|
||||
//if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) {
|
||||
// $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
// $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//}
|
||||
//if (isset($search)) {
|
||||
// $sql .= "and (";
|
||||
// $sql .= " lower(call_recording_name) like :search ";
|
||||
// $sql .= " or lower(call_recording_path) like :search ";
|
||||
// $sql .= ") ";
|
||||
// $parameters['search'] = '%'.$search.'%';
|
||||
//}
|
||||
//$database = new database;
|
||||
//$num_rows = $database->select($sql, $parameters, 'column');
|
||||
|
||||
//prepare some of the paging values
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$page = $_GET['page'] ?? '';
|
||||
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select r.domain_uuid, d.domain_name, r.call_recording_uuid, r.call_direction, ";
|
||||
$sql .= "r.call_recording_name, r.call_recording_path, r.call_recording_transcription, r.call_recording_length, ";
|
||||
$sql .= "r.caller_id_name, r.caller_id_number, r.caller_destination, r.destination_number, ";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'DD Mon YYYY') as call_recording_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'HH12:MI:SS am') as call_recording_time_formatted \n";
|
||||
$sql .= "from view_call_recordings as r, v_domains as d ";
|
||||
//$sql .= "from v_call_recordings as r, v_domains as d ";
|
||||
$sql .= "where true ";
|
||||
if ($show != "all" || !permission_exists('call_recording_all')) {
|
||||
$sql .= "and (r.domain_uuid = :domain_uuid or r.domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
$sql .= "and r.domain_uuid = d.domain_uuid ";
|
||||
if (!empty($search)) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(r.call_direction) like :search ";
|
||||
$sql .= " or lower(r.caller_id_name) like :search ";
|
||||
$sql .= " or lower(r.caller_id_number) like :search ";
|
||||
$sql .= " or lower(r.caller_destination) like :search ";
|
||||
$sql .= " or lower(r.destination_number) like :search ";
|
||||
$sql .= " or lower(r.call_recording_name) like :search ";
|
||||
$sql .= " or lower(r.call_recording_path) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
$sql .= order_by($order_by, $order, 'r.call_recording_date', 'desc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$call_recordings = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//detect if any transcriptions available
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) {
|
||||
$transcriptions_exists = false;
|
||||
foreach ($call_recordings as $row) {
|
||||
if (!empty($row['call_recording_transcription'])) { $transcriptions_exists = true; }
|
||||
}
|
||||
}
|
||||
|
||||
//count the results
|
||||
$result_count = is_array($call_recordings) ? sizeof($call_recordings) : 0;
|
||||
|
||||
//limit the number of results
|
||||
if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) {
|
||||
$num_rows = $_SESSION['cdr']['limit']['numeric'];
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
list($paging_controls_mini, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, true, $result_count); //top
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, false, $result_count); //bottom
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-call_recordings'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_recordings']." </b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('call_recording_download') && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'id'=>'btn_download','name'=>'btn_download','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if (permission_exists('call_recording_delete') && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','collapse'=>'hide-xs','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('call_recording_all')) {
|
||||
if ($show == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
|
||||
}
|
||||
}
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=\"$('#btn_reset').hide(); $('#btn_search').show();\">";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>(empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
if (!empty($paging_controls_mini)) {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('call_recording_delete') && !empty($call_recordings)) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['title_description-call_recordings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
$col_count = 8;
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
$col_count++;
|
||||
}
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($call_recordings) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='hide-sm-dn shrink'");
|
||||
}
|
||||
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order, null, "class='pct-15'");
|
||||
echo th_order_by('caller_destination', $text['label-caller_destination'], $order_by, $order, null, "class='pct-10 hide-sm-dn'");
|
||||
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order, null, "class='pct-10'");
|
||||
echo th_order_by('call_recording_name', $text['label-call_recording_name'], $order_by, $order, null, "class='pct-20 hide-sm-dn'");
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo "<th class='shrink center'>".$text['label-recording']."</th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
echo th_order_by('call_recording_length', $text['label-call_recording_length'], $order_by, $order, null, "class='right hide-sm-dn shrink'");
|
||||
echo th_order_by('call_recording_date', $text['label-call_recording_date'], $order_by, $order, null, "class='pct-20 center'");
|
||||
echo th_order_by('call_direction', $text['label-call_direction'], $order_by, $order, null, "class='hide-sm-dn shrink'");
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($call_recordings) && @sizeof($call_recordings) != 0) {
|
||||
$x = 0;
|
||||
foreach ($call_recordings as $row) {
|
||||
//add padding to the call recording length
|
||||
$call_recording_length_padding = (!empty($row['call_recording_length'])) ? str_pad($row['call_recording_length'], 2, '0', STR_PAD_LEFT) : '';
|
||||
|
||||
//playback progress bar
|
||||
if (permission_exists('call_recording_play')) {
|
||||
echo "<tr class='list-row' id='recording_progress_bar_".escape($row['call_recording_uuid'])."' style='display: none;' onclick=\"recording_play('".escape($row['call_recording_uuid'])."')\"><td id='playback_progress_bar_background_".escape($row['call_recording_uuid'])."' class='playback_progress_bar_background' colspan='".$col_count."'><span class='playback_progress_bar' id='recording_progress_".escape($row['call_recording_uuid'])."'></span></td>".(permission_exists('xml_cdr_details') ? "<td class='action-button' style='border-bottom: none !important;'></td>" : null)."</tr>\n";
|
||||
echo "<tr class='list-row' style='display: none;'><td></td></tr>\n"; // dummy row to maintain alternating background color
|
||||
}
|
||||
if (permission_exists('call_recording_play')) {
|
||||
$list_row_url = "javascript:recording_play('".escape($row['call_recording_uuid'])."');";
|
||||
}
|
||||
echo "<tr class='list-row' href=\"".$list_row_url."\">\n";
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='call_recordings[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='call_recordings[$x][uuid]' value='".escape($row['call_recording_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";
|
||||
echo " <td class='shrink'>".escape(format_phone(substr($row['caller_id_number'], 0, 20)))."</td>\n";
|
||||
echo " <td class='hide-sm-dn shrink'>".escape(format_phone(substr($row['caller_destination'], 0, 20)))."</td>\n";
|
||||
echo " <td class='shrink'>".escape(format_phone(substr($row['destination_number'], 0, 20)))."</td>\n";
|
||||
echo " <td class='overflow hide-sm-dn nowrap'>".escape($row['call_recording_name'])."</td>\n";
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo " <td class='middle button center no-link no-wrap'>";
|
||||
if (file_exists($row['call_recording_path'].'/'.$row['call_recording_name'])) {
|
||||
if (permission_exists('call_recording_play')) {
|
||||
$recording_file_ext = pathinfo($row['call_recording_name'], PATHINFO_EXTENSION);
|
||||
switch ($recording_file_ext) {
|
||||
case "wav" : $recording_type = "audio/wav"; break;
|
||||
case "mp3" : $recording_type = "audio/mpeg"; break;
|
||||
case "ogg" : $recording_type = "audio/ogg"; break;
|
||||
}
|
||||
echo "<audio id='recording_audio_".escape($row['call_recording_uuid'])."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".escape($row['call_recording_uuid'])."')\" onended=\"recording_reset('".escape($row['call_recording_uuid'])."');\" src='download.php?id=".urlencode($row['call_recording_uuid'])."' type='".$recording_type."'></audio>";
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['call_recording_uuid']),'onclick'=>"recording_play('".escape($row['call_recording_uuid'])."')"]);
|
||||
}
|
||||
if (permission_exists('call_recording_download')) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['call_recording_uuid']).'&binary']);
|
||||
}
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $transcriptions_exists === true) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['call_recording_transcription']) ? 'visibility:hidden;' : null),'onclick'=>"document.getElementById('transcription_".$row['call_recording_uuid']."').style.display = document.getElementById('transcription_".$row['call_recording_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]);
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td class='right overflow hide-sm-dn shrink'>".($row['call_recording_length'] <= 59 ? '0:' : null).escape($call_recording_length_padding)."</td>\n";
|
||||
echo " <td class='overflow center no-wrap'>".escape($row['call_recording_date_formatted'])." <span class='hide-sm-dn'>".escape($row['call_recording_time_formatted'])."</span></td>\n";
|
||||
echo " <td class='left hide-sm-dn shrink'>".($row['call_direction'] != '' ? escape($text['label-'.$row['call_direction']]) : null)."</td>\n";
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>PROJECT_PATH.'/app/xml_cdr/xml_cdr_details.php?id='.urlencode($row['call_recording_uuid'])]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) {
|
||||
echo "<tr style='display: none;'><td></td></tr>\n"; // dummy row to maintain same background color for transcription row
|
||||
echo "<tr id='transcription_".$row['call_recording_uuid']."' class='list-row' style='display: none;'>\n";
|
||||
echo " <td style='padding: 10px 20px 15px 20px;' colspan='".$col_count."'>\n";
|
||||
echo " <strong style='display: inline-block; font-size: 90%; margin-bottom: 10px;'>".$text['label-transcription']."...</strong><br />\n";
|
||||
echo escape($row['call_recording_transcription'])."\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset($call_recordings);
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2024
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('call_recording_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//create the database connection
|
||||
$database = new database;
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//add the settings object
|
||||
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$transcribe_engine = $settings->get('transcribe', 'engine', '');
|
||||
|
||||
//set additional variables
|
||||
$search = $_GET["search"] ?? '';
|
||||
$show = $_GET["show"] ?? '';
|
||||
|
||||
//get the http post data
|
||||
if (!empty($_POST['call_recordings']) && is_array($_POST['call_recordings'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$call_recordings = $_POST['call_recordings'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if (!empty($action) && is_array($call_recordings) && @sizeof($call_recordings) != 0) {
|
||||
switch ($action) {
|
||||
case 'download':
|
||||
if (permission_exists('call_recording_download')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->download($call_recordings);
|
||||
}
|
||||
break;
|
||||
case 'transcribe':
|
||||
if (permission_exists('call_recording_transcribe')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->transcribe($call_recordings);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
$obj = new call_recordings;
|
||||
$obj->delete($call_recordings);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header('Location: call_recordings.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//add the search string
|
||||
if (!empty($search)) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
//set the time zone
|
||||
if (!empty($_SESSION['domain']['time_zone']['name'])) {
|
||||
$time_zone = $_SESSION['domain']['time_zone']['name'];
|
||||
}
|
||||
else {
|
||||
$time_zone = date_default_timezone_get();
|
||||
}
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//prepare some of the paging values
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$page = $_GET['page'] ?? '';
|
||||
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select r.domain_uuid, d.domain_name, r.call_recording_uuid, r.call_direction, ";
|
||||
$sql .= "r.call_recording_name, r.call_recording_path, r.call_recording_transcription, r.call_recording_length, ";
|
||||
$sql .= "r.caller_id_name, r.caller_id_number, r.caller_destination, r.destination_number, ";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'DD Mon YYYY') as call_recording_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'HH12:MI:SS am') as call_recording_time_formatted \n";
|
||||
$sql .= "from view_call_recordings as r, v_domains as d ";
|
||||
//$sql .= "from v_call_recordings as r, v_domains as d ";
|
||||
$sql .= "where true ";
|
||||
if ($show != "all" || !permission_exists('call_recording_all')) {
|
||||
$sql .= "and r.domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
$sql .= "and r.domain_uuid = d.domain_uuid ";
|
||||
if (!empty($search)) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(r.call_direction) like :search ";
|
||||
$sql .= " or lower(r.caller_id_name) like :search ";
|
||||
$sql .= " or lower(r.caller_id_number) like :search ";
|
||||
$sql .= " or lower(r.caller_destination) like :search ";
|
||||
$sql .= " or lower(r.destination_number) like :search ";
|
||||
$sql .= " or lower(r.call_recording_name) like :search ";
|
||||
$sql .= " or lower(r.call_recording_path) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
$sql .= order_by($order_by, $order, 'r.call_recording_date', 'desc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$call_recordings = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//detect if any transcriptions available
|
||||
if ($transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings) && is_array($call_recordings)) {
|
||||
$transcriptions_exists = false;
|
||||
foreach ($call_recordings as $row) {
|
||||
if (!empty($row['call_recording_transcription'])) { $transcriptions_exists = true; }
|
||||
}
|
||||
}
|
||||
|
||||
//limit the number of results
|
||||
if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) {
|
||||
$num_rows = $_SESSION['cdr']['limit']['numeric'];
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
list($paging_controls_mini, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, true, $result_count); //top
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows ?? null, $param, $rows_per_page, false, $result_count); //bottom
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-call_recordings'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_recordings']." </b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('call_recording_download') && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'id'=>'btn_download','name'=>'btn_download','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','style'=>'display: none;','collapse'=>'hide-xs','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]);
|
||||
}
|
||||
if (permission_exists('call_recording_delete') && !empty($call_recordings)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','collapse'=>'hide-xs','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('call_recording_all')) {
|
||||
if ($show == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]);
|
||||
}
|
||||
}
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=\"$('#btn_reset').hide(); $('#btn_search').show();\">";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>(empty($search) ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
if (!empty($paging_controls_mini)) {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('call_recording_delete') && !empty($call_recordings)) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['title_description-call_recordings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
$col_count = 8;
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
$col_count++;
|
||||
}
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($call_recordings) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='hide-sm-dn shrink'");
|
||||
}
|
||||
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order, null, "class='pct-15'");
|
||||
echo th_order_by('caller_destination', $text['label-caller_destination'], $order_by, $order, null, "class='pct-10 hide-sm-dn'");
|
||||
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order, null, "class='pct-10'");
|
||||
echo th_order_by('call_recording_name', $text['label-call_recording_name'], $order_by, $order, null, "class='pct-20 hide-sm-dn'");
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo "<th class='shrink center'>".$text['label-recording']."</th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
echo th_order_by('call_recording_length', $text['label-call_recording_length'], $order_by, $order, null, "class='right hide-sm-dn shrink'");
|
||||
echo th_order_by('call_recording_date', $text['label-call_recording_date'], $order_by, $order, null, "class='pct-20 center'");
|
||||
echo th_order_by('call_direction', $text['label-call_direction'], $order_by, $order, null, "class='hide-sm-dn shrink'");
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($call_recordings) && @sizeof($call_recordings) != 0) {
|
||||
$x = 0;
|
||||
foreach ($call_recordings as $row) {
|
||||
//playback progress bar
|
||||
if (permission_exists('call_recording_play')) {
|
||||
echo "<tr class='list-row' id='recording_progress_bar_".escape($row['call_recording_uuid'])."' style='display: none;' onclick=\"recording_seek(event,'".escape($row['call_recording_uuid'])."')\"><td id='playback_progress_bar_background_".escape($row['call_recording_uuid'])."' class='playback_progress_bar_background' colspan='".$col_count."'><span class='playback_progress_bar' id='recording_progress_".escape($row['call_recording_uuid'])."'></span></td>".(permission_exists('xml_cdr_details') ? "<td class='action-button' style='border-bottom: none !important;'></td>" : null)."</tr>\n";
|
||||
echo "<tr class='list-row' style='display: none;'><td></td></tr>\n"; // dummy row to maintain alternating background color
|
||||
}
|
||||
if (permission_exists('call_recording_play')) {
|
||||
$list_row_url = "javascript:recording_play('".escape($row['call_recording_uuid'])."');";
|
||||
}
|
||||
echo "<tr class='list-row' href=\"".$list_row_url."\">\n";
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='call_recordings[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='call_recordings[$x][uuid]' value='".escape($row['call_recording_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($show == "all" && permission_exists('call_recording_all')) {
|
||||
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";
|
||||
echo " <td class='shrink'>".escape(format_phone(substr($row['caller_id_number'], 0, 20)))."</td>\n";
|
||||
echo " <td class='hide-sm-dn shrink'>".escape(format_phone(substr($row['caller_destination'], 0, 20)))."</td>\n";
|
||||
echo " <td class='shrink'>".escape(format_phone(substr($row['destination_number'], 0, 20)))."</td>\n";
|
||||
echo " <td class='overflow hide-sm-dn nowrap'>".escape($row['call_recording_name'])."</td>\n";
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo " <td class='middle button center no-link no-wrap'>";
|
||||
if (file_exists($row['call_recording_path'].'/'.$row['call_recording_name'])) {
|
||||
if (permission_exists('call_recording_play')) {
|
||||
$recording_file_ext = pathinfo($row['call_recording_name'], PATHINFO_EXTENSION);
|
||||
switch ($recording_file_ext) {
|
||||
case "wav" : $recording_type = "audio/wav"; break;
|
||||
case "mp3" : $recording_type = "audio/mpeg"; break;
|
||||
case "ogg" : $recording_type = "audio/ogg"; break;
|
||||
}
|
||||
echo "<audio id='recording_audio_".escape($row['call_recording_uuid'])."' style='display: none;' preload='none' ontimeupdate=\"update_progress('".escape($row['call_recording_uuid'])."')\" onended=\"recording_reset('".escape($row['call_recording_uuid'])."');\" src='download.php?id=".urlencode($row['call_recording_uuid'])."' type='".$recording_type."'></audio>";
|
||||
echo button::create(['type'=>'button','title'=>$text['label-play'].' / '.$text['label-pause'],'icon'=>$_SESSION['theme']['button_icon_play'],'id'=>'recording_button_'.escape($row['call_recording_uuid']),'onclick'=>"recording_play('".escape($row['call_recording_uuid'])."')"]);
|
||||
}
|
||||
if (permission_exists('call_recording_download')) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'download.php?id='.urlencode($row['call_recording_uuid']).'&binary']);
|
||||
}
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && $transcriptions_exists === true) {
|
||||
echo button::create(['type'=>'button','title'=>$text['label-transcription'],'icon'=>'quote-right','style'=>(empty($row['call_recording_transcription']) ? 'visibility:hidden;' : null),'onclick'=>"document.getElementById('transcription_".$row['call_recording_uuid']."').style.display = document.getElementById('transcription_".$row['call_recording_uuid']."').style.display == 'none' ? 'table-row' : 'none'; this.blur(); return false;"]);
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td class='right overflow hide-sm-dn shrink'>".escape(gmdate("G:i:s", $row['call_recording_length']))."</td>\n";
|
||||
echo " <td class='overflow center no-wrap'>".escape($row['call_recording_date_formatted'])." <span class='hide-sm-dn'>".escape($row['call_recording_time_formatted'])."</span></td>\n";
|
||||
echo " <td class='left hide-sm-dn shrink'>".($row['call_direction'] != '' ? escape($text['label-'.$row['call_direction']]) : null)."</td>\n";
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>PROJECT_PATH.'/app/xml_cdr/xml_cdr_details.php?id='.urlencode($row['call_recording_uuid'])]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
if (permission_exists('call_recording_transcribe') && $transcribe_enabled && !empty($transcribe_engine) && !empty($row['call_recording_transcription'])) {
|
||||
echo "<tr style='display: none;'><td></td></tr>\n"; // dummy row to maintain same background color for transcription row
|
||||
echo "<tr id='transcription_".$row['call_recording_uuid']."' class='list-row' style='display: none;'>\n";
|
||||
echo " <td style='padding: 10px 20px 15px 20px;' colspan='".$col_count."'>\n";
|
||||
echo " <strong style='display: inline-block; font-size: 90%; margin-bottom: 10px;'>".$text['label-transcription']."...</strong><br />\n";
|
||||
echo escape($row['call_recording_transcription'])."\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset($call_recordings);
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permisions
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//download
|
||||
if (is_uuid($_GET['id'])) {
|
||||
$obj = new call_recordings;
|
||||
$obj->recording_uuid = $_GET['id'];
|
||||
$obj->binary = isset($_GET['binary']) ? true : false;
|
||||
$obj->download();
|
||||
}
|
||||
|
||||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2016-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permisions
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//download
|
||||
if (is_uuid($_GET['id'])) {
|
||||
$obj = new call_recordings;
|
||||
$obj->recording_uuid = $_GET['id'];
|
||||
$obj->binary = isset($_GET['binary']) ? true : false;
|
||||
$obj->download();
|
||||
}
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -468,8 +468,8 @@ $text['label-domain']['zh-cn'] = "领域";
|
|||
$text['label-domain']['ja-jp'] = "ドメイン";
|
||||
$text['label-domain']['ko-kr'] = "도메인";
|
||||
|
||||
$text['label-destination']['en-us'] = "Dest";
|
||||
$text['label-destination']['en-gb'] = "Dest";
|
||||
$text['label-destination']['en-us'] = "Destination";
|
||||
$text['label-destination']['en-gb'] = "Destination";
|
||||
$text['label-destination']['ar-eg'] = "الوجهة";
|
||||
$text['label-destination']['de-at'] = "Ziel";
|
||||
$text['label-destination']['de-ch'] = "Ziel";
|
||||
|
|
@ -546,8 +546,8 @@ $text['label-codec']['zh-cn'] = "读/写编解码器";
|
|||
$text['label-codec']['ja-jp'] = "読み取り/書き込みコーデック";
|
||||
$text['label-codec']['ko-kr'] = "읽기/쓰기 코덱";
|
||||
|
||||
$text['label-cid-number']['en-us'] = "CID Number";
|
||||
$text['label-cid-number']['en-gb'] = "CID Number";
|
||||
$text['label-cid-number']['en-us'] = "Caller Number";
|
||||
$text['label-cid-number']['en-gb'] = "Caller Number";
|
||||
$text['label-cid-number']['ar-eg'] = "رقم CID";
|
||||
$text['label-cid-number']['de-at'] = "Anrufer Nummer";
|
||||
$text['label-cid-number']['de-ch'] = "Anrufer Nummer";
|
||||
|
|
@ -572,8 +572,8 @@ $text['label-cid-number']['zh-cn'] = "来电号码";
|
|||
$text['label-cid-number']['ja-jp'] = "CID番号";
|
||||
$text['label-cid-number']['ko-kr'] = "CID 번호";
|
||||
|
||||
$text['label-cid-name']['en-us'] = "CID Name";
|
||||
$text['label-cid-name']['en-gb'] = "CID Name";
|
||||
$text['label-cid-name']['en-us'] = "Caller Name";
|
||||
$text['label-cid-name']['en-gb'] = "Caller Name";
|
||||
$text['label-cid-name']['ar-eg'] = "اسم CID";
|
||||
$text['label-cid-name']['de-at'] = "Anrufer Name";
|
||||
$text['label-cid-name']['de-ch'] = "Anrufer Name";
|
||||
|
|
@ -650,6 +650,33 @@ $text['label-eavesdrop']['zh-cn'] = "窃听";
|
|||
$text['label-eavesdrop']['ja-jp'] = "盗聴";
|
||||
$text['label-eavesdrop']['ko-kr'] = "엿듣다";
|
||||
|
||||
$text['label-duration']['en-us'] = "Duration";
|
||||
$text['label-duration']['en-gb'] = "Duration";
|
||||
$text['label-duration']['ar-eg'] = "المدة";
|
||||
$text['label-duration']['de-at'] = "Dauer";
|
||||
$text['label-duration']['de-ch'] = "Dauer";
|
||||
$text['label-duration']['de-de'] = "Dauer";
|
||||
$text['label-duration']['el-gr'] = "Διάρκεια";
|
||||
$text['label-duration']['es-cl'] = "Duración";
|
||||
$text['label-duration']['es-mx'] = "Duración";
|
||||
$text['label-duration']['fr-ca'] = "Durée";
|
||||
$text['label-duration']['fr-fr'] = "Durée";
|
||||
$text['label-duration']['he-il'] = "משך השיחה";
|
||||
$text['label-duration']['it-it'] = "Durata";
|
||||
$text['label-duration']['ka-ge'] = "ხანგრძლივობა";
|
||||
$text['label-duration']['nl-nl'] = "Duur";
|
||||
$text['label-duration']['pl-pl'] = "Czas trwania";
|
||||
$text['label-duration']['pt-br'] = "Duração";
|
||||
$text['label-duration']['pt-pt'] = "Duração";
|
||||
$text['label-duration']['ro-ro'] = "Durată";
|
||||
$text['label-duration']['ru-ru'] = "Продолжительность";
|
||||
$text['label-duration']['sv-se'] = "Samtalstid";
|
||||
$text['label-duration']['uk-ua'] = "Тривалість";
|
||||
$text['label-duration']['tr-tr'] = "Süre";
|
||||
$text['label-duration']['zh-cn'] = "期间";
|
||||
$text['label-duration']['ja-jp'] = "間隔";
|
||||
$text['label-duration']['ko-kr'] = "지속";
|
||||
|
||||
$text['description-2']['en-us'] = "Use this to view all extensions and monitor and interact with active calls.";
|
||||
$text['description-2']['en-gb'] = "Use this to view all extensions and monitor and interact with active calls.";
|
||||
$text['description-2']['ar-eg'] = "استخدم هذا لعرض جميع الملحقات ومراقبة المكالمات النشطة والتفاعل معها.";
|
||||
|
|
|
|||
|
|
@ -88,10 +88,8 @@
|
|||
}
|
||||
$num_rows = @sizeof($rows);
|
||||
|
||||
|
||||
//if the connnection is available then run it and return the results
|
||||
if (!$event_socket) {
|
||||
|
||||
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
|
|
@ -103,172 +101,197 @@
|
|||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create('/app/calls_active/calls_active_inc.php');
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create('/app/calls_active/calls_active_inc.php');
|
||||
|
||||
//show content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
|
||||
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) {
|
||||
if (sizeof($_SESSION['user']['extensions']) > 1) {
|
||||
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
|
||||
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
|
||||
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
|
||||
if (is_array($_SESSION['user']['extensions'])) {
|
||||
foreach ($_SESSION['user']['extensions'] as $user_extension) {
|
||||
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
|
||||
}
|
||||
//add the style
|
||||
echo "<style>\n";
|
||||
echo " /* Small screens: Hide columns with class 'hide-small' */\n";
|
||||
echo " @media (max-width: 600px) {\n";
|
||||
echo " .hide-small {\n";
|
||||
echo " display: none;\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo "\n";
|
||||
echo " /* Medium screens: Hide columns with class 'hide-medium' */\n";
|
||||
echo "@media (max-width: 1023px) and (min-width: 601px) {\n";
|
||||
echo " .hide-medium {\n";
|
||||
echo " display: none;\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo "\n";
|
||||
echo "</style>\n";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
|
||||
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) {
|
||||
if (sizeof($_SESSION['user']['extensions']) > 1) {
|
||||
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
|
||||
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
|
||||
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
|
||||
if (is_array($_SESSION['user']['extensions'])) {
|
||||
foreach ($_SESSION['user']['extensions'] as $user_extension) {
|
||||
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
}
|
||||
else if (sizeof($_SESSION['user']['extensions']) == 1) {
|
||||
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
|
||||
}
|
||||
}
|
||||
if (permission_exists('call_active_hangup') && $rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
|
||||
}
|
||||
if (permission_exists('call_active_all')) {
|
||||
if ($show == "all") {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('call_active_hangup') && $rows) {
|
||||
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['description']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
//show the results
|
||||
echo "<div id='cmd_reponse'></div>\n";
|
||||
|
||||
echo "<form id='form_list' method='post' action='calls_exec.php'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo " <table class='list'>\n";
|
||||
echo " <tr class='list-header'>\n";
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo " <th class='hide-small'>".$text['label-profile']."</th>\n";
|
||||
//echo" <th>".$text['label-created']."</th>\n";
|
||||
echo " <th>".$text['label-duration']."</th>\n";
|
||||
if ($show == 'all') {
|
||||
echo " <th>".$text['label-domain']."</th>\n";
|
||||
}
|
||||
//echo " <th>".$text['label-number']."</th>\n";
|
||||
echo " <th class='hide-small'>".$text['label-cid-name']."</th>\n";
|
||||
echo " <th>".$text['label-cid-number']."</th>\n";
|
||||
echo " <th>".$text['label-destination']."</th>\n";
|
||||
echo " <th class='hide-small hide-medium'>".$text['label-app']."</th>\n";
|
||||
echo " <th class='hide-small hide-medium'>".$text['label-codec']."</th>\n";
|
||||
echo " <th class='hide-small hide-medium'>".$text['label-secure']."</th>\n";
|
||||
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
|
||||
echo " <th> </th>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
if (is_array($rows)) {
|
||||
$x = 0;
|
||||
foreach ($rows as $row) {
|
||||
|
||||
//set the php variables
|
||||
foreach ($row as $key => $value) {
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
//get the sip profile
|
||||
$name_array = explode("/", $name);
|
||||
$sip_profile = $name_array[1];
|
||||
$sip_uri = $name_array[2];
|
||||
|
||||
//get the number
|
||||
//$temp_array = explode("@", $sip_uri);
|
||||
//$tmp_number = $temp_array[0];
|
||||
//$tmp_number = str_replace("sip:", "", $tmp_number);
|
||||
|
||||
//remove the '+' because it breaks the call recording
|
||||
$cid_num = str_replace("+", "", $cid_num);
|
||||
|
||||
//replace gateway uuid with name
|
||||
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
|
||||
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
|
||||
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
|
||||
}
|
||||
echo " </select>\n";
|
||||
}
|
||||
else if (sizeof($_SESSION['user']['extensions']) == 1) {
|
||||
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
|
||||
|
||||
//calculate elapsed seconds
|
||||
$elapsed_seconds = time() - $created_epoch;
|
||||
|
||||
//convert seconds to hours, minutes, and seconds
|
||||
$hours = floor($elapsed_seconds / 3600);
|
||||
$minutes = floor(($elapsed_seconds % 3600) / 60);
|
||||
$seconds = $elapsed_seconds % 60;
|
||||
|
||||
//format the elapsed time as HH:MM:SS
|
||||
$elapsed_time = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
|
||||
|
||||
//reduce too long app data
|
||||
if(strlen($application_data) > 80) {
|
||||
$application_data = substr($application_data, 0, 80) . '...';
|
||||
}
|
||||
}
|
||||
if (permission_exists('call_active_hangup') && $rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
|
||||
}
|
||||
if (permission_exists('call_active_all')) {
|
||||
if ($show == "all") {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
|
||||
//send the html
|
||||
echo " <tr class='list-row'>\n";
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
echo " <td class='hide-small'>".escape($sip_profile)." </td>\n";
|
||||
//echo " <td>".escape($created)." </td>\n";
|
||||
echo " <td>".escape($elapsed_time)."</td>\n";
|
||||
if ($show == 'all') {
|
||||
echo " <td>".escape($domain_name)." </td>\n";
|
||||
}
|
||||
}
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('call_active_hangup') && $rows) {
|
||||
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['description']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
//show the results
|
||||
echo "<div id='cmd_reponse'></div>\n";
|
||||
|
||||
echo "<form id='form_list' method='post' action='calls_exec.php'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo " <th>".$text['label-profile']."</th>\n";
|
||||
echo " <th>".$text['label-created']."</th>\n";
|
||||
if ($show == 'all') {
|
||||
echo " <th>".$text['label-domain']."</th>\n";
|
||||
}
|
||||
echo " <th>".$text['label-number']."</th>\n";
|
||||
echo " <th>".$text['label-cid-name']."</th>\n";
|
||||
echo " <th>".$text['label-cid-number']."</th>\n";
|
||||
echo " <th>".$text['label-destination']."</th>\n";
|
||||
echo " <th>".$text['label-app']."</th>\n";
|
||||
echo " <th>".$text['label-codec']."</th>\n";
|
||||
echo " <th>".$text['label-secure']."</th>\n";
|
||||
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
|
||||
echo " <th> </th>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($rows)) {
|
||||
$x = 0;
|
||||
foreach ($rows as $row) {
|
||||
|
||||
//set the php variables
|
||||
foreach ($row as $key => $value) {
|
||||
$$key = $value;
|
||||
}
|
||||
|
||||
//get the sip profile
|
||||
$name_array = explode("/", $name);
|
||||
$sip_profile = $name_array[1];
|
||||
$sip_uri = $name_array[2];
|
||||
|
||||
//get the number
|
||||
$temp_array = explode("@", $sip_uri);
|
||||
$tmp_number = $temp_array[0];
|
||||
$tmp_number = str_replace("sip:", "", $tmp_number);
|
||||
|
||||
//remove the '+' because it breaks the call recording
|
||||
$cid_num = str_replace("+", "", $cid_num);
|
||||
|
||||
//replace gateway uuid with name
|
||||
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
|
||||
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
|
||||
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
|
||||
}
|
||||
}
|
||||
|
||||
// reduce too long app data
|
||||
if(strlen($application_data) > 512) {
|
||||
$application_data = substr($application_data, 0, 512) . '...';
|
||||
}
|
||||
|
||||
//send the html
|
||||
echo "<tr class='list-row'>\n";
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>".escape($sip_profile)." </td>\n";
|
||||
echo " <td>".escape($created)." </td>\n";
|
||||
if ($show == 'all') {
|
||||
echo " <td>".escape($domain_name)." </td>\n";
|
||||
}
|
||||
echo " <td>".escape($tmp_number)." </td>\n";
|
||||
echo " <td>".escape($cid_name)." </td>\n";
|
||||
echo " <td>".escape($cid_num)." </td>\n";
|
||||
echo " <td>".escape($dest)." </td>\n";
|
||||
echo " <td>".(!empty($application) ? escape($application).":".escape($application_data) : null)." </td>\n";
|
||||
echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)." </td>\n";
|
||||
echo " <td>".escape($secure)." </td>\n";
|
||||
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
|
||||
echo " <td class='button right' style='padding-right: 0;'>\n";
|
||||
//eavesdrop
|
||||
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
//hangup
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
//unset the domain name
|
||||
unset($domain_name);
|
||||
|
||||
//increment counter
|
||||
$x++;
|
||||
//echo " <td>".escape($tmp_number)." </td>\n";
|
||||
echo " <td class='hide-small'>".escape($cid_name)." </td>\n";
|
||||
echo " <td>".escape($cid_num)." </td>\n";
|
||||
echo " <td>".escape($dest)." </td>\n";
|
||||
echo " <td class='hide-small hide-medium' style='max-width: 200px; word-wrap: break-word;'>".(!empty($application) ? escape($application).":".escape($application_data) : null)." </td>\n";
|
||||
echo " <td class='hide-small hide-medium'>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)." </td>\n";
|
||||
echo " <td class='hide-small hide-medium'>".escape($secure)." </td>\n";
|
||||
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
|
||||
echo " <td class='button right' style='padding-right: 0;'>\n";
|
||||
//eavesdrop
|
||||
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
//hangup
|
||||
if (permission_exists('call_active_hangup')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
unset($rows);
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
//unset the domain name
|
||||
unset($domain_name);
|
||||
|
||||
//increment counter
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
echo " </table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
$array['dialplans'][0]["app_uuid"] = "b81412e8-7253-91f4-e48e-42fc2c9a38d9";
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@
|
|||
$array['conference_room_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
||||
//un-assigne the users from the conference room
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_room_user_delete', 'temp');
|
||||
|
||||
$database->app_name = 'conference_centers';
|
||||
|
|
@ -358,7 +358,7 @@
|
|||
$array['conference_room_users'][0]['conference_room_uuid'] = $conference_room_uuid;
|
||||
$array['conference_room_users'][0]['user_uuid'] = $_SESSION["user_uuid"];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_room_user_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_centers';
|
||||
|
|
@ -440,7 +440,7 @@
|
|||
$array['conference_room_users'][0]['conference_room_uuid'] = $conference_room_uuid;
|
||||
$array['conference_room_users'][0]['user_uuid'] = $user_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_room_user_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_centers';
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ if (!class_exists('conference_centers')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
|
|
@ -425,7 +425,7 @@ if (!class_exists('conference_centers')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_room_user_delete', 'temp');
|
||||
$p->add('conference_room_delete', 'temp');
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ if (!class_exists('conference_centers')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_session_detail_delete', 'temp');
|
||||
$p->add('conference_user_delete', 'temp');
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ if (!class_exists('conference_centers')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
$array['conference_controls'][0]['control_name'] = $control_name;
|
||||
$array['conference_controls'][0]['control_enabled'] = 'true';
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_control_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_controls';
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
}
|
||||
$array['conference_control_details'][0]['control_enabled'] = $control_enabled;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_control_detail_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_controls';
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ if (!class_exists('conference_controls')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_control_detail_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
$array['conference_profiles'][0]['profile_name'] = $profile_name;
|
||||
$array['conference_profiles'][0]['profile_enabled'] = 'true';
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_profile_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_profiles';
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
$array['conference_profile_params'][0]['profile_param_value'] = $profile_param_value;
|
||||
$array['conference_profile_params'][0]['profile_param_enabled'] = $profile_param_enabled;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_profile_param_add', 'temp');
|
||||
|
||||
$database->app_name = 'conference_profiles';
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ if (!class_exists('conference_profiles')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_profile_param_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -410,7 +410,7 @@ if (!class_exists('conference_profiles')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_profile_param_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
$user_uuid = $_REQUEST["user_uuid"];
|
||||
$conference_uuid = $_REQUEST["id"];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_user_delete', 'temp');
|
||||
|
||||
$array['conference_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
$array['conference_users'][0]['conference_uuid'] = $conference_uuid;
|
||||
$array['conference_users'][0]['user_uuid'] = $user_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_user_add', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
$array['dialplans'][0]['dialplan_enabled'] = $conference_enabled;
|
||||
$array['dialplans'][0]['dialplan_description'] = $conference_description;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if (!class_exists('conferences')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_user_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
|
@ -203,7 +203,7 @@ if (!class_exists('conferences')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -341,7 +341,7 @@ if (!class_exists('conferences')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('conference_user_add', 'temp');
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@
|
|||
//save the data
|
||||
if (!empty($array)) {
|
||||
//add the permission object
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_add', 'temp');
|
||||
$p->add('contact_phone_add', 'temp');
|
||||
$p->add('contact_address_add', 'temp');
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ if ($_POST['a'] == 'import') {
|
|||
unset($duplicate_contact_uuid);
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_delete', 'temp');
|
||||
|
||||
//delete duplicate contact
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
$array['contacts'][0]['last_mod_date'] = 'now()';
|
||||
$array['contacts'][0]['last_mod_user'] = $_SESSION['username'];
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('contact_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if (!class_exists('contacts')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temp permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$database = new database;
|
||||
foreach ($this->tables as $table) {
|
||||
$p->add(database::singular($table).'_delete', 'temp');
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ if ($domains_processed == 1) {
|
|||
//save to the data
|
||||
if (!empty($array)) {
|
||||
//add temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('destination_edit', 'temp');
|
||||
|
||||
//create the database object and save the data
|
||||
|
|
@ -109,7 +109,7 @@ if ($domains_processed == 1) {
|
|||
|
||||
if (!empty($array)) {
|
||||
//add temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('destination_edit', 'temp');
|
||||
|
||||
//create the database object and save the data
|
||||
|
|
|
|||
|
|
@ -41,10 +41,13 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//initialize the database
|
||||
$database = new database;
|
||||
//initialize the database object
|
||||
$database = database::new();
|
||||
|
||||
//initialize the destinations object
|
||||
//initialize the settings object
|
||||
$settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid]);
|
||||
|
||||
//initialize the destination object
|
||||
$destination = new destinations;
|
||||
|
||||
//initialize the ringbacks object
|
||||
|
|
@ -68,17 +71,20 @@
|
|||
default: $destination_type = 'inbound';
|
||||
}
|
||||
|
||||
//get the call recording extension
|
||||
$record_extension = $settings->get('call_recordings', 'record_extension', 'mp3');
|
||||
|
||||
//get total destination count from the database, check limit, if defined
|
||||
if (!permission_exists('destination_domain')) {
|
||||
if ($action == 'add') {
|
||||
if (!empty($_SESSION['limit']['destinations']['numeric'])) {
|
||||
if (!empty($settings->get('limit', 'destinations', ''))) {
|
||||
$sql = "select count(*) from v_destinations where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$total_destinations = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
if ($total_destinations >= $_SESSION['limit']['destinations']['numeric']) {
|
||||
message::add($text['message-maximum_destinations'].' '.$_SESSION['limit']['destinations']['numeric'], 'negative');
|
||||
if ($total_destinations >= $settings->get('limit', 'destinations', '')) {
|
||||
message::add($text['message-maximum_destinations'].' '.$settings->get('limit', 'destinations', ''), 'negative');
|
||||
header('Location: destinations.php');
|
||||
exit;
|
||||
}
|
||||
|
|
@ -198,7 +204,7 @@
|
|||
if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
|
||||
|
||||
//check for duplicates
|
||||
if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $_SESSION['destinations']['unique']['boolean'] == 'true') {
|
||||
if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $settings->get('destinations', 'unique', '')) {
|
||||
$sql = "select count(*) from v_destinations ";
|
||||
$sql .= "where (destination_number = :destination_number or destination_prefix || destination_number = :destination_number) ";
|
||||
$sql .= "and destination_type = 'inbound' ";
|
||||
|
|
@ -444,15 +450,15 @@
|
|||
if (!empty($destination_condition_field)) {
|
||||
$dialplan_detail_type = $destination_condition_field;
|
||||
}
|
||||
elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
|
||||
elseif (!empty($settings->get('dialplan', 'destination', ''))) {
|
||||
$dialplan_detail_type = $settings->get('dialplan', 'destination', '');
|
||||
}
|
||||
else {
|
||||
$dialplan_detail_type = "destination_number";
|
||||
}
|
||||
|
||||
//authorized specific dialplan_detail_type that are safe, sanitize all other values
|
||||
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
|
||||
$dialplan_detail_type = $settings->get('dialplan', 'destination', '');
|
||||
switch ($dialplan_detail_type) {
|
||||
case 'destination_number':
|
||||
break;
|
||||
|
|
@ -530,10 +536,11 @@
|
|||
}
|
||||
if (!empty($destination_record) && $destination_record == 'true') {
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.".$record_extension."\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_in_progress=true\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_stereo_swap=true\" inline=\"true\"/>\n";
|
||||
$dialplan["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n";
|
||||
}
|
||||
if (!empty($destination_hold_music)) {
|
||||
|
|
@ -592,7 +599,7 @@
|
|||
$dialplan["dialplan_xml"] .= "</extension>\n";
|
||||
|
||||
//dialplan details
|
||||
if ($_SESSION['destinations']['dialplan_details']['boolean'] == "true") {
|
||||
if ($settings->get('destinations', 'dialplan_details', '')) {
|
||||
|
||||
//set initial value of the row id
|
||||
$y=0;
|
||||
|
|
@ -633,8 +640,8 @@
|
|||
if (!empty($destination_condition_field)) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field;
|
||||
}
|
||||
elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
|
||||
elseif (!empty($settings->get('dialplan', 'destination', ''))) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $settings->get('dialplan', 'destination', '');
|
||||
}
|
||||
else {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "regex";
|
||||
|
|
@ -693,8 +700,8 @@
|
|||
if (!empty($destination_condition_field)) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field;
|
||||
}
|
||||
elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
|
||||
elseif (!empty($settings->get('dialplan', 'destination', ''))) {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $settings->get('dialplan', 'destination', '');
|
||||
}
|
||||
else {
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
|
||||
|
|
@ -942,7 +949,7 @@
|
|||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_name=\${uuid}.\${record_ext}";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_name=\${uuid}.".$record_extension;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_inline"] = "true";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = $dialplan_detail_group;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||
|
|
@ -979,6 +986,20 @@
|
|||
//increment the dialplan detail order
|
||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||
|
||||
//add a variable
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "record_stereo_swap=true";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_inline"] = "true";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = $dialplan_detail_group;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order;
|
||||
$y++;
|
||||
|
||||
//increment the dialplan detail order
|
||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||
|
||||
//add a variable
|
||||
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
|
||||
|
|
@ -1139,7 +1160,7 @@
|
|||
}
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", 'temp');
|
||||
$p->add("dialplan_detail_add", 'temp');
|
||||
$p->add("dialplan_edit", 'temp');
|
||||
|
|
@ -1159,10 +1180,10 @@
|
|||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
if ($_SESSION['destinations']['dialplan_mode']['text'] == 'multiple') {
|
||||
if ($settings->get('destinations', 'dialplan_mode', '') == 'multiple') {
|
||||
$cache->delete("dialplan:".$destination_context);
|
||||
}
|
||||
if ($_SESSION['destinations']['dialplan_mode']['text'] == 'single') {
|
||||
if ($settings->get('destinations', 'dialplan_mode', '') == 'single') {
|
||||
if (isset($destination_prefix) && is_numeric($destination_prefix) && isset($destination_number) && is_numeric($destination_number)) {
|
||||
$cache->delete("dialplan:".$destination_context.":".$destination_prefix.$destination_number);
|
||||
$cache->delete("dialplan:".$destination_context.":+".$destination_prefix.$destination_number);
|
||||
|
|
@ -2046,7 +2067,7 @@
|
|||
echo " ".$text['label-destination_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
if (substr($settings->get('theme', 'input_toggle_style', ''), 0, 6) == 'switch') {
|
||||
echo " <label class='switch'>\n";
|
||||
echo " <input type='checkbox' id='destination_enabled' name='destination_enabled' value='true' ".($destination_enabled == 'true' ? "checked='checked'" : null).">\n";
|
||||
echo " <span class='slider'></span>\n";
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -402,7 +402,7 @@ if (!class_exists('destinations')) {
|
|||
}
|
||||
}
|
||||
//application: hangup
|
||||
if (!empty($data['application'])) {
|
||||
if (!empty($data['application']) && $data['application'] === 'hangup') {
|
||||
$select_value = str_replace("transfer", $data['application'], $select_value);
|
||||
}
|
||||
}
|
||||
|
|
@ -1081,7 +1081,7 @@ if (!class_exists('destinations')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
|
|
@ -1134,6 +1134,9 @@ if (!class_exists('destinations')) {
|
|||
$time_zone = date_default_timezone_get();
|
||||
}
|
||||
|
||||
//set the time zone for php
|
||||
date_default_timezone_set($time_zone);
|
||||
|
||||
//build the date range
|
||||
if (!empty($this->start_stamp_begin) || !empty($this->start_stamp_end)) {
|
||||
unset($this->quick_select);
|
||||
|
|
@ -1236,6 +1239,7 @@ if (!class_exists('destinations')) {
|
|||
}
|
||||
$sql .= " and direction = 'inbound' \n";
|
||||
$sql .= " and caller_destination is not null \n";
|
||||
$sql .= " and leg = 'a' \n";
|
||||
$sql .= $sql_date_range ?? '';
|
||||
$sql .= ") as c \n";
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ if ($domains_processed == 1) {
|
|||
$array['device_keys'][$index]['device_key_vendor'] = $row["device_vendor"];
|
||||
}
|
||||
if (is_array($array) && @sizeof($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_key_edit', 'temp');
|
||||
|
||||
$database->app_name = 'devices';
|
||||
|
|
@ -106,7 +106,7 @@ if ($domains_processed == 1) {
|
|||
|
||||
//save the array
|
||||
if (!empty($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_profile_key_add', 'temp');
|
||||
|
||||
$database->app_name = 'devices';
|
||||
|
|
@ -144,7 +144,7 @@ if ($domains_processed == 1) {
|
|||
|
||||
//save the array
|
||||
if (!empty($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_profile_setting_add', 'temp');
|
||||
|
||||
$database->app_name = 'devices';
|
||||
|
|
@ -225,7 +225,7 @@ if ($domains_processed == 1) {
|
|||
|
||||
//execute
|
||||
if (!empty($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_add', 'temp');
|
||||
$p->add('device_vendor_function_add', 'temp');
|
||||
$p->add('device_vendor_function_group_add', 'temp');
|
||||
|
|
|
|||
|
|
@ -1317,7 +1317,7 @@
|
|||
|
||||
if (permission_exists('device_line_server_address_primary')) {
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
if (!empty($settings->get('provision', 'server_address_primary', ''))) {
|
||||
if (!empty($settings->get('provision', 'server_address_primary', '')) && is_array($settings->get('provision', 'server_address_primary', ''))) {
|
||||
echo " <select class='formfld' style='width: 75px;' name='device_lines[".$x."][server_address_primary]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($settings->get('provision', 'server_address_primary', '') as $field) {
|
||||
|
|
@ -1333,7 +1333,7 @@
|
|||
|
||||
if (permission_exists('device_line_server_address_secondary')) {
|
||||
echo " <td valign='top' align='left' nowrap='nowrap'>\n";
|
||||
if (!empty($settings->get('provision', 'server_address_secondary', ''))) {
|
||||
if (!empty($settings->get('provision', 'server_address_secondary', '')) && is_array($settings->get('provision', 'server_address_secondary', ''))) {
|
||||
echo " <select class='formfld' style='width: 75px;' name='device_lines[".$x."][server_address_secondary]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($settings->get('provision', 'server_address_secondary', '') as $field) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
//delete the device vendor function group
|
||||
$array['device_vendor_function_groups'][0]['device_vendor_function_group_uuid'] = $device_vendor_function_group_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_function_group_delete', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
$array['device_vendor_function_groups'][0]['group_name'] = $group_name;
|
||||
$array['device_vendor_function_groups'][0]['group_uuid'] = $group_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_function_group_add', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
}
|
||||
|
||||
//assign temp permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_add', 'temp');
|
||||
$p->add('device_vendor_function_add', 'temp');
|
||||
$p->add('device_vendor_function_group_add', 'temp');
|
||||
|
|
|
|||
|
|
@ -48,18 +48,6 @@
|
|||
$database = database::new();
|
||||
$settings = new settings(['database' => $database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]);
|
||||
|
||||
//set all permissions
|
||||
$has_device_import = permission_exists('device_import');
|
||||
$has_device_edit = permission_exists('device_edit');
|
||||
$has_device_all = permission_exists('device_all');
|
||||
$has_device_delete = permission_exists('device_delete');
|
||||
$has_device_domain_all = permission_exists('device_domain_all');
|
||||
$has_device_export = permission_exists('device_export');
|
||||
$has_device_vendor_view = permission_exists('device_vendor_view');
|
||||
$has_device_profile_view = permission_exists('device_profile_view');
|
||||
$has_device_add = permission_exists('device_add');
|
||||
$has_show_all = &$has_device_domain_all;
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
|
@ -78,13 +66,13 @@
|
|||
if (!empty($action) && !empty($devices) && is_array($devices) && @sizeof($devices) != 0) {
|
||||
switch ($action) {
|
||||
case 'toggle':
|
||||
if ($has_device_edit) {
|
||||
if (permission_exists('device_edit')) {
|
||||
$obj = new device;
|
||||
$obj->toggle($devices);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if ($has_device_delete) {
|
||||
if (permission_exists('device_delete')) {
|
||||
$obj = new device;
|
||||
$obj->delete($devices);
|
||||
}
|
||||
|
|
@ -105,7 +93,7 @@
|
|||
//get total devices count from the database
|
||||
$sql = "select count(*) from v_devices ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
if (!$has_device_all && !$has_device_domain_all) {
|
||||
if (!permission_exists('device_all') && !permission_exists('device_domain_all')) {
|
||||
$sql .= "and device_user_uuid = :user_uuid ";
|
||||
$parameters['user_uuid'] = $user_uuid;
|
||||
}
|
||||
|
|
@ -113,23 +101,6 @@
|
|||
$total_devices = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//update the has_device_add permission if the total device count is greater then set limit
|
||||
$device_limit = $settings->get('limit', 'devices', null);
|
||||
if ($has_device_add && $device_limit !== null) {
|
||||
$has_device_add = $total_devices > $device_limit;
|
||||
}
|
||||
|
||||
//get the domains if user has permission for show all
|
||||
$domains = [];
|
||||
if ($has_device_domain_all) {
|
||||
$rows = $database->select("select domain_uuid, domain_name from v_domains where domain_enabled = 'true'");
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
$domains[$row['domain_uuid']] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the devices profiles
|
||||
$sql = "select * from v_device_profiles ";
|
||||
$sql .= "where true ";
|
||||
|
|
@ -142,7 +113,7 @@
|
|||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) from v_devices as d ";
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
if (!empty($search)) {
|
||||
$sql .= "where ";
|
||||
}
|
||||
|
|
@ -150,7 +121,7 @@
|
|||
else {
|
||||
$sql .= "where (";
|
||||
$sql .= " d.domain_uuid = :domain_uuid ";
|
||||
if ($has_device_all) {
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
|
|
@ -205,7 +176,7 @@
|
|||
$param = "&search=".$search;
|
||||
$param .= "&fields=".$fields;
|
||||
}
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
$param .= "&show=all";
|
||||
}
|
||||
$page = $_GET['page'] ?? 0;
|
||||
|
|
@ -214,11 +185,15 @@
|
|||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select d.*, d2.device_label as alternate_label, ";
|
||||
$sql = "select ";
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
$sql .= "d3.domain_name, ";
|
||||
}
|
||||
$sql .="d.*, d2.device_label as alternate_label, ";
|
||||
$sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'DD Mon YYYY') as provisioned_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, d.device_provisioned_date), 'HH12:MI:SS am') as provisioned_time_formatted \n";
|
||||
$sql .= "from v_devices as d, v_devices as d2 ";
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
$sql .= ", v_domains as d3 ";
|
||||
}
|
||||
$sql .= "where ( ";
|
||||
|
|
@ -228,19 +203,19 @@
|
|||
$sql .= " d.device_uuid = d2.device_uuid ";
|
||||
$sql .= " ) ";
|
||||
$sql .= ") ";
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
$sql .= " and d.domain_uuid = d3.domain_uuid ";
|
||||
}
|
||||
else {
|
||||
$sql .= "and (";
|
||||
$sql .= " d.domain_uuid = :domain_uuid ";
|
||||
if ($has_device_all) {
|
||||
if (permission_exists('device_all')) {
|
||||
$sql .= " or d.domain_uuid is null ";
|
||||
}
|
||||
$sql .= ") ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
if (!$has_device_all && !$has_device_domain_all) {
|
||||
if (!permission_exists('device_all') && !permission_exists('device_domain_all')) {
|
||||
$sql .= "and d.device_user_uuid = :user_uuid ";
|
||||
$parameters['user_uuid'] = $user_uuid;
|
||||
}
|
||||
|
|
@ -314,33 +289,33 @@
|
|||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-devices']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if ($has_device_import) {
|
||||
if (permission_exists('device_import')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$settings->get('theme', 'button_icon_import'),'link'=>'device_imports.php']);
|
||||
}
|
||||
if ($has_device_export) {
|
||||
if (permission_exists('device_export')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$settings->get('theme', 'button_icon_export'),'link'=>'device_download.php']);
|
||||
}
|
||||
if ($has_device_vendor_view) {
|
||||
if (permission_exists('device_vendor_view')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-vendors'],'icon'=>'fax','link'=>'device_vendors.php']);
|
||||
}
|
||||
if ($has_device_profile_view) {
|
||||
if (permission_exists('device_profile_view')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-profiles'],'icon'=>'clone','link'=>'device_profiles.php']);
|
||||
}
|
||||
$margin_left = $has_device_import || $has_device_export || $has_device_vendor_view || $has_device_profile_view ? "margin-left: 15px;" : null;
|
||||
if ($has_device_add) {
|
||||
$margin_left = permission_exists('device_import') || permission_exists('device_export') || permission_exists('device_vendor_view') || permission_exists('device_profile_view') ? "margin-left: 15px;" : null;
|
||||
if (permission_exists('device_add') && (empty($_SESSION['limit']['devices']['numeric']) || ($total_devices < $_SESSION['limit']['devices']['numeric']))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','style'=>$margin_left,'link'=>'device_edit.php']);
|
||||
unset($margin_left);
|
||||
}
|
||||
if ($has_device_edit && $devices) {
|
||||
if (permission_exists('device_edit') && $devices) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$settings->get('theme', 'button_icon_toggle'),'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.($margin_left ?? null),'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
if ($has_device_delete && $devices) {
|
||||
if (permission_exists('device_delete') && $devices) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$settings->get('theme', 'button_icon_delete'),'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? null),'onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if ($has_device_all) {
|
||||
if (permission_exists('device_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
|
|
@ -369,10 +344,10 @@
|
|||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if ($has_device_edit && $devices) {
|
||||
if (permission_exists('device_edit') && $devices) {
|
||||
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if ($has_device_delete && $devices) {
|
||||
if (permission_exists('device_delete') && $devices) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
|
|
@ -387,12 +362,12 @@
|
|||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if ($has_device_edit || $has_device_delete) {
|
||||
if (permission_exists('device_edit') || permission_exists('device_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($devices) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, null, null, $param);
|
||||
}
|
||||
echo th_order_by('device_address', $text['label-device_address'], $order_by, $order, null, null, $param ?? null);
|
||||
|
|
@ -406,7 +381,7 @@
|
|||
echo th_order_by('device_enabled', $text['label-device_enabled'], $order_by, $order, null, "class='center'", $param ?? null);
|
||||
echo th_order_by('device_provisioned_date', $text['label-device_status'], $order_by, $order, null, null, $param ?? null);
|
||||
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order, null, "class='hide-sm-dn'", $param ?? null);
|
||||
if ($has_device_edit && $settings->get('theme', 'list_row_edit_button', 'false') === 'true') {
|
||||
if (permission_exists('device_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
|
@ -422,7 +397,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if ($has_device_edit) {
|
||||
if (permission_exists('device_edit')) {
|
||||
$list_row_url = "device_edit.php?id=".urlencode($row['device_uuid']);
|
||||
}
|
||||
|
||||
|
|
@ -437,17 +412,17 @@
|
|||
}
|
||||
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if ($has_device_edit || $has_device_delete) {
|
||||
if (permission_exists('device_edit') || permission_exists('device_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='devices[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='devices[$x][uuid]' value='".escape($row['device_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && $has_device_all) {
|
||||
echo " <td>".escape($domains[$row['domain_uuid']])."</td>\n";
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
|
||||
echo " <td>".escape($domain_name)."</td>\n";
|
||||
}
|
||||
echo " <td class='no-wrap'>";
|
||||
echo $has_device_edit ? "<a href='".$list_row_url."'>".escape(format_device_address($row['device_address']))."</a>" : escape(format_device_address($row['device_address']));
|
||||
echo permission_exists('device_edit') ? "<a href='".$list_row_url."'>".escape(format_device_address($row['device_address']))."</a>" : escape(format_device_address($row['device_address']));
|
||||
echo " </td>\n";
|
||||
echo " <td>".escape($row['device_label'])." </td>\n";
|
||||
if ($device_alternate) {
|
||||
|
|
@ -463,7 +438,7 @@
|
|||
echo " <td>".escape($row['device_vendor'])." </td>\n";
|
||||
echo " <td>".escape($row['device_template'])." </td>\n";
|
||||
echo " <td>".escape($device_profile_name)." </td>\n";
|
||||
if ($has_device_edit) {
|
||||
if (permission_exists('device_edit')) {
|
||||
echo " <td class='no-link center'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['device_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
|
|
@ -474,7 +449,7 @@
|
|||
echo " </td>\n";
|
||||
echo " <td class='no-link'><a title='".escape($row['device_provisioned_agent'])."' href='javascript:void(0)'>".escape($row['provisioned_date_formatted'])." ".escape($row['provisioned_time_formatted'])."</a> ".escape($device_provisioned_method)." <a href='".escape($device_provisioned_method)."://".escape($row['device_provisioned_ip'])."' target='_blank'>".escape($row['device_provisioned_ip'])."</a> </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['device_description'])." </td>\n";
|
||||
if ($has_device_edit && $settings->get('theme', 'list_row_edit_button', 'false') === 'true') {
|
||||
if (permission_exists('device_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$settings->get('theme','button_icon_edit'),'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_setting_delete', 'temp');
|
||||
$p->add('device_line_delete', 'temp');
|
||||
$p->add('device_key_delete', 'temp');
|
||||
|
|
@ -722,7 +722,7 @@
|
|||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_function_delete', 'temp');
|
||||
$p->add('device_vendor_function_group_delete', 'temp');
|
||||
|
||||
|
|
@ -784,7 +784,7 @@
|
|||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_vendor_function_group_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -845,7 +845,7 @@
|
|||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_profile_key_delete', 'temp');
|
||||
$p->add('device_profile_setting_delete', 'temp');
|
||||
|
||||
|
|
@ -1370,13 +1370,13 @@
|
|||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_profile_key_add', 'temp');
|
||||
$p->add('device_profile_setting_add', 'temp');
|
||||
|
||||
//save the array
|
||||
$this->database->app_name = $this->app_name;
|
||||
$this->databasee->app_uuid = $this->app_uuid;
|
||||
$this->database->app_uuid = $this->app_uuid;
|
||||
$this->database->save($array);
|
||||
unset($array);
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@
|
|||
}
|
||||
if ($save) {
|
||||
//add the temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_keys_add', 'temp');
|
||||
$p->add('device_key_edit', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@
|
|||
//update the destination dialplan_uuid
|
||||
if (is_uuid($destination_uuid)) {
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('destination_edit', 'temp');
|
||||
|
||||
$array['destinations'][0]['destination_uuid'] = $destination_uuid;
|
||||
|
|
|
|||
|
|
@ -815,7 +815,7 @@
|
|||
}
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_detail_add", "temp");
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@
|
|||
$array['dialplan_details'][1]['dialplan_detail_data'] = 'WARNING [inbound routes] 404 not found \${sip_network_ip}';
|
||||
$array['dialplan_details'][1]['dialplan_detail_order'] = '20';
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
$p->add('dialplan_detail_add', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
$array['dialplans'][0]['dialplan_description'] = $this->dialplan_description;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
//execute insert
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
$array['dialplans'][0]['dialplan_description'] = $this->dialplan_description;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -447,7 +447,7 @@
|
|||
} //end foreach $xml_list
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
$p->add('dialplan_detail_add', 'temp');
|
||||
|
|
@ -1007,7 +1007,7 @@
|
|||
$array['dialplans'][$x]['dialplan_uuid'] = $key;
|
||||
$array['dialplans'][$x]['dialplan_xml'] = $value;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
//execute update
|
||||
$database = new database;
|
||||
|
|
@ -1160,7 +1160,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
|
|
@ -1264,7 +1264,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -1371,7 +1371,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -1525,7 +1525,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
$array['dialplans'][0]['dialplan_description'] = $this->dialplan_description;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
//execute insert
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
$array['dialplans'][0]['dialplan_description'] = $this->dialplan_description;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -452,7 +452,7 @@
|
|||
} //end foreach $xml_list
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_add', 'temp');
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
$p->add('dialplan_detail_add', 'temp');
|
||||
|
|
@ -1065,7 +1065,7 @@
|
|||
$array['dialplans'][$x]['dialplan_xml'] = $value;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//execute update
|
||||
|
|
@ -1188,7 +1188,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
|
|
@ -1290,7 +1290,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -1395,7 +1395,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -1546,7 +1546,7 @@
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -40,6 +40,18 @@
|
|||
<condition field="${from_user_record}" expression="^local$" break="never">
|
||||
<action application="set" data="record_session=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${record_session}" expression="^true$"/>
|
||||
<condition field="${call_direction}" expression="^inbound" break="never">
|
||||
<action application="set" data="record_stereo_swap=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${record_session}" expression="^true$"/>
|
||||
<condition field="${call_direction}" expression="^outbound$" break="never">
|
||||
<action application="set" data="record_stereo=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${record_session}" expression="^true$"/>
|
||||
<condition field="${call_direction}" expression="^local$" break="never">
|
||||
<action application="set" data="record_stereo=true" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${record_session}" expression="^true$">
|
||||
<action application="set" data="record_path=${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}" inline="true" enabled="true"/>
|
||||
<action application="set" data="record_name=${uuid}.${record_ext}" inline="true" enabled="true"/>
|
||||
|
|
@ -50,9 +62,8 @@
|
|||
<action application="bind_digit_action" data="local,*6,api:uuid_record,${uuid} unmask ${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.${record_ext},both,self" enabled="true"/>
|
||||
<action application="set" data="record_append=true" inline="true" enabled="true"/>
|
||||
<action application="set" data="record_in_progress=true" inline="true" enabled="true"/>
|
||||
<action application="set" data="api_on_answer=uuid_record ${uuid} start ${record_path}/${record_name}" inline="false" enabled="false"/>
|
||||
<action application="set" data="RECORD_ANSWER_REQ=true" enabled="true"/>
|
||||
<action application="record_session" data="${record_path}/${record_name}" enabled="true"/>
|
||||
<action application="set" data="api_on_answer=uuid_record ${uuid} start ${record_path}/${record_name}" inline="false" enabled="true"/>
|
||||
<action application="set" data="record_answer_req=true" enabled="true"/>
|
||||
<action application="record_session" data="${record_path}/${record_name}" enabled="false"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
<extension name="valet_park" number="park+*5901-*5999" context="${domain_name}" continue="false" app_uuid="3cc8363d-5ce3-48aa-8ac1-143cf297c4f7" enabled="true" order="470">
|
||||
<condition field="destination_number" expression="^(park)?\+?\*(59(0[1-9]|[1-9][0-9]))$" break="never"/>
|
||||
<condition field="${sip_h_Referred-By}" expression="sip:(.*)@.*" break="never">
|
||||
<condition field="${sip_refer_to}" expression="^.+$" break="never"/>
|
||||
<condition field="${sip_refer_to}" expression="sip:(.*)@(.*?)(?::\d+)?\>" break="never">
|
||||
<action application="set" data="referred_by_host=$2" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${sip_h_Referred-By}" expression="sip:(.*)@(.*?)(?::\d+)?\>" break="never">
|
||||
<action application="set" data="referred_by_user=$1" inline="true"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^(park)?\+?\*(59(0[1-9]|[1-9][0-9]))$" break="never"/>
|
||||
<condition field="${referred_by_user}" expression="^.+$" break="never">
|
||||
<action application="set" data="valet_context=${referred_by_host}" inline="true"/>
|
||||
<anti-action application="set" data="valet_context=${domain_name}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="destination_number" expression="^(park)?\+?\*(59(0[1-9]|[1-9][0-9]))$" break="never">
|
||||
<action application="set" data="park_in_use=false" inline="true"/>
|
||||
<action application="set" data="park_lot=$2" inline="true"/>
|
||||
|
|
@ -10,16 +19,16 @@
|
|||
</condition>
|
||||
<condition field="destination_number" expression="^(park)?\+?\*(59(0[1-9]|[1-9][0-9]))$"/>
|
||||
<condition field="${referred_by_user}" expression="^.+$" break="never">
|
||||
<action application="set" data="valet_info_park=${valet_info park@${domain_name}}|\*${park_lot}" inline="true"/>
|
||||
<action application="set" data="park_in_use=${regex ${valet_info park@${domain_name}}|\*${park_lot}}" inline="true"/>
|
||||
<action application="set" data="valet_info_park=${valet_info park@${valet_context}}|\*${park_lot}" inline="true"/>
|
||||
<action application="set" data="park_in_use=${regex ${valet_info park@${valet_context}}|\*${park_lot}}" inline="true"/>
|
||||
</condition>
|
||||
<condition field="${park_in_use}" expression="true" break="never">
|
||||
<action application="transfer" data="${referred_by_user} XML ${context}"/>
|
||||
<action application="transfer" data="${referred_by_user} XML ${referred_by_host}"/>
|
||||
<anti-action application="set" data="effective_caller_id_name=${cond ${regex ${direction} | inbound} == true ? 'park#${caller_id_name}' : 'park#${callee_id_name}'}" inline="true"/>
|
||||
<anti-action application="set" data="valet_parking_timeout=900"/>
|
||||
<anti-action application="set" data="valet_hold_music=${hold_music}"/>
|
||||
<anti-action application="set" data="valet_parking_orbit_exten=${cond ${regex ${referred_by_user} | ^$} == true ? ${sip_from_user} : ${referred_by_user}}"/>
|
||||
<anti-action application="answer" data=""/>
|
||||
<anti-action application="valet_park" data="park@${domain_name} *${park_lot}"/>
|
||||
<anti-action application="valet_park" data="park@${valet_context} *${park_lot}"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<extension name="operator" number="0" context="${domain_name}" continue="false" app_uuid="0e1cd2d7-9d84-4959-8b6c-0cb23de4de59" enabled="false" order="480">
|
||||
<condition field="destination_number" expression="^0$|^operator$">
|
||||
<action application="export" data="transfer_context={v_context}" enabled="true"/>
|
||||
<action application="bind_meta_app" data="4 ab s execute_extension::att_xfer XML ${context}" enabled="false"/>
|
||||
<action application="bind_meta_app" data="5 ab s execute_extension::xfer_vm XML ${context}" enabled="false"/>
|
||||
<action application="set" data="domain_name={v_context}" enabled="true"/>
|
||||
<action application="transfer" data="${operator} XML {v_context}" enabled="true"/>
|
||||
<action application="export" data="transfer_context=${domain_name}" enabled="true"/>
|
||||
<action application="bind_meta_app" data="4 ab s execute_extension::att_xfer XML ${domain_name}" enabled="false"/>
|
||||
<action application="bind_meta_app" data="5 ab s execute_extension::xfer_vm XML ${domain_name}" enabled="false"/>
|
||||
<action application="set" data="domain_name=${domain_name}" enabled="true"/>
|
||||
<action application="transfer" data="${operator} XML ${domain_name}" enabled="true"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<extension name="operator-forward" number="*000" context="${domain_name}" continue="false" app_uuid="a90d3639-3b82-4905-a65d-85f58b6c4a19" enabled="true" order="485">
|
||||
<condition field="destination_number" expression="^\*000$" >
|
||||
<action application="set" data="dial_string=loopback/operator/${context}/XML" />
|
||||
<action application="set" data="dial_string=loopback/operator/${domain_name}/XML" />
|
||||
<action application="set" data="direction=both" />
|
||||
<action application="set" data="extension=true" />
|
||||
<action application="lua" data="dial_string.lua" />
|
||||
|
|
|
|||
|
|
@ -138,9 +138,8 @@
|
|||
|
||||
//process the messages
|
||||
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
|
||||
$which_php = exec('which php');
|
||||
foreach($email_queue as $row) {
|
||||
$command = $which_php." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
|
||||
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
|
||||
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
|
||||
if (isset($debug)) {
|
||||
//run process inline to see debug info
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
//get the email settings
|
||||
$retry_limit = $settings->get('email_queue', 'retry_limit');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled');
|
||||
$transcribe_enabled = $settings->get('transcribe', 'enabled', false);
|
||||
$save_response = $settings->get('email_queue', 'save_response');
|
||||
|
||||
//set defaults
|
||||
|
|
@ -181,6 +181,9 @@
|
|||
//$voicemail_description = $row["voicemail_description"];
|
||||
//$voicemail_name_base64 = $row["voicemail_name_base64"];
|
||||
//$voicemail_tutorial = $row["voicemail_tutorial"];
|
||||
if (gettype($voicemail_transcription_enabled) === 'string') {
|
||||
$voicemail_transcription_enabled = ($voicemail_transcription_enabled === 'true') ? true : false;
|
||||
}
|
||||
}
|
||||
unset($parameters);
|
||||
|
||||
|
|
@ -220,7 +223,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($transcribe_enabled) && $transcribe_enabled === 'true' && isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled === 'true') {
|
||||
if ($transcribe_enabled && isset($voicemail_transcription_enabled) && $voicemail_transcription_enabled) {
|
||||
//debug message
|
||||
echo "transcribe enabled: true\n";
|
||||
|
||||
|
|
@ -440,7 +443,7 @@
|
|||
$array['email_queue'][0]['email_status'] = 'sent';
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('email_queue_add', 'temp');
|
||||
$p->add('email_queue_update', 'temp');
|
||||
//execute insert
|
||||
|
|
@ -471,7 +474,7 @@
|
|||
$array['email_queue'][0]['email_status'] = 'failed';
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('email_queue_add', 'temp');
|
||||
|
||||
//execute insert
|
||||
|
|
@ -525,7 +528,7 @@
|
|||
$array['email_logs'][0]['status'] = 'failed';
|
||||
$array['email_logs'][0]['email'] = str_replace("'", "''", $msg);
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('email_log_add', 'temp');
|
||||
//execute insert
|
||||
$database->app_name = 'v_mailto';
|
||||
|
|
@ -569,4 +572,3 @@
|
|||
//fwrite($esl, $content);
|
||||
//fclose($esl);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
$sql = "select * from v_email_queue ";
|
||||
$sql .= "where (email_status = 'waiting' or email_status = 'trying') ";
|
||||
$sql .= "and hostname = :hostname ";
|
||||
$sql .= "order by domain_uuid asc ";
|
||||
$sql .= "order by domain_uuid, email_date desc ";
|
||||
$sql .= "limit :limit ";
|
||||
$parameters['hostname'] = $hostname;
|
||||
$parameters['limit'] = $email_queue_limit;
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
//process the messages
|
||||
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
|
||||
foreach($email_queue as $row) {
|
||||
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
|
||||
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
|
||||
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
|
||||
if (isset($debug)) {
|
||||
//run process inline to see debug info
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@
|
|||
//add the missing email templates
|
||||
if (!empty($array['email_templates'])) {
|
||||
//add the temporary permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("email_template_add", 'temp');
|
||||
$p->add("email_template_edit", 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ $text['title-emergency_logs']['zh-cn'] = "紧急日志";
|
|||
$text['title-emergency_logs']['ja-jp'] = "緊急ログ";
|
||||
$text['title-emergency_logs']['ko-kr'] = "비상 기록";
|
||||
|
||||
$text['title_description-emergency_logs']['en-us'] = "Track emergency calls includinng details of the time, date, and originating extension.";
|
||||
$text['title_description-emergency_logs']['en-gb'] = "Track emergency calls includinng details of the time, date, and originating extension.";
|
||||
$text['title_description-emergency_logs']['en-us'] = "Track emergency calls including details of the time, date, and originating extension.";
|
||||
$text['title_description-emergency_logs']['en-gb'] = "Track emergency calls including details of the time, date, and originating extension.";
|
||||
$text['title_description-emergency_logs']['ar-eg'] = "تتبع مكالمات الطوارئ بما في ذلك تفاصيل الوقت والتاريخ والامتداد الأصلي.";
|
||||
$text['title_description-emergency_logs']['de-at'] = "Verfolgen Sie Notrufe mit Angaben zu Uhrzeit, Datum und Nebenstelle des Anrufers.";
|
||||
$text['title_description-emergency_logs']['de-ch'] = "Verfolgen Sie Notrufe mit Angaben zu Uhrzeit, Datum und Nebenstelle des Anrufers.";
|
||||
|
|
|
|||
|
|
@ -229,11 +229,11 @@
|
|||
$x++;
|
||||
}
|
||||
if (is_array($array)) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('event_guard_log_edit', 'temp');
|
||||
$database->app_name = 'event guard';
|
||||
$database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637';
|
||||
$database->save($array);
|
||||
$database->save($array, false);
|
||||
//$message = $database->message;
|
||||
$p->delete('event_guard_log_edit', 'temp');
|
||||
unset($array);
|
||||
|
|
@ -349,11 +349,11 @@
|
|||
$array['event_guard_logs'][0]['extension'] = $event['to-user'].'@'.$event['to-host'];
|
||||
$array['event_guard_logs'][0]['user_agent'] = $event['user-agent'];
|
||||
$array['event_guard_logs'][0]['log_status'] = 'blocked';
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('event_guard_log_add', 'temp');
|
||||
$database->app_name = 'event guard';
|
||||
$database->app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637';
|
||||
$database->save($array);
|
||||
$database->save($array, false);
|
||||
$p->delete('event_guard_log_add', 'temp');
|
||||
|
||||
//send debug information to the console
|
||||
|
|
|
|||
|
|
@ -1,384 +1,384 @@
|
|||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2021-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$extension_uuid = '';
|
||||
$extension_setting_uuid = '';
|
||||
$extension_setting_name = '';
|
||||
$extension_setting_value = '';
|
||||
$extension_setting_description = '';
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$extension_setting_uuid = $_REQUEST["id"];
|
||||
$id = $_REQUEST["id"];
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the extension id
|
||||
if (!empty($_REQUEST["extension_setting_uuid"]) && is_uuid($_REQUEST["extension_setting_uuid"])) {
|
||||
$extension_setting_uuid = $_REQUEST["extension_setting_uuid"];
|
||||
}
|
||||
if (!empty($_REQUEST["extension_uuid"]) && is_uuid($_REQUEST["extension_uuid"])) {
|
||||
$extension_uuid = $_REQUEST["extension_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (!empty($_POST)) {
|
||||
$domain_uuid = $_POST["domain_uuid"] ?? null;
|
||||
$extension_setting_type = $_POST["extension_setting_type"];
|
||||
$extension_setting_name = $_POST["extension_setting_name"];
|
||||
$extension_setting_value = $_POST["extension_setting_value"];
|
||||
$extension_setting_enabled = $_POST["extension_setting_enabled"] ?? 'false';
|
||||
$extension_setting_description = $_POST["extension_setting_description"];
|
||||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_settings.php?id='.$extension_uuid);
|
||||
exit;
|
||||
}
|
||||
|
||||
//process the http post data by submitted action
|
||||
if (!empty($_POST['action'])) {
|
||||
|
||||
//prepare the array(s)
|
||||
//send the array to the database class
|
||||
switch ($_POST['action']) {
|
||||
case 'copy':
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
$obj = new database;
|
||||
$obj->copy($array);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
$obj = new database;
|
||||
$obj->delete($array);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('extension_setting_update')) {
|
||||
$obj = new database;
|
||||
$obj->toggle($array);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if (in_array($_POST['action'], array('copy', 'delete', 'toggle')) && is_uuid($id) && is_uuid($extension_uuid)) {
|
||||
header('Location: extension_setting_edit.php?id='.$id.'&extension_uuid='.$extension_uuid);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
|
||||
if (empty($extension_setting_type)) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']."<br>\n"; }
|
||||
if (empty($extension_setting_name)) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']."<br>\n"; }
|
||||
//if (empty($extension_setting_value)) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']."<br>\n"; }
|
||||
if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."<br>\n"; }
|
||||
//if (empty($extension_setting_description)) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']."<br>\n"; }
|
||||
if (!empty($msg) && empty($_POST["persistformvar"])) {
|
||||
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;
|
||||
}
|
||||
|
||||
//add the extension_setting_uuid
|
||||
if (empty($extension_setting_uuid)) {
|
||||
$extension_setting_uuid = uuid();
|
||||
}
|
||||
|
||||
//prepare the array
|
||||
$array['extension_settings'][0]['extension_setting_uuid'] = $extension_setting_uuid;
|
||||
$array['extension_settings'][0]['extension_uuid'] = $extension_uuid;
|
||||
$array['extension_settings'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//$array['extension_settings'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['extension_settings'][0]['extension_setting_type'] = $extension_setting_type;
|
||||
$array['extension_settings'][0]['extension_setting_name'] = $extension_setting_name;
|
||||
$array['extension_settings'][0]['extension_setting_value'] = $extension_setting_value;
|
||||
$array['extension_settings'][0]['extension_setting_enabled'] = $extension_setting_enabled;
|
||||
$array['extension_settings'][0]['extension_setting_description'] = $extension_setting_description;
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'extension settings';
|
||||
$database->app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||
$database->save($array);
|
||||
|
||||
//clear the cache
|
||||
$sql = "select extension, number_alias, user_context from v_extensions ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$database = new database;
|
||||
$extension = $database->select($sql, $parameters, 'row');
|
||||
$cache = new cache;
|
||||
$cache->delete("directory:".$extension["extension"]."@".$extension["user_context"]);
|
||||
$cache->delete("directory:".$extension["number_alias"]."@".$extension["user_context"]);
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
//header('Location: extension_settings.php');
|
||||
header('Location: extension_setting_edit.php?id='.urlencode($extension_setting_uuid).'&extension_uuid='.$extension_uuid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$sql = "select ";
|
||||
//$sql .= "extension_uuid, ";
|
||||
//$sql .= "domain_uuid, ";
|
||||
$sql .= "extension_setting_uuid, ";
|
||||
$sql .= "extension_setting_type, ";
|
||||
$sql .= "extension_setting_name, ";
|
||||
$sql .= "extension_setting_value, ";
|
||||
$sql .= "cast(extension_setting_enabled as text), ";
|
||||
$sql .= "extension_setting_description ";
|
||||
$sql .= "from v_extension_settings ";
|
||||
$sql .= "where extension_setting_uuid = :extension_setting_uuid ";
|
||||
//$sql .= "and domain_uuid = :domain_uuid ";
|
||||
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['extension_setting_uuid'] = $extension_setting_uuid ?? '';
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row)) {
|
||||
if (!empty($row["extension_uuid"]) && is_uuid($row["extension_uuid"])) {
|
||||
$extension_uuid = $row["extension_uuid"];
|
||||
}
|
||||
//$domain_uuid = $row["domain_uuid"];
|
||||
$extension_setting_type = $row["extension_setting_type"];
|
||||
$extension_setting_name = $row["extension_setting_name"];
|
||||
$extension_setting_value = $row["extension_setting_value"];
|
||||
$extension_setting_enabled = $row["extension_setting_enabled"];
|
||||
$extension_setting_description = $row["extension_setting_description"];
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if (empty($extension_setting_enabled)) { $extension_setting_enabled = 'true'; }
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//show the header
|
||||
$document['title'] = $text['title-extension_setting'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
||||
echo "<input class='formfld' type='hidden' name='extension_setting_uuid' value='".escape($extension_setting_uuid)."'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-extension_setting']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'extension_settings.php?id='.$extension_uuid]);
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
}
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['title_description-extension_settings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'copy','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
//echo "<tr>\n";
|
||||
//echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
//echo " ".$text['label-domain_uuid']."\n";
|
||||
//echo "</td>\n";
|
||||
//echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
//echo " <select class='formfld' name='domain_uuid'>\n";
|
||||
//if (empty($domain_uuid)) {
|
||||
// echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
|
||||
//}
|
||||
//else {
|
||||
// echo " <option value=''>".$text['label-global']."</option>\n";
|
||||
//}
|
||||
//foreach ($_SESSION['domains'] as $row) {
|
||||
// if ($row['domain_uuid'] == $domain_uuid) {
|
||||
// echo " <option value='".$row['domain_uuid']."' selected='selected'>".escape($row['domain_name'])."</option>\n";
|
||||
// }
|
||||
// else {
|
||||
// echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
|
||||
// }
|
||||
//}
|
||||
//echo " </select>\n";
|
||||
//echo "<br />\n";
|
||||
//echo $text['description-domain_uuid']."\n";
|
||||
//echo "</td>\n";
|
||||
//echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='extension_setting_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (!empty($extension_setting_type) && $extension_setting_type == "param") {
|
||||
echo " <option value='param' selected='selected'>".$text['label-param']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='param'>".$text['label-param']."</option>\n";
|
||||
}
|
||||
if (!empty($extension_setting_type) && $extension_setting_type == "variable") {
|
||||
echo " <option value='variable' selected='selected'>".$text['label-variable']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='variable'>".$text['label-variable']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_name' maxlength='255' value='".escape($extension_setting_name)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_value']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_value' maxlength='255' value='".escape($extension_setting_value)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_value']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
echo " <label class='switch'>\n";
|
||||
echo " <input type='checkbox' id='extension_setting_enabled' name='extension_setting_enabled' value='true' ".($extension_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
|
||||
echo " <span class='slider'></span>\n";
|
||||
echo " </label>\n";
|
||||
}
|
||||
else {
|
||||
echo " <select class='formfld' id='extension_setting_enabled' name='extension_setting_enabled'>\n";
|
||||
echo " <option value='true' ".($extension_setting_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||
echo " <option value='false' ".($extension_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_description' maxlength='255' value='".escape($extension_setting_description)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<input type='hidden' name='extension_uuid' value='".$extension_uuid."'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2021-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$extension_uuid = '';
|
||||
$extension_setting_uuid = '';
|
||||
$extension_setting_name = '';
|
||||
$extension_setting_value = '';
|
||||
$extension_setting_description = '';
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$extension_setting_uuid = $_REQUEST["id"];
|
||||
$id = $_REQUEST["id"];
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the extension id
|
||||
if (!empty($_REQUEST["extension_setting_uuid"]) && is_uuid($_REQUEST["extension_setting_uuid"])) {
|
||||
$extension_setting_uuid = $_REQUEST["extension_setting_uuid"];
|
||||
}
|
||||
if (!empty($_REQUEST["extension_uuid"]) && is_uuid($_REQUEST["extension_uuid"])) {
|
||||
$extension_uuid = $_REQUEST["extension_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (!empty($_POST)) {
|
||||
$domain_uuid = $_POST["domain_uuid"] ?? null;
|
||||
$extension_setting_type = $_POST["extension_setting_type"];
|
||||
$extension_setting_name = $_POST["extension_setting_name"];
|
||||
$extension_setting_value = $_POST["extension_setting_value"];
|
||||
$extension_setting_enabled = $_POST["extension_setting_enabled"] ?? 'false';
|
||||
$extension_setting_description = $_POST["extension_setting_description"];
|
||||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_settings.php?id='.$extension_uuid);
|
||||
exit;
|
||||
}
|
||||
|
||||
//process the http post data by submitted action
|
||||
if (!empty($_POST['action'])) {
|
||||
|
||||
//prepare the array(s)
|
||||
//send the array to the database class
|
||||
switch ($_POST['action']) {
|
||||
case 'copy':
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
$obj = new database;
|
||||
$obj->copy($array);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
$obj = new database;
|
||||
$obj->delete($array);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('extension_setting_update')) {
|
||||
$obj = new database;
|
||||
$obj->toggle($array);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if (in_array($_POST['action'], array('copy', 'delete', 'toggle')) && is_uuid($id) && is_uuid($extension_uuid)) {
|
||||
header('Location: extension_setting_edit.php?id='.$id.'&extension_uuid='.$extension_uuid);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
|
||||
if (empty($extension_setting_type)) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']."<br>\n"; }
|
||||
if (empty($extension_setting_name)) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']."<br>\n"; }
|
||||
//if (empty($extension_setting_value)) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']."<br>\n"; }
|
||||
if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."<br>\n"; }
|
||||
//if (empty($extension_setting_description)) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']."<br>\n"; }
|
||||
if (!empty($msg) && empty($_POST["persistformvar"])) {
|
||||
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;
|
||||
}
|
||||
|
||||
//add the extension_setting_uuid
|
||||
if (empty($extension_setting_uuid)) {
|
||||
$extension_setting_uuid = uuid();
|
||||
}
|
||||
|
||||
//prepare the array
|
||||
$array['extension_settings'][0]['extension_setting_uuid'] = $extension_setting_uuid;
|
||||
$array['extension_settings'][0]['extension_uuid'] = $extension_uuid;
|
||||
$array['extension_settings'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//$array['extension_settings'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['extension_settings'][0]['extension_setting_type'] = $extension_setting_type;
|
||||
$array['extension_settings'][0]['extension_setting_name'] = $extension_setting_name;
|
||||
$array['extension_settings'][0]['extension_setting_value'] = $extension_setting_value;
|
||||
$array['extension_settings'][0]['extension_setting_enabled'] = $extension_setting_enabled;
|
||||
$array['extension_settings'][0]['extension_setting_description'] = $extension_setting_description;
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'extension settings';
|
||||
$database->app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||
$database->save($array);
|
||||
|
||||
//clear the cache
|
||||
$sql = "select extension, number_alias, user_context from v_extensions ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$database = new database;
|
||||
$extension = $database->select($sql, $parameters, 'row');
|
||||
$cache = new cache;
|
||||
$cache->delete("directory:".$extension["extension"]."@".$extension["user_context"]);
|
||||
$cache->delete("directory:".$extension["number_alias"]."@".$extension["user_context"]);
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
if ($action == "add") {
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
}
|
||||
if ($action == "update") {
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
//header('Location: extension_settings.php');
|
||||
header('Location: extension_setting_edit.php?id='.urlencode($extension_setting_uuid).'&extension_uuid='.$extension_uuid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$sql = "select ";
|
||||
//$sql .= "extension_uuid, ";
|
||||
//$sql .= "domain_uuid, ";
|
||||
$sql .= "extension_setting_uuid, ";
|
||||
$sql .= "extension_setting_type, ";
|
||||
$sql .= "extension_setting_name, ";
|
||||
$sql .= "extension_setting_value, ";
|
||||
$sql .= "cast(extension_setting_enabled as text), ";
|
||||
$sql .= "extension_setting_description ";
|
||||
$sql .= "from v_extension_settings ";
|
||||
$sql .= "where extension_setting_uuid = :extension_setting_uuid ";
|
||||
//$sql .= "and domain_uuid = :domain_uuid ";
|
||||
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['extension_setting_uuid'] = $extension_setting_uuid ?? '';
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row)) {
|
||||
if (!empty($row["extension_uuid"]) && is_uuid($row["extension_uuid"])) {
|
||||
$extension_uuid = $row["extension_uuid"];
|
||||
}
|
||||
//$domain_uuid = $row["domain_uuid"];
|
||||
$extension_setting_type = $row["extension_setting_type"];
|
||||
$extension_setting_name = $row["extension_setting_name"];
|
||||
$extension_setting_value = $row["extension_setting_value"];
|
||||
$extension_setting_enabled = $row["extension_setting_enabled"];
|
||||
$extension_setting_description = $row["extension_setting_description"];
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if (empty($extension_setting_enabled)) { $extension_setting_enabled = 'true'; }
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//show the header
|
||||
$document['title'] = $text['title-extension_setting'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
||||
echo "<input class='formfld' type='hidden' name='extension_setting_uuid' value='".escape($extension_setting_uuid)."'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-extension_setting']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'extension_settings.php?id='.$extension_uuid]);
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
}
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['title_description-extension_settings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'copy','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
|
||||
}
|
||||
}
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
//echo "<tr>\n";
|
||||
//echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
//echo " ".$text['label-domain_uuid']."\n";
|
||||
//echo "</td>\n";
|
||||
//echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
//echo " <select class='formfld' name='domain_uuid'>\n";
|
||||
//if (empty($domain_uuid)) {
|
||||
// echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
|
||||
//}
|
||||
//else {
|
||||
// echo " <option value=''>".$text['label-global']."</option>\n";
|
||||
//}
|
||||
//foreach ($_SESSION['domains'] as $row) {
|
||||
// if ($row['domain_uuid'] == $domain_uuid) {
|
||||
// echo " <option value='".$row['domain_uuid']."' selected='selected'>".escape($row['domain_name'])."</option>\n";
|
||||
// }
|
||||
// else {
|
||||
// echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
|
||||
// }
|
||||
//}
|
||||
//echo " </select>\n";
|
||||
//echo "<br />\n";
|
||||
//echo $text['description-domain_uuid']."\n";
|
||||
//echo "</td>\n";
|
||||
//echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <select class='formfld' name='extension_setting_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if (!empty($extension_setting_type) && $extension_setting_type == "param") {
|
||||
echo " <option value='param' selected='selected'>".$text['label-param']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='param'>".$text['label-param']."</option>\n";
|
||||
}
|
||||
if (!empty($extension_setting_type) && $extension_setting_type == "variable") {
|
||||
echo " <option value='variable' selected='selected'>".$text['label-variable']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='variable'>".$text['label-variable']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_name' maxlength='255' value='".escape($extension_setting_name)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_value']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_value' maxlength='255' value='".escape($extension_setting_value)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_value']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||
echo " <label class='switch'>\n";
|
||||
echo " <input type='checkbox' id='extension_setting_enabled' name='extension_setting_enabled' value='true' ".($extension_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
|
||||
echo " <span class='slider'></span>\n";
|
||||
echo " </label>\n";
|
||||
}
|
||||
else {
|
||||
echo " <select class='formfld' id='extension_setting_enabled' name='extension_setting_enabled'>\n";
|
||||
echo " <option value='true' ".($extension_setting_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||
echo " <option value='false' ".($extension_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-extension_setting_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='extension_setting_description' maxlength='255' value='".escape($extension_setting_description)."'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension_setting_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<input type='hidden' name='extension_uuid' value='".$extension_uuid."'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,334 +1,334 @@
|
|||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2021-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_setting_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$search = '';
|
||||
$paging_controls = '';
|
||||
$id = '';
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the http post data
|
||||
if (!empty($_POST['extension_settings'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$extension_settings = $_POST['extension_settings'];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$extension_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if (!empty($action) && !empty($extension_settings)) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_settings.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//prepare the database object
|
||||
$obj = new extension_settings;
|
||||
|
||||
//send the array to the database class
|
||||
switch ($action) {
|
||||
case 'copy':
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
$obj->copy($extension_settings);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
$obj->toggle($extension_settings);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
$obj->extension_uuid = $extension_uuid;
|
||||
$obj->delete($extension_settings);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header('Location: extension_settings.php?id='.urlencode($extension_uuid).'&'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//add the search
|
||||
if (isset($_GET["search"])) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
//get the count
|
||||
$sql = "select count(extension_setting_uuid) ";
|
||||
$sql .= "from v_extension_settings ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
if (isset($search)) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(extension_setting_type) like :search ";
|
||||
$sql .= " or lower(extension_setting_name) like :search ";
|
||||
$sql .= " or lower(extension_setting_description) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
else {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "and ".$sql_search;
|
||||
}
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the list
|
||||
$sql = "select ";
|
||||
//$sql .= "d.domain_name, ";
|
||||
$sql .= "extension_setting_uuid, ";
|
||||
$sql .= "extension_setting_type, ";
|
||||
$sql .= "extension_setting_name, ";
|
||||
$sql .= "extension_setting_value, ";
|
||||
$sql .= "cast(extension_setting_enabled as text), ";
|
||||
$sql .= "extension_setting_description ";
|
||||
$sql .= "from v_extension_settings as e ";
|
||||
//$sql .= ",v_domains as d ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
$sql .= "and (e.domain_uuid = :domain_uuid or e.domain_uuid is null) ";
|
||||
//$sql .= "and d.domain_uuid = e.domain_uuid ";
|
||||
if (isset($_GET["search"])) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(extension_setting_type) like :search ";
|
||||
$sql .= " or lower(extension_setting_name) like :search ";
|
||||
$sql .= " or lower(extension_setting_description) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
|
||||
$sql .= order_by($order_by, $order, 'extension_setting_type', 'asc');
|
||||
$sql .= limit_offset($rows_per_page ?? null, $offset ?? null);
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$extension_settings = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-extension_settings'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-extension_settings']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_add','name'=>'btn_add','style'=>'margin-right: 15px;','link'=>'/app/extensions/extension_edit.php?id='.$extension_uuid]);
|
||||
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'extension_setting_edit.php?extension_uuid='.$extension_uuid]);
|
||||
}
|
||||
if (permission_exists('extension_setting_add') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display:none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('extension_setting_edit') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display:none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
//if (permission_exists('extension_setting_all')) {
|
||||
// if ($_GET['show'] == 'all') {
|
||||
// echo " <input type='hidden' name='show' value='all'>\n";
|
||||
// }
|
||||
// else {
|
||||
// echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all&id='.$extension_uuid]);
|
||||
// }
|
||||
//}
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'extension_settings.php?id='.$extension_uuid,'style'=>(empty($search) ? 'display: none;' : null)]);
|
||||
if (!empty($paging_controls_mini)) {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " <input type='hidden' name='id' value='".$extension_uuid."'>\n";
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('extension_setting_add') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_edit') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['title_description-extension_settings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
if (!empty($extension_settings)) {
|
||||
//define the variable
|
||||
$previous_extension_setting_type = '';
|
||||
|
||||
//set the initial value
|
||||
$x = 0;
|
||||
|
||||
//show the extension settings
|
||||
foreach ($extension_settings as $row) {
|
||||
$extension_setting_type = $row['extension_setting_type'];
|
||||
$extension_setting_type = strtolower($extension_setting_type);
|
||||
|
||||
$label_extension_setting_type = $row['extension_setting_type'];
|
||||
$label_extension_setting_type = str_replace("_", " ", $label_extension_setting_type);
|
||||
$label_extension_setting_type = str_replace("-", " ", $label_extension_setting_type);
|
||||
$label_extension_setting_type = ucwords($label_extension_setting_type);
|
||||
|
||||
if ($previous_extension_setting_type !== $row['extension_setting_type']) {
|
||||
echo " <tr>";
|
||||
echo " <td align='left' colspan='999'> </td>\n";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td align='left' colspan='999' nowrap='nowrap'><b>".escape($label_extension_setting_type)."</b></td>\n";
|
||||
echo " </tr>";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit') || permission_exists('extension_setting_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$extension_setting_type."' name='checkbox_all' onclick=\"list_all_toggle('".$extension_setting_type."'); checkbox_on_change(this);\">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
//if ($_GET['show'] == 'all' && permission_exists('extension_setting_all')) {
|
||||
// echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
//}
|
||||
|
||||
//echo th_order_by('extension_setting_type', $text['label-extension_setting_type'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_name', $text['label-extension_setting_name'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_value', $text['label-extension_setting_value'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_enabled', $text['label-extension_setting_enabled'], $order_by, $order, null, "class='center'");
|
||||
echo " <th>".$text['label-extension_setting_type']."</th>\n";
|
||||
echo " <th>".$text['label-extension_setting_name']."</th>\n";
|
||||
echo " <th>".$text['label-extension_setting_value']."</th>\n";
|
||||
echo " <th class='center'>".$text['label-extension_setting_enabled']."</th>\n";
|
||||
|
||||
echo " <th class='hide-sm-dn'>".$text['label-extension_setting_description']."</th>\n";
|
||||
if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
}
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
$list_row_url = "extension_setting_edit.php?id=".urlencode($row['extension_setting_uuid'])."&extension_uuid=".urlencode($extension_uuid);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit') || permission_exists('extension_setting_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='extension_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_".$extension_setting_type."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all_".$extension_setting_type."').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='extension_settings[$x][uuid]' value='".escape($row['extension_setting_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
//if ($_GET['show'] == 'all' && permission_exists('extension_setting_all')) {
|
||||
// echo " <td>".escape($row['domain_name'])."</td>\n";
|
||||
//}
|
||||
echo " <td>".escape($row['extension_setting_type'])."</td>\n";
|
||||
echo " <td>".escape($row['extension_setting_name'])."</td>\n";
|
||||
echo " <td>".escape($row['extension_setting_value'])."</td>\n";
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
echo " <td class='no-link center'>\n";
|
||||
echo " <input type='hidden' name='number_translations[$x][extension_setting_enabled]' value='".escape($row['extension_setting_enabled'])."' />\n";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['extension_setting_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>\n";
|
||||
echo $text['label-'.$row['extension_setting_enabled']];
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['extension_setting_description'])."</td>\n";
|
||||
if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
//set the previous category
|
||||
$previous_extension_setting_type = $row['extension_setting_type'];
|
||||
$x++;
|
||||
}
|
||||
unset($extension_settings);
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
echo "<input type='hidden' name='".$id."' value='".$extension_uuid."'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2021-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_setting_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$search = '';
|
||||
$paging_controls = '';
|
||||
$id = '';
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the http post data
|
||||
if (!empty($_POST['extension_settings'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$extension_settings = $_POST['extension_settings'];
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$extension_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if (!empty($action) && !empty($extension_settings)) {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_settings.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//prepare the database object
|
||||
$obj = new extension_settings;
|
||||
|
||||
//send the array to the database class
|
||||
switch ($action) {
|
||||
case 'copy':
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
$obj->copy($extension_settings);
|
||||
}
|
||||
break;
|
||||
case 'toggle':
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
$obj->toggle($extension_settings);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (permission_exists('extension_setting_delete')) {
|
||||
$obj->extension_uuid = $extension_uuid;
|
||||
$obj->delete($extension_settings);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header('Location: extension_settings.php?id='.urlencode($extension_uuid).'&'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by
|
||||
$order_by = $_GET["order_by"] ?? '';
|
||||
$order = $_GET["order"] ?? '';
|
||||
|
||||
//add the search
|
||||
if (isset($_GET["search"])) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
//get the count
|
||||
$sql = "select count(extension_setting_uuid) ";
|
||||
$sql .= "from v_extension_settings ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
if (isset($search)) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(extension_setting_type) like :search ";
|
||||
$sql .= " or lower(extension_setting_name) like :search ";
|
||||
$sql .= " or lower(extension_setting_description) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
else {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
if (isset($sql_search)) {
|
||||
$sql .= "and ".$sql_search;
|
||||
}
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
}
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the list
|
||||
$sql = "select ";
|
||||
//$sql .= "d.domain_name, ";
|
||||
$sql .= "extension_setting_uuid, ";
|
||||
$sql .= "extension_setting_type, ";
|
||||
$sql .= "extension_setting_name, ";
|
||||
$sql .= "extension_setting_value, ";
|
||||
$sql .= "cast(extension_setting_enabled as text), ";
|
||||
$sql .= "extension_setting_description ";
|
||||
$sql .= "from v_extension_settings as e ";
|
||||
//$sql .= ",v_domains as d ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
$sql .= "and (e.domain_uuid = :domain_uuid or e.domain_uuid is null) ";
|
||||
//$sql .= "and d.domain_uuid = e.domain_uuid ";
|
||||
if (isset($_GET["search"])) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(extension_setting_type) like :search ";
|
||||
$sql .= " or lower(extension_setting_name) like :search ";
|
||||
$sql .= " or lower(extension_setting_description) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
|
||||
$sql .= order_by($order_by, $order, 'extension_setting_type', 'asc');
|
||||
$sql .= limit_offset($rows_per_page ?? null, $offset ?? null);
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$extension_settings = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-extension_settings'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-extension_settings']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_add','name'=>'btn_add','style'=>'margin-right: 15px;','link'=>'/app/extensions/extension_edit.php?id='.$extension_uuid]);
|
||||
|
||||
if (permission_exists('extension_setting_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'extension_setting_edit.php?extension_uuid='.$extension_uuid]);
|
||||
}
|
||||
if (permission_exists('extension_setting_add') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display:none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
}
|
||||
if (permission_exists('extension_setting_edit') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display:none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete') && $extension_settings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
//if (permission_exists('extension_setting_all')) {
|
||||
// if ($_GET['show'] == 'all') {
|
||||
// echo " <input type='hidden' name='show' value='all'>\n";
|
||||
// }
|
||||
// else {
|
||||
// echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all&id='.$extension_uuid]);
|
||||
// }
|
||||
//}
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'extension_settings.php?id='.$extension_uuid,'style'=>(empty($search) ? 'display: none;' : null)]);
|
||||
if (!empty($paging_controls_mini)) {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " <input type='hidden' name='id' value='".$extension_uuid."'>\n";
|
||||
echo " </form>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('extension_setting_add') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_edit') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('extension_setting_delete') && $extension_settings) {
|
||||
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo $text['title_description-extension_settings']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
if (!empty($extension_settings)) {
|
||||
//define the variable
|
||||
$previous_extension_setting_type = '';
|
||||
|
||||
//set the initial value
|
||||
$x = 0;
|
||||
|
||||
//show the extension settings
|
||||
foreach ($extension_settings as $row) {
|
||||
$extension_setting_type = $row['extension_setting_type'];
|
||||
$extension_setting_type = strtolower($extension_setting_type);
|
||||
|
||||
$label_extension_setting_type = $row['extension_setting_type'];
|
||||
$label_extension_setting_type = str_replace("_", " ", $label_extension_setting_type);
|
||||
$label_extension_setting_type = str_replace("-", " ", $label_extension_setting_type);
|
||||
$label_extension_setting_type = ucwords($label_extension_setting_type);
|
||||
|
||||
if ($previous_extension_setting_type !== $row['extension_setting_type']) {
|
||||
echo " <tr>";
|
||||
echo " <td align='left' colspan='999'> </td>\n";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td align='left' colspan='999' nowrap='nowrap'><b>".escape($label_extension_setting_type)."</b></td>\n";
|
||||
echo " </tr>";
|
||||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit') || permission_exists('extension_setting_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$extension_setting_type."' name='checkbox_all' onclick=\"list_all_toggle('".$extension_setting_type."'); checkbox_on_change(this);\">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
//if ($_GET['show'] == 'all' && permission_exists('extension_setting_all')) {
|
||||
// echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
//}
|
||||
|
||||
//echo th_order_by('extension_setting_type', $text['label-extension_setting_type'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_name', $text['label-extension_setting_name'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_value', $text['label-extension_setting_value'], $order_by, $order);
|
||||
//echo th_order_by('extension_setting_enabled', $text['label-extension_setting_enabled'], $order_by, $order, null, "class='center'");
|
||||
echo " <th>".$text['label-extension_setting_type']."</th>\n";
|
||||
echo " <th>".$text['label-extension_setting_name']."</th>\n";
|
||||
echo " <th>".$text['label-extension_setting_value']."</th>\n";
|
||||
echo " <th class='center'>".$text['label-extension_setting_enabled']."</th>\n";
|
||||
|
||||
echo " <th class='hide-sm-dn'>".$text['label-extension_setting_description']."</th>\n";
|
||||
if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
}
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
$list_row_url = "extension_setting_edit.php?id=".urlencode($row['extension_setting_uuid'])."&extension_uuid=".urlencode($extension_uuid);
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('extension_setting_add') || permission_exists('extension_setting_edit') || permission_exists('extension_setting_delete')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='extension_settings[$x][checked]' id='checkbox_".$x."' class='checkbox_".$extension_setting_type."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all_".$extension_setting_type."').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='extension_settings[$x][uuid]' value='".escape($row['extension_setting_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
//if ($_GET['show'] == 'all' && permission_exists('extension_setting_all')) {
|
||||
// echo " <td>".escape($row['domain_name'])."</td>\n";
|
||||
//}
|
||||
echo " <td>".escape($row['extension_setting_type'])."</td>\n";
|
||||
echo " <td>".escape($row['extension_setting_name'])."</td>\n";
|
||||
echo " <td>".escape($row['extension_setting_value'])."</td>\n";
|
||||
if (permission_exists('extension_setting_edit')) {
|
||||
echo " <td class='no-link center'>\n";
|
||||
echo " <input type='hidden' name='number_translations[$x][extension_setting_enabled]' value='".escape($row['extension_setting_enabled'])."' />\n";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['extension_setting_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
}
|
||||
else {
|
||||
echo " <td class='center'>\n";
|
||||
echo $text['label-'.$row['extension_setting_enabled']];
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['extension_setting_description'])."</td>\n";
|
||||
if (permission_exists('extension_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
//set the previous category
|
||||
$previous_extension_setting_type = $row['extension_setting_type'];
|
||||
$x++;
|
||||
}
|
||||
unset($extension_settings);
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
echo "<input type='hidden' name='".$id."' value='".$extension_uuid."'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
}
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
$database->app_name = 'extensions';
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
$sql .= "where default_setting_category = 'security' ";
|
||||
$sql .= "and default_setting_subcategory like 'password_%' ";
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('default_setting_edit', 'temp');
|
||||
|
||||
$database->execute($sql);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
|
||||
//initialize the database object
|
||||
$database = new database;
|
||||
$database = database::new();
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -261,7 +261,7 @@
|
|||
$array['extension_users'][0]['user_uuid'] = $user_uuid;
|
||||
|
||||
//add temporary permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_user_delete', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -288,7 +288,7 @@
|
|||
$array['device_lines'][0]['device_line_uuid'] = $device_line_uuid;
|
||||
|
||||
//add temporary permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('device_line_delete', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -401,6 +401,19 @@
|
|||
//extension exists
|
||||
}
|
||||
else {
|
||||
//password permission not assigned get the password from the database
|
||||
if ($action == "update" && !permission_exists('extension_password')) {
|
||||
$sql = "select password from v_extensions ";
|
||||
$sql .= "where extension_uuid = :extension_uuid ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['extension_uuid'] = $extension_uuid;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$password = $row["password"];
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
||||
//get the password length and strength
|
||||
$password_length = $_SESSION["extension"]["password_length"]["numeric"];
|
||||
|
|
@ -658,9 +671,9 @@
|
|||
$array["devices"][$j]["device_lines"][0]["auth_id"] = $extension;
|
||||
$array["devices"][$j]["device_lines"][0]["password"] = $password;
|
||||
$array["devices"][$j]["device_lines"][0]["line_number"] = is_numeric($line_numbers[$d]) ? $line_numbers[$d] : '1';
|
||||
$array["devices"][$j]["device_lines"][0]["sip_port"] = $_SESSION['provision']['line_sip_port']['numeric'];
|
||||
$array["devices"][$j]["device_lines"][0]["sip_port"] = $_SESSION['provision']['line_sip_port']['text'];
|
||||
$array["devices"][$j]["device_lines"][0]["sip_transport"] = $_SESSION['provision']['line_sip_transport']['text'];
|
||||
$array["devices"][$j]["device_lines"][0]["register_expires"] = $_SESSION['provision']['line_register_expires']['numeric'];
|
||||
$array["devices"][$j]["device_lines"][0]["register_expires"] = $_SESSION['provision']['line_register_expires']['text'];
|
||||
$array["devices"][$j]["device_lines"][0]["enabled"] = "true";
|
||||
}
|
||||
|
||||
|
|
@ -1766,7 +1779,7 @@
|
|||
echo " ".$text['label-voicemail_mail_to']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='voicemail_mail_to' maxlength='255' value=\"".escape($voicemail_mail_to ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='text' name='voicemail_mail_to' maxlength='1024' value=\"".escape($voicemail_mail_to ?? '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-voicemail_mail_to']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
|
|||
|
|
@ -1,464 +1,464 @@
|
|||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_import')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//initialize the database object
|
||||
$database = new database;
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduct the functionality but requirs PHP 5.1.0 or higher
|
||||
if (!function_exists('str_getcsv')) {
|
||||
function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
|
||||
$fp = fopen("php://memory", 'r+');
|
||||
fputs($fp, $input);
|
||||
rewind($fp);
|
||||
$data = fgetcsv($fp, null, $delimiter, $enclosure, $escape);
|
||||
fclose($fp);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
$action = $_POST["action"] ?? null;
|
||||
$from_row = $_POST["from_row"] ?? null;
|
||||
$delimiter = $_POST["data_delimiter"] ?? null;
|
||||
$enclosure = $_POST["data_enclosure"] ?? null;
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/extensions-".$_SESSION['domain_name'].".csv";
|
||||
file_put_contents($file, $_POST['data']);
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
|
||||
//copy the csv file
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('extension_import')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*');
|
||||
unset($_POST['txtCommand']);
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
//get the schema
|
||||
if (!empty($delimiter)) {
|
||||
//get the first line
|
||||
$line = fgets(fopen($_SESSION['file'], 'r'));
|
||||
$line_fields = explode($delimiter, $line);
|
||||
|
||||
//get the schema
|
||||
$x = 0;
|
||||
include "app/extensions/app_config.php";
|
||||
$i = 0;
|
||||
foreach ($apps[0]['db'] as $table) {
|
||||
//get the table name and parent name
|
||||
$table_name = $table["table"]['name'];
|
||||
$parent_name = $table["table"]['parent'];
|
||||
|
||||
//remove the v_ table prefix
|
||||
if (substr($table_name, 0, 2) == 'v_') {
|
||||
$table_name = substr($table_name, 2);
|
||||
}
|
||||
if (substr($parent_name, 0, 2) == 'v_') {
|
||||
$parent_name = substr($parent_name, 2);
|
||||
}
|
||||
|
||||
//filter for specific tables and build the schema array
|
||||
if ($table_name == "extensions") {
|
||||
$schema[$i]['table'] = $table_name;
|
||||
$schema[$i]['parent'] = $parent_name;
|
||||
foreach ($table['fields'] as $row) {
|
||||
if (empty($row['deprecated']) || $row['deprecated'] !== 'true') {
|
||||
if (is_array($row['name'])) {
|
||||
$field_name = $row['name']['text'];
|
||||
}
|
||||
else {
|
||||
$field_name = $row['name'];
|
||||
}
|
||||
$schema[$i]['fields'][] = $field_name;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$schema[$i]['table'] = 'extension_users';
|
||||
$schema[$i]['parent'] = 'extensions';
|
||||
$schema[$i]['fields'][] = 'username';
|
||||
}
|
||||
|
||||
//match the column names to the field names
|
||||
if (!empty($delimiter) && file_exists($_SESSION['file']) && $action != 'import') {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include header
|
||||
$document['title'] = $text['title-extension_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//form to match the fields to the column names
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-extension_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'extension_imports.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['description-import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
//loop through user columns
|
||||
$x = 0;
|
||||
foreach ($line_fields as $line_field) {
|
||||
$line_field = preg_replace('#[^a-zA-Z0-9_]#', '', $line_field);
|
||||
echo "<tr>\n";
|
||||
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
//echo " ".$text['label-zzz']."\n";
|
||||
echo $line_field;
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='' name='fields[$x]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($schema as $row) {
|
||||
echo " <optgroup label='".$row['table']."'>\n";
|
||||
if (!empty($row['fields'])) {
|
||||
foreach($row['fields'] as $field) {
|
||||
$selected = '';
|
||||
if ($field == $line_field) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
if ($field !== 'domain_uuid') {
|
||||
echo " <option value='".$row['table'].".".$field."' ".$selected.">".$field."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
//echo "<br />\n";
|
||||
//echo $text['description-zzz']."\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<input name='action' type='hidden' value='import'>\n";
|
||||
echo "<input name='from_row' type='hidden' value='$from_row'>\n";
|
||||
echo "<input name='data_delimiter' type='hidden' value='$delimiter'>\n";
|
||||
echo "<input name='data_enclosure' type='hidden' value='$enclosure'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
require_once "resources/footer.php";
|
||||
|
||||
//normalize the column names
|
||||
//$line = strtolower($line);
|
||||
//$line = str_replace("-", "_", $line);
|
||||
//$line = str_replace($delimiter."title".$delimiter, $delimiter."contact_title".$delimiter, $line);
|
||||
//$line = str_replace("firstname", "name_given", $line);
|
||||
//$line = str_replace("lastname", "name_family", $line);
|
||||
//$line = str_replace("company", "organization", $line);
|
||||
//$line = str_replace("company", "contact_email", $line);
|
||||
|
||||
//end the script
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the parent table
|
||||
function get_parent($schema,$table_name) {
|
||||
foreach ($schema as $row) {
|
||||
if ($row['table'] == $table_name) {
|
||||
return $row['parent'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//upload the csv
|
||||
if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//user selected fields
|
||||
$fields = $_POST['fields'];
|
||||
|
||||
//set the domain_uuid
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
|
||||
//get the users
|
||||
$sql = "select * from v_users where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the contents of the csv file and convert them into an array
|
||||
$handle = @fopen($_SESSION['file'], "r");
|
||||
if ($handle) {
|
||||
//set the starting identifiers
|
||||
$row_id = 0;
|
||||
$row_number = 1;
|
||||
|
||||
//loop through the array
|
||||
while (($line = fgets($handle, 4096)) !== false) {
|
||||
if ($from_row <= $row_number) {
|
||||
//format the data
|
||||
$y = 0;
|
||||
foreach ($fields as $key => $value) {
|
||||
//get the line
|
||||
$result = str_getcsv($line, $delimiter, $enclosure);
|
||||
|
||||
//get the table and field name
|
||||
$field_array = explode(".",$value);
|
||||
$table_name = $field_array[0];
|
||||
$field_name = $field_array[1] ?? null;
|
||||
//echo "value: $value<br />\n";
|
||||
//echo "table_name: $table_name<br />\n";
|
||||
//echo "field_name: $field_name<br />\n";
|
||||
|
||||
//get the parent table name
|
||||
$parent = get_parent($schema, $table_name);
|
||||
|
||||
//remove formatting from the phone number
|
||||
if ($field_name == "phone_number") {
|
||||
$result[$key] = preg_replace('{\D}', '', $result[$key]);
|
||||
}
|
||||
|
||||
//set various fields to lower case
|
||||
if (in_array($field_name, array('enabled','directory_visible','directory_exten_visible','call_screen_enabled','user_record','do_not_disturb','forward_all_enabled','forward_busy_enabled','forward_no_answer_enabled','forward_user_not_registered_enabled'))) {
|
||||
$result[$key] = strtolower($result[$key]);
|
||||
}
|
||||
|
||||
//build the data array
|
||||
if (!empty($table_name)) {
|
||||
if (empty($parent)) {
|
||||
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
|
||||
$array[$table_name][$row_id][$field_name] = $result[$key];
|
||||
}
|
||||
elseif ($field_name != "username") {
|
||||
$array[$parent][$row_id][$table_name][$y]['domain_uuid'] = $domain_uuid;
|
||||
$array[$parent][$row_id][$table_name][$y][$field_name] = $result[$key];
|
||||
}
|
||||
|
||||
if ($field_name == "username") {
|
||||
foreach ($users as $field) {
|
||||
if ($field['username'] == $result[$key]) {
|
||||
//$array[$parent][$row_id]['extension_users'][$y]['cextension_user_uuid'] = uuid();
|
||||
$array[$parent][$row_id]['extension_users'][$y]['domain_uuid'] = $domain_uuid;
|
||||
//$array[$parent][$row_id]['extension_users'] = $row['extension_uuid'];
|
||||
$array[$parent][$row_id]['extension_users'][$y]['user_uuid'] = $field['user_uuid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process a chunk of the array
|
||||
if ($row_id === 1000) {
|
||||
|
||||
//save to the data
|
||||
$database->app_name = 'extensions';
|
||||
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||
$database->save($array);
|
||||
|
||||
//clear the array
|
||||
unset($array);
|
||||
|
||||
//set the row id back to 0
|
||||
$row_id = 0;
|
||||
}
|
||||
|
||||
} //if ($from_row <= $row_number)
|
||||
$row_number++;
|
||||
$row_id++;
|
||||
} //end while
|
||||
fclose($handle);
|
||||
|
||||
//save to the data
|
||||
if (!empty($array) && is_array($array)) {
|
||||
$database->app_name = 'extensions';
|
||||
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
}
|
||||
|
||||
//send the redirect header
|
||||
header("Location: extensions.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-extension_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show content
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-extension_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'extensions.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['description-import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'>".($data ?? null)."</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-from_row']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='from_row'>\n";
|
||||
$i=2;
|
||||
while($i<=99) {
|
||||
$selected = ($i == $from_row) ? "selected" : null;
|
||||
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-from_row']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_delimiter']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='width:40px;' name='data_delimiter'>\n";
|
||||
echo " <option value=','>,</option>\n";
|
||||
echo " <option value='|'>|</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_delimiter']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_enclosure']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='width:40px;' name='data_enclosure'>\n";
|
||||
echo " <option value='\"'>\"</option>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_enclosure']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_file_upload']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input name='ulfile' type='file' class='formfld fileinput' id='ulfile'>\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input name='type' type='hidden' value='csv'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
<?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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('extension_import')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//initialize the database object
|
||||
$database = new database;
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//built in str_getcsv requires PHP 5.3 or higher, this function can be used to reproduct the functionality but requirs PHP 5.1.0 or higher
|
||||
if (!function_exists('str_getcsv')) {
|
||||
function str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") {
|
||||
$fp = fopen("php://memory", 'r+');
|
||||
fputs($fp, $input);
|
||||
rewind($fp);
|
||||
$data = fgetcsv($fp, null, $delimiter, $enclosure, $escape);
|
||||
fclose($fp);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
$action = $_POST["action"] ?? null;
|
||||
$from_row = $_POST["from_row"] ?? null;
|
||||
$delimiter = $_POST["data_delimiter"] ?? null;
|
||||
$enclosure = $_POST["data_enclosure"] ?? null;
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/extensions-".$_SESSION['domain_name'].".csv";
|
||||
file_put_contents($file, $_POST['data']);
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
|
||||
//copy the csv file
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('extension_import')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*');
|
||||
unset($_POST['txtCommand']);
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
//get the schema
|
||||
if (!empty($delimiter)) {
|
||||
//get the first line
|
||||
$line = fgets(fopen($_SESSION['file'], 'r'));
|
||||
$line_fields = explode($delimiter, $line);
|
||||
|
||||
//get the schema
|
||||
$x = 0;
|
||||
include "app/extensions/app_config.php";
|
||||
$i = 0;
|
||||
foreach ($apps[0]['db'] as $table) {
|
||||
//get the table name and parent name
|
||||
$table_name = $table["table"]['name'];
|
||||
$parent_name = $table["table"]['parent'];
|
||||
|
||||
//remove the v_ table prefix
|
||||
if (substr($table_name, 0, 2) == 'v_') {
|
||||
$table_name = substr($table_name, 2);
|
||||
}
|
||||
if (substr($parent_name, 0, 2) == 'v_') {
|
||||
$parent_name = substr($parent_name, 2);
|
||||
}
|
||||
|
||||
//filter for specific tables and build the schema array
|
||||
if ($table_name == "extensions") {
|
||||
$schema[$i]['table'] = $table_name;
|
||||
$schema[$i]['parent'] = $parent_name;
|
||||
foreach ($table['fields'] as $row) {
|
||||
if (empty($row['deprecated']) || $row['deprecated'] !== 'true') {
|
||||
if (is_array($row['name'])) {
|
||||
$field_name = $row['name']['text'];
|
||||
}
|
||||
else {
|
||||
$field_name = $row['name'];
|
||||
}
|
||||
$schema[$i]['fields'][] = $field_name;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
$schema[$i]['table'] = 'extension_users';
|
||||
$schema[$i]['parent'] = 'extensions';
|
||||
$schema[$i]['fields'][] = 'username';
|
||||
}
|
||||
|
||||
//match the column names to the field names
|
||||
if (!empty($delimiter) && file_exists($_SESSION['file']) && $action != 'import') {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include header
|
||||
$document['title'] = $text['title-extension_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//form to match the fields to the column names
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-extension_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'extension_imports.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['description-import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
//loop through user columns
|
||||
$x = 0;
|
||||
foreach ($line_fields as $line_field) {
|
||||
$line_field = preg_replace('#[^a-zA-Z0-9_]#', '', $line_field);
|
||||
echo "<tr>\n";
|
||||
echo " <td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
//echo " ".$text['label-zzz']."\n";
|
||||
echo $line_field;
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='' name='fields[$x]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach($schema as $row) {
|
||||
echo " <optgroup label='".$row['table']."'>\n";
|
||||
if (!empty($row['fields'])) {
|
||||
foreach($row['fields'] as $field) {
|
||||
$selected = '';
|
||||
if ($field == $line_field) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
if ($field !== 'domain_uuid') {
|
||||
echo " <option value='".$row['table'].".".$field."' ".$selected.">".$field."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
//echo "<br />\n";
|
||||
//echo $text['description-zzz']."\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<input name='action' type='hidden' value='import'>\n";
|
||||
echo "<input name='from_row' type='hidden' value='$from_row'>\n";
|
||||
echo "<input name='data_delimiter' type='hidden' value='$delimiter'>\n";
|
||||
echo "<input name='data_enclosure' type='hidden' value='$enclosure'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
require_once "resources/footer.php";
|
||||
|
||||
//normalize the column names
|
||||
//$line = strtolower($line);
|
||||
//$line = str_replace("-", "_", $line);
|
||||
//$line = str_replace($delimiter."title".$delimiter, $delimiter."contact_title".$delimiter, $line);
|
||||
//$line = str_replace("firstname", "name_given", $line);
|
||||
//$line = str_replace("lastname", "name_family", $line);
|
||||
//$line = str_replace("company", "organization", $line);
|
||||
//$line = str_replace("company", "contact_email", $line);
|
||||
|
||||
//end the script
|
||||
exit;
|
||||
}
|
||||
|
||||
//get the parent table
|
||||
function get_parent($schema,$table_name) {
|
||||
foreach ($schema as $row) {
|
||||
if ($row['table'] == $table_name) {
|
||||
return $row['parent'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//upload the csv
|
||||
if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: extension_imports.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
//user selected fields
|
||||
$fields = $_POST['fields'];
|
||||
|
||||
//set the domain_uuid
|
||||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
|
||||
//get the users
|
||||
$sql = "select * from v_users where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//get the contents of the csv file and convert them into an array
|
||||
$handle = @fopen($_SESSION['file'], "r");
|
||||
if ($handle) {
|
||||
//set the starting identifiers
|
||||
$row_id = 0;
|
||||
$row_number = 1;
|
||||
|
||||
//loop through the array
|
||||
while (($line = fgets($handle, 4096)) !== false) {
|
||||
if ($from_row <= $row_number) {
|
||||
//format the data
|
||||
$y = 0;
|
||||
foreach ($fields as $key => $value) {
|
||||
//get the line
|
||||
$result = str_getcsv($line, $delimiter, $enclosure);
|
||||
|
||||
//get the table and field name
|
||||
$field_array = explode(".",$value);
|
||||
$table_name = $field_array[0];
|
||||
$field_name = $field_array[1] ?? null;
|
||||
//echo "value: $value<br />\n";
|
||||
//echo "table_name: $table_name<br />\n";
|
||||
//echo "field_name: $field_name<br />\n";
|
||||
|
||||
//get the parent table name
|
||||
$parent = get_parent($schema, $table_name);
|
||||
|
||||
//remove formatting from the phone number
|
||||
if ($field_name == "phone_number") {
|
||||
$result[$key] = preg_replace('{\D}', '', $result[$key]);
|
||||
}
|
||||
|
||||
//set various fields to lower case
|
||||
if (in_array($field_name, array('enabled','directory_visible','directory_exten_visible','call_screen_enabled','user_record','do_not_disturb','forward_all_enabled','forward_busy_enabled','forward_no_answer_enabled','forward_user_not_registered_enabled'))) {
|
||||
$result[$key] = strtolower($result[$key]);
|
||||
}
|
||||
|
||||
//build the data array
|
||||
if (!empty($table_name)) {
|
||||
if (empty($parent)) {
|
||||
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
|
||||
$array[$table_name][$row_id][$field_name] = $result[$key];
|
||||
}
|
||||
elseif ($field_name != "username") {
|
||||
$array[$parent][$row_id][$table_name][$y]['domain_uuid'] = $domain_uuid;
|
||||
$array[$parent][$row_id][$table_name][$y][$field_name] = $result[$key];
|
||||
}
|
||||
|
||||
if ($field_name == "username") {
|
||||
foreach ($users as $field) {
|
||||
if ($field['username'] == $result[$key]) {
|
||||
//$array[$parent][$row_id]['extension_users'][$y]['cextension_user_uuid'] = uuid();
|
||||
$array[$parent][$row_id]['extension_users'][$y]['domain_uuid'] = $domain_uuid;
|
||||
//$array[$parent][$row_id]['extension_users'] = $row['extension_uuid'];
|
||||
$array[$parent][$row_id]['extension_users'][$y]['user_uuid'] = $field['user_uuid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//process a chunk of the array
|
||||
if ($row_id === 1000) {
|
||||
|
||||
//save to the data
|
||||
$database->app_name = 'extensions';
|
||||
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||
$database->save($array);
|
||||
|
||||
//clear the array
|
||||
unset($array);
|
||||
|
||||
//set the row id back to 0
|
||||
$row_id = 0;
|
||||
}
|
||||
|
||||
} //if ($from_row <= $row_number)
|
||||
$row_number++;
|
||||
$row_id++;
|
||||
} //end while
|
||||
fclose($handle);
|
||||
|
||||
//save to the data
|
||||
if (!empty($array) && is_array($array)) {
|
||||
$database->app_name = 'extensions';
|
||||
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
}
|
||||
|
||||
//send the redirect header
|
||||
header("Location: extensions.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//include the header
|
||||
$document['title'] = $text['title-extension_import'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show content
|
||||
echo "<form name='frmUpload' method='post' enctype='multipart/form-data'>\n";
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-extension_import']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'extensions.php']);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>$_SESSION['theme']['button_icon_upload'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo $text['description-import']."\n";
|
||||
echo "<br /><br />\n";
|
||||
|
||||
echo "<div class='card'>\n";
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'>".($data ?? null)."</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-from_row']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='from_row'>\n";
|
||||
$i=2;
|
||||
while($i<=99) {
|
||||
$selected = ($i == $from_row) ? "selected" : null;
|
||||
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||
$i++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-from_row']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_delimiter']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='width:40px;' name='data_delimiter'>\n";
|
||||
echo " <option value=','>,</option>\n";
|
||||
echo " <option value='|'>|</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_delimiter']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_enclosure']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' style='width:40px;' name='data_enclosure'>\n";
|
||||
echo " <option value='\"'>\"</option>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_enclosure']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-import_file_upload']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input name='ulfile' type='file' class='formfld fileinput' id='ulfile'>\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input name='type' type='hidden' value='csv'>\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ if (!class_exists('extension')) {
|
|||
//build update array
|
||||
$array['voicemails'][0]['voicemail_uuid'] = $voicemail_uuid;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('voicemail_edit', 'temp');
|
||||
}
|
||||
else {
|
||||
|
|
@ -161,7 +161,7 @@ if (!class_exists('extension')) {
|
|||
$array['voicemails'][0]['voicemail_uuid'] = uuid();
|
||||
$array['voicemails'][0]['domain_uuid'] = $this->domain_uuid;
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('voicemail_add', 'temp');
|
||||
}
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
|
@ -639,7 +639,7 @@ if (!class_exists('extension')) {
|
|||
}
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_user_delete', 'temp');
|
||||
$p->add('follow_me_delete', 'temp');
|
||||
$p->add('follow_me_destination_delete', 'temp');
|
||||
|
|
@ -743,7 +743,7 @@ if (!class_exists('extension')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('extension_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
$array_temp = $array;
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("extension_edit", "temp");
|
||||
|
||||
//save to the data
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@
|
|||
//add the missing email templates
|
||||
if (!empty($array['email_templates'])) {
|
||||
//add the temporary permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("email_template_add", 'temp');
|
||||
$p->add("email_template_edit", 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
//execute
|
||||
if (isset($array) && is_array($array)) {
|
||||
//assign temp permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_add', 'temp');
|
||||
$p->add('fax_edit', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
$array['fax'][0]['fax_description'] = $fax_description;
|
||||
|
||||
//execute insert
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_add', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@
|
|||
$array['fax_users'][0]['fax_uuid'] = $fax_uuid;
|
||||
$array['fax_users'][0]['user_uuid'] = $user_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_user_delete', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
@ -202,7 +202,7 @@
|
|||
$array['fax_users'][0]['fax_uuid'] = $fax_uuid;
|
||||
$array['fax_users'][0]['user_uuid'] = $user_uuid;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_user_add', 'temp');
|
||||
|
||||
$database = new database;
|
||||
|
|
@ -299,7 +299,7 @@
|
|||
$array['fax'][0]['dialplan_uuid'] = $dialplan_uuid;
|
||||
|
||||
//assign temp permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_add', 'temp');
|
||||
|
||||
//set the dialplan action
|
||||
|
|
@ -311,7 +311,7 @@
|
|||
$array['fax'][0]['fax_uuid'] = $fax_uuid;
|
||||
|
||||
//assign temp permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_edit', 'temp');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -266,8 +266,7 @@ if (!empty($result) && @sizeof($result) != 0) {
|
|||
|
||||
//send fax
|
||||
$cwd = getcwd();
|
||||
$included = true;
|
||||
require("fax_send.php");
|
||||
require "fax_send.php";
|
||||
if($cwd){
|
||||
chdir($cwd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@
|
|||
}
|
||||
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('fax_file_delete') || permission_exists['fax_file_edit']) {
|
||||
if (permission_exists('fax_file_delete') || permission_exists('fax_file_edit')) {
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='fax_files[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; } checkbox_on_change(this);\">\n";
|
||||
echo " <input type='hidden' name='fax_files[$x][uuid]' value='".escape($row['fax_file_uuid'])."' />\n";
|
||||
|
|
|
|||
|
|
@ -28,14 +28,19 @@
|
|||
Corey Moullas <cmoullas@emak.tech>
|
||||
*/
|
||||
|
||||
//set included to boolean
|
||||
if (!isset($included)) { $included = false; }
|
||||
|
||||
//check if windows
|
||||
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
|
||||
|
||||
//send email through browser
|
||||
if (!$included) {
|
||||
//executed via command line
|
||||
if (defined('STDIN')) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($setting->get('domain','language','en-us'), 'app/fax');
|
||||
|
||||
}
|
||||
//executed via browser
|
||||
else {
|
||||
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
||||
|
|
@ -124,6 +129,7 @@ if (!$included) {
|
|||
$fax_cover_font = $setting->get('fax','cover_font') ?? null;
|
||||
}
|
||||
|
||||
//define function correct_path
|
||||
if (!function_exists('correct_path')) {
|
||||
function correct_path($p) {
|
||||
global $IS_WINDOWS;
|
||||
|
|
@ -206,7 +212,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
|
||||
//send the fax
|
||||
$continue = false;
|
||||
if (!$included) {
|
||||
if (!defined('STDIN')) {
|
||||
if (!empty($_POST['action']) && $_POST['action'] == "send" && $domain_enabled == true) {
|
||||
//get the values from the HTTP POST
|
||||
$fax_numbers = $_POST['fax_numbers'];
|
||||
|
|
@ -300,10 +306,10 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
|
||||
//process uploaded or emailed files (if any)
|
||||
$fax_page_count = 0;
|
||||
$_files = (!$included) ? $_FILES['fax_files'] : $emailed_files;
|
||||
$_files = (!defined('STDIN')) ? $_FILES['fax_files'] : $emailed_files;
|
||||
unset($tif_files);
|
||||
foreach ($_files['tmp_name'] as $index => $fax_tmp_name) {
|
||||
$uploaded_file = (!$included) ? is_uploaded_file($fax_tmp_name) : true;
|
||||
$uploaded_file = (!defined('STDIN')) ? is_uploaded_file($fax_tmp_name) : true;
|
||||
if ( $uploaded_file && $_files['error'][$index] == 0 && $_files['size'][$index] > 0 ) {
|
||||
//get the file extension
|
||||
$fax_file_extension = strtolower(pathinfo($_files['name'][$index], PATHINFO_EXTENSION));
|
||||
|
|
@ -323,7 +329,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
}
|
||||
unset($attachment_file_name);
|
||||
|
||||
if (!$included) {
|
||||
if (!defined('STDIN')) {
|
||||
//check if directory exists
|
||||
if (!is_dir($dir_fax_temp)) {
|
||||
mkdir($dir_fax_temp, 0770);
|
||||
|
|
@ -490,10 +496,9 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
//field values
|
||||
$pdf->SetFont($pdf_font, "", 12);
|
||||
$pdf->SetXY($x + 2.0, $y + 1.65);
|
||||
if ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview') {
|
||||
$time_zone = isset($_SESSION['domain']['time_zone']['name']) ? $_SESSION['domain']['time_zone']['name'] : date_default_timezone_get();
|
||||
$date = new DateTime('now', new DateTimeZone($time_zone) );
|
||||
$pdf->Write(0.3, $date->format('d M Y'));
|
||||
if (defined('STDIN') || ($_REQUEST['submit'] != '' && $_REQUEST['submit'] != 'preview')) {
|
||||
$date = new DateTime('now', new DateTimeZone( $setting->get('domain','time_zone', date_default_timezone_get() ) ));
|
||||
$pdf->Write(0.3, $date->format('d M Y @ h:i:s A'));
|
||||
}
|
||||
$pdf->SetXY($x + 2.0, $y + 1.95);
|
||||
if ($fax_recipient != '') {
|
||||
|
|
@ -624,7 +629,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
@unlink($tif_file);
|
||||
}
|
||||
}
|
||||
elseif (!$included) {
|
||||
elseif (!defined('STDIN')) {
|
||||
//nothing to send, redirect the browser
|
||||
message::add($text['message-invalid-fax'], 'negative', 4000);
|
||||
header("Location: fax_send.php?id=".$fax_uuid);
|
||||
|
|
@ -678,13 +683,10 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
unset($sql, $parameters, $row);
|
||||
|
||||
//for email to fax send email notification back to the email sender
|
||||
if ($included) {
|
||||
if (defined('STDIN')) {
|
||||
//use email-to-fax from address
|
||||
$mail_to_address = $sender_email;
|
||||
}
|
||||
else {
|
||||
//send fax through the browser
|
||||
}
|
||||
|
||||
//move the generated tif (and pdf) files to the sent directory
|
||||
//if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".tif")) {
|
||||
|
|
@ -733,6 +735,8 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
if (!empty($provider_prefix)) {
|
||||
$common_variables .= "provider_prefix='".$provider_prefix."',";
|
||||
}
|
||||
$common_variables .= "hangup_after_bridge=true,";
|
||||
$common_variables .= "continue_on_fail=true,";
|
||||
|
||||
if (!empty($fax_numbers)) {
|
||||
foreach ($fax_numbers as $fax_number) {
|
||||
|
|
@ -808,7 +812,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
$array['fax_queue'][0]['fax_command'] = 'originate '.$dial_string;
|
||||
|
||||
//add temporary permisison
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_queue_add', 'temp');
|
||||
|
||||
//save the data
|
||||
|
|
@ -826,7 +830,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
}
|
||||
|
||||
//redirect the browser
|
||||
if (!$included && is_uuid($fax_uuid)) {
|
||||
if (!defined('STDIN') && is_uuid($fax_uuid)) {
|
||||
header("Location: fax_files.php?id=".$fax_uuid."&box=sent");
|
||||
//header("Location: fax_outbox.php?id=".$fax_uuid);
|
||||
exit;
|
||||
|
|
@ -836,7 +840,7 @@ if (!function_exists('fax_split_dtmf')) {
|
|||
|
||||
|
||||
//show content in the browser
|
||||
if (!$included) {
|
||||
if (!defined('STDIN')) {
|
||||
|
||||
//retrieve current user's assigned groups (uuids)
|
||||
foreach ($_SESSION['groups'] as $group_data) {
|
||||
|
|
@ -861,7 +865,7 @@ if (!$included) {
|
|||
$sql .= "and cp.phone_type_fax = 1 ";
|
||||
$sql .= "and cp.phone_number is not null ";
|
||||
$sql .= "and cp.phone_number <> '' ";
|
||||
if ($setting->get('contact','permissions') == "true") {
|
||||
if ($setting->get('contact','permissions', false)) {
|
||||
if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) {
|
||||
//only show contacts assigned to current user's group(s) and those not assigned to any group
|
||||
$sql .= "and (";
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ if (!class_exists('fax')) {
|
|||
$array['dialplan_details'][0]['domain_uuid'] = $this->domain_uuid;
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_detail_delete', 'temp');
|
||||
|
||||
//execute delete
|
||||
|
|
@ -166,7 +166,7 @@ if (!class_exists('fax')) {
|
|||
$array['dialplans'][] = $dialplan;
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", 'temp');
|
||||
$p->add("dialplan_detail_add", 'temp');
|
||||
$p->add("dialplan_edit", 'temp');
|
||||
|
|
@ -312,7 +312,7 @@ if (!class_exists('fax')) {
|
|||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_delete', 'temp');
|
||||
$p->add('fax_user_delete', 'temp');
|
||||
$p->add('fax_file_delete', 'temp');
|
||||
|
|
@ -625,7 +625,7 @@ if (!class_exists('fax')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_add', 'temp');
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ function parse_message_decode_text($connection, &$part, $message_number, $id, $o
|
|||
}
|
||||
}
|
||||
if($charset){
|
||||
$msg = mb_convert_encoding($msg, $to_charset, $charset);
|
||||
if ($charset === 'windows-1256') {
|
||||
$msg = iconv('windows-1256', 'utf-8', $msg);
|
||||
} else {
|
||||
$msg = mb_convert_encoding($msg, $to_charset, $charset);
|
||||
}
|
||||
}
|
||||
$msg = trim($msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,14 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "30";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of days to retain the fax queue logs in the database for the maintenance app.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "5506cf35-e19d-4f02-ab9d-43fd0f8460f7";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "prefer_local";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Determine whether fax calls should attempt to stay local or route to the provider.";
|
||||
//$y++;
|
||||
//$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "afd729d9-cf69-4793-a140-21093814d314";
|
||||
//$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@
|
|||
echo th_order_by('fax_retry_date', $text['label-fax_retry_date'], $order_by, $order);
|
||||
echo th_order_by('fax_notify_date', $text['label-fax_notify_date'], $order_by, $order);
|
||||
echo th_order_by('fax_retry_count', $text['label-fax_retry_count'], $order_by, $order);
|
||||
if ($permission['fax_queue_edit'] && $settings->get('theme', 'list_row_edit_button', 'false') == 'true') {
|
||||
if ($permission['fax_queue_edit'] && $settings->get('theme', 'list_row_edit_button', false)) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
|
@ -358,7 +358,7 @@
|
|||
echo " <td>".escape($row['fax_retry_date_formatted'])." ".escape($row['fax_retry_time_formatted'])."</td>\n";
|
||||
echo " <td>".escape($row['fax_notify_date_formatted'])." ".escape($row['fax_notify_time_formatted'])."</td>\n";
|
||||
echo " <td>".escape($row['fax_retry_count'])."</td>\n";
|
||||
if ($permission['fax_queue_edit'] && $settings->get('theme', 'list_row_edit_button', 'false') == 'true') {
|
||||
if ($permission['fax_queue_edit'] && $settings->get('theme', 'list_row_edit_button', false)) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon' => $settings->get('theme', 'button_icon_edit'),'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@
|
|||
//process the messages
|
||||
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
|
||||
foreach($fax_queue as $row) {
|
||||
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
|
||||
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
|
||||
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."&debug=true'";
|
||||
if (isset($debug)) {
|
||||
//run process inline to see debug info
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//connect to the database
|
||||
$database = new database;
|
||||
|
||||
//shutdown call back function
|
||||
function shutdown() {
|
||||
//when the fax status is still sending
|
||||
|
|
@ -156,7 +159,6 @@
|
|||
$sql .= "where fax_queue_uuid = :fax_queue_uuid ";
|
||||
$sql .= "and q.domain_uuid = d.domain_uuid and f.fax_uuid = q.fax_uuid";
|
||||
$parameters['fax_queue_uuid'] = $fax_queue_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row)) {
|
||||
$fax_queue_uuid = $row['fax_queue_uuid'];
|
||||
|
|
@ -221,6 +223,23 @@
|
|||
//sending the fax
|
||||
if ($fax_status == 'waiting' || $fax_status == 'trying' || $fax_status == 'busy') {
|
||||
|
||||
//get the provider_prefix from the domain_variables dialplan
|
||||
$sql = "select dialplan_detail_data from v_dialplan_details ";
|
||||
$sql .= "where dialplan_uuid in ( ";
|
||||
$sql .= " select dialplan_uuid from v_dialplans ";
|
||||
$sql .= " where dialplan_name = 'domain-variables' ";
|
||||
$sql .= " and domain_uuid = :domain_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "and dialplan_detail_data like 'provider_prefix%' ";
|
||||
$sql .= "and dialplan_detail_enabled = 'true' ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
$dialplan_detail_data = $row["dialplan_detail_data"];
|
||||
unset($sql, $parameters, $row);
|
||||
if (!empty($dialplan_detail_data)) {
|
||||
$provider_prefix = explode('=', $dialplan_detail_data)[1];
|
||||
}
|
||||
|
||||
//create event socket handle
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
|
|
@ -230,28 +249,70 @@
|
|||
|
||||
//fax options, first attempt use the fax variables from settings
|
||||
if ($fax_retry_count == 0) {
|
||||
$fax_options = '';
|
||||
}
|
||||
if ($fax_retry_count == 1) {
|
||||
//use default settings or domain settings (defaults to t38)
|
||||
$fax_options = '';
|
||||
foreach($setting->get('fax','variable') as $variable) {
|
||||
$fax_options .= $variable.",";
|
||||
}
|
||||
}
|
||||
elseif ($fax_retry_count == 2) {
|
||||
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true";
|
||||
}
|
||||
elseif ($fax_retry_count == 3) {
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false";
|
||||
}
|
||||
elseif ($fax_retry_count == 4) {
|
||||
elseif ($fax_retry_count == 1) {
|
||||
//send without t38 faster
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
|
||||
}
|
||||
elseif ($fax_retry_count == 2) {
|
||||
//use t38 passthru
|
||||
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,t38_passthru=true";
|
||||
}
|
||||
elseif ($fax_retry_count == 3) {
|
||||
//send without t38 slower
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=true";
|
||||
}
|
||||
elseif ($fax_retry_count == 4) {
|
||||
//send with t38 no error correction
|
||||
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true";
|
||||
}
|
||||
elseif ($fax_retry_count == 5) {
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
|
||||
//send with t38 with error correction faster
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false";
|
||||
}
|
||||
elseif ($fax_retry_count == 6) {
|
||||
$fax_options = "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
|
||||
//send with t38 with error correction slower
|
||||
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
|
||||
}
|
||||
else {
|
||||
//try the user definable method again
|
||||
$fax_options = '';
|
||||
foreach($setting->get('fax','variable') as $variable) {
|
||||
$fax_options .= $variable.",";
|
||||
}
|
||||
}
|
||||
|
||||
//extract fax_dtmf from the fax number
|
||||
fax_split_dtmf($fax_number, $fax_dtmf);
|
||||
|
||||
//get the fax toll allow
|
||||
if (!empty($fax_toll_allow)) {
|
||||
$channel_variables["toll_allow"] = $fax_toll_allow;
|
||||
}
|
||||
|
||||
//check to see if the destination number is local
|
||||
$local_destination = false;
|
||||
if ($setting->get('fax_queue','prefer_local', false)) {
|
||||
$sql = "select count(destination_uuid) ";
|
||||
$sql .= "from v_destinations ";
|
||||
$sql .= "where (";
|
||||
$sql .= " destination_number = :destination_number ";
|
||||
$sql .= " or concat(destination_prefix, destination_number) = :destination_number ";
|
||||
$sql .= " or concat(destination_trunk_prefix, destination_number) = :destination_number ";
|
||||
$sql .= " or concat(destination_area_code, destination_number) = :destination_number ";
|
||||
$sql .= " or concat(destination_prefix, destination_area_code, destination_number) = :destination_number ";
|
||||
$sql .= ") ";
|
||||
$parameters['destination_number'] = $fax_number;
|
||||
$destination_count = $database->select($sql, $parameters, 'column');
|
||||
if ($destination_count > 0) {
|
||||
$local_destination = true;
|
||||
$route_array[] = 'loopback/'.$fax_number.'/public';
|
||||
}
|
||||
}
|
||||
|
||||
//define the fax file
|
||||
|
|
@ -262,34 +323,61 @@
|
|||
$common_variables .= "domain_name=" . $domain_name . ",";
|
||||
$common_variables .= "origination_caller_id_name='" . escape_quote($fax_caller_id_name) . "',";
|
||||
$common_variables .= "origination_caller_id_number=" . $fax_caller_id_number . ",";
|
||||
$common_variables .= "fax_ident='" . escape_quote($fax_caller_id_number) . "',";
|
||||
$common_variables .= "fax_header='" . escape_quote($fax_caller_id_name) . "',";
|
||||
$common_variables .= "fax_file='" . escape_quote($fax_file) . "',";
|
||||
$common_variables .= "fax_ident='" . escape_quote($fax_caller_id_number) . "',";
|
||||
$common_variables .= "fax_header='" . escape_quote($fax_caller_id_name) . "',";
|
||||
$common_variables .= "fax_file='" . escape_quote($fax_file) . "',";
|
||||
$common_variables .= "hangup_after_bridge=true,";
|
||||
$common_variables .= "continue_on_fail=true,";
|
||||
|
||||
//add the fax destination number variables
|
||||
if ($local_destination) {
|
||||
$common_variables .= "sip_to_user=".$fax_number.",";
|
||||
$common_variables .= "sip_req_user=".$fax_number.",";
|
||||
}
|
||||
|
||||
//extract fax_dtmf from the fax number
|
||||
fax_split_dtmf($fax_number, $fax_dtmf);
|
||||
|
||||
//prepare the fax command
|
||||
if (!empty($fax_toll_allow)) {
|
||||
$channel_variables["toll_allow"] = $fax_toll_allow;
|
||||
}
|
||||
$channel_variables["toll_allow"] = !empty($fax_toll_allow) ? $fax_toll_allow : null;
|
||||
$route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables);
|
||||
if (count($route_array) == 0) {
|
||||
//check for valid extension
|
||||
$sql = "select count(extension_uuid) ";
|
||||
$sql .= "from v_extensions ";
|
||||
$sql .= "where extension = :fax_number ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['fax_number'] = $fax_number;
|
||||
$database = new database;
|
||||
$extension_count = $database->select($sql, $parameters, 'column');
|
||||
if ($extension_count > 0) {
|
||||
//send the internal call to the registered extension
|
||||
$route_array[] = "user/".$fax_number."@".$domain_name;
|
||||
|
||||
if (empty($route_array)) {
|
||||
//send the internal call to the registered extension
|
||||
if (count($route_array) == 0) {
|
||||
//check for valid extension
|
||||
$sql = "select count(extension_uuid) ";
|
||||
$sql .= "from v_extensions ";
|
||||
$sql .= "where extension = :fax_number ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['fax_number'] = $fax_number;
|
||||
$extension_count = $database->select($sql, $parameters, 'column');
|
||||
if ($extension_count > 0) {
|
||||
//send the internal call to the registered extension
|
||||
$fax_uri = "user/".$fax_number."@".$domain_name;
|
||||
}
|
||||
else {
|
||||
$fax_uri = '';
|
||||
$fax_status = 'failed';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$fax_status = 'failed';
|
||||
}
|
||||
else {
|
||||
foreach($route_array as $key => $bridge) {
|
||||
//add the bridge to the fax_uri, after first iteration add the delimiter
|
||||
if ($key == 0) {
|
||||
$fax_uri = $bridge;
|
||||
}
|
||||
else {
|
||||
$fax_uri .= '|'.$bridge;
|
||||
}
|
||||
|
||||
//add the provider_prefix
|
||||
if (!empty($provider_prefix)) {
|
||||
$fax_uri = preg_replace('/\${provider_prefix}/', $provider_prefix, $fax_uri);
|
||||
}
|
||||
|
||||
//remove switch ${variables} from the bridge statement
|
||||
$fax_uri = preg_replace('/\${[^}]+}/', '', $fax_uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -299,13 +387,13 @@
|
|||
//build a list of fax variables
|
||||
$dial_string = $common_variables;
|
||||
$dial_string .= $fax_options.",";
|
||||
$dial_string .= "origination_uuid=" . $origination_uuid. ",";
|
||||
$dial_string .= "fax_uuid=" . $fax_uuid. ",";
|
||||
$dial_string .= "fax_queue_uuid=" . $fax_queue_uuid. ",";
|
||||
$dial_string .= "mailto_address='" . $fax_email_address . "',";
|
||||
$dial_string .= "origination_uuid=" . $origination_uuid . ",";
|
||||
$dial_string .= "fax_uuid=" . $fax_uuid . ",";
|
||||
$dial_string .= "fax_queue_uuid=" . $fax_queue_uuid . ",";
|
||||
$dial_string .= "mailto_address='" . $fax_email_address . "',";
|
||||
$dial_string .= "mailfrom_address='" . $email_from_address . "',";
|
||||
$dial_string .= "fax_retry_attempts=" . $fax_retry_count . ",";
|
||||
$dial_string .= "fax_retry_limit=" . $retry_limit . ",";
|
||||
$dial_string .= "fax_retry_attempts=" . $fax_retry_count . ",";
|
||||
$dial_string .= "fax_retry_limit=" . $retry_limit . ",";
|
||||
//$dial_string .= "fax_retry_sleep=180,";
|
||||
$dial_string .= "fax_verbose=true,";
|
||||
//$dial_string .= "fax_use_ecm=off,";
|
||||
|
|
@ -315,21 +403,18 @@
|
|||
//connect to event socket and send the command
|
||||
if ($fax_status != 'failed' && file_exists($fax_file)) {
|
||||
//send the fax and try another route if the fax fails
|
||||
foreach($route_array as $route) {
|
||||
$fax_command = "originate {" . $dial_string . ",fax_uri=".$route."}" . $route." &txfax('".$fax_file."')";
|
||||
$fax_response = event_socket::api($fax_command);
|
||||
$response = str_replace("\n", "", $fax_response);
|
||||
$response = trim(str_replace("+OK", "", $response));
|
||||
if (is_uuid($response)) {
|
||||
//originate command accepted
|
||||
$uuid = $response;
|
||||
echo "uuid: ".$uuid."\n";
|
||||
break;
|
||||
}
|
||||
else {
|
||||
//originate command failed (-ERR INVALID_GATEWAY or other errors)
|
||||
echo "response: ".$response."\n";
|
||||
}
|
||||
$fax_command = "originate {" . $dial_string . ",fax_uri=".$fax_uri."}" . $fax_uri." &txfax('".$fax_file."')";
|
||||
$fax_response = event_socket::api($fax_command);
|
||||
$response = str_replace("\n", "", $fax_response);
|
||||
$response = trim(str_replace("+OK", "", $response));
|
||||
if (is_uuid($response)) {
|
||||
//originate command accepted
|
||||
$uuid = $response;
|
||||
echo "uuid: ".$uuid."\n";
|
||||
}
|
||||
else {
|
||||
//originate command failed (-ERR INVALID_GATEWAY or other errors)
|
||||
echo "response: ".$response."\n";
|
||||
}
|
||||
|
||||
//set the fax file name without the extension
|
||||
|
|
@ -351,11 +436,10 @@
|
|||
$array['fax_queue'][0]['fax_response'] = $fax_response;
|
||||
|
||||
//add temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_queue_edit', 'temp');
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'fax queue';
|
||||
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
|
||||
$database->save($array, false);
|
||||
|
|
@ -399,7 +483,6 @@
|
|||
$parameters['template_language'] = $language_code;
|
||||
$parameters['template_category'] = 'fax';
|
||||
$parameters['template_type'] = 'html';
|
||||
$database = new database;
|
||||
$fax_templates = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
|
@ -451,7 +534,6 @@
|
|||
$sql .= "from v_fax_logs ";
|
||||
$sql .= "where fax_log_uuid = :fax_log_uuid ";
|
||||
$parameters['fax_log_uuid'] = $fax_log_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row)) {
|
||||
$fax_success = $row['fax_success'];
|
||||
|
|
@ -569,11 +651,10 @@
|
|||
$array['fax_queue'][0]['fax_notify_date'] = 'now()';
|
||||
|
||||
//add temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fax_queue_edit', 'temp');
|
||||
|
||||
//save the data
|
||||
$database = new database;
|
||||
$database->app_name = 'fax queue';
|
||||
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
|
||||
$database->save($array, false);
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@
|
|||
//process the messages
|
||||
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
|
||||
foreach($fax_queue as $row) {
|
||||
$command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
|
||||
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
|
||||
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."'";
|
||||
if (isset($debug)) {
|
||||
//run process inline to see debug info
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@
|
|||
}
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
|
|
@ -396,14 +396,11 @@
|
|||
echo " <div class='heading'><b>".$text['title-fifo']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$button_icon_back,'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'fifo.php']);
|
||||
// if ($action == 'update') {
|
||||
// if (permission_exists('fifo_member_add')) {
|
||||
// echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$button_icon_copy,'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
// }
|
||||
// if (permission_exists('fifo_member_delete')) {
|
||||
// echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
// }
|
||||
// }
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('fifo_member_delete')) {
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'action','value'=>'delete','style'=>'display: none; margin-right: 15px;']);
|
||||
}
|
||||
}
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$button_icon_save,'id'=>'btn_save','collapse'=>'hide-xs']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
|
@ -482,7 +479,7 @@
|
|||
echo " <th class='vtablereq'>".$text['label-member_enabled']."</th>\n";
|
||||
if (is_array($fifo_members) && @sizeof($fifo_members) > 1 && permission_exists('fifo_member_delete')) {
|
||||
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_details', 'delete_toggle_details');\" onmouseout=\"swap_display('delete_label_details', 'delete_toggle_details');\">\n";
|
||||
echo " <span id='delete_label_details'>".$text['label-action']."</span>\n";
|
||||
echo " <span id='delete_label_details'>".$text['label-delete']."</span>\n";
|
||||
echo " <span id='delete_toggle_details'><input type='checkbox' id='checkbox_all_details' name='checkbox_all' onclick=\"edit_all_toggle('details'); checkbox_on_change(this);\"></span>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -497,9 +494,9 @@
|
|||
if (empty($row["member_wrap_up_time"])) { $row["member_wrap_up_time"] = '10'; }
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][domain_uuid]' value=\"".escape($row["domain_uuid"])."\">\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][fifo_uuid]' value=\"".escape($row["fifo_uuid"])."\">\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][fifo_member_uuid]' value=\"".escape($row["fifo_member_uuid"])."\">\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][domain_uuid]' value=\"".escape($row["domain_uuid"])."\">\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][fifo_uuid]' value=\"".escape($row["fifo_uuid"])."\">\n";
|
||||
echo " <input type='hidden' name='fifo_members[$x][fifo_member_uuid]' value=\"".escape($row["fifo_member_uuid"])."\">\n";
|
||||
echo " <td class='formfld'>\n";
|
||||
echo " $member_contact\n";
|
||||
echo " </td>\n";
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ if (!class_exists('fifo')) {
|
|||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fifo_member_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ if (!class_exists('fifo')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('fifo_member_add', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
|
|||
|
|
@ -980,7 +980,7 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "flyingvoice_voice_vad";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "1";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "0";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set 1 = On, 0 = Off (default)";
|
||||
$y++;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "ivr_menu";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "direct_dial_digits_max";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "11";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "8";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
||||
$y++;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ if ($domains_processed == 1) {
|
|||
}
|
||||
if (!empty($array)) {
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('ivr_menu_edit', 'temp');
|
||||
|
||||
$database->app_name = 'ivr_menus';
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@
|
|||
$array['dialplans'] = $dialplan;
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add("dialplan_add", "temp");
|
||||
$p->add("dialplan_edit", "temp");
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//initialize the database
|
||||
$database = database::new();
|
||||
|
||||
//set the defaults
|
||||
$ivr_menu_name = '';
|
||||
$ivr_menu_extension = '';
|
||||
|
|
@ -70,7 +73,6 @@
|
|||
if (!empty($_SESSION['limit']['ivr_menus']['numeric'])) {
|
||||
$sql = "select count(*) as num_rows from v_ivr_menus where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$total_ivr_menus = $database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -176,7 +178,6 @@
|
|||
$sql = "select * from v_ivr_menus ";
|
||||
$sql .= "where ivr_menu_uuid = :ivr_menu_uuid ";
|
||||
$parameters['ivr_menu_uuid'] = $ivr_menu_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (!empty($row)) {
|
||||
if (!permission_exists('ivr_menu_domain')) {
|
||||
|
|
@ -392,7 +393,7 @@
|
|||
$array['dialplans'][0]["app_uuid"] = "a5788e9b-58bc-bd1b-df59-fff5d51253ab";
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
if ($action == "add") {
|
||||
$p->add("dialplan_add", "temp");
|
||||
}
|
||||
|
|
@ -401,7 +402,6 @@
|
|||
}
|
||||
|
||||
//save to the data
|
||||
$database = new database;
|
||||
$database->app_name = 'ivr_menus';
|
||||
$database->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
|
||||
$database->save($array);
|
||||
|
|
@ -441,7 +441,6 @@
|
|||
$sql .=" ) ";
|
||||
$sql .=" select * from ivr_menus ";
|
||||
$parameters['ivr_menu_parent_uuid'] = $ivr_menu_parent_uuid;
|
||||
$database = new database;
|
||||
$parent_uuids = $database->select($sql, $parameters, "all");
|
||||
if (!empty($parent_uuids)) {
|
||||
foreach ($parent_uuids as $x => $row) {
|
||||
|
|
@ -530,7 +529,6 @@
|
|||
$sql .= "order by natural_sort(ivr_menu_option_digits::text) asc, ivr_menu_option_order asc; ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['ivr_menu_uuid'] = $ivr_menu_uuid;
|
||||
$database = new database;
|
||||
$ivr_menu_options = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -539,7 +537,6 @@
|
|||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by v_ivr_menus asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$ivr_menus = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
|
@ -868,6 +865,16 @@
|
|||
unset($selected);
|
||||
}
|
||||
}
|
||||
else if ($key == 'phrases') {
|
||||
if (!empty($instance_value) && $instance_value == $row["value"]) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
unset($selected);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unset($selected);
|
||||
}
|
||||
|
|
@ -941,6 +948,16 @@
|
|||
unset($selected);
|
||||
}
|
||||
}
|
||||
else if ($key == 'phrases') {
|
||||
if (!empty($instance_value) && $instance_value == $row["value"]) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
unset($selected);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unset($selected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ if (!class_exists('ivr_menu')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('ivr_menu_option_delete', 'temp');
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ if (!class_exists('ivr_menu')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
//save the array
|
||||
|
|
@ -459,7 +459,7 @@ if (!class_exists('ivr_menu')) {
|
|||
if (!empty($array)) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('ivr_menu_option_add', 'temp');
|
||||
$p->add('dialplan_add', 'temp');
|
||||
|
||||
|
|
@ -471,7 +471,7 @@ if (!class_exists('ivr_menu')) {
|
|||
unset($array);
|
||||
|
||||
//revoke temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->delete('ivr_menu_option_add', 'temp');
|
||||
$p->delete('dialplan_add', 'temp');
|
||||
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ if (!class_exists('modules')) {
|
|||
}
|
||||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('module_add', 'temp');
|
||||
//execute insert
|
||||
$database = new database;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ if ($domains_processed == 1) {
|
|||
$array['music_on_hold'][0]['music_on_hold_chime_max'] = isset($chime_max) ? $chime_max : null;
|
||||
$array['music_on_hold'][0]['music_on_hold_path'] = $stream_path;
|
||||
|
||||
$p = new permissions;
|
||||
$p = permissions::new();
|
||||
$p->add('music_on_hold_add', 'temp');
|
||||
|
||||
$database->app_name = 'app_name';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue