Update extension caller_id so it would work better with the dashboard

This commit is contained in:
FusionPBX 2021-11-11 14:05:22 -07:00 committed by GitHub
parent 60d67c6db9
commit 1b7785c8ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 177 additions and 183 deletions

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) 2017 - 2019
Portions created by the Initial Developer are Copyright (C) 2017 - 2021
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -29,28 +29,21 @@
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('extension_caller_id')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'app/extensions');
//add or update the database
//add or update the database
if (is_array($_POST['extensions']) && @sizeof($_POST['extensions']) != 0) {
//validate the token
$token = new token;
if (!$token->validate('/app/extensions/extension_dashboard.php')) {
if (!$token->validate($_SERVER["DOCUMENT_ROOT"].'/extensions/resources/dashboard/caller_id.php')) {
message::add($text['message-invalid_token'],'negative');
header('Location: /core/user_settings/user_dashboard.php');
header('Location: /core/dashboard/');
exit;
}
@ -124,17 +117,17 @@
message::add($text['message-update']);
//redirect the browser
header("Location: /core/user_settings/user_dashboard.php");
header("Location: /core/dashboard/");
exit;
}
//set the sub array index
//set the sub array index
$x = "999";
//get the extensions
//get the extensions
$extensions = $_SESSION['user']['extension'];
//get the destinations
//get the destinations
$sql = "select destination_caller_id_name, destination_caller_id_number from v_destinations ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and destination_type = 'inbound' ";
@ -144,11 +137,11 @@
$destinations = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//create token
//create token
$object = new token;
$token = $object->create('/app/extensions/extension_dashboard.php');
$token = $object->create($_SERVER["DOCUMENT_ROOT"].'/extensions/resources/dashboard/caller_id.php');
//show the content
//show the content
echo "<div class='action_bar sub'>\n";
echo " <div class='heading'><b>".$text['label-caller_id_number']."</b></div>\n";
echo " <div class='actions'>\n";
@ -157,7 +150,7 @@
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<form id='form_list_extension_caller_id' method='post' action='".PROJECT_PATH."/app/extensions/extension_dashboard.php'>\n";
echo "<form id='form_list_extension_caller_id' method='post' action='/app/extensions/resources/dashboard/caller_id.php'>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
@ -231,5 +224,6 @@
echo "<br />\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
}
?>