Add a new dashboard

This commit is contained in:
markjcrane
2021-11-09 18:42:14 -07:00
parent 75e83ff879
commit 032a5aec39
34 changed files with 3249 additions and 20 deletions
@@ -28,7 +28,6 @@
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
if (permission_exists('call_center_queue_view')) {
@@ -0,0 +1,14 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = '9083305a-ebb4-4b67-bb9b-8c09cf030261';
$array['dashboard'][$x]['dashboard_name'] = 'Call Center Agents';
$array['dashboard'][$x]['dashboard_path'] = 'app/call_centers/resources/dashboard/call_center_agents.php';
$array['dashboard'][$x]['dashboard_order'] = '160';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Status for agent in a call center.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '22d8937c-a9b3-4458-b34c-0ebeda15ffad';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '9083305a-ebb4-4b67-bb9b-8c09cf030261';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'agent';
?>
+6 -6
View File
@@ -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-2019
Portions created by the Initial Developer are Copyright (C) 2008-2021
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -41,7 +41,7 @@
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'app/calls');
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
//get posted data
if (is_array($_POST['extensions'])) {
@@ -73,7 +73,7 @@
break;
}
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
header('Location: call_forward.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
@@ -200,7 +200,7 @@
echo " <div class='heading'><b>".$text['header-call_forward']."</b></div>\n";
echo " <div class='actions'>\n";
if ($num_rows > 10) {
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'project-diagram','collapse'=>false,'link'=>PROJECT_PATH.'/app/calls/calls.php']);
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'project-diagram','collapse'=>false,'link'=>PROJECT_PATH.'/app/call_forward/call_forward.php']);
}
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
@@ -231,7 +231,7 @@
}
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'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'calls.php','style'=>($search == '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_forward.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
@@ -284,7 +284,7 @@
if (is_array($extensions)) {
$x = 0;
foreach($extensions as $row) {
$list_row_url = PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']."&return_url=".urlencode($_SERVER['REQUEST_URI']);
$list_row_url = PROJECT_PATH."/app/call_forward/call_forward_edit.php?id=".$row['extension_uuid']."&return_url=".urlencode($_SERVER['REQUEST_URI']);
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (!$is_included && $extensions) {
echo " <td class='checkbox'>\n";
+1 -1
View File
@@ -495,7 +495,7 @@
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-call_forward']."</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','link'=>'calls.php']);
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'call_forward.php']);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
@@ -0,0 +1,51 @@
<?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
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
//require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
//set a variable for the included code to know its included
$is_included = true;
//include the call forward
require_once "app/call_forward/call_forward.php";
?>
@@ -0,0 +1,22 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
$array['dashboard'][$x]['dashboard_name'] = 'Call Forward';
$array['dashboard'][$x]['dashboard_path'] = 'app/call_forward/resources/dashboard/call_forward.php';
$array['dashboard'][$x]['dashboard_order'] = '0';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Call routing for extension using Call forward, Follow Me and Do Not Disturb.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '5de9537d-4098-405f-9922-caf5f85fade3';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b550e850-36d5-4cde-9936-85180f401df4';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '6d04646f-54cf-49f4-a3ce-a16e7adda2b9';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -0,0 +1,14 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = 'f1c722d5-b714-4fa2-9664-5f6d24d44661';
$array['dashboard'][$x]['dashboard_name'] = 'Device Keys';
$array['dashboard'][$x]['dashboard_path'] = 'app/devices/resources/dashboard/device_keys.php';
$array['dashboard'][$x]['dashboard_order'] = '160';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = '';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '0d04d50e-aa49-40d2-9e98-ed21f9070f6f';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'f1c722d5-b714-4fa2-9664-5f6d24d44661';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -0,0 +1,22 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
$array['dashboard'][$x]['dashboard_name'] = 'Domain Limits';
$array['dashboard'][$x]['dashboard_path'] = 'app/domain_limits/resources/dashboard/domain_limits.php';
$array['dashboard'][$x]['dashboard_order'] = '180';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = '';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'e99eb62e-4150-42a8-8c0c-4a264245f12a';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'db7c3c71-9761-4bd9-a166-ea5a0de2cd0e';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b8772e85-bcbd-4e8c-afba-e9c04a700bfa';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '2f7a90cc-8d60-4df4-98ee-2ef4000afac7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -0,0 +1,117 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('xml_cdr_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//domain limits
if (is_array($_SESSION['limit']) && sizeof($_SESSION['limit']) > 0) {
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
$show_stat = true;
if (permission_exists('extension_view')) {
$sql = "select count(extension_uuid) from v_extensions ";
$database = new database;
$extension_total = $database->select($sql, null, 'column');
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
$hud_stat = $extension_total;
$hud_stat_title = $text['label-total_extensions'];
}
else if (permission_exists('destination_view')) {
$sql = "select count(destination_uuid) from v_destinations ";
$database = new database;
$destination_total = $database->select($sql, null, 'column');
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/destinations/destinations.php'\"";
$hud_stat = $destination_total;
$hud_stat_title = $text['label-total_destinations'];
}
else {
$show_stat = false;
}
echo "<span class='hud_title' ".$onclick.">".$text['label-domain_limits']."</span>";
if ($show_stat) {
echo "<span class='hud_stat' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\">".$hud_stat."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\">".$hud_stat_title."</span>\n";
}
echo "<div class='hud_details hud_box' id='hud_domain_limits_details'>";
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<th class='hud_heading' width='50%'>".$text['label-feature']."</th>\n";
echo "<th class='hud_heading' width='50%' style='text-align: center;'>".$text['label-used']."</th>\n";
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
echo "</tr>\n";
foreach ($_SESSION['limit'] as $category => $value) {
$limit = $value['numeric'];
switch ($category) {
case 'users':
if (!permission_exists('user_view')) { continue 2; }
$url = '/core/users/users.php';
break;
case 'call_center_queues':
if (!permission_exists('call_center_active_view')) { continue 2; }
$url = '/app/call_centers/call_center_queues.php';
break;
case 'destinations':
if (!permission_exists('destination_view')) { continue 2; }
$url = '/app/destinations/destinations.php';
break;
case 'devices':
if (!permission_exists('device_view')) { continue 2; }
$url = '/app/devices/devices.php';
break;
case 'extensions':
if (!permission_exists('extension_view')) { continue 2; }
$url = '/app/extensions/extensions.php';
break;
case 'gateways':
if (!permission_exists('gateway_view')) { continue 2; }
$url = '/app/gateways/gateways.php';
break;
case 'ivr_menus':
if (!permission_exists('ivr_menu_view')) { continue 2; }
$url = '/app/ivr_menus/ivr_menus.php';
break;
case 'ring_groups':
if (!permission_exists('ring_group_view')) { continue 2; }
$url = '/app/ring_groups/ring_groups.php';
break;
}
$tr_link = "href='".PROJECT_PATH.$url."'";
echo "<tr ".$tr_link." style='cursor: pointer;'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-'.$category]."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats['domain'][$category]['total']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$limit."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
echo "</table>\n";
echo "</div>";
$n++;
echo " <span class='hud_expander' onclick=\"$('#hud_domain_limits_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
}
?>
@@ -101,14 +101,14 @@
//update the session array
foreach ($array['extensions'] as $row) {
$x=0;
foreach ($_SESSION['user']['extension'] as $field) {
if ($field['extension_uuid'] == $row['extension_uuid']) {
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
}
$x++;
$x=0;
foreach ($_SESSION['user']['extension'] as $field) {
if ($field['extension_uuid'] == $row['extension_uuid']) {
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
}
$x++;
}
}
//remove the temporary permission
@@ -232,4 +232,4 @@
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
?>
?>
@@ -0,0 +1,22 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
$array['dashboard'][$x]['dashboard_name'] = 'Caller ID';
$array['dashboard'][$x]['dashboard_path'] = 'app/extensions/resources/dashboard/caller_id.php';
$array['dashboard'][$x]['dashboard_order'] = '160';
$array['dashboard'][$x]['dashboard_enabled'] = 'false';
$array['dashboard'][$x]['dashboard_description'] = '';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '931f7a2f-43fb-4d3d-8e39-e546a82206fa';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '47f4f687-d346-4614-b61f-fcf730f56d53';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'ab2dd268-057d-419d-bf5a-1d3730d60daa';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '3bac3209-2f51-47db-b5fe-a1a804f49da9';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
+1 -1
View File
@@ -24,7 +24,7 @@
$apps[$x]['menu'][$y]['uuid'] = "a1144e12-873e-4722-9818-02da1adb6ba3";
$apps[$x]['menu'][$y]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][$y]['category'] = "internal";
$apps[$x]['menu'][$y]['path'] = "/app/calls/calls.php";
$apps[$x]['menu'][$y]['path'] = "/app/call_forward/call_forward.php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$apps[$x]['menu'][$y]['groups'][] = "admin";
$apps[$x]['menu'][$y]['groups'][] = "user";
@@ -0,0 +1,22 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
$array['dashboard'][$x]['dashboard_name'] = 'Ring Group Forward';
$array['dashboard'][$x]['dashboard_path'] = 'app/ring_groups/resources/dashboard/ring_group_forward.php';
$array['dashboard'][$x]['dashboard_order'] = '140';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Used for updating ring group call forward.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '7aa0fdf0-100a-4ee3-ae37-67cb9a021493';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '10ec859b-2325-4d66-92ce-410da9e1ee62';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'f7ef37b1-8134-48d1-b25a-d1a50bf0e339';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'b5da1d72-2cc7-422e-b05c-f07659aed419';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -59,14 +59,14 @@
//find the path
switch ($_SERVER['REQUEST_URI']) {
case PROJECT_PATH."/core/user_settings/user_dashboard.php":
$validated_path = PROJECT_PATH."/core/user_settings/user_dashboard.php";
case PROJECT_PATH."/app/dashboard/index.php":
$validated_path = PROJECT_PATH."/app/dashboard/index.php";
break;
case PROJECT_PATH."/app/ring_groups/ring_group_forward.php":
$validated_path = PROJECT_PATH."/app/ring_groups/ring_group_forward.php";
break;
default:
$validated_path = PROJECT_PATH."/app/ring_groups/ring_group_forward.php";
$validated_path = PROJECT_PATH."/app/ring_groups/resources/dashboard/ring_group_forward.php";
}
//update ring group forwarding
@@ -107,6 +107,7 @@
//set message
message::add($text['message-update']);
$validated_path = PROJECT_PATH."/app/dashboard/index.php";
//redirect the user
header("Location: ".$validated_path);
@@ -0,0 +1,90 @@
<?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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>
+30
View File
@@ -0,0 +1,30 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
$array['dashboard'][$x]['dashboard_name'] = 'System Counts';
$array['dashboard'][$x]['dashboard_path'] = 'app/system/resources/dashboard/system_counts.php';
$array['dashboard'][$x]['dashboard_order'] = '80';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'A list of showing the count of active and inactive domains, devices, extensions, gateways, users, desttinations, ring groups and more';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'a772d2a8-7c1f-4453-b77b-2e15b510a78d';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '127382ae-0dd1-45eb-869c-56a708220de5';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'bb76f7fc-669f-41dd-a636-6ddaee5deae1';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$x++;
$array['dashboard'][$x]['dashboard_uuid'] = 'c9b1f67a-d78a-4299-a16e-594a4b7cd246';
$array['dashboard'][$x]['dashboard_name'] = 'System Status';
$array['dashboard'][$x]['dashboard_path'] = 'app/system/resources/dashboard/system_status.php';
$array['dashboard'][$x]['dashboard_order'] = '100';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'System information like CPU and DIsk usage.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '625971b9-4892-4948-97e6-8bb8d409f4e1';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c9b1f67a-d78a-4299-a16e-594a4b7cd246';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
?>
@@ -0,0 +1,197 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('xml_cdr_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//system counts
//if (is_array($selected_blocks) && in_array('counts', $selected_blocks)) {
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
$scope = (permission_exists('dialplan_add')) ? 'system' : 'domain';
$show_stat = true;
if (permission_exists('domain_view')) {
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/core/domains/domains.php'\"";
$hud_stat = $stats[$scope]['domains']['total'] - $stats[$scope]['domains']['disabled'];
$hud_stat_title = $text['label-active_domains'];
}
else if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
$hud_stat = $stats[$scope]['extensions']['total'] - $stats[$scope]['extensions']['disabled'];
$hud_stat_title = $text['label-active_extensions'];
}
else if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/core/users/users.php'\"";
$hud_stat = $stats[$scope]['users']['total'] - $stats[$scope]['users']['disabled'];
$hud_stat_title = $text['label-active_users'];
}
else {
$show_stat = false;
}
echo "<span class='hud_title' ".$onclick.">".$text['label-system_counts']."</span>";
if ($show_stat) {
echo "<span class='hud_stat' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\">".$hud_stat."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\">".$hud_stat_title."</span>\n";
}
echo "<div class='hud_details hud_box' id='hud_system_counts_details'>";
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
echo "<th class='hud_heading' width='50%' style='text-align: center; padding-left: 0; padding-right: 0;'>".$text['label-disabled']."</th>\n";
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
echo "</tr>\n";
//domains
if (permission_exists('domain_view')) {
$tr_link = "href='".PROJECT_PATH."/core/domains/domains.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-domains']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['domains']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['domains']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//devices
if (permission_exists('device_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/devices/")) {
$tr_link = "href='".PROJECT_PATH."/app/devices/devices.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-devices']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['devices']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['devices']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//extensions
if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
$tr_link = "href='".PROJECT_PATH."/app/extensions/extensions.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-extensions']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['extensions']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['extensions']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//gateways
if (permission_exists('gateway_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/gateways/")) {
$tr_link = "href='".PROJECT_PATH."/app/gateways/gateways.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-gateways']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['gateways']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['gateways']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//users
if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
$tr_link = "href='".PROJECT_PATH."/core/users/users.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-users']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['users']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['users']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//destinations
if (permission_exists('destination_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/destinations/")) {
$tr_link = "href='".PROJECT_PATH."/app/destinations/destinations.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-destinations']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['destinations']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['destinations']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//call center queues
if (permission_exists('call_center_active_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/call_centers/")) {
$tr_link = "href='".PROJECT_PATH."/app/call_centers/call_center_queues.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-call_center_queues']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['call_center_queues']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['call_center_queues']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//ivr menus
if (permission_exists('ivr_menu_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ivr_menus/")) {
$tr_link = "href='".PROJECT_PATH."/app/ivr_menus/ivr_menus.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ivr_menus']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ivr_menus']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ivr_menus']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//ring groups
if (permission_exists('ring_group_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ring_groups/")) {
$tr_link = "href='".PROJECT_PATH."/app/ring_groups/ring_groups.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ring_groups']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ring_groups']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['ring_groups']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//voicemails
if (permission_exists('voicemail_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemails.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-voicemail']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['voicemails']['disabled']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['voicemails']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//messages
if (permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
echo "<tr>\n";
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
echo "<th class='hud_heading' width='50%' style='text-align: center; padding-left: 0; padding-right: 0;'>".$text['label-new']."</th>\n";
echo "<th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>\n";
echo "</tr>\n";
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemails.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-messages']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['messages']['new']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".$stats[$scope]['messages']['total']."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
echo "</table>\n";
echo "</div>";
$n++;
//}
echo " <span class='hud_expander' onclick=\"$('#hud_system_counts_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
?>
@@ -0,0 +1,204 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('xml_cdr_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//system status
//if (is_array($selected_blocks) && in_array('system', $selected_blocks)) {
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<span class='hud_title' style='cursor: default;'>".$text['label-system_status']."</span>";
//disk usage
if (PHP_OS == 'FreeBSD' || PHP_OS == 'Linux') {
$tmp = shell_exec("df /home 2>&1");
$tmp = explode("\n", $tmp);
$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
$tmp = explode(' ', $tmp);
foreach ($tmp as $stat) {
if (substr_count($stat, '%') > 0) { $percent_disk_usage = rtrim($stat,'%'); break; }
}
if ($percent_disk_usage != '') {
echo "<span class='hud_stat' onclick=\"$('#hud_system_status_details').slideToggle('fast');\">".$percent_disk_usage."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_system_status_details').slideToggle('fast');\" style='cursor: default;'>".$text['label-disk_usage']." (%)</span>\n";
}
}
echo "<span class='hud_stat' onclick=\"$('#hud_system_status_details').slideToggle('fast');\">".$num_rows."</span>";
echo "<div class='hud_details hud_box' id='hud_system_status_details'>";
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
echo "<th class='hud_heading' style='text-align: right;'>".$text['label-value']."</th>\n";
echo "</tr>\n";
//pbx version
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".(isset($_SESSION['theme']['title']['text'])?$_SESSION['theme']['title']['text']:'FusionPBX')."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".software::version()."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
//os uptime
if (stristr(PHP_OS, 'Linux')) {
unset($tmp);
$cut = shell_exec("/usr/bin/which cut");
$uptime = trim(shell_exec(escapeshellcmd($cut." -d. -f1 /proc/uptime")));
$tmp['y'] = floor($uptime/60/60/24/365);
$tmp['d'] = $uptime/60/60/24%365;
$tmp['h'] = $uptime/60/60%24;
$tmp['m'] = $uptime/60%60;
$tmp['s'] = $uptime%60;
$uptime = (($tmp['y'] != 0 && $tmp['y'] != '') ? $tmp['y'].'y ' : null);
$uptime .= (($tmp['d'] != 0 && $tmp['d'] != '') ? $tmp['d'].'d ' : null);
$uptime .= (($tmp['h'] != 0 && $tmp['h'] != '') ? $tmp['h'].'h ' : null);
$uptime .= (($tmp['m'] != 0 && $tmp['m'] != '') ? $tmp['m'].'m ' : null);
$uptime .= (($tmp['s'] != 0 && $tmp['s'] != '') ? $tmp['s'].'s' : null);
if ($uptime != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-system_uptime']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$uptime."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
//memory usage (for available memory, use "free | awk 'FNR == 3 {print $4/($3+$4)*100}'" instead)
if (stristr(PHP_OS, 'Linux')) {
$free = shell_exec("/usr/bin/which free");
$awk = shell_exec("/usr/bin/which awk");
$percent_memory = round(shell_exec(escapeshellcmd($free." | ".$awk." 'FNR == 3 {print $3/($3+$4)*100}'")), 1);
if ($percent_memory != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_usage']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_memory."%</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
//memory available
if (stristr(PHP_OS, 'Linux')) {
$result = trim(shell_exec('free -hw | grep \'Mem:\' | cut -d\' \' -f 55-64'));
if ($result != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_available']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$result."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
//disk usage
if (stristr(PHP_OS, 'Linux')) {
//calculated above
if ($percent_disk_usage != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-disk_usage']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_disk_usage."%</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
//cpu usage
if (stristr(PHP_OS, 'Linux')) {
$result = shell_exec('ps -A -o pcpu');
$percent_cpu = 0;
foreach (explode("\n", $result) as $value) {
if (is_numeric($value)) { $percent_cpu = $percent_cpu + $value; }
}
$result = trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
$cores = count(explode("\n", $result));
if ($percent_cpu > 1) { $percent_cpu = $percent_cpu / $cores; }
$percent_cpu = round($percent_cpu, 2);
if ($percent_cpu != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-processor_usage']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$percent_cpu."%</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
//db connections
switch ($db_type) {
case 'pgsql':
$sql = "select count(*) from pg_stat_activity";
break;
case 'mysql':
$sql = "show status where `variable_name` = 'Threads_connected'";
break;
default:
unset($sql);
if ($db_path != '' && $dbfilename != '') {
$tmp = shell_exec("lsof ".realpath($db_path).'/'.$dbfilename);
$tmp = explode("\n", $tmp);
$connections = sizeof($tmp) - 1;
}
}
if ($sql != '') {
$database = new database;
$connections = $database->select($sql, null, 'column');
unset($sql);
}
if ($connections != '') {
echo "<tr class='tr_link_void'>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-database_connections']."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$connections."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//channel count
if ($fp) {
$tmp = event_socket_request($fp, 'api status');
$matches = Array();
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
$channels = $matches[1] ? $matches[1] : 0;
$tr_link = "href='".PROJECT_PATH."/app/calls_active/calls_active.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-channels']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$channels."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
//registration count
if ($fp && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
$registration = new registrations;
$registrations = $registration->count();
$tr_link = "href='".PROJECT_PATH."/app/registrations/registrations.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-registrations']."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$registrations."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
echo "</table>\n";
echo "</div>";
$n++;
//}
echo " <span class='hud_expander' onclick=\"$('#hud_system_status_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
?>
@@ -0,0 +1,22 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
$array['dashboard'][$x]['dashboard_name'] = 'New Messages';
$array['dashboard'][$x]['dashboard_path'] = 'app/voicemails/resources/dashboard/voicemails.php';
$array['dashboard'][$x]['dashboard_order'] = '20';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Count the new voicemail messages and list of assigned voicemail boxes.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '05466c38-88cd-456c-98cd-4cbf323af04f';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '5320e3a7-255e-49b0-9ff5-172f590dcdf1';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '9052c80b-802f-4111-baa4-202a41ec7ffc';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'be2aaa22-d8f1-4d9b-b5f9-14a26da329cb';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -0,0 +1,94 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('voicemail_view') || permission_exists('voicemail_message_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//used for missed and recent calls
$theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/";
//voicemail
//if (is_array($selected_blocks) && in_array('voicemail', $selected_blocks) && permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
//required class
require_once "app/voicemails/resources/classes/voicemail.php";
//get the voicemail
$vm = new voicemail;
$vm->db = $db;
$vm->domain_uuid = $_SESSION['domain_uuid'];
$vm->order_by = $order_by;
$vm->order = $order;
$voicemails = $vm->messages();
//sum total and new
$messages['total'] = 0;
$messages['new'] = 0;
if (sizeof($voicemails) > 0) {
foreach($voicemails as $field) {
$messages[$field['voicemail_uuid']]['ext'] = $field['voicemail_id'];
$messages[$field['voicemail_uuid']]['total'] = 0;
$messages[$field['voicemail_uuid']]['new'] = 0;
foreach($field['messages'] as &$row) {
if ($row['message_status'] == '') {
$messages[$field['voicemail_uuid']]['new']++;
$messages['new']++;
}
$messages[$field['voicemail_uuid']]['total']++;
$messages['total']++;
}
}
}
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php';\">".$text['label-voicemail']."</span>";
echo "<span class='hud_stat' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">".$messages['new']."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">".$text['label-new_messages']."</span>\n";
echo "<div class='hud_details hud_box' id='hud_voicemail_details'>";
if (sizeof($voicemails) > 0) {
echo "<table class='tr_hover' cellpadding='2' cellspacing='0' border='0' width='100%'>";
echo "<tr>";
echo " <th class='hud_heading' width='50%'>".$text['label-voicemail']."</th>";
echo " <th class='hud_heading' style='text-align: center;' width='50%'>".$text['label-new']."</th>";
echo " <th class='hud_heading' style='text-align: center;'>".$text['label-total']."</th>";
echo "</tr>";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
foreach ($messages as $voicemail_uuid => $row) {
if (is_uuid($voicemail_uuid)) {
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'";
echo "<tr ".$tr_link." style='cursor: pointer;'>";
echo " <td class='".$row_style[$c]." hud_text'><a href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'>".$row['ext']."</a></td>";
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['new']."</td>";
echo " <td class='".$row_style[$c]." hud_text' style='text-align: center;'>".$row['total']."</td>";
echo "</tr>";
$c = ($c) ? 0 : 1;
}
}
echo "</table>";
}
else {
echo "<br />".$text['label-no_voicemail_assigned'];
}
echo "</div>";
$n++;
//}
echo " <span class='hud_expander' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
?>
@@ -0,0 +1,43 @@
<?php
$array['dashboard'][$x]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
$array['dashboard'][$x]['dashboard_name'] = 'Missed Calls';
$array['dashboard'][$x]['dashboard_path'] = 'app/xml_cdr/resources/dashboard/missed_calls.php';
$array['dashboard'][$x]['dashboard_order'] = '40';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Show number and list of calls that were missed.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '85573555-7e18-4449-aa59-a264a7addda9';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'cde35063-58ca-4cdd-94fa-a1c4ee03e66c';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'b6e6c697-5351-484c-808d-884589c6d527';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '6ad0e056-bf3d-465a-956d-bd77d513ab36';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
$x++;
$array['dashboard'][$x]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
$array['dashboard'][$x]['dashboard_name'] = 'Recent Calls';
$array['dashboard'][$x]['dashboard_path'] = 'app/xml_cdr/resources/dashboard/recent_calls.php';
$array['dashboard'][$x]['dashboard_order'] = '60';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'List of recent calls.';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '976018d2-ed21-4ccd-a95c-ef7e36c1134e';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '62e53c42-aa15-4a4a-abf0-fb8cd37bafad';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'admin';
$y++;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = 'a923b923-f1c9-4244-abfd-132c5a2f5b6e';
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = 'c323e296-b1cf-42ea-9c57-fc00697915b7';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'user';
?>
@@ -0,0 +1,144 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('xml_cdr_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//missed calls
//if (is_array($selected_blocks) && in_array('missed', $selected_blocks) && permission_exists('xml_cdr_view') && is_array($_SESSION['user']['extension']) && sizeof($_SESSION['user']['extension']) > 0) {
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
}
unset($assigned_extension);
//if also viewing system status, show more recent calls (more room avaialble)
$missed_limit = (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5;
$sql = "select \n";
$sql .= " direction, \n";
$sql .= " start_stamp, \n";
$sql .= " start_epoch, \n";
$sql .= " caller_id_name, \n";
$sql .= " caller_id_number, \n";
$sql .= " answer_stamp \n";
$sql .= "from \n";
$sql .= " v_xml_cdr \n";
$sql .= "where \n";
$sql .= " domain_uuid = :domain_uuid \n";
$sql .= " and ( \n";
$sql .= " direction = 'inbound' \n";
$sql .= " or direction = 'local' \n";
$sql .= " ) \n";
$sql .= " and (missed_call = true or bridge_uuid is null) ";
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
$x = 0;
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
$sql_where_array[] = "extension_uuid = :assigned_extension_uuid_".$x;
$sql_where_array[] = "destination_number = :destination_number_".$x;
$parameters['assigned_extension_uuid_'.$x] = $assigned_extension_uuid;
$parameters['destination_number_'.$x] = $assigned_extension;
$x++;
}
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
$sql .= "and (".implode(' or ', $sql_where_array).") \n";
}
unset($sql_where_array);
}
$sql .= "and start_epoch > ".(time() - 86400)." \n";
$sql .= "order by \n";
$sql .= "start_epoch desc \n";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
//echo $sql;
//view_array($parameters);
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$num_rows = is_array($result) ? sizeof($result) : 0;
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?call_result=missed'\">".$text['label-missed_calls']."</span>";
echo "<span class='hud_stat' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\">".$num_rows."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\">".$text['label-last_24_hours']."</span>\n";
echo "<div class='hud_details hud_box' id='hud_missed_calls_details'>";
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
if ($num_rows > 0) {
echo "<th class='hud_heading'>&nbsp;</th>\n";
}
echo "<th class='hud_heading' width='100%'>".$text['label-cid_number']."</th>\n";
echo "<th class='hud_heading'>".$text['label-missed']."</th>\n";
echo "</tr>\n";
if ($num_rows > 0) {
$theme_cdr_images_exist = (
file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") &&
file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") &&
file_exists($theme_image_path."icon_cdr_local_voicemail.png") &&
file_exists($theme_image_path."icon_cdr_local_cancelled.png")
) ? true : false;
foreach($result as $index => $row) {
if ($index + 1 > $missed_limit) { break; } //only show limit
$tmp_year = date("Y", strtotime($row['start_stamp']));
$tmp_month = date("M", strtotime($row['start_stamp']));
$tmp_day = date("d", strtotime($row['start_stamp']));
$tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("n/j g:ia", $row['start_epoch']) : date("n/j H:i", $row['start_epoch']);
//set click-to-call variables
if (permission_exists('click_to_call_call')) {
$tr_link = "onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php".
"?src_cid_name=".urlencode($row['caller_id_name']).
"&src_cid_number=".urlencode($row['caller_id_number']).
"&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name']).
"&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number']).
"&src=".urlencode($_SESSION['user']['extension'][0]['user']).
"&dest=".urlencode($row['caller_id_number']).
"&rec=".(isset($_SESSION['click_to_call']['record']['boolean'])?$_SESSION['click_to_call']['record']['boolean']:"false").
"&ringback=".(isset($_SESSION['click_to_call']['ringback']['text'])?$_SESSION['click_to_call']['ringback']['text']:"us-ring").
"&auto_answer=".(isset($_SESSION['click_to_call']['auto_answer']['boolean'])?$_SESSION['click_to_call']['auto_answer']['boolean']:"true").
"');\" ".
"style='cursor: pointer;'";
}
echo "<tr ".$tr_link.">\n";
echo "<td valign='middle' class='".$row_style[$c]."' style='cursor: help; padding: 0 0 0 6px;'>\n";
if ($theme_cdr_images_exist) {
$call_result = ($row['answer_stamp'] != '') ? 'voicemail' : 'cancelled';
if (isset($row['direction'])) {
echo " <img src='".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_".$row['direction']."_".$call_result.".png' width='16' style='border: none;' title='".$text['label-'.$row['direction']].": ".$text['label-'.$call_result]."'>\n";
}
}
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'><a href='javascript:void(0);' ".(($row['caller_id_name'] != '') ? "title=\"".$row['caller_id_name']."\"" : null).">".((is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'])."</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$tmp_start_epoch."</td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
}
unset($sql, $parameters, $result, $num_rows, $index, $row);
echo "</table>\n";
echo "<span style='display: block; margin: 6px 0 7px 0;'><a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php?call_result=missed'>".$text['label-view_all']."</a></span>\n";
echo "</div>";
$n++;
//}
echo " <span class='hud_expander' onclick=\"$('#hud_missed_calls_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
?>
@@ -0,0 +1,176 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permisions
require_once "resources/check_auth.php";
if (permission_exists('xml_cdr_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
//recent calls
//if (is_array($selected_blocks) && in_array('recent', $selected_blocks) && permission_exists('xml_cdr_view') && is_array($_SESSION['user']['extension']) && sizeof($_SESSION['user']['extension']) > 0) {
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
}
//if also viewing system status, show more recent calls (more room avaialble)
$recent_limit = (is_array($selected_blocks) && in_array('counts', $selected_blocks)) ? 10 : 5;
$sql = "
select
direction,
start_stamp,
start_epoch,
caller_id_name,
caller_id_number,
destination_number,
answer_stamp,
bridge_uuid,
sip_hangup_disposition
from
v_xml_cdr
where
domain_uuid = :domain_uuid ";
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
$x = 0;
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
$sql_where_array[] = "extension_uuid = :extension_uuid_".$x;
$sql_where_array[] = "caller_id_number = :caller_id_number_".$x;
$sql_where_array[] = "destination_number = :destination_number_1_".$x;
$sql_where_array[] = "destination_number = :destination_number_2_".$x;
$parameters['extension_uuid_'.$x] = $assigned_extension_uuid;
$parameters['caller_id_number_'.$x] = $assigned_extension;
$parameters['destination_number_1_'.$x] = $assigned_extension;
$parameters['destination_number_2_'.$x] = '*99'.$assigned_extension;
$x++;
}
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
$sql .= "and (".implode(' or ', $sql_where_array).") ";
}
unset($sql_where_array);
}
$sql .= "
and start_epoch > ".(time() - 86400)."
order by
start_epoch desc";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$result = $database->select($sql, $parameters, 'all');
$num_rows = is_array($result) ? sizeof($result) : 0;
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<span class='hud_title' onclick=\"document.location.href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php';\">".$text['label-recent_calls']."</span>";
echo "<span class='hud_stat' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\">".$num_rows."</span>";
echo "<span class='hud_stat_title' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\">".$text['label-last_24_hours']."</span>\n";
echo "<div class='hud_details hud_box' id='hud_recent_calls_details'>";
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr>\n";
if ($num_rows > 0) {
echo "<th class='hud_heading'>&nbsp;</th>\n";
}
echo "<th class='hud_heading' width='100%'>".$text['label-cid_number']."</th>\n";
echo "<th class='hud_heading'>".$text['label-date_time']."</th>\n";
echo "</tr>\n";
if ($num_rows > 0) {
$theme_cdr_images_exist = (
file_exists($theme_image_path."icon_cdr_inbound_answered.png") &&
file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") &&
file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") &&
file_exists($theme_image_path."icon_cdr_inbound_failed.png") &&
file_exists($theme_image_path."icon_cdr_outbound_answered.png") &&
file_exists($theme_image_path."icon_cdr_outbound_cancelled.png") &&
file_exists($theme_image_path."icon_cdr_outbound_failed.png") &&
file_exists($theme_image_path."icon_cdr_local_answered.png") &&
file_exists($theme_image_path."icon_cdr_local_voicemail.png") &&
file_exists($theme_image_path."icon_cdr_local_cancelled.png") &&
file_exists($theme_image_path."icon_cdr_local_failed.png")
) ? true : false;
foreach($result as $index => $row) {
if ($index + 1 > $recent_limit) { break; } //only show limit
$tmp_year = date("Y", strtotime($row['start_stamp']));
$tmp_month = date("M", strtotime($row['start_stamp']));
$tmp_day = date("d", strtotime($row['start_stamp']));
$tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("n/j g:ia", $row['start_epoch']) : date("n/j H:i", $row['start_epoch']);
//determine name
$cdr_name = ($row['direction'] == 'inbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['destination_number'], $assigned_extensions))) ? $row['caller_id_name'] : $row['destination_number'];
//determine number to display
if ($row['direction'] == 'inbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['destination_number'], $assigned_extensions))) {
$cdr_number = (is_numeric($row['caller_id_number'])) ? format_phone($row['caller_id_number']) : $row['caller_id_number'];
$dest = $row['caller_id_number'];
}
else if ($row['direction'] == 'outbound' || ($row['direction'] == 'local' && is_array($assigned_extensions) && in_array($row['caller_id_number'], $assigned_extensions))) {
$cdr_number = (is_numeric($row['destination_number'])) ? format_phone($row['destination_number']) : $row['destination_number'];
$dest = $row['destination_number'];
}
//set click-to-call variables
if (permission_exists('click_to_call_call')) {
$tr_link = "onclick=\"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php".
"?src_cid_name=".urlencode($cdr_name).
"&src_cid_number=".urlencode($cdr_number).
"&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name']).
"&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number']).
"&src=".urlencode($_SESSION['user']['extension'][0]['user']).
"&dest=".urlencode($dest).
"&rec=".(isset($_SESSION['click_to_call']['record']['boolean'])?$_SESSION['click_to_call']['record']['boolean']:"false").
"&ringback=".(isset($_SESSION['click_to_call']['ringback']['text'])?$_SESSION['click_to_call']['ringback']['text']:"us-ring").
"&auto_answer=".(isset($_SESSION['click_to_call']['auto_answer']['boolean'])?$_SESSION['click_to_call']['auto_answer']['boolean']:"true").
"');\" ".
"style='cursor: pointer;'";
}
echo "<tr ".$tr_link.">\n";
//determine call result and appropriate icon
echo "<td valign='middle' class='".$row_style[$c]."' style='cursor: help; padding: 0 0 0 6px;'>\n";
if ($theme_cdr_images_exist) {
if ($row['direction'] == 'inbound' || $row['direction'] == 'local') {
if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
else if ($row['answer_stamp'] != '' && $row['bridge_uuid'] == '') { $call_result = 'voicemail'; }
else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] == '' && $row['sip_hangup_disposition'] != 'send_refuse') { $call_result = 'cancelled'; }
else { $call_result = 'failed'; }
}
else if ($row['direction'] == 'outbound') {
if ($row['answer_stamp'] != '' && $row['bridge_uuid'] != '') { $call_result = 'answered'; }
else if ($row['answer_stamp'] == '' && $row['bridge_uuid'] != '') { $call_result = 'cancelled'; }
else { $call_result = 'failed'; }
}
if (isset($row['direction'])) {
echo "<img src='".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_".$row['direction']."_".$call_result.".png' width='16' style='border: none;' title='".$text['label-'.$row['direction']].": ".$text['label-'.$call_result]."'>\n";
}
}
echo "</td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'><a href='javascript:void(0);' ".(($cdr_name != '') ? "title=\"".$cdr_name."\"" : null).">".$cdr_number."</a></td>\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text' nowrap='nowrap'>".$tmp_start_epoch."</td>\n";
echo "</tr>\n";
unset($cdr_name, $cdr_number);
$c = ($c) ? 0 : 1;
}
}
unset($sql, $parameters, $result, $num_rows, $index, $row);
echo "</table>\n";
echo "<span style='display: block; margin: 6px 0 7px 0;'><a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr.php'>".$text['label-view_all']."</a></span>\n";
echo "</div>";
$n++;
//}
echo " <span class='hud_expander' onclick=\"$('#hud_recent_calls_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
?>
+90
View File
@@ -0,0 +1,90 @@
<?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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>