Merge pull request #1557 from hcoin/fix-warnings

Mariadb 10.1, Freeswitch 1.6, Ubuntu Xenial LTS, Ldaps, warnings enabled, cli install/upgrade
This commit is contained in:
FusionPBX
2016-04-28 14:43:06 -06:00
216 changed files with 41215 additions and 40927 deletions

View File

@@ -48,9 +48,6 @@
else {
$xml_string = "<configuration name=\"acl.conf\" description=\"Network Lists\">\n";
$xml_string .= " <network-lists>\n";
$xml_string .= " <list name=\"lan\" default=\"allow\">\n";
$xml_string .= " <node type=\"allow\" cidr=\"192.168.42.42/32\"/>\n";
$xml_string .= " </list>\n";
$xml_string .= " <list name=\"domains\" default=\"deny\">\n";
$xml_string .= " <node type=\"allow\" domain=\"".$_SESSION['domain_name']."\"/>\n";
$xml_string .= " </list>\n";

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,19 +1,19 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Adminer";
$apps[$x]['menu'][0]['title']['es-cl'] = "Administrador";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Admin BDD";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Administrador";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "1f59d07b-b4f7-4f9e-bde9-312cf491d66e";
$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][0]['category'] = "external";
$apps[$x]['menu'][0]['path'] = "<!--{project_path}-->/app/adminer/index.php";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Adminer";
$apps[$x]['menu'][0]['title']['es-cl'] = "Administrador";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Admin BDD";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Administrador";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "1f59d07b-b4f7-4f9e-bde9-312cf491d66e";
$apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][0]['category'] = "external";
$apps[$x]['menu'][0]['path'] = "<!--{project_path}-->/app/adminer/index.php";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,258 +1,258 @@
<?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>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists("backup_download")) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//download the backup
if ($_GET['a'] == "download" && permission_exists('backup_download')) {
$file_format = $_GET['file_format'];
$file_format = ($file_format != '') ? $file_format : 'tgz';
//build the backup file
$backup_path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp';
$backup_file = 'backup_'.date('Ymd_His').'.'.$file_format;
if (count($_SESSION['backup']['path']) > 0) {
//determine compression method
switch ($file_format) {
case "rar" : $cmd = 'rar a -ow -r '; break;
case "zip" : $cmd = 'zip -r '; break;
case "tbz" : $cmd = 'tar -jvcf '; break;
default : $cmd = 'tar -zvcf ';
}
$cmd .= $backup_path.'/'.$backup_file.' ';
foreach ($_SESSION['backup']['path'] as $value) {
$cmd .= $value.' ';
}
exec($cmd);
//download the file
session_cache_limiter('public');
if (file_exists($backup_path."/".$backup_file)) {
$fd = fopen($backup_path."/".$backup_file, 'rb');
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename='.$backup_file);
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Length: ".filesize($backup_path."/".$backup_file));
header("Pragma: no-cache");
header("Expires: 0");
ob_clean();
fpassthru($fd);
exit;
}
else {
//set response message
$_SESSION["message"] = $text['message-backup_failed_format'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
else {
//set response message
$_SESSION["message"] = $text['message-backup_failed_paths'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
//script a backup (cron)
if ($_GET['a'] == "script" && permission_exists('backup_download')) {
$file_format = $_GET['file_format'];
$target_type = "script";
$backup = new backup;
$command = $backup->command("backup", $file_format);
}
//restore a backup
if ($_POST['a'] == "restore" && permission_exists('backup_upload')) {
$backup_path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp';
$backup_file = $_FILES['backup_file']['name'];
if (is_uploaded_file($_FILES['backup_file']['tmp_name'])) {
//move temp file to backup path
move_uploaded_file($_FILES['backup_file']['tmp_name'], $backup_path.'/'.$backup_file);
//determine file format and restore backup
$file_format = pathinfo($_FILES['backup_file']['name'], PATHINFO_EXTENSION);
$valid_format = true;
switch ($file_format) {
case "rar" : $cmd = 'rar x -ow -o+ '.$backup_path.'/'.$backup_file.' /'; break;
case "zip" : $cmd = 'umask 755; unzip -o -qq -X -K '.$backup_path.'/'.$backup_file.' -d /'; break;
case "tbz" : $cmd = 'tar -xvpjf '.$backup_path.'/'.$backup_file.' -C /'; break;
case "tgz" : $cmd = 'tar -xvpzf '.$backup_path.'/'.$backup_file.' -C /'; break;
default: $valid_format = false;
}
if (!$valid_format) {
@unlink($backup_path.'/'.$backup_file);
$_SESSION["message"] = $text['message-restore_failed_format'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
exec($cmd);
//set response message
$_SESSION["message"] = $text['message-restore_completed'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
else {
//set response message
$_SESSION["message"] = $text['message-restore_failed_upload'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
//add the header
require_once "resources/header.php";
$document['title'] = $text['title-destinations'];
// backup type switch javascript
echo "<script language='javascript' type='text/javascript'>";
echo " var fade_speed = 400;";
echo " function toggle_target(first_elem, second_elem) {";
echo " $('#command').fadeOut(fade_speed);";
echo " $('#'+first_elem).fadeToggle(fade_speed, function() {";
echo " $('#command').slideUp(fade_speed, function() {";
echo " $('#'+second_elem).fadeToggle(fade_speed);";
echo " });";
echo " });";
echo " }";
echo "</script>";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' valign='top'>\n";
echo "<b>".$text['header-backup']."</b>\n";
echo "<br><br>";
echo $text['description-backup']."\n";
echo "<br><br><br>";
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-source_paths']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
foreach ($_SESSION['backup']['path'] as $backup_path) {
echo $backup_path."<br>\n";
}
echo "</td>";
echo "</tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-file_format']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='file_format' id='file_format'>";
echo " <option value='tgz' ".(($file_format == 'tgz') ? 'selected' : null).">TAR GZIP</option>";
echo " <option value='tbz' ".(($file_format == 'tbz') ? 'selected' : null).">TAR BZIP</option>";
echo " <option value='rar' ".(($file_format == 'rar') ? 'selected' : null).">RAR</option>";
echo " <option value='zip' ".(($file_format == 'zip') ? 'selected' : null).">ZIP</option>";
echo " </select>";
echo "</td>";
echo "</tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-target_type']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='target_type' id='target_type' onchange=\"(this.selectedIndex == 0) ? toggle_target('btn_script','btn_download') : toggle_target('btn_download','btn_script');\">";
echo " <option value='download'>".$text['option-file_download']."</option>";
echo " <option value='script' ".(($target_type == 'script') ? 'selected' : null).">".$text['option-command']."</option>";
echo " </select>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<div id='command' ".(($command == '') ? "style='display: none;'" : null).">";
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-command']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <textarea class='formfld' style='width: 100%; height: 200px; font-family: courier;'>".$command."</textarea>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br>";
echo "<div align='right'>";
echo "<input type='button' id='btn_script' class='btn' ".(($target_type != 'script') ? "style='display: none;'" : null)." value='".$text['button-generate']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=script&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
echo "<input type='button' id='btn_download' class='btn' ".(($target_type == 'script') ? "style='display: none;'" : null)." value='".$text['button-download']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=download&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
echo "</div>";
echo "<br><br>";
if (permission_exists("backup_upload")) {
echo " </td>\n";
echo " <td width='20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
echo " <td width='50%' valign='top'>\n";
echo " <b>".$text['header-restore']."</b>\n";
echo " <br><br>";
echo $text['description-restore']."\n";
echo " <br><br><br>";
echo " <div align='center'>";
echo " <form name='frmrestore' method='post' enctype='multipart/form-data' action=''>";
echo " <input type='hidden' name='a' value='restore'>";
echo " <table>";
echo " <tr>";
echo " <td nowrap>".$text['label-select_backup']."&nbsp;</td>";
echo " <td><input type='file' class='formfld fileinput' name='backup_file'></td>";
echo " <td><input type='submit' class='btn' value='".$text['button-restore']."'></td>";
echo " </tr>";
echo " </table>";
echo " <br>";
echo " <span style='font-weight: bold; text-decoration: underline; color: #000;'>".$text['description-restore_warning']."</span>";
echo " </form>\n";
echo " </div>";
echo " </td>\n";
}
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>";
//show 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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists("backup_download")) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//download the backup
if ($_GET['a'] == "download" && permission_exists('backup_download')) {
$file_format = $_GET['file_format'];
$file_format = ($file_format != '') ? $file_format : 'tgz';
//build the backup file
$backup_path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp';
$backup_file = 'backup_'.date('Ymd_His').'.'.$file_format;
if (count($_SESSION['backup']['path']) > 0) {
//determine compression method
switch ($file_format) {
case "rar" : $cmd = 'rar a -ow -r '; break;
case "zip" : $cmd = 'zip -r '; break;
case "tbz" : $cmd = 'tar -jvcf '; break;
default : $cmd = 'tar -zvcf ';
}
$cmd .= $backup_path.'/'.$backup_file.' ';
foreach ($_SESSION['backup']['path'] as $value) {
$cmd .= $value.' ';
}
exec($cmd);
//download the file
session_cache_limiter('public');
if (file_exists($backup_path."/".$backup_file)) {
$fd = fopen($backup_path."/".$backup_file, 'rb');
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename='.$backup_file);
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Length: ".filesize($backup_path."/".$backup_file));
header("Pragma: no-cache");
header("Expires: 0");
ob_clean();
fpassthru($fd);
exit;
}
else {
//set response message
$_SESSION["message"] = $text['message-backup_failed_format'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
else {
//set response message
$_SESSION["message"] = $text['message-backup_failed_paths'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
//script a backup (cron)
if ($_GET['a'] == "script" && permission_exists('backup_download')) {
$file_format = $_GET['file_format'];
$target_type = "script";
$backup = new backup;
$command = $backup->command("backup", $file_format);
}
//restore a backup
if ($_POST['a'] == "restore" && permission_exists('backup_upload')) {
$backup_path = ($_SESSION['server']['backup']['path'] != '') ? $_SESSION['server']['backup']['path'] : '/tmp';
$backup_file = $_FILES['backup_file']['name'];
if (is_uploaded_file($_FILES['backup_file']['tmp_name'])) {
//move temp file to backup path
move_uploaded_file($_FILES['backup_file']['tmp_name'], $backup_path.'/'.$backup_file);
//determine file format and restore backup
$file_format = pathinfo($_FILES['backup_file']['name'], PATHINFO_EXTENSION);
$valid_format = true;
switch ($file_format) {
case "rar" : $cmd = 'rar x -ow -o+ '.$backup_path.'/'.$backup_file.' /'; break;
case "zip" : $cmd = 'umask 755; unzip -o -qq -X -K '.$backup_path.'/'.$backup_file.' -d /'; break;
case "tbz" : $cmd = 'tar -xvpjf '.$backup_path.'/'.$backup_file.' -C /'; break;
case "tgz" : $cmd = 'tar -xvpzf '.$backup_path.'/'.$backup_file.' -C /'; break;
default: $valid_format = false;
}
if (!$valid_format) {
@unlink($backup_path.'/'.$backup_file);
$_SESSION["message"] = $text['message-restore_failed_format'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
else {
exec($cmd);
//set response message
$_SESSION["message"] = $text['message-restore_completed'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
else {
//set response message
$_SESSION["message"] = $text['message-restore_failed_upload'];
header("Location: ".$_SERVER['PHP_SELF']);
exit;
}
}
//add the header
require_once "resources/header.php";
$document['title'] = $text['title-destinations'];
// backup type switch javascript
echo "<script language='javascript' type='text/javascript'>";
echo " var fade_speed = 400;";
echo " function toggle_target(first_elem, second_elem) {";
echo " $('#command').fadeOut(fade_speed);";
echo " $('#'+first_elem).fadeToggle(fade_speed, function() {";
echo " $('#command').slideUp(fade_speed, function() {";
echo " $('#'+second_elem).fadeToggle(fade_speed);";
echo " });";
echo " });";
echo " }";
echo "</script>";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' valign='top'>\n";
echo "<b>".$text['header-backup']."</b>\n";
echo "<br><br>";
echo $text['description-backup']."\n";
echo "<br><br><br>";
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-source_paths']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
foreach ($_SESSION['backup']['path'] as $backup_path) {
echo $backup_path."<br>\n";
}
echo "</td>";
echo "</tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-file_format']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='file_format' id='file_format'>";
echo " <option value='tgz' ".(($file_format == 'tgz') ? 'selected' : null).">TAR GZIP</option>";
echo " <option value='tbz' ".(($file_format == 'tbz') ? 'selected' : null).">TAR BZIP</option>";
echo " <option value='rar' ".(($file_format == 'rar') ? 'selected' : null).">RAR</option>";
echo " <option value='zip' ".(($file_format == 'zip') ? 'selected' : null).">ZIP</option>";
echo " </select>";
echo "</td>";
echo "</tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-target_type']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='target_type' id='target_type' onchange=\"(this.selectedIndex == 0) ? toggle_target('btn_script','btn_download') : toggle_target('btn_download','btn_script');\">";
echo " <option value='download'>".$text['option-file_download']."</option>";
echo " <option value='script' ".(($target_type == 'script') ? 'selected' : null).">".$text['option-command']."</option>";
echo " </select>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<div id='command' ".(($command == '') ? "style='display: none;'" : null).">";
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-command']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <textarea class='formfld' style='width: 100%; height: 200px; font-family: courier;'>".$command."</textarea>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br>";
echo "<div align='right'>";
echo "<input type='button' id='btn_script' class='btn' ".(($target_type != 'script') ? "style='display: none;'" : null)." value='".$text['button-generate']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=script&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
echo "<input type='button' id='btn_download' class='btn' ".(($target_type == 'script') ? "style='display: none;'" : null)." value='".$text['button-download']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=download&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
echo "</div>";
echo "<br><br>";
if (permission_exists("backup_upload")) {
echo " </td>\n";
echo " <td width='20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
echo " <td width='50%' valign='top'>\n";
echo " <b>".$text['header-restore']."</b>\n";
echo " <br><br>";
echo $text['description-restore']."\n";
echo " <br><br><br>";
echo " <div align='center'>";
echo " <form name='frmrestore' method='post' enctype='multipart/form-data' action=''>";
echo " <input type='hidden' name='a' value='restore'>";
echo " <table>";
echo " <tr>";
echo " <td nowrap>".$text['label-select_backup']."&nbsp;</td>";
echo " <td><input type='file' class='formfld fileinput' name='backup_file'></td>";
echo " <td><input type='submit' class='btn' value='".$text['button-restore']."'></td>";
echo " </tr>";
echo " </table>";
echo " <br>";
echo " <span style='font-weight: bold; text-decoration: underline; color: #000;'>".$text['description-restore_warning']."</span>";
echo " </form>\n";
echo " </div>";
echo " </td>\n";
}
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>";
//show the footer
require_once "resources/footer.php";
?>

5
app/backup/root.php Executable file → Normal file
View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,360 +1,360 @@
<?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>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name'];
//convert the string to a named array
function str_to_named_array($tmp_str, $tmp_delimiter) {
$tmp_array = explode ("\n", $tmp_str);
$result = '';
if (trim(strtoupper($tmp_array[0])) != "+OK") {
$tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]);
$x = 0;
foreach ($tmp_array as $row) {
if ($x > 0) {
$tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]);
$y = 0;
foreach ($tmp_field_value_array as $tmp_value) {
$tmp_name = $tmp_field_name_array[$y];
if (trim(strtoupper($tmp_value)) != "+OK") {
$result[$x][$tmp_name] = $tmp_value;
}
$y++;
}
}
$x++;
}
unset($row);
}
return $result;
}
//alternate the color of the row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create an event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the call center queue, agent and tiers list
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//get the agent list
//show the title
echo "<b>".$text['header-agents']."</b><br />\n";
echo $text['description-agents']."<br /><br />\n";
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
$switch_cmd = 'callcenter_config queue list tiers '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//prepare the result for array_multisort
$x = 0;
foreach ($result as $row) {
$tier_result[$x]['level'] = $row['level'];
$tier_result[$x]['position'] = $row['position'];
$tier_result[$x]['agent'] = $row['agent'];
$tier_result[$x]['state'] = trim($row['state']);
$tier_result[$x]['queue'] = $row['queue'];
$x++;
}
//sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
array_multisort($tier_result, SORT_ASC);
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
$switch_cmd = 'callcenter_config queue list agents '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_result = str_to_named_array($event_socket_str, '|');
//list the agents
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-state']."</th>\n";
echo "<th>".$text['label-status_change']."</th>\n";
echo "<th>".$text['label-missed']."</th>\n";
echo "<th>".$text['label-answered']."</th>\n";
echo "<th>".$text['label-tier_state']."</th>\n";
echo "<th>".$text['label-tier_level']."</th>\n";
echo "<th>".$text['label-tier_position']."</th>\n";
if (permission_exists('call_center_active_options')) {
echo "<th>".$text['label-options']."</th>\n";
}
echo "</tr>\n";
foreach ($tier_result as $tier_row) {
//$queue = $tier_row['queue'];
//$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue);
$agent = $tier_row['agent'];
//$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent);
$tier_state = $tier_row['state'];
$tier_level = $tier_row['level'];
$tier_position = $tier_row['position'];
foreach ($agent_result as $agent_row) {
if ($tier_row['agent'] == $agent_row['name']) {
$name = $agent_row['name'];
$name = str_replace('@'.$_SESSION['domain_name'], '', $name);
//$system = $agent_row['system'];
$a_uuid = $agent_row['uuid'];
//$type = $agent_row['type'];
$contact = $agent_row['contact'];
$a_exten = preg_replace("/user\//", "", $contact);
$a_exten = preg_replace("/@.*/", "", $a_exten);
$a_exten = preg_replace("/{.*}/", "", $a_exten);
$status = $agent_row['status'];
$state = $agent_row['state'];
$max_no_answer = $agent_row['max_no_answer'];
$wrap_up_time = $agent_row['wrap_up_time'];
$reject_delay_time = $agent_row['reject_delay_time'];
$busy_delay_time = $agent_row['busy_delay_time'];
$last_bridge_start = $agent_row['last_bridge_start'];
$last_bridge_end = $agent_row['last_bridge_end'];
//$last_offered_call = $agent_row['last_offered_call'];
$last_status_change = $agent_row['last_status_change'];
$no_answer_count = $agent_row['no_answer_count'];
$calls_answered = $agent_row['calls_answered'];
$talk_time = $agent_row['talk_time'];
$ready_time = $agent_row['ready_time'];
$last_offered_call_seconds = time() - $last_offered_call;
$last_offered_call_length_hour = floor($last_offered_call_seconds/3600);
$last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60));
$last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60));
$last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min);
$last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec);
$last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec;
$last_status_change_seconds = time() - $last_status_change;
$last_status_change_length_hour = floor($last_status_change_seconds/3600);
$last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60));
$last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60));
$last_status_change_length_min = sprintf("%02d", $last_status_change_length_min);
$last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec);
$last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$a_exten."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$status."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$last_status_change_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$no_answer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$calls_answered."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_level."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_position."</td>\n";
if (permission_exists('call_center_active_options')) {
echo "<td valign='top' class='".$row_style[$c]."'>";
//need to check state to so only waiting gets call, and trying/answer gets eavesdrop
if ($tier_state == "Offering" || $tier_state == "Active Inbound") {
$orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$a_uuid.")";
//debug
//echo $orig_command;
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
$xfer_command = $a_uuid." -bleg ".$_SESSION['user']['extension'][0]['user']." XML ".$_SESSION['domain_name'];
//$xfer_command = $a_uuid." ".$_SESSION['user']['extension'][0]['user']." XML default";
$xfer_command = urlencode($xfer_command);
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=uuid_transfer+".$xfer_command."');}\">".$text['label-transfer']."</a>&nbsp;\n";
}
else {
$orig_call="{origination_caller_id_name=c2c-".urlencode($name).",origination_caller_id_number=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26bridge(user/".$a_exten."@".$_SESSION['domain_name'].")";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_call.")');}\">".$text['label-call']."</a>&nbsp;\n";
}
echo "</td>";
}
}
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n\n";
//add vertical spacing
echo "<br />";
echo "<br />";
echo "<br />";
echo "<br />";
//get the queue list
//send the event socket command and get the response
//callcenter_config queue list members [queue_name]
$switch_cmd = 'callcenter_config queue list members '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//show the title
$q_waiting=0;
$q_trying=0;
$q_answered=0;
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>".$text['label-queue'].": ".ucfirst($_GET[queue_name])."</b><br />\n";
echo " ".$text['description-queue']."<br />\n";
echo " </td>\n";
echo " <td align='right' valign='top'>";
foreach ($result as $row) {
$state = $row['state'];
$q_trying += ($state == "Trying") ? 1 : 0;
$q_waiting += ($state == "Waiting") ? 1 : 0;
$q_answered += ($state == "Answered") ? 1 : 0;
}
echo " <strong>".$text['label-waiting'].":</strong> <b>".$q_waiting."</b>&nbsp;&nbsp;&nbsp;";
echo " <strong>".$text['label-trying'].":</strong> <b>".$q_trying."</b>&nbsp;&nbsp;&nbsp; ";
echo " <strong>".$text['label-answered'].":</strong> <b>".$q_answered."</b>";
echo " </td>";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-time']."</th>\n";
//echo "<th>".$text['label-system']."</th>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-number']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
if ((if_group("admin") || if_group("superadmin"))) {
echo "<th>".$text['label-options']."</th>\n";
}
echo "<th>".$text['label-agent']."</th>\n";
echo "</tr>\n";
foreach ($result as $row) {
$queue = $row['queue'];
$system = $row['system'];
$uuid = $row['uuid'];
$session_uuid = $row['session_uuid'];
$caller_number = $row['cid_number'];
$caller_name = $row['cid_name'];
$system_epoch = $row['system_epoch'];
$joined_epoch = $row['joined_epoch'];
$rejoined_epoch = $row['rejoined_epoch'];
$bridge_epoch = $row['bridge_epoch'];
$abandoned_epoch = $row['abandoned_epoch'];
$base_score = $row['base_score'];
$skill_score = $row['skill_score'];
$serving_agent = $row['serving_agent'];
$serving_system = $row['serving_system'];
$state = $row['state'];
$joined_seconds = time() - $joined_epoch;
$joined_length_hour = floor($joined_seconds/3600);
$joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60));
$joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60));
$joined_length_min = sprintf("%02d", $joined_length_min);
$joined_length_sec = sprintf("%02d", $joined_length_sec);
$joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec;
//$system_seconds = time() - $system_epoch;
//$system_length_hour = floor($system_seconds/3600);
//$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60));
//$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60));
//$system_length_min = sprintf("%02d", $system_length_min);
//$system_length_sec = sprintf("%02d", $system_length_sec);
//$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$joined_length."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$system_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_name."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_number."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<td valign='top' class='".$row_style[$c]."'>";
if ($state != "Abandoned") {
$q_caller_number = urlencode($caller_number);
$orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$q_caller_number."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$session_uuid.")";
//debug
//echo $orig_command;
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
}
else {
echo "&nbsp;";
}
echo "</td>";
}
echo "<td valign='top' class='".$row_style[$c]."'>".$serving_agent."&nbsp;</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
}
?>
<?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>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the queue_name and set it as a variable
$queue_name = $_GET[queue_name].'@'. $_SESSION['domains'][$domain_uuid]['domain_name'];
//convert the string to a named array
function str_to_named_array($tmp_str, $tmp_delimiter) {
$tmp_array = explode ("\n", $tmp_str);
$result = '';
if (trim(strtoupper($tmp_array[0])) != "+OK") {
$tmp_field_name_array = explode ($tmp_delimiter, $tmp_array[0]);
$x = 0;
foreach ($tmp_array as $row) {
if ($x > 0) {
$tmp_field_value_array = explode ($tmp_delimiter, $tmp_array[$x]);
$y = 0;
foreach ($tmp_field_value_array as $tmp_value) {
$tmp_name = $tmp_field_name_array[$y];
if (trim(strtoupper($tmp_value)) != "+OK") {
$result[$x][$tmp_name] = $tmp_value;
}
$y++;
}
}
$x++;
}
unset($row);
}
return $result;
}
//alternate the color of the row
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create an event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get the call center queue, agent and tiers list
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
else {
//get the agent list
//show the title
echo "<b>".$text['header-agents']."</b><br />\n";
echo $text['description-agents']."<br /><br />\n";
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
$switch_cmd = 'callcenter_config queue list tiers '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//prepare the result for array_multisort
$x = 0;
foreach ($result as $row) {
$tier_result[$x]['level'] = $row['level'];
$tier_result[$x]['position'] = $row['position'];
$tier_result[$x]['agent'] = $row['agent'];
$tier_result[$x]['state'] = trim($row['state']);
$tier_result[$x]['queue'] = $row['queue'];
$x++;
}
//sort the array //SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
array_multisort($tier_result, SORT_ASC);
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
$switch_cmd = 'callcenter_config queue list agents '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$agent_result = str_to_named_array($event_socket_str, '|');
//list the agents
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
echo "<th>".$text['label-state']."</th>\n";
echo "<th>".$text['label-status_change']."</th>\n";
echo "<th>".$text['label-missed']."</th>\n";
echo "<th>".$text['label-answered']."</th>\n";
echo "<th>".$text['label-tier_state']."</th>\n";
echo "<th>".$text['label-tier_level']."</th>\n";
echo "<th>".$text['label-tier_position']."</th>\n";
if (permission_exists('call_center_active_options')) {
echo "<th>".$text['label-options']."</th>\n";
}
echo "</tr>\n";
foreach ($tier_result as $tier_row) {
//$queue = $tier_row['queue'];
//$queue = str_replace('@'.$_SESSION['domain_name'], '', $queue);
$agent = $tier_row['agent'];
//$agent = str_replace('@'.$_SESSION['domain_name'], '', $agent);
$tier_state = $tier_row['state'];
$tier_level = $tier_row['level'];
$tier_position = $tier_row['position'];
foreach ($agent_result as $agent_row) {
if ($tier_row['agent'] == $agent_row['name']) {
$name = $agent_row['name'];
$name = str_replace('@'.$_SESSION['domain_name'], '', $name);
//$system = $agent_row['system'];
$a_uuid = $agent_row['uuid'];
//$type = $agent_row['type'];
$contact = $agent_row['contact'];
$a_exten = preg_replace("/user\//", "", $contact);
$a_exten = preg_replace("/@.*/", "", $a_exten);
$a_exten = preg_replace("/{.*}/", "", $a_exten);
$status = $agent_row['status'];
$state = $agent_row['state'];
$max_no_answer = $agent_row['max_no_answer'];
$wrap_up_time = $agent_row['wrap_up_time'];
$reject_delay_time = $agent_row['reject_delay_time'];
$busy_delay_time = $agent_row['busy_delay_time'];
$last_bridge_start = $agent_row['last_bridge_start'];
$last_bridge_end = $agent_row['last_bridge_end'];
//$last_offered_call = $agent_row['last_offered_call'];
$last_status_change = $agent_row['last_status_change'];
$no_answer_count = $agent_row['no_answer_count'];
$calls_answered = $agent_row['calls_answered'];
$talk_time = $agent_row['talk_time'];
$ready_time = $agent_row['ready_time'];
$last_offered_call_seconds = time() - $last_offered_call;
$last_offered_call_length_hour = floor($last_offered_call_seconds/3600);
$last_offered_call_length_min = floor($last_offered_call_seconds/60 - ($last_offered_call_length_hour * 60));
$last_offered_call_length_sec = $last_offered_call_seconds - (($last_offered_call_length_hour * 3600) + ($last_offered_call_length_min * 60));
$last_offered_call_length_min = sprintf("%02d", $last_offered_call_length_min);
$last_offered_call_length_sec = sprintf("%02d", $last_offered_call_length_sec);
$last_offered_call_length = $last_offered_call_length_hour.':'.$last_offered_call_length_min.':'.$last_offered_call_length_sec;
$last_status_change_seconds = time() - $last_status_change;
$last_status_change_length_hour = floor($last_status_change_seconds/3600);
$last_status_change_length_min = floor($last_status_change_seconds/60 - ($last_status_change_length_hour * 60));
$last_status_change_length_sec = $last_status_change_seconds - (($last_status_change_length_hour * 3600) + ($last_status_change_length_min * 60));
$last_status_change_length_min = sprintf("%02d", $last_status_change_length_min);
$last_status_change_length_sec = sprintf("%02d", $last_status_change_length_sec);
$last_status_change_length = $last_status_change_length_hour.':'.$last_status_change_length_min.':'.$last_status_change_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$name."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$a_exten."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$status."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$last_status_change_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$no_answer_count."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$calls_answered."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_state."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_level."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$tier_position."</td>\n";
if (permission_exists('call_center_active_options')) {
echo "<td valign='top' class='".$row_style[$c]."'>";
//need to check state to so only waiting gets call, and trying/answer gets eavesdrop
if ($tier_state == "Offering" || $tier_state == "Active Inbound") {
$orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$a_uuid.")";
//debug
//echo $orig_command;
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
$xfer_command = $a_uuid." -bleg ".$_SESSION['user']['extension'][0]['user']." XML ".$_SESSION['domain_name'];
//$xfer_command = $a_uuid." ".$_SESSION['user']['extension'][0]['user']." XML default";
$xfer_command = urlencode($xfer_command);
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=uuid_transfer+".$xfer_command."');}\">".$text['label-transfer']."</a>&nbsp;\n";
}
else {
$orig_call="{origination_caller_id_name=c2c-".urlencode($name).",origination_caller_id_number=".$a_exten."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26bridge(user/".$a_exten."@".$_SESSION['domain_name'].")";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_call.")');}\">".$text['label-call']."</a>&nbsp;\n";
}
echo "</td>";
}
}
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n\n";
//add vertical spacing
echo "<br />";
echo "<br />";
echo "<br />";
echo "<br />";
//get the queue list
//send the event socket command and get the response
//callcenter_config queue list members [queue_name]
$switch_cmd = 'callcenter_config queue list members '.$queue_name;
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
$result = str_to_named_array($event_socket_str, '|');
//show the title
$q_waiting=0;
$q_trying=0;
$q_answered=0;
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>".$text['label-queue'].": ".ucfirst($_GET[queue_name])."</b><br />\n";
echo " ".$text['description-queue']."<br />\n";
echo " </td>\n";
echo " <td align='right' valign='top'>";
foreach ($result as $row) {
$state = $row['state'];
$q_trying += ($state == "Trying") ? 1 : 0;
$q_waiting += ($state == "Waiting") ? 1 : 0;
$q_answered += ($state == "Answered") ? 1 : 0;
}
echo " <strong>".$text['label-waiting'].":</strong> <b>".$q_waiting."</b>&nbsp;&nbsp;&nbsp;";
echo " <strong>".$text['label-trying'].":</strong> <b>".$q_trying."</b>&nbsp;&nbsp;&nbsp; ";
echo " <strong>".$text['label-answered'].":</strong> <b>".$q_answered."</b>";
echo " </td>";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-time']."</th>\n";
//echo "<th>".$text['label-system']."</th>\n";
echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-number']."</th>\n";
echo "<th>".$text['label-status']."</th>\n";
if ((if_group("admin") || if_group("superadmin"))) {
echo "<th>".$text['label-options']."</th>\n";
}
echo "<th>".$text['label-agent']."</th>\n";
echo "</tr>\n";
foreach ($result as $row) {
$queue = $row['queue'];
$system = $row['system'];
$uuid = $row['uuid'];
$session_uuid = $row['session_uuid'];
$caller_number = $row['cid_number'];
$caller_name = $row['cid_name'];
$system_epoch = $row['system_epoch'];
$joined_epoch = $row['joined_epoch'];
$rejoined_epoch = $row['rejoined_epoch'];
$bridge_epoch = $row['bridge_epoch'];
$abandoned_epoch = $row['abandoned_epoch'];
$base_score = $row['base_score'];
$skill_score = $row['skill_score'];
$serving_agent = $row['serving_agent'];
$serving_system = $row['serving_system'];
$state = $row['state'];
$joined_seconds = time() - $joined_epoch;
$joined_length_hour = floor($joined_seconds/3600);
$joined_length_min = floor($joined_seconds/60 - ($joined_length_hour * 60));
$joined_length_sec = $joined_seconds - (($joined_length_hour * 3600) + ($joined_length_min * 60));
$joined_length_min = sprintf("%02d", $joined_length_min);
$joined_length_sec = sprintf("%02d", $joined_length_sec);
$joined_length = $joined_length_hour.':'.$joined_length_min.':'.$joined_length_sec;
//$system_seconds = time() - $system_epoch;
//$system_length_hour = floor($system_seconds/3600);
//$system_length_min = floor($system_seconds/60 - ($system_length_hour * 60));
//$system_length_sec = $system_seconds - (($system_length_hour * 3600) + ($system_length_min * 60));
//$system_length_min = sprintf("%02d", $system_length_min);
//$system_length_sec = sprintf("%02d", $system_length_sec);
//$system_length = $system_length_hour.':'.$system_length_min.':'.$system_length_sec;
echo "<tr>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$joined_length."</td>\n";
//echo "<td valign='top' class='".$row_style[$c]."'>".$system_length."</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_name."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$caller_number."&nbsp;</td>\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$state."</td>\n";
if (if_group("admin") || if_group("superadmin")) {
echo "<td valign='top' class='".$row_style[$c]."'>";
if ($state != "Abandoned") {
$q_caller_number = urlencode($caller_number);
$orig_command="{origination_caller_id_name=eavesdrop,origination_caller_id_number=".$q_caller_number."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." %26eavesdrop(".$session_uuid.")";
//debug
//echo $orig_command;
//echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=log+".$orig_command.")');}\">log_cmd</a>&nbsp;\n";
echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['message-confirm']."');if (confirm_response){send_cmd('call_center_exec.php?cmd=originate+".$orig_command.")');}\">".$text['label-eavesdrop']."</a>&nbsp;\n";
}
else {
echo "&nbsp;";
}
echo "</td>";
}
echo "<td valign='top' class='".$row_style[$c]."'>".$serving_agent."&nbsp;</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "</table>\n";
//add vertical spacing
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
}
?>

View File

@@ -1,100 +1,100 @@
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim(check_str($_GET["action"]));
$data = trim(check_str($_GET["data"]));
$username = trim(check_str($_GET["username"]));
}
//authorized commands
if (stristr($switch_cmd, 'user_status') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'callcenter_config') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'eavesdrop') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'bridge') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_transfer') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
//set the username
if (if_group("admin") || if_group("superadmin")) {
//use the username that was provided
}
else {
$username = $_SESSION['username'];
}
//get to php variables
if (count($_GET)>0) {
if ($action == "user_status") {
$user_status = $data;
$sql = "update v_users set ";
$sql .= "user_status = '".trim($user_status, "'")."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//ensure the connection exists
if ($fp) {
//send the command
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//set the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
}
}
?>
<?php
/* $Id$ */
/*
v_exec.php
Copyright (C) 2008 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('call_center_active_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//http get variables set to php variables
if (count($_GET)>0) {
$switch_cmd = trim($_GET["cmd"]);
$action = trim(check_str($_GET["action"]));
$data = trim(check_str($_GET["data"]));
$username = trim(check_str($_GET["username"]));
}
//authorized commands
if (stristr($switch_cmd, 'user_status') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'callcenter_config') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'eavesdrop') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'bridge') == true) {
//authorized;
} elseif (stristr($switch_cmd, 'uuid_transfer') == true) {
//authorized;
} else {
//not found. this command is not authorized
echo "access denied";
exit;
}
//set the username
if (if_group("admin") || if_group("superadmin")) {
//use the username that was provided
}
else {
$username = $_SESSION['username'];
}
//get to php variables
if (count($_GET)>0) {
if ($action == "user_status") {
$user_status = $data;
$sql = "update v_users set ";
$sql .= "user_status = '".trim($user_status, "'")."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '".$username."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
//fs cmd
if (strlen($switch_cmd) > 0) {
//setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//ensure the connection exists
if ($fp) {
//send the command
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//set the user state
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
}
}
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,27 +1,27 @@
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
?>

View File

@@ -1,224 +1,224 @@
<?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>
Copyright (C) 2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* cache class provides an abstracted cache
*
* @method string dialplan - builds the dialplan for call center
*/
//define the call center class
if (!class_exists('call_center')) {
class call_center {
/**
* define the variables
*/
public $domain_uuid;
public $call_center_queue_uuid;
public $dialplan_uuid;
public $queue_name;
public $queue_description;
public $destination_number;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan() {
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->destination_number;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "210";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->queue_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^".$this->destination_number."\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=".$this->queue_cid_prefix."#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name.'@'.$_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":",$this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0])+1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
}
}
/*
$o = new call_center;
$c->domain_uuid = "";
$c->dialplan_uuid = "";
$c->queue_name = "";
$c->queue_cid_prefix = "";
$c->queue_timeout_action = "";
$c->queue_description = "";
$c->destination_number = "";
$c->dialplan();
*/
<?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>
Copyright (C) 2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* cache class provides an abstracted cache
*
* @method string dialplan - builds the dialplan for call center
*/
//define the call center class
if (!class_exists('call_center')) {
class call_center {
/**
* define the variables
*/
public $domain_uuid;
public $call_center_queue_uuid;
public $dialplan_uuid;
public $queue_name;
public $queue_description;
public $destination_number;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan() {
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->destination_number;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "210";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->queue_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^".$this->destination_number."\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=".$this->queue_cid_prefix."#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name.'@'.$_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":",$this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0])+1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
}
}
/*
$o = new call_center;
$c->domain_uuid = "";
$c->dialplan_uuid = "";
$c->queue_name = "";
$c->queue_cid_prefix = "";
$c->queue_timeout_action = "";
$c->queue_description = "";
$c->destination_number = "";
$c->dialplan();
*/
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,475 +1,475 @@
<?php
$text['title']['en-us'] = "Call Routing";
$text['title']['es-cl'] = "enrutamiento de llamadas";
$text['title']['pt-pt'] = "roteamento de chamadas";
$text['title']['fr-fr'] = "routage des appels";
$text['title']['uk'] = "маршрутизація викликів";
$text['title']['pl'] = "Call Routing";
$text['title']['sv-se'] = "Call Routing";
$text['title']['de-at'] = "Call Routing";
$text['title']['ro'] = "rutare de apel";
$text['title']['ar-eg'] = "توجيه الدعوة";
$text['title']['he'] = "ניתוב שיחות";
$text['table-tools']['en-us'] = "Tools";
$text['table-tools']['es-cl'] = "Herramientas";
$text['table-tools']['pt-pt'] = "Ferramentas";
$text['table-tools']['fr-fr'] = "Outils";
$text['table-tools']['pt-br'] = "Ferramentas";
$text['table-tools']['pl'] = "Narzędzia";
$text['table-tools']['sv-se'] = "Verktyg ";
$text['table-tools']['uk'] = "Інструменти";
$text['table-tools']['de-at'] = "Funktionen";
$text['table-extension']['en-us'] = "Extension";
$text['table-extension']['es-cl'] = "Extensión";
$text['table-extension']['pt-pt'] = "Extensão";
$text['table-extension']['fr-fr'] = "Extension";
$text['table-extension']['pt-br'] = "Ramal";
$text['table-extension']['pl'] = "Numer wewnętrzny";
$text['table-extension']['sv-se'] = "Anknytning ";
$text['table-extension']['uk'] = "Розширення (Extention)";
$text['table-extension']['de-at'] = "Nebenstelle";
$text['table-description']['en-us'] = "Description";
$text['table-description']['es-cl'] = "Descripción";
$text['table-description']['pt-pt'] = "Descrição";
$text['table-description']['fr-fr'] = "Description";
$text['table-description']['pt-br'] = "Descrição";
$text['table-description']['pl'] = "Opis";
$text['table-description']['sv-se'] = "Beskrivning ";
$text['table-description']['uk'] = "Опис";
$text['table-description']['de-at'] = "Beschreibung";
$text['label-select-cid-number']['en-us'] = "Select Caller ID Number";
$text['label-select-cid-number']['es-cl'] = "Seleccione Llamadas Número de Identificación";
$text['label-select-cid-number']['pt-pt'] = "Selecione Caller ID Number";
$text['label-select-cid-number']['fr-fr'] = "Sélectionnez Caller ID Number";
$text['label-select-cid-number']['pt-br'] = "Selecionar ID da chamada";
$text['label-select-cid-number']['pl'] = "Ustaw prezentację numeru dzwoniącego";
$text['label-select-cid-number']['sv-se'] = "Välj Nummerpresentation ";
$text['label-select-cid-number']['uk'] = "";
$text['label-select-cid-number']['de-at'] = "Anruferkennung (Nummer) wählen";
$text['label-ring-timeout']['en-us'] = "Timeout";
$text['label-ring-timeout']['es-cl'] = "Timeout";
$text['label-ring-timeout']['pt-pt'] = "Timeout";
$text['label-ring-timeout']['fr-fr'] = "Timeout";
$text['label-ring-timeout']['pt-br'] = "Tempo limite";
$text['label-ring-timeout']['pl'] = "Przekroczenie czasu oczekiwania ";
$text['label-ring-timeout']['sv-se'] = "Tidsgräns ";
$text['label-ring-timeout']['uk'] = "Таймаут";
$text['label-ring-timeout']['de-at'] = "Abwurfzeit";
$text['label-ring-order']['en-us'] = "Ring Order";
$text['label-ring-order']['es-cl'] = "Solicitar Llamado";
$text['label-ring-order']['pt-pt'] = "Pedir Chamada";
$text['label-ring-order']['fr-fr'] = "Ordre de sonnerie";
$text['label-ring-order']['pt-br'] = "Solicitar chamada";
$text['label-ring-order']['pl'] = "Kolejność dzwonienia";
$text['label-ring-order']['sv-se'] = "Ring Ordning ";
$text['label-ring-order']['uk'] = "Послідовність набору";
$text['label-ring-order']['de-at'] = "Ruf Reihenfolge";
$text['label-ring-delay']['en-us'] = "Delay";
$text['label-ring-delay']['es-cl'] = "Retardo";
$text['label-ring-delay']['pt-pt'] = "Atraso";
$text['label-ring-delay']['fr-fr'] = "Délais";
$text['label-ring-delay']['pt-br'] = "Delay";
$text['label-ring-delay']['pl'] = "Opóznienie";
$text['label-ring-delay']['sv-se'] = "Fördröjning ";
$text['label-ring-delay']['uk'] = "Затримка";
$text['label-ring-delay']['de-at'] = "Verzögerung";
$text['label-prompt']['en-us'] = "Prompt to accept the call";
$text['label-prompt']['es-cl'] = "Preguntar para aceptar una llamada";
$text['label-prompt']['pt-pt'] = "Perguntar para aceitar a chamada";
$text['label-prompt']['fr-fr'] = "Annonce pour accepter l'appel";
$text['label-prompt']['pt-br'] = "Perguntar para aceitar a chamada";
$text['label-prompt']['pl'] = "Podpowiedz, aby odebrać rozmowę";
$text['label-prompt']['sv-se'] = "Kräv verifiering för att ta emot samtal. ";
$text['label-prompt']['uk'] = "";
$text['label-prompt']['de-at'] = "Ansage um den Anruf anzunehmen";
$text['label-on-busy']['en-us'] = "On Busy";
$text['label-on-busy']['es-cl'] = "Concurrida";
$text['label-on-busy']['pt-pt'] = "Movimentado";
$text['label-on-busy']['fr-fr'] = "Sur Occupé";
$text['label-on-busy']['it-it'] = "Su occupato";
$text['label-on-busy']['pt-br'] = "Ocupado";
$text['label-on-busy']['pl'] = "Kiedy zajęty";
$text['label-on-busy']['sv-se'] = "Vid Upptaget ";
$text['label-on-busy']['uk'] = "Якщо зайнято";
$text['label-on-busy']['de-at'] = "Bei Besetzt";
$text['label-number']['en-us'] = "Number";
$text['label-number']['es-cl'] = "Número";
$text['label-number']['pt-pt'] = "Número";
$text['label-number']['fr-fr'] = "Numéro";
$text['label-number']['pt-br'] = "Número";
$text['label-number']['pl'] = "Numer";
$text['label-number']['sv-se'] = "Nummer ";
$text['label-number']['uk'] = "Номер";
$text['label-number']['de-at'] = "Nummer";
$text['label-no_answer']['en-us'] = "No Answer";
$text['label-no_answer']['es-cl'] = "Sin Respuesta";
$text['label-no_answer']['pt-pt'] = "Sem Resposta";
$text['label-no_answer']['fr-fr'] = "Sans Réponse";
$text['label-no_answer']['it-it'] = "Senza Risposta";
$text['label-no_answer']['pt-br'] = "Sem resposta";
$text['label-no_answer']['pl'] = "Brak odpowiedzi";
$text['label-no_answer']['sv-se'] = "Inget Svar ";
$text['label-no_answer']['uk'] = "Без відповіді";
$text['label-no_answer']['de-at'] = "Keine Antwort";
$text['label-not_registered']['en-us'] = "Not Registered";
$text['label-not_registered']['es-cl'] = "";
$text['label-not_registered']['pt-pt'] = "";
$text['label-not_registered']['fr-fr'] = "";
$text['label-not_registered']['it-it'] = "";
$text['label-not_registered']['pt-br'] = "";
$text['label-not_registered']['pl'] = "";
$text['label-not_registered']['sv-se'] = "";
$text['label-not_registered']['uk'] = "";
$text['label-not_registered']['de-at'] = "";
$text['label-ignore-busy']['en-us'] = "Ignore Busy";
$text['label-ignore-busy']['es-cl'] = "";
$text['label-ignore-busy']['pt-pt'] = "";
$text['label-ignore-busy']['fr-fr'] = "";
$text['label-ignore-busy']['it-it'] = "";
$text['label-ignore-busy']['pt-br'] = "";
$text['label-ignore-busy']['pl'] = "";
$text['label-ignore-busy']['sv-se'] = "";
$text['label-ignore-busy']['uk'] = "";
$text['label-ignore-busy']['de-at'] = "Ignorieren bei Besetzt";
$text['label-follow-me']['en-us'] = "Follow Me";
$text['label-follow-me']['es-cl'] = "Sígueme";
$text['label-follow-me']['pt-pt'] = "Segue-me";
$text['label-follow-me']['fr-fr'] = "Follow Me";
$text['label-follow-me']['pt-br'] = "Siga-me";
$text['label-follow-me']['pl'] = "Podążaj za mną";
$text['label-follow-me']['sv-se'] = "Följ Mig ";
$text['label-follow-me']['uk'] = "";
$text['label-follow-me']['de-at'] = "Anrufweiterschaltung";
$text['label-dnd']['en-us'] = "Do Not Disturb";
$text['label-dnd']['es-cl'] = "No Molestar";
$text['label-dnd']['pt-pt'] = "Não Perturbar";
$text['label-dnd']['fr-fr'] = "Ne pas déranger";
$text['label-dnd']['pt-br'] = "Não Pertube";
$text['label-dnd']['pl'] = "Nie przeszkadzaj (DND)";
$text['label-dnd']['sv-se'] = "Stör Ej ";
$text['label-dnd']['uk'] = "Не турбувати";
$text['label-dnd']['de-at'] = "Bitte nicht stören";
$text['label-destinations']['en-us'] = "Destinations";
$text['label-destinations']['es-cl'] = "Destinos";
$text['label-destinations']['fr-fr'] = "Destinations";
$text['label-destinations']['pt-pt'] = "Destinos";
$text['label-destinations']['pt-br'] = "Destinos";
$text['label-destinations']['pl'] = "Destynacje";
$text['label-destinations']['sv-se'] = "Destinationer ";
$text['label-destinations']['uk'] = "Номери";
$text['label-destinations']['de-at'] = "Ziele";
$text['label-destination_timeout']['en-us'] = "Timeout";
$text['label-destination_timeout']['es-cl'] = "Timeout";
$text['label-destination_timeout']['fr-fr'] = "Timeout";
$text['label-destination_timeout']['pt-pt'] = "Timeout";
$text['label-destination_timeout']['pt-br'] = "Tempo de saída";
$text['label-destination_timeout']['pl'] = "Limit czasowy";
$text['label-destination_timeout']['sv-se'] = "Tidsgräns ";
$text['label-destination_timeout']['uk'] = "Таймаут";
$text['label-destination_timeout']['de-at'] = "Abwurfzeit";
$text['label-destination_prompt_confirm']['en-us'] = "Confirm";
$text['label-destination_prompt_confirm']['es-cl'] = "Confirmar";
$text['label-destination_prompt_confirm']['fr-fr'] = "Confirmer";
$text['label-destination_prompt_confirm']['pt-pt'] = "Confirmar";
$text['label-destination_prompt_confirm']['pt-br'] = "Confirmar";
$text['label-destination_prompt_confirm']['pl'] = "Potwierdź";
$text['label-destination_prompt_confirm']['sv-se'] = "Bekräfta ";
$text['label-destination_prompt_confirm']['uk'] = "Підтвердити";
$text['label-destination_prompt_confirm']['de-at'] = "Bestätigen";
$text['label-destination_prompt_announce']['en-us'] = "Announce";
$text['label-destination_prompt_announce']['es-cl'] = "Anunciar";
$text['label-destination_prompt_announce']['fr-fr'] = "Annonce";
$text['label-destination_prompt_announce']['pt-pt'] = "Anunciar";
$text['label-destination_prompt_announce']['pt-br'] = "Anunciar";
$text['label-destination_prompt_announce']['pl'] = "Rozgłoś/powiadom";
$text['label-destination_prompt_announce']['sv-se'] = "Meddela ";
$text['label-destination_prompt_announce']['uk'] = "";
$text['label-destination_prompt_announce']['de-at'] = "Ankündigen";
$text['label-destination_prompt']['en-us'] = "Prompt";
$text['label-destination_prompt']['es-cl'] = "Prompt";
$text['label-destination_prompt']['fr-fr'] = "Prompt";
$text['label-destination_prompt']['pt-pt'] = "Prompt";
$text['label-destination_prompt']['pt-br'] = "Prompt";
$text['label-destination_prompt']['pl'] = "Potwierdź aby odebrac rozmowę";
$text['label-destination_prompt']['sv-se'] = "Verifiering ";
$text['label-destination_prompt']['uk'] = "";
$text['label-destination_prompt']['de-at'] = "Nachfragen";
$text['label-destination_number']['en-us'] = "Destination";
$text['label-destination_number']['es-cl'] = "Destino";
$text['label-destination_number']['fr-fr'] = "Destination";
$text['label-destination_number']['pt-pt'] = "Destino";
$text['label-destination_number']['pt-br'] = "Desvio";
$text['label-destination_number']['pl'] = "Destynacja";
$text['label-destination_number']['sv-se'] = "Destination Nummer ";
$text['label-destination_number']['uk'] = "Номер";
$text['label-destination_number']['de-at'] = "Ziel";
$text['label-destination_delay']['en-us'] = "Delay";
$text['label-destination_delay']['es-cl'] = "Retraso";
$text['label-destination_delay']['fr-fr'] = "Délais";
$text['label-destination_delay']['pt-pt'] = "Atraso";
$text['label-destination_delay']['pt-br'] = "Delay";
$text['label-destination_delay']['pl'] = "Opóźnienie";
$text['label-destination_delay']['sv-se'] = "Fördröjning ";
$text['label-destination_delay']['uk'] = "Затримка";
$text['label-destination_delay']['de-at'] = "Verzögerung";
$text['label-destination']['en-us'] = "Destination";
$text['label-destination']['es-cl'] = "Destino";
$text['label-destination']['fr-fr'] = "Destination";
$text['label-destination']['pt-pt'] = "Destino";
$text['label-destination']['pt-br'] = "Número de destino";
$text['label-destination']['pl'] = "Destynacja";
$text['label-destination']['sv-se'] = "Destination ";
$text['label-destination']['uk'] = "Номер";
$text['label-destination']['de-at'] = "Ziel";
$text['label-cid-number-prefix']['en-us'] = "Caller ID Number";
$text['label-cid-number-prefix']['es-cl'] = "Número de Caller ID";
$text['label-cid-number-prefix']['pt-pt'] = "Número do Chamador";
$text['label-cid-number-prefix']['pt-br'] = "Número do discador";
$text['label-cid-number-prefix']['pl'] = "Prefiks prezentacji numeru dzwoniącego";
$text['label-cid-number-prefix']['sv-se'] = "Nummerpresentation ";
$text['label-cid-number-prefix']['uk'] = "Caller ID Номер";
$text['label-cid-number-prefix']['fr-fr'] = "CID Nombre Préfixe";
$text['label-cid-number-prefix']['de-at'] = "Anruferkennung (Nummer)";
$text['label-cid-name-prefix']['en-us'] = "Caller ID Name";
$text['label-cid-name-prefix']['es-cl'] = "Nombre de Caller ID";
$text['label-cid-name-prefix']['pt-pt'] = "Nome do Chamador";
$text['label-cid-name-prefix']['fr-fr'] = "Préfixe de l'appelant";
$text['label-cid-name-prefix']['pt-br'] = "Nome do discador";
$text['label-cid-name-prefix']['pl'] = "Prefiks prezentacji nazwy dzwoniącego";
$text['label-cid-name-prefix']['sv-se'] = "Namnpresentation ";
$text['label-cid-name-prefix']['uk'] = "Caller ID Ім’я";
$text['label-cid-name-prefix']['de-at'] = "Anruferkennung (Name)";
$text['label-call-prompt']['en-us'] = "Call Prompt";
$text['label-call-prompt']['es-cl'] = "Aviso de Llamadas";
$text['label-call-prompt']['pt-pt'] = "Espoletar Chamada";
$text['label-call-prompt']['fr-fr'] = "Annonce d'appel";
$text['label-call-prompt']['pt-br'] = "Prompt chamada";
$text['label-call-prompt']['pl'] = "Potwierdź przed odebraniem rozmowy";
$text['label-call-prompt']['sv-se'] = "Samtals Verifiering ";
$text['label-call-prompt']['uk'] = "";
$text['label-call-prompt']['de-at'] = "Nachfragen";
$text['label-call-forward']['en-us'] = "Call Forward";
$text['label-call-forward']['es-cl'] = "Reenvio de Llamadas";
$text['label-call-forward']['pt-pt'] = "Encaminhamento de Chamadas";
$text['label-call-forward']['fr-fr'] = "Renvoi d'appel";
$text['label-call-forward']['pt-br'] = "Encaminhamento de chamadas";
$text['label-call-forward']['pl'] = "Przekierowanie";
$text['label-call-forward']['sv-se'] = "Vidarekoppling ";
$text['label-call-forward']['uk'] = "Переадресація";
$text['label-call-forward']['de-at'] = "Rufumleitung";
$text['header-call_routing']['en-us'] = "Call Routing";
$text['header-call_routing']['es-cl'] = "Enrutamiento de Llamadas";
$text['header-call_routing']['pt-pt'] = "Roteamento de Chamadas";
$text['header-call_routing']['fr-fr'] = "Routage des Appels";
$text['header-call_routing']['pt-br'] = "Roteamento de Chamadas";
$text['header-call_routing']['pl'] = "Trasy połączeń";
$text['header-call_routing']['he'] = "ניתוב שיחות";
$text['header-call_routing']['uk'] = "маршрутизація викликів";
$text['header-call_routing']['sv-se'] = "samtals Rutter";
$text['header-call_routing']['de-at'] = "Anrufrouten";
$text['header-call_routing']['ro'] = "Маршрутизация вызовов";
$text['header-call_routing']['fa'] = "";
$text['header-call_routing']['ar-eg'] = "توجيه الدعوة";
$text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-on-busy']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
$text['description-on-busy']['pt-pt'] = "Se ativado, ele substitui o valor de correio de voz que permite em extensão.";
$text['description-on-busy']['fr-fr'] = "Remplace la messagerie vocale si activé.";
$text['description-on-busy']['it-it'] = "Se abilitato, esegue l'override del valore di abilitazione voicemail nell'estensione.";
$text['description-on-busy']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo uma extensão quando estiver ocupado";
$text['description-on-busy']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
$text['description-on-busy']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
$text['description-on-busy']['uk'] = "";
$text['description-on-busy']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
$text['description-no_answer']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-no_answer']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
$text['description-no_answer']['pt-pt'] = "Se ativado, ele substitui o valor de correio de voz que permite em extensão.";
$text['description-no_answer']['fr-fr'] = "Remplace la messagerie vocale si activé.";
$text['description-no_answer']['it-it'] = "Se abilitato, esegue l'override del valore di abilitazione voicemail nell'estensione.";
$text['description-no_answer']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo uma extensão quando estiver chamando";
$text['description-no_answer']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
$text['description-no_answer']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
$text['description-no_answer']['uk'] = "";
$text['description-no_answer']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
$text['description-not_registered']['en-us'] = "If endpoint is not reachable, forward to this destination before going to voicemail.";
$text['description-not_registered']['es-cl'] = "";
$text['description-not_registered']['pt-pt'] = "";
$text['description-not_registered']['fr-fr'] = "";
$text['description-not_registered']['it-it'] = "";
$text['description-not_registered']['pt-br'] = "";
$text['description-not_registered']['pl'] = "";
$text['description-not_registered']['sv-se'] = "";
$text['description-not_registered']['uk'] = "";
$text['description-not_registered']['de-at'] = "";
$text['description-cid-number-prefix']['en-us'] = "Set the caller ID number prefix.";
$text['description-cid-number-prefix']['es-cl'] = "Configure el prefijo de número de caller ID.";
$text['description-cid-number-prefix']['pt-pt'] = "Defina o número do Chamador";
$text['description-cid-number-prefix']['pt-br'] = "Defina o número do prefixo";
$text['description-cid-number-prefix']['pl'] = "Prefiks prezentacji numeru dzwoniącego.";
$text['description-cid-number-prefix']['sv-se'] = "Ange nummerpresentation prefix. ";
$text['description-cid-number-prefix']['uk'] = "";
$text['description-cid-number-prefix']['fr-fr'] = "Définir un préfixe sur le nombre d'ID d'appelant.";
$text['description-cid-number-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Nummer)";
$text['description-cid-name-prefix']['en-us'] = "Set the caller ID name prefix.";
$text['description-cid-name-prefix']['es-cl'] = "Configure el prefijo de nombre de caller ID";
$text['description-cid-name-prefix']['pt-pt'] = "Defina o nome do Chamador";
$text['description-cid-name-prefix']['fr-fr'] = "Choisr le péfixe du nom d'appelant.";
$text['description-cid-name-prefix']['pt-br'] = "Defina o nome do discador";
$text['description-cid-name-prefix']['pl'] = "Prefiks prezentacji nazwy dzwoniącego.";
$text['description-cid-name-prefix']['sv-se'] = "Ange namnpresentation prefix. ";
$text['description-cid-name-prefix']['uk'] = "";
$text['description-cid-name-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Name)";
$text['description-call-prompt']['en-us'] = "Prompt to accept the call for external destinations.";
$text['description-call-prompt']['es-cl'] = "Preguntar para aceptar un llamado para destinos externos";
$text['description-call-prompt']['pt-pt'] = "Aceitar chamada para destinos externos.";
$text['description-call-prompt']['fr-fr'] = "Annonce pour accepter l'appel venant de destinations externes.";
$text['description-call-prompt']['pt-br'] = "Aceiter chamada para destinos externos";
$text['description-call-prompt']['pl'] = "Zapytaj czy akceptować rozmowę do zewnętrznych destynacji.";
$text['description-call-prompt']['sv-se'] = "Kräv verifiering för att ta emot samtal för externa destinationer. ";
$text['description-call-prompt']['uk'] = "";
$text['description-call-prompt']['de-at'] = "Nachfragen, ob der Anruf auch wirklich durchgestellt werden soll.";
$text['description-call_routing']['en-us'] = "Define alternate inbound call handling for the following extensions.";
$text['description-call_routing']['es-cl'] = "Definir alternativa para el manejo de las siguientes extensiones de llamadas entrantes.";
$text['description-call_routing']['pt-pt'] = "Definir alternativo chamada de entrada assistência para as seguintes extensões.";
$text['description-call_routing']['fr-fr'] = "Définir la manipulation pour les extensions suivantes alternent appel entrant.";
$text['description-call_routing']['pt-br'] = "Definir alternativo chamada de entrada assistência para as seguintes extensões.";
$text['description-call_routing']['pl'] = "Definiowanie alternatywnego połączenia przychodzącego obsługi dla następujących rozszerzeń.";
$text['description-call_routing']['sv-se'] = "Definiera alternativa inkommande samtalshantering för följande tillägg.";
$text['description-call_routing']['uk'] = "Визначити обробку для наступних розширень альтернативного вхідного дзвінка.";
$text['description-call_routing']['de-at'] = "Definieren Sie alternative eingehende Anruf für die folgenden Erweiterungen der Handhabung.";
$text['description']['en-us'] = "Directs incoming calls for extension:";
$text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:";
$text['description']['pt-pt'] = "Direciona as chamadas recebidas para a extensão:";
$text['description']['fr-fr'] = "Rediriger les appels entrant pour l'extension:";
$text['description']['pt-br'] = "Editar informações da conta.";
$text['description']['pl'] = "Kieruj rozmowy przychodzące na numer wewnętrzny:";
$text['description']['sv-se'] = "Styr inkommande samtal för anknytning: ";
$text['description']['uk'] = "Керування вхідними дзвінками для розширення";
$text['description']['de-at'] = "Leitet eingehende Gespräche für die Nebenstelle:";
$text['confirm-update']['en-us'] = "Update Complete";
$text['confirm-update']['es-cl'] = "Actualización Completa";
$text['confirm-update']['pt-pt'] = "Actualização Efectuada";
$text['confirm-update']['fr-fr'] = "Mis à jour";
$text['confirm-update']['pt-br'] = "Atualização Efetuada";
$text['confirm-update']['pl'] = "Aktualizacja zakonczona";
$text['confirm-update']['sv-se'] = "Uppdatering Klar ";
$text['confirm-update']['uk'] = "Оновлено";
$text['confirm-update']['de-at'] = "Aktualisierung durchgeführt";
$text['ckeck-true']['es-cl'] = "Verdadero";
$text['ckeck-true']['pt-pt'] = "Sim";
$text['ckeck-true']['fr-fr'] = "Oui";
$text['ckeck-true']['pt-br'] = "Sim";
$text['ckeck-true']['pl'] = "";
$text['ckeck-true']['sv-se'] = "";
$text['ckeck-true']['uk'] = "";
$text['ckeck-true']['de-at'] = "";
$text['ckeck-simultaneous']['es-cl'] = "simultaneo";
$text['ckeck-simultaneous']['pt-pt'] = "simultâneo";
$text['ckeck-simultaneous']['pt-br'] = "Simultâneo";
$text['ckeck-simultaneous']['pl'] = "";
$text['ckeck-simultaneous']['sv-se'] = "";
$text['ckeck-simultaneous']['uk'] = "";
$text['ckeck-simultaneous']['fr-fr'] = "";
$text['ckeck-simultaneous']['de-at'] = "";
$text['ckeck-sequence']['es-cl'] = "secuencia";
$text['ckeck-sequence']['pt-pt'] = "sequência";
$text['ckeck-sequence']['pt-br'] = "Sequência";
$text['ckeck-sequence']['pl'] = "";
$text['ckeck-sequence']['sv-se'] = "";
$text['ckeck-sequence']['uk'] = "";
$text['ckeck-sequence']['fr-fr'] = "";
$text['ckeck-sequence']['de-at'] = "";
$text['ckeck-false']['es-cl'] = "Falso";
$text['ckeck-false']['pt-pt'] = "Não";
$text['ckeck-false']['fr-fr'] = "Non";
$text['ckeck-false']['pt-br'] = "Não";
$text['ckeck-false']['pl'] = "";
$text['ckeck-false']['sv-se'] = "";
$text['ckeck-false']['uk'] = "";
$text['ckeck-false']['de-at'] = "";
$text['check-true']['en-us'] = "True";
$text['check-true']['pt-br'] = "";
$text['check-true']['pl'] = "Tak";
$text['check-true']['sv-se'] = "Sann ";
$text['check-true']['uk'] = "Так";
$text['check-true']['fr-fr'] = "";
$text['check-true']['de-at'] = "An";
$text['check-simultaneous']['en-us'] = "simultaneous";
$text['check-simultaneous']['fr-fr'] = "simultanément";
$text['check-simultaneous']['pt-br'] = "";
$text['check-simultaneous']['pl'] = "jednoczesne";
$text['check-simultaneous']['sv-se'] = "Samtidiga ";
$text['check-simultaneous']['uk'] = "одночасно";
$text['check-simultaneous']['de-at'] = "gleichzeitig";
$text['check-sequence']['en-us'] = "sequence";
$text['check-sequence']['fr-fr'] = "séquence";
$text['check-sequence']['pt-br'] = "";
$text['check-sequence']['pl'] = "kolejność";
$text['check-sequence']['sv-se'] = "sekvens ";
$text['check-sequence']['uk'] = "послідовно";
$text['check-sequence']['de-at'] = "sequenziell";
$text['check-false']['en-us'] = "False";
$text['check-false']['pt-br'] = "";
$text['check-false']['pl'] = "Nie";
$text['check-false']['sv-se'] = "Falsk ";
$text['check-false']['uk'] = "Ні";
$text['check-false']['fr-fr'] = "";
$text['check-false']['de-at'] = "Aus";
$text['button-view_all']['en-us'] = "View All";
$text['button-view_all']['es-cl'] = "Mostrar Todos";
$text['button-view_all']['pt-pt'] = "Mostrar Todos";
$text['button-view_all']['fr-fr'] = "Tout Montrer";
$text['button-view_all']['pl'] = "Pokaż wszystkie";
$text['button-view_all']['uk'] = "Показати всі";
$text['button-view_all']['sv-se'] = "Visa Allt";
$text['button-view_all']['ro'] = "";
$text['button-view_all']['de-at'] = "Alle anzeigen";
$text['button-view_all']['he'] = "הצג הכל";
<?php
$text['title']['en-us'] = "Call Routing";
$text['title']['es-cl'] = "enrutamiento de llamadas";
$text['title']['pt-pt'] = "roteamento de chamadas";
$text['title']['fr-fr'] = "routage des appels";
$text['title']['uk'] = "маршрутизація викликів";
$text['title']['pl'] = "Call Routing";
$text['title']['sv-se'] = "Call Routing";
$text['title']['de-at'] = "Call Routing";
$text['title']['ro'] = "rutare de apel";
$text['title']['ar-eg'] = "توجيه الدعوة";
$text['title']['he'] = "ניתוב שיחות";
$text['table-tools']['en-us'] = "Tools";
$text['table-tools']['es-cl'] = "Herramientas";
$text['table-tools']['pt-pt'] = "Ferramentas";
$text['table-tools']['fr-fr'] = "Outils";
$text['table-tools']['pt-br'] = "Ferramentas";
$text['table-tools']['pl'] = "Narzędzia";
$text['table-tools']['sv-se'] = "Verktyg ";
$text['table-tools']['uk'] = "Інструменти";
$text['table-tools']['de-at'] = "Funktionen";
$text['table-extension']['en-us'] = "Extension";
$text['table-extension']['es-cl'] = "Extensión";
$text['table-extension']['pt-pt'] = "Extensão";
$text['table-extension']['fr-fr'] = "Extension";
$text['table-extension']['pt-br'] = "Ramal";
$text['table-extension']['pl'] = "Numer wewnętrzny";
$text['table-extension']['sv-se'] = "Anknytning ";
$text['table-extension']['uk'] = "Розширення (Extention)";
$text['table-extension']['de-at'] = "Nebenstelle";
$text['table-description']['en-us'] = "Description";
$text['table-description']['es-cl'] = "Descripción";
$text['table-description']['pt-pt'] = "Descrição";
$text['table-description']['fr-fr'] = "Description";
$text['table-description']['pt-br'] = "Descrição";
$text['table-description']['pl'] = "Opis";
$text['table-description']['sv-se'] = "Beskrivning ";
$text['table-description']['uk'] = "Опис";
$text['table-description']['de-at'] = "Beschreibung";
$text['label-select-cid-number']['en-us'] = "Select Caller ID Number";
$text['label-select-cid-number']['es-cl'] = "Seleccione Llamadas Número de Identificación";
$text['label-select-cid-number']['pt-pt'] = "Selecione Caller ID Number";
$text['label-select-cid-number']['fr-fr'] = "Sélectionnez Caller ID Number";
$text['label-select-cid-number']['pt-br'] = "Selecionar ID da chamada";
$text['label-select-cid-number']['pl'] = "Ustaw prezentację numeru dzwoniącego";
$text['label-select-cid-number']['sv-se'] = "Välj Nummerpresentation ";
$text['label-select-cid-number']['uk'] = "";
$text['label-select-cid-number']['de-at'] = "Anruferkennung (Nummer) wählen";
$text['label-ring-timeout']['en-us'] = "Timeout";
$text['label-ring-timeout']['es-cl'] = "Timeout";
$text['label-ring-timeout']['pt-pt'] = "Timeout";
$text['label-ring-timeout']['fr-fr'] = "Timeout";
$text['label-ring-timeout']['pt-br'] = "Tempo limite";
$text['label-ring-timeout']['pl'] = "Przekroczenie czasu oczekiwania ";
$text['label-ring-timeout']['sv-se'] = "Tidsgräns ";
$text['label-ring-timeout']['uk'] = "Таймаут";
$text['label-ring-timeout']['de-at'] = "Abwurfzeit";
$text['label-ring-order']['en-us'] = "Ring Order";
$text['label-ring-order']['es-cl'] = "Solicitar Llamado";
$text['label-ring-order']['pt-pt'] = "Pedir Chamada";
$text['label-ring-order']['fr-fr'] = "Ordre de sonnerie";
$text['label-ring-order']['pt-br'] = "Solicitar chamada";
$text['label-ring-order']['pl'] = "Kolejność dzwonienia";
$text['label-ring-order']['sv-se'] = "Ring Ordning ";
$text['label-ring-order']['uk'] = "Послідовність набору";
$text['label-ring-order']['de-at'] = "Ruf Reihenfolge";
$text['label-ring-delay']['en-us'] = "Delay";
$text['label-ring-delay']['es-cl'] = "Retardo";
$text['label-ring-delay']['pt-pt'] = "Atraso";
$text['label-ring-delay']['fr-fr'] = "Délais";
$text['label-ring-delay']['pt-br'] = "Delay";
$text['label-ring-delay']['pl'] = "Opóznienie";
$text['label-ring-delay']['sv-se'] = "Fördröjning ";
$text['label-ring-delay']['uk'] = "Затримка";
$text['label-ring-delay']['de-at'] = "Verzögerung";
$text['label-prompt']['en-us'] = "Prompt to accept the call";
$text['label-prompt']['es-cl'] = "Preguntar para aceptar una llamada";
$text['label-prompt']['pt-pt'] = "Perguntar para aceitar a chamada";
$text['label-prompt']['fr-fr'] = "Annonce pour accepter l'appel";
$text['label-prompt']['pt-br'] = "Perguntar para aceitar a chamada";
$text['label-prompt']['pl'] = "Podpowiedz, aby odebrać rozmowę";
$text['label-prompt']['sv-se'] = "Kräv verifiering för att ta emot samtal. ";
$text['label-prompt']['uk'] = "";
$text['label-prompt']['de-at'] = "Ansage um den Anruf anzunehmen";
$text['label-on-busy']['en-us'] = "On Busy";
$text['label-on-busy']['es-cl'] = "Concurrida";
$text['label-on-busy']['pt-pt'] = "Movimentado";
$text['label-on-busy']['fr-fr'] = "Sur Occupé";
$text['label-on-busy']['it-it'] = "Su occupato";
$text['label-on-busy']['pt-br'] = "Ocupado";
$text['label-on-busy']['pl'] = "Kiedy zajęty";
$text['label-on-busy']['sv-se'] = "Vid Upptaget ";
$text['label-on-busy']['uk'] = "Якщо зайнято";
$text['label-on-busy']['de-at'] = "Bei Besetzt";
$text['label-number']['en-us'] = "Number";
$text['label-number']['es-cl'] = "Número";
$text['label-number']['pt-pt'] = "Número";
$text['label-number']['fr-fr'] = "Numéro";
$text['label-number']['pt-br'] = "Número";
$text['label-number']['pl'] = "Numer";
$text['label-number']['sv-se'] = "Nummer ";
$text['label-number']['uk'] = "Номер";
$text['label-number']['de-at'] = "Nummer";
$text['label-no_answer']['en-us'] = "No Answer";
$text['label-no_answer']['es-cl'] = "Sin Respuesta";
$text['label-no_answer']['pt-pt'] = "Sem Resposta";
$text['label-no_answer']['fr-fr'] = "Sans Réponse";
$text['label-no_answer']['it-it'] = "Senza Risposta";
$text['label-no_answer']['pt-br'] = "Sem resposta";
$text['label-no_answer']['pl'] = "Brak odpowiedzi";
$text['label-no_answer']['sv-se'] = "Inget Svar ";
$text['label-no_answer']['uk'] = "Без відповіді";
$text['label-no_answer']['de-at'] = "Keine Antwort";
$text['label-not_registered']['en-us'] = "Not Registered";
$text['label-not_registered']['es-cl'] = "";
$text['label-not_registered']['pt-pt'] = "";
$text['label-not_registered']['fr-fr'] = "";
$text['label-not_registered']['it-it'] = "";
$text['label-not_registered']['pt-br'] = "";
$text['label-not_registered']['pl'] = "";
$text['label-not_registered']['sv-se'] = "";
$text['label-not_registered']['uk'] = "";
$text['label-not_registered']['de-at'] = "";
$text['label-ignore-busy']['en-us'] = "Ignore Busy";
$text['label-ignore-busy']['es-cl'] = "";
$text['label-ignore-busy']['pt-pt'] = "";
$text['label-ignore-busy']['fr-fr'] = "";
$text['label-ignore-busy']['it-it'] = "";
$text['label-ignore-busy']['pt-br'] = "";
$text['label-ignore-busy']['pl'] = "";
$text['label-ignore-busy']['sv-se'] = "";
$text['label-ignore-busy']['uk'] = "";
$text['label-ignore-busy']['de-at'] = "Ignorieren bei Besetzt";
$text['label-follow-me']['en-us'] = "Follow Me";
$text['label-follow-me']['es-cl'] = "Sígueme";
$text['label-follow-me']['pt-pt'] = "Segue-me";
$text['label-follow-me']['fr-fr'] = "Follow Me";
$text['label-follow-me']['pt-br'] = "Siga-me";
$text['label-follow-me']['pl'] = "Podążaj za mną";
$text['label-follow-me']['sv-se'] = "Följ Mig ";
$text['label-follow-me']['uk'] = "";
$text['label-follow-me']['de-at'] = "Anrufweiterschaltung";
$text['label-dnd']['en-us'] = "Do Not Disturb";
$text['label-dnd']['es-cl'] = "No Molestar";
$text['label-dnd']['pt-pt'] = "Não Perturbar";
$text['label-dnd']['fr-fr'] = "Ne pas déranger";
$text['label-dnd']['pt-br'] = "Não Pertube";
$text['label-dnd']['pl'] = "Nie przeszkadzaj (DND)";
$text['label-dnd']['sv-se'] = "Stör Ej ";
$text['label-dnd']['uk'] = "Не турбувати";
$text['label-dnd']['de-at'] = "Bitte nicht stören";
$text['label-destinations']['en-us'] = "Destinations";
$text['label-destinations']['es-cl'] = "Destinos";
$text['label-destinations']['fr-fr'] = "Destinations";
$text['label-destinations']['pt-pt'] = "Destinos";
$text['label-destinations']['pt-br'] = "Destinos";
$text['label-destinations']['pl'] = "Destynacje";
$text['label-destinations']['sv-se'] = "Destinationer ";
$text['label-destinations']['uk'] = "Номери";
$text['label-destinations']['de-at'] = "Ziele";
$text['label-destination_timeout']['en-us'] = "Timeout";
$text['label-destination_timeout']['es-cl'] = "Timeout";
$text['label-destination_timeout']['fr-fr'] = "Timeout";
$text['label-destination_timeout']['pt-pt'] = "Timeout";
$text['label-destination_timeout']['pt-br'] = "Tempo de saída";
$text['label-destination_timeout']['pl'] = "Limit czasowy";
$text['label-destination_timeout']['sv-se'] = "Tidsgräns ";
$text['label-destination_timeout']['uk'] = "Таймаут";
$text['label-destination_timeout']['de-at'] = "Abwurfzeit";
$text['label-destination_prompt_confirm']['en-us'] = "Confirm";
$text['label-destination_prompt_confirm']['es-cl'] = "Confirmar";
$text['label-destination_prompt_confirm']['fr-fr'] = "Confirmer";
$text['label-destination_prompt_confirm']['pt-pt'] = "Confirmar";
$text['label-destination_prompt_confirm']['pt-br'] = "Confirmar";
$text['label-destination_prompt_confirm']['pl'] = "Potwierdź";
$text['label-destination_prompt_confirm']['sv-se'] = "Bekräfta ";
$text['label-destination_prompt_confirm']['uk'] = "Підтвердити";
$text['label-destination_prompt_confirm']['de-at'] = "Bestätigen";
$text['label-destination_prompt_announce']['en-us'] = "Announce";
$text['label-destination_prompt_announce']['es-cl'] = "Anunciar";
$text['label-destination_prompt_announce']['fr-fr'] = "Annonce";
$text['label-destination_prompt_announce']['pt-pt'] = "Anunciar";
$text['label-destination_prompt_announce']['pt-br'] = "Anunciar";
$text['label-destination_prompt_announce']['pl'] = "Rozgłoś/powiadom";
$text['label-destination_prompt_announce']['sv-se'] = "Meddela ";
$text['label-destination_prompt_announce']['uk'] = "";
$text['label-destination_prompt_announce']['de-at'] = "Ankündigen";
$text['label-destination_prompt']['en-us'] = "Prompt";
$text['label-destination_prompt']['es-cl'] = "Prompt";
$text['label-destination_prompt']['fr-fr'] = "Prompt";
$text['label-destination_prompt']['pt-pt'] = "Prompt";
$text['label-destination_prompt']['pt-br'] = "Prompt";
$text['label-destination_prompt']['pl'] = "Potwierdź aby odebrac rozmowę";
$text['label-destination_prompt']['sv-se'] = "Verifiering ";
$text['label-destination_prompt']['uk'] = "";
$text['label-destination_prompt']['de-at'] = "Nachfragen";
$text['label-destination_number']['en-us'] = "Destination";
$text['label-destination_number']['es-cl'] = "Destino";
$text['label-destination_number']['fr-fr'] = "Destination";
$text['label-destination_number']['pt-pt'] = "Destino";
$text['label-destination_number']['pt-br'] = "Desvio";
$text['label-destination_number']['pl'] = "Destynacja";
$text['label-destination_number']['sv-se'] = "Destination Nummer ";
$text['label-destination_number']['uk'] = "Номер";
$text['label-destination_number']['de-at'] = "Ziel";
$text['label-destination_delay']['en-us'] = "Delay";
$text['label-destination_delay']['es-cl'] = "Retraso";
$text['label-destination_delay']['fr-fr'] = "Délais";
$text['label-destination_delay']['pt-pt'] = "Atraso";
$text['label-destination_delay']['pt-br'] = "Delay";
$text['label-destination_delay']['pl'] = "Opóźnienie";
$text['label-destination_delay']['sv-se'] = "Fördröjning ";
$text['label-destination_delay']['uk'] = "Затримка";
$text['label-destination_delay']['de-at'] = "Verzögerung";
$text['label-destination']['en-us'] = "Destination";
$text['label-destination']['es-cl'] = "Destino";
$text['label-destination']['fr-fr'] = "Destination";
$text['label-destination']['pt-pt'] = "Destino";
$text['label-destination']['pt-br'] = "Número de destino";
$text['label-destination']['pl'] = "Destynacja";
$text['label-destination']['sv-se'] = "Destination ";
$text['label-destination']['uk'] = "Номер";
$text['label-destination']['de-at'] = "Ziel";
$text['label-cid-number-prefix']['en-us'] = "Caller ID Number";
$text['label-cid-number-prefix']['es-cl'] = "Número de Caller ID";
$text['label-cid-number-prefix']['pt-pt'] = "Número do Chamador";
$text['label-cid-number-prefix']['pt-br'] = "Número do discador";
$text['label-cid-number-prefix']['pl'] = "Prefiks prezentacji numeru dzwoniącego";
$text['label-cid-number-prefix']['sv-se'] = "Nummerpresentation ";
$text['label-cid-number-prefix']['uk'] = "Caller ID Номер";
$text['label-cid-number-prefix']['fr-fr'] = "CID Nombre Préfixe";
$text['label-cid-number-prefix']['de-at'] = "Anruferkennung (Nummer)";
$text['label-cid-name-prefix']['en-us'] = "Caller ID Name";
$text['label-cid-name-prefix']['es-cl'] = "Nombre de Caller ID";
$text['label-cid-name-prefix']['pt-pt'] = "Nome do Chamador";
$text['label-cid-name-prefix']['fr-fr'] = "Préfixe de l'appelant";
$text['label-cid-name-prefix']['pt-br'] = "Nome do discador";
$text['label-cid-name-prefix']['pl'] = "Prefiks prezentacji nazwy dzwoniącego";
$text['label-cid-name-prefix']['sv-se'] = "Namnpresentation ";
$text['label-cid-name-prefix']['uk'] = "Caller ID Ім’я";
$text['label-cid-name-prefix']['de-at'] = "Anruferkennung (Name)";
$text['label-call-prompt']['en-us'] = "Call Prompt";
$text['label-call-prompt']['es-cl'] = "Aviso de Llamadas";
$text['label-call-prompt']['pt-pt'] = "Espoletar Chamada";
$text['label-call-prompt']['fr-fr'] = "Annonce d'appel";
$text['label-call-prompt']['pt-br'] = "Prompt chamada";
$text['label-call-prompt']['pl'] = "Potwierdź przed odebraniem rozmowy";
$text['label-call-prompt']['sv-se'] = "Samtals Verifiering ";
$text['label-call-prompt']['uk'] = "";
$text['label-call-prompt']['de-at'] = "Nachfragen";
$text['label-call-forward']['en-us'] = "Call Forward";
$text['label-call-forward']['es-cl'] = "Reenvio de Llamadas";
$text['label-call-forward']['pt-pt'] = "Encaminhamento de Chamadas";
$text['label-call-forward']['fr-fr'] = "Renvoi d'appel";
$text['label-call-forward']['pt-br'] = "Encaminhamento de chamadas";
$text['label-call-forward']['pl'] = "Przekierowanie";
$text['label-call-forward']['sv-se'] = "Vidarekoppling ";
$text['label-call-forward']['uk'] = "Переадресація";
$text['label-call-forward']['de-at'] = "Rufumleitung";
$text['header-call_routing']['en-us'] = "Call Routing";
$text['header-call_routing']['es-cl'] = "Enrutamiento de Llamadas";
$text['header-call_routing']['pt-pt'] = "Roteamento de Chamadas";
$text['header-call_routing']['fr-fr'] = "Routage des Appels";
$text['header-call_routing']['pt-br'] = "Roteamento de Chamadas";
$text['header-call_routing']['pl'] = "Trasy połączeń";
$text['header-call_routing']['he'] = "ניתוב שיחות";
$text['header-call_routing']['uk'] = "маршрутизація викликів";
$text['header-call_routing']['sv-se'] = "samtals Rutter";
$text['header-call_routing']['de-at'] = "Anrufrouten";
$text['header-call_routing']['ro'] = "Маршрутизация вызовов";
$text['header-call_routing']['fa'] = "";
$text['header-call_routing']['ar-eg'] = "توجيه الدعوة";
$text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-on-busy']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
$text['description-on-busy']['pt-pt'] = "Se ativado, ele substitui o valor de correio de voz que permite em extensão.";
$text['description-on-busy']['fr-fr'] = "Remplace la messagerie vocale si activé.";
$text['description-on-busy']['it-it'] = "Se abilitato, esegue l'override del valore di abilitazione voicemail nell'estensione.";
$text['description-on-busy']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo uma extensão quando estiver ocupado";
$text['description-on-busy']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
$text['description-on-busy']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
$text['description-on-busy']['uk'] = "";
$text['description-on-busy']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
$text['description-no_answer']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-no_answer']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión.";
$text['description-no_answer']['pt-pt'] = "Se ativado, ele substitui o valor de correio de voz que permite em extensão.";
$text['description-no_answer']['fr-fr'] = "Remplace la messagerie vocale si activé.";
$text['description-no_answer']['it-it'] = "Se abilitato, esegue l'override del valore di abilitazione voicemail nell'estensione.";
$text['description-no_answer']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo uma extensão quando estiver chamando";
$text['description-no_answer']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
$text['description-no_answer']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
$text['description-no_answer']['uk'] = "";
$text['description-no_answer']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
$text['description-not_registered']['en-us'] = "If endpoint is not reachable, forward to this destination before going to voicemail.";
$text['description-not_registered']['es-cl'] = "";
$text['description-not_registered']['pt-pt'] = "";
$text['description-not_registered']['fr-fr'] = "";
$text['description-not_registered']['it-it'] = "";
$text['description-not_registered']['pt-br'] = "";
$text['description-not_registered']['pl'] = "";
$text['description-not_registered']['sv-se'] = "";
$text['description-not_registered']['uk'] = "";
$text['description-not_registered']['de-at'] = "";
$text['description-cid-number-prefix']['en-us'] = "Set the caller ID number prefix.";
$text['description-cid-number-prefix']['es-cl'] = "Configure el prefijo de número de caller ID.";
$text['description-cid-number-prefix']['pt-pt'] = "Defina o número do Chamador";
$text['description-cid-number-prefix']['pt-br'] = "Defina o número do prefixo";
$text['description-cid-number-prefix']['pl'] = "Prefiks prezentacji numeru dzwoniącego.";
$text['description-cid-number-prefix']['sv-se'] = "Ange nummerpresentation prefix. ";
$text['description-cid-number-prefix']['uk'] = "";
$text['description-cid-number-prefix']['fr-fr'] = "Définir un préfixe sur le nombre d'ID d'appelant.";
$text['description-cid-number-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Nummer)";
$text['description-cid-name-prefix']['en-us'] = "Set the caller ID name prefix.";
$text['description-cid-name-prefix']['es-cl'] = "Configure el prefijo de nombre de caller ID";
$text['description-cid-name-prefix']['pt-pt'] = "Defina o nome do Chamador";
$text['description-cid-name-prefix']['fr-fr'] = "Choisr le péfixe du nom d'appelant.";
$text['description-cid-name-prefix']['pt-br'] = "Defina o nome do discador";
$text['description-cid-name-prefix']['pl'] = "Prefiks prezentacji nazwy dzwoniącego.";
$text['description-cid-name-prefix']['sv-se'] = "Ange namnpresentation prefix. ";
$text['description-cid-name-prefix']['uk'] = "";
$text['description-cid-name-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Name)";
$text['description-call-prompt']['en-us'] = "Prompt to accept the call for external destinations.";
$text['description-call-prompt']['es-cl'] = "Preguntar para aceptar un llamado para destinos externos";
$text['description-call-prompt']['pt-pt'] = "Aceitar chamada para destinos externos.";
$text['description-call-prompt']['fr-fr'] = "Annonce pour accepter l'appel venant de destinations externes.";
$text['description-call-prompt']['pt-br'] = "Aceiter chamada para destinos externos";
$text['description-call-prompt']['pl'] = "Zapytaj czy akceptować rozmowę do zewnętrznych destynacji.";
$text['description-call-prompt']['sv-se'] = "Kräv verifiering för att ta emot samtal för externa destinationer. ";
$text['description-call-prompt']['uk'] = "";
$text['description-call-prompt']['de-at'] = "Nachfragen, ob der Anruf auch wirklich durchgestellt werden soll.";
$text['description-call_routing']['en-us'] = "Define alternate inbound call handling for the following extensions.";
$text['description-call_routing']['es-cl'] = "Definir alternativa para el manejo de las siguientes extensiones de llamadas entrantes.";
$text['description-call_routing']['pt-pt'] = "Definir alternativo chamada de entrada assistência para as seguintes extensões.";
$text['description-call_routing']['fr-fr'] = "Définir la manipulation pour les extensions suivantes alternent appel entrant.";
$text['description-call_routing']['pt-br'] = "Definir alternativo chamada de entrada assistência para as seguintes extensões.";
$text['description-call_routing']['pl'] = "Definiowanie alternatywnego połączenia przychodzącego obsługi dla następujących rozszerzeń.";
$text['description-call_routing']['sv-se'] = "Definiera alternativa inkommande samtalshantering för följande tillägg.";
$text['description-call_routing']['uk'] = "Визначити обробку для наступних розширень альтернативного вхідного дзвінка.";
$text['description-call_routing']['de-at'] = "Definieren Sie alternative eingehende Anruf für die folgenden Erweiterungen der Handhabung.";
$text['description']['en-us'] = "Directs incoming calls for extension:";
$text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:";
$text['description']['pt-pt'] = "Direciona as chamadas recebidas para a extensão:";
$text['description']['fr-fr'] = "Rediriger les appels entrant pour l'extension:";
$text['description']['pt-br'] = "Editar informações da conta.";
$text['description']['pl'] = "Kieruj rozmowy przychodzące na numer wewnętrzny:";
$text['description']['sv-se'] = "Styr inkommande samtal för anknytning: ";
$text['description']['uk'] = "Керування вхідними дзвінками для розширення";
$text['description']['de-at'] = "Leitet eingehende Gespräche für die Nebenstelle:";
$text['confirm-update']['en-us'] = "Update Complete";
$text['confirm-update']['es-cl'] = "Actualización Completa";
$text['confirm-update']['pt-pt'] = "Actualização Efectuada";
$text['confirm-update']['fr-fr'] = "Mis à jour";
$text['confirm-update']['pt-br'] = "Atualização Efetuada";
$text['confirm-update']['pl'] = "Aktualizacja zakonczona";
$text['confirm-update']['sv-se'] = "Uppdatering Klar ";
$text['confirm-update']['uk'] = "Оновлено";
$text['confirm-update']['de-at'] = "Aktualisierung durchgeführt";
$text['ckeck-true']['es-cl'] = "Verdadero";
$text['ckeck-true']['pt-pt'] = "Sim";
$text['ckeck-true']['fr-fr'] = "Oui";
$text['ckeck-true']['pt-br'] = "Sim";
$text['ckeck-true']['pl'] = "";
$text['ckeck-true']['sv-se'] = "";
$text['ckeck-true']['uk'] = "";
$text['ckeck-true']['de-at'] = "";
$text['ckeck-simultaneous']['es-cl'] = "simultaneo";
$text['ckeck-simultaneous']['pt-pt'] = "simultâneo";
$text['ckeck-simultaneous']['pt-br'] = "Simultâneo";
$text['ckeck-simultaneous']['pl'] = "";
$text['ckeck-simultaneous']['sv-se'] = "";
$text['ckeck-simultaneous']['uk'] = "";
$text['ckeck-simultaneous']['fr-fr'] = "";
$text['ckeck-simultaneous']['de-at'] = "";
$text['ckeck-sequence']['es-cl'] = "secuencia";
$text['ckeck-sequence']['pt-pt'] = "sequência";
$text['ckeck-sequence']['pt-br'] = "Sequência";
$text['ckeck-sequence']['pl'] = "";
$text['ckeck-sequence']['sv-se'] = "";
$text['ckeck-sequence']['uk'] = "";
$text['ckeck-sequence']['fr-fr'] = "";
$text['ckeck-sequence']['de-at'] = "";
$text['ckeck-false']['es-cl'] = "Falso";
$text['ckeck-false']['pt-pt'] = "Não";
$text['ckeck-false']['fr-fr'] = "Non";
$text['ckeck-false']['pt-br'] = "Não";
$text['ckeck-false']['pl'] = "";
$text['ckeck-false']['sv-se'] = "";
$text['ckeck-false']['uk'] = "";
$text['ckeck-false']['de-at'] = "";
$text['check-true']['en-us'] = "True";
$text['check-true']['pt-br'] = "";
$text['check-true']['pl'] = "Tak";
$text['check-true']['sv-se'] = "Sann ";
$text['check-true']['uk'] = "Так";
$text['check-true']['fr-fr'] = "";
$text['check-true']['de-at'] = "An";
$text['check-simultaneous']['en-us'] = "simultaneous";
$text['check-simultaneous']['fr-fr'] = "simultanément";
$text['check-simultaneous']['pt-br'] = "";
$text['check-simultaneous']['pl'] = "jednoczesne";
$text['check-simultaneous']['sv-se'] = "Samtidiga ";
$text['check-simultaneous']['uk'] = "одночасно";
$text['check-simultaneous']['de-at'] = "gleichzeitig";
$text['check-sequence']['en-us'] = "sequence";
$text['check-sequence']['fr-fr'] = "séquence";
$text['check-sequence']['pt-br'] = "";
$text['check-sequence']['pl'] = "kolejność";
$text['check-sequence']['sv-se'] = "sekvens ";
$text['check-sequence']['uk'] = "послідовно";
$text['check-sequence']['de-at'] = "sequenziell";
$text['check-false']['en-us'] = "False";
$text['check-false']['pt-br'] = "";
$text['check-false']['pl'] = "Nie";
$text['check-false']['sv-se'] = "Falsk ";
$text['check-false']['uk'] = "Ні";
$text['check-false']['fr-fr'] = "";
$text['check-false']['de-at'] = "Aus";
$text['button-view_all']['en-us'] = "View All";
$text['button-view_all']['es-cl'] = "Mostrar Todos";
$text['button-view_all']['pt-pt'] = "Mostrar Todos";
$text['button-view_all']['fr-fr'] = "Tout Montrer";
$text['button-view_all']['pl'] = "Pokaż wszystkie";
$text['button-view_all']['uk'] = "Показати всі";
$text['button-view_all']['sv-se'] = "Visa Allt";
$text['button-view_all']['ro'] = "";
$text['button-view_all']['de-at'] = "Alle anzeigen";
$text['button-view_all']['he'] = "הצג הכל";
?>

View File

@@ -1,21 +1,21 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Call Routing";
$apps[$x]['menu'][0]['title']['es-mx'] = "enrutamiento de llamadas";
$apps[$x]['menu'][0]['title']['de-de'] = "Call Routing";
$apps[$x]['menu'][0]['title']['de-ch'] = "Call Routing";
$apps[$x]['menu'][0]['title']['de-at'] = "Call Routing";
$apps[$x]['menu'][0]['title']['fr-fr'] = "routage des appels";
$apps[$x]['menu'][0]['title']['fr-ca'] = "routage des appels";
$apps[$x]['menu'][0]['title']['fr-ch'] = "routage des appels";
$apps[$x]['menu'][0]['title']['pt-pt'] = "roteamento de chamadas";
$apps[$x]['menu'][0]['title']['pt-br'] = "roteamento de chamadas";
$apps[$x]['menu'][0]['uuid'] = "4e4df00b-aafb-45a8-82c1-cdabc921889c";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/calls/calls.php";
$apps[$x]['menu'][0]['groups'][] = "user";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Call Routing";
$apps[$x]['menu'][0]['title']['es-mx'] = "enrutamiento de llamadas";
$apps[$x]['menu'][0]['title']['de-de'] = "Call Routing";
$apps[$x]['menu'][0]['title']['de-ch'] = "Call Routing";
$apps[$x]['menu'][0]['title']['de-at'] = "Call Routing";
$apps[$x]['menu'][0]['title']['fr-fr'] = "routage des appels";
$apps[$x]['menu'][0]['title']['fr-ca'] = "routage des appels";
$apps[$x]['menu'][0]['title']['fr-ch'] = "routage des appels";
$apps[$x]['menu'][0]['title']['pt-pt'] = "roteamento de chamadas";
$apps[$x]['menu'][0]['title']['pt-br'] = "roteamento de chamadas";
$apps[$x]['menu'][0]['uuid'] = "4e4df00b-aafb-45a8-82c1-cdabc921889c";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/calls/calls.php";
$apps[$x]['menu'][0]['groups'][] = "user";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -1,448 +1,448 @@
<?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>
Copyright (C) 2010 - 2014
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
Salvatore Caruso <salvatore.caruso@nems.it>
Riccardo Granchi <riccardo.granchi@nems.it>
Errol Samuels <voiptology@gmail.com>
*/
include "root.php";
//define the follow me class
class follow_me {
public $domain_uuid;
public $db_type;
public $follow_me_uuid;
public $cid_name_prefix;
public $cid_number_prefix;
public $accountcode;
public $follow_me_enabled;
public $follow_me_caller_id_uuid;
public $follow_me_ignore_busy;
public $outbound_caller_id_name;
public $outbound_caller_id_number;
private $extension;
private $toll_allow;
public $destination_data_1;
public $destination_type_1;
public $destination_delay_1;
public $destination_prompt_1;
public $destination_timeout_1;
public $destination_data_2;
public $destination_type_2;
public $destination_delay_2;
public $destination_prompt_2;
public $destination_timeout_2;
public $destination_data_3;
public $destination_type_3;
public $destination_delay_3;
public $destination_prompt_3;
public $destination_timeout_3;
public $destination_data_4;
public $destination_type_4;
public $destination_delay_4;
public $destination_prompt_4;
public $destination_timeout_4;
public $destination_data_5;
public $destination_type_5;
public $destination_delay_5;
public $destination_prompt_5;
public $destination_timeout_5;
public $destination_timeout = 0;
public $destination_order = 1;
public function add() {
//set the global variable
global $db;
//add a new follow me
$sql = "insert into v_follow_me ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "follow_me_uuid, ";
$sql .= "cid_name_prefix, ";
if (strlen($this->cid_number_prefix) > 0) {
$sql .= "cid_number_prefix, ";
}
$sql .= "follow_me_caller_id_uuid, ";
$sql .= "follow_me_enabled, ";
$sql .= "follow_me_ignore_busy ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->cid_name_prefix', ";
if (strlen($this->cid_number_prefix) > 0) {
$sql .= "'$this->cid_number_prefix', ";
}
if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "'$this->follow_me_caller_id_uuid', ";
}
else {
$sql .= 'null, ';
}
$sql .= "'$this->follow_me_enabled', ";
$sql .= "'$this->follow_me_ignore_busy' ";
$sql .= ")";
if ($v_debug) {
echo $sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function update() {
//set the global variable
global $db;
//update follow me table
$sql = "update v_follow_me set ";
$sql .= "follow_me_enabled = '$this->follow_me_enabled', ";
$sql .= "follow_me_ignore_busy = '$this->follow_me_ignore_busy', ";
$sql .= "cid_name_prefix = '$this->cid_name_prefix', ";
if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "follow_me_caller_id_uuid = '$this->follow_me_caller_id_uuid', ";
}
else {
$sql .= "follow_me_caller_id_uuid = null, ";
}
$sql .= "cid_number_prefix = '$this->cid_number_prefix' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function follow_me_destinations() {
//set the global variable
global $db;
//prepare insert statement
$stmt = $db->prepare(
"insert into v_follow_me_destinations("
. "follow_me_destination_uuid,"
. "domain_uuid,"
. "follow_me_uuid,"
. "follow_me_destination,"
. "follow_me_timeout,"
. "follow_me_delay,"
. "follow_me_prompt,"
. "follow_me_order"
. ")values(?,?,?,?,?,?,?,?)"
);
//delete related follow me destinations
$sql = "delete from v_follow_me_destinations where follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
//insert the follow me destinations
if (strlen($this->destination_data_1) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_1,
$this->destination_timeout_1,
$this->destination_delay_1,
$this->destination_prompt_1,
'1'
));
$this->destination_order++;
}
if (strlen($this->destination_data_2) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_2,
$this->destination_timeout_2,
$this->destination_delay_2,
$this->destination_prompt_2,
'2'
));
$this->destination_order++;
}
if (strlen($this->destination_data_3) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_3,
$this->destination_timeout_3,
$this->destination_delay_3,
$this->destination_prompt_3,
'3'
));
$this->destination_order++;
}
if (strlen($this->destination_data_4) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_4,
$this->destination_timeout_4,
$this->destination_delay_4,
$this->destination_prompt_4,
'4'
));
$this->destination_order++;
}
if (strlen($this->destination_data_5) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_5,
$this->destination_timeout_5,
$this->destination_delay_5,
$this->destination_prompt_5,
'5'
));
$this->destination_order++;
}
unset($stmt);
} //function
public function set() {
//set the global variable
global $db;
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and extension_uuid = '".$this->extension_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
}
//determine whether to update the dial string
$sql = "select * from v_follow_me ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$follow_me_uuid = $row["follow_me_uuid"];
$this->cid_name_prefix = $row["cid_name_prefix"];
$this->cid_number_prefix = $row["cid_number_prefix"];
}
}
unset ($prep_statement);
//add follow me
if (strlen($follow_me_uuid) == 0) {
$this->add();
}
//set the extension dial string
$sql = "select * from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = '".$this->follow_me_uuid."' ";
$sql .= "order by follow_me_order asc ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$dial_string = "{";
if ($this->follow_me_ignore_busy != 'true') {
$dial_string .= "fail_on_single_reject=USER_BUSY,";
}
$dial_string .= "instant_ringback=true,";
$dial_string .= "ignore_early_media=true";
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
$dial_string .= ",domain=".$_SESSION['domain_name'];
$dial_string .= ",extension_uuid=".$this->extension_uuid;
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua";
$dial_string_caller_id_name = "\${caller_id_name}";
$dial_string_caller_id_number = "\${caller_id_number}";
if (strlen($this->follow_me_caller_id_uuid) > 0){
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
$prep_statement_caller = $db->prepare($sql_caller);
if ($prep_statement_caller) {
$prep_statement_caller->execute();
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
$caller_id_number = $row_caller['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_caller['destination_number'];
}
$caller_id_name = $row_caller['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_caller['destination_description'];
}
if (strlen($caller_id_name) > 0) {
$dial_string_caller_id_name = $caller_id_name;
}
if (strlen($caller_id_number) > 0) {
$dial_string_caller_id_number = $caller_id_number;
}
}
}
if (strlen($this->cid_name_prefix) > 0) {
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."$dial_string_caller_id_name";
}
else {
$dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name";
}
if (strlen($this->cid_number_prefix) > 0) {
//$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."";
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."$dial_string_caller_id_number";
}
else {
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
}
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
$dial_string .= ",accountcode=".$this->accountcode;
}
$dial_string .= ",toll_allow='".$this->toll_allow."'";
$dial_string .= "}";
$x = 0;
foreach ($result as &$row) {
if ($x > 0) {
$dial_string .= ",";
}
if (extension_exists($row["follow_me_destination"])) {
//set the dial string
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
$dial_string .= "[";
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
$dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
if ($row["follow_me_prompt"] == "1") {
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")}";
}
else {
$replace_value = $row["follow_me_destination"];
if ($row["follow_me_prompt"] == "1") {
$replace_value .= "[group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true]";
}
$local_dial_string = $_SESSION['domain']['dial_string']['text'];
$local_dial_string = str_replace("\${dialed_user}", $replace_value, $local_dial_string);
$local_dial_string = str_replace("\${dialed_domain}", $_SESSION['domain_name'], $local_dial_string);
$local_dial_string = str_replace("\${call_timeout}", $row["follow_me_timeout"], $local_dial_string);
$local_dial_string = str_replace("\${leg_timeout}", $row["follow_me_timeout"], $local_dial_string);
$dial_string .= $local_dial_string;
}
}
else {
$dial_string .= "[";
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
$dial_string .= ",outbound_caller_id_number=".$this->outbound_caller_id_number;
$dial_string .= ",origination_caller_id_name=".$this->outbound_caller_id_name;
$dial_string .= ",origination_caller_id_number=".$this->outbound_caller_id_number;
}
else{
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
}
$dial_string .= ",presence_id=".$this->extension."@".$_SESSION['domain_name'];
if ($row["follow_me_prompt"] == "1") {
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= ",leg_delay_start=".$row["follow_me_delay"];
$dial_string .= ",leg_timeout=".$row["follow_me_timeout"]."]";
if (is_numeric($row["follow_me_destination"])) {
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]);
$dial_string .= $bridge[0];
}
elseif ($_SESSION['domain']['bridge']['text'] == "loopback") {
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
}
elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
$dial_string .= "lcr/".$_SESSION['lcr']['profile']['text']."/".$_SESSION['domain_name']."/".$row["follow_me_destination"];
}
else {
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
}
}
else {
$dial_string .= $row["follow_me_destination"];
}
}
$x++;
}
$this->dial_string = $dial_string;
$sql = "update v_follow_me set ";
$sql .= "dial_string = '".$this->dial_string."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec($sql);
unset($sql);
//is follow me enabled
$dial_string = '';
if ($this->follow_me_enabled == "true") {
$dial_string = $this->dial_string;
}
$sql = "update v_extensions set ";
$sql .= "dial_string = '".check_str($dial_string)."', ";
$sql .= "dial_domain = '".$_SESSION['domain_name']."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec($sql);
unset($sql);
} //function
} //class
?>
<?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>
Copyright (C) 2010 - 2014
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
Salvatore Caruso <salvatore.caruso@nems.it>
Riccardo Granchi <riccardo.granchi@nems.it>
Errol Samuels <voiptology@gmail.com>
*/
include "root.php";
//define the follow me class
class follow_me {
public $domain_uuid;
public $db_type;
public $follow_me_uuid;
public $cid_name_prefix;
public $cid_number_prefix;
public $accountcode;
public $follow_me_enabled;
public $follow_me_caller_id_uuid;
public $follow_me_ignore_busy;
public $outbound_caller_id_name;
public $outbound_caller_id_number;
private $extension;
private $toll_allow;
public $destination_data_1;
public $destination_type_1;
public $destination_delay_1;
public $destination_prompt_1;
public $destination_timeout_1;
public $destination_data_2;
public $destination_type_2;
public $destination_delay_2;
public $destination_prompt_2;
public $destination_timeout_2;
public $destination_data_3;
public $destination_type_3;
public $destination_delay_3;
public $destination_prompt_3;
public $destination_timeout_3;
public $destination_data_4;
public $destination_type_4;
public $destination_delay_4;
public $destination_prompt_4;
public $destination_timeout_4;
public $destination_data_5;
public $destination_type_5;
public $destination_delay_5;
public $destination_prompt_5;
public $destination_timeout_5;
public $destination_timeout = 0;
public $destination_order = 1;
public function add() {
//set the global variable
global $db;
//add a new follow me
$sql = "insert into v_follow_me ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "follow_me_uuid, ";
$sql .= "cid_name_prefix, ";
if (strlen($this->cid_number_prefix) > 0) {
$sql .= "cid_number_prefix, ";
}
$sql .= "follow_me_caller_id_uuid, ";
$sql .= "follow_me_enabled, ";
$sql .= "follow_me_ignore_busy ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->cid_name_prefix', ";
if (strlen($this->cid_number_prefix) > 0) {
$sql .= "'$this->cid_number_prefix', ";
}
if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "'$this->follow_me_caller_id_uuid', ";
}
else {
$sql .= 'null, ';
}
$sql .= "'$this->follow_me_enabled', ";
$sql .= "'$this->follow_me_ignore_busy' ";
$sql .= ")";
if ($v_debug) {
echo $sql."<br />";
}
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function update() {
//set the global variable
global $db;
//update follow me table
$sql = "update v_follow_me set ";
$sql .= "follow_me_enabled = '$this->follow_me_enabled', ";
$sql .= "follow_me_ignore_busy = '$this->follow_me_ignore_busy', ";
$sql .= "cid_name_prefix = '$this->cid_name_prefix', ";
if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "follow_me_caller_id_uuid = '$this->follow_me_caller_id_uuid', ";
}
else {
$sql .= "follow_me_caller_id_uuid = null, ";
}
$sql .= "cid_number_prefix = '$this->cid_number_prefix' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
} //end function
public function follow_me_destinations() {
//set the global variable
global $db;
//prepare insert statement
$stmt = $db->prepare(
"insert into v_follow_me_destinations("
. "follow_me_destination_uuid,"
. "domain_uuid,"
. "follow_me_uuid,"
. "follow_me_destination,"
. "follow_me_timeout,"
. "follow_me_delay,"
. "follow_me_prompt,"
. "follow_me_order"
. ")values(?,?,?,?,?,?,?,?)"
);
//delete related follow me destinations
$sql = "delete from v_follow_me_destinations where follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
//insert the follow me destinations
if (strlen($this->destination_data_1) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_1,
$this->destination_timeout_1,
$this->destination_delay_1,
$this->destination_prompt_1,
'1'
));
$this->destination_order++;
}
if (strlen($this->destination_data_2) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_2,
$this->destination_timeout_2,
$this->destination_delay_2,
$this->destination_prompt_2,
'2'
));
$this->destination_order++;
}
if (strlen($this->destination_data_3) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_3,
$this->destination_timeout_3,
$this->destination_delay_3,
$this->destination_prompt_3,
'3'
));
$this->destination_order++;
}
if (strlen($this->destination_data_4) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_4,
$this->destination_timeout_4,
$this->destination_delay_4,
$this->destination_prompt_4,
'4'
));
$this->destination_order++;
}
if (strlen($this->destination_data_5) > 0) {
$stmt->execute(array(
uuid(),
$this->domain_uuid,
$this->follow_me_uuid,
$this->destination_data_5,
$this->destination_timeout_5,
$this->destination_delay_5,
$this->destination_prompt_5,
'5'
));
$this->destination_order++;
}
unset($stmt);
} //function
public function set() {
//set the global variable
global $db;
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and extension_uuid = '".$this->extension_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
}
//determine whether to update the dial string
$sql = "select * from v_follow_me ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$follow_me_uuid = $row["follow_me_uuid"];
$this->cid_name_prefix = $row["cid_name_prefix"];
$this->cid_number_prefix = $row["cid_number_prefix"];
}
}
unset ($prep_statement);
//add follow me
if (strlen($follow_me_uuid) == 0) {
$this->add();
}
//set the extension dial string
$sql = "select * from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = '".$this->follow_me_uuid."' ";
$sql .= "order by follow_me_order asc ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$dial_string = "{";
if ($this->follow_me_ignore_busy != 'true') {
$dial_string .= "fail_on_single_reject=USER_BUSY,";
}
$dial_string .= "instant_ringback=true,";
$dial_string .= "ignore_early_media=true";
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
$dial_string .= ",domain=".$_SESSION['domain_name'];
$dial_string .= ",extension_uuid=".$this->extension_uuid;
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua";
$dial_string_caller_id_name = "\${caller_id_name}";
$dial_string_caller_id_number = "\${caller_id_number}";
if (strlen($this->follow_me_caller_id_uuid) > 0){
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
$prep_statement_caller = $db->prepare($sql_caller);
if ($prep_statement_caller) {
$prep_statement_caller->execute();
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
$caller_id_number = $row_caller['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_caller['destination_number'];
}
$caller_id_name = $row_caller['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_caller['destination_description'];
}
if (strlen($caller_id_name) > 0) {
$dial_string_caller_id_name = $caller_id_name;
}
if (strlen($caller_id_number) > 0) {
$dial_string_caller_id_number = $caller_id_number;
}
}
}
if (strlen($this->cid_name_prefix) > 0) {
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."$dial_string_caller_id_name";
}
else {
$dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name";
}
if (strlen($this->cid_number_prefix) > 0) {
//$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."";
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."$dial_string_caller_id_number";
}
else {
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
}
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
$dial_string .= ",accountcode=".$this->accountcode;
}
$dial_string .= ",toll_allow='".$this->toll_allow."'";
$dial_string .= "}";
$x = 0;
foreach ($result as &$row) {
if ($x > 0) {
$dial_string .= ",";
}
if (extension_exists($row["follow_me_destination"])) {
//set the dial string
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
$dial_string .= "[";
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
$dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
if ($row["follow_me_prompt"] == "1") {
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")}";
}
else {
$replace_value = $row["follow_me_destination"];
if ($row["follow_me_prompt"] == "1") {
$replace_value .= "[group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true]";
}
$local_dial_string = $_SESSION['domain']['dial_string']['text'];
$local_dial_string = str_replace("\${dialed_user}", $replace_value, $local_dial_string);
$local_dial_string = str_replace("\${dialed_domain}", $_SESSION['domain_name'], $local_dial_string);
$local_dial_string = str_replace("\${call_timeout}", $row["follow_me_timeout"], $local_dial_string);
$local_dial_string = str_replace("\${leg_timeout}", $row["follow_me_timeout"], $local_dial_string);
$dial_string .= $local_dial_string;
}
}
else {
$dial_string .= "[";
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
$dial_string .= ",outbound_caller_id_number=".$this->outbound_caller_id_number;
$dial_string .= ",origination_caller_id_name=".$this->outbound_caller_id_name;
$dial_string .= ",origination_caller_id_number=".$this->outbound_caller_id_number;
}
else{
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
}
$dial_string .= ",presence_id=".$this->extension."@".$_SESSION['domain_name'];
if ($row["follow_me_prompt"] == "1") {
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
$dial_string .= ",leg_delay_start=".$row["follow_me_delay"];
$dial_string .= ",leg_timeout=".$row["follow_me_timeout"]."]";
if (is_numeric($row["follow_me_destination"])) {
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]);
$dial_string .= $bridge[0];
}
elseif ($_SESSION['domain']['bridge']['text'] == "loopback") {
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
}
elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
$dial_string .= "lcr/".$_SESSION['lcr']['profile']['text']."/".$_SESSION['domain_name']."/".$row["follow_me_destination"];
}
else {
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
}
}
else {
$dial_string .= $row["follow_me_destination"];
}
}
$x++;
}
$this->dial_string = $dial_string;
$sql = "update v_follow_me set ";
$sql .= "dial_string = '".$this->dial_string."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec($sql);
unset($sql);
//is follow me enabled
$dial_string = '';
if ($this->follow_me_enabled == "true") {
$dial_string = $this->dial_string;
}
$sql = "update v_extensions set ";
$sql .= "dial_string = '".check_str($dial_string)."', ";
$sql .= "dial_domain = '".$_SESSION['domain_name']."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec($sql);
unset($sql);
} //function
} //class
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,18 +1,18 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Click to Call";
$apps[$x]['menu'][0]['title']['es-cl'] = "Pulse para Llamar";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Cliquez pour Appeller";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Clicar para Chamadas";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "f862556f-9ddd-2697-fdf4-bed08ec63aa5";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/click_to_call/click_to_call.php";
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Click to Call";
$apps[$x]['menu'][0]['title']['es-cl'] = "Pulse para Llamar";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Cliquez pour Appeller";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Clicar para Chamadas";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "f862556f-9ddd-2697-fdf4-bed08ec63aa5";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/click_to_call/click_to_call.php";
?>

View File

@@ -1,377 +1,377 @@
<?php
/* $Id$ */
/*
call.php
Copyright (C) 2008, 2009 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('click_to_call_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//include the header
require_once "resources/header.php";
if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])) {
//retrieve submitted variables
$src = check_str($_REQUEST['src']);
$src_cid_name = check_str($_REQUEST['src_cid_name']);
$src_cid_number = check_str($_REQUEST['src_cid_number']);
$dest = check_str($_REQUEST['dest']);
$dest_cid_name = check_str($_REQUEST['dest_cid_name']);
$dest_cid_number = check_str($_REQUEST['dest_cid_number']);
$auto_answer = check_str($_REQUEST['auto_answer']); //true,false
$rec = check_str($_REQUEST['rec']); //true,false
$ringback = check_str($_REQUEST['ringback']);
$context = $_SESSION['context'];
//clean up variable values
$src = str_replace(array('.','(',')','-',' '), '', $src);
$dest = (strpbrk($dest, '@') != FALSE) ? str_replace(array('(',')',' '), '', $dest) : str_replace(array('.','(',')','-',' '), '', $dest); //don't strip periods or dashes in sip-uri calls, only phone numbers
//adjust variable values
$sip_auto_answer = ($auto_answer == "true") ? ",sip_auto_answer=true" : null;
//mozilla thunderbird TBDialout workaround (seems it can only handle the first %NUM%)
$dest = ($dest == "%NUM%") ? $src_cid_number : $dest;
//translate ringback
switch ($ringback) {
case "music": $ringback_value = "\'local_stream://moh\'"; break;
case "uk-ring": $ringback_value = "\'%(400,200,400,450);%(400,2200,400,450)\'"; break;
case "fr-ring": $ringback_value = "\'%(1500,3500,440.0,0.0)\'"; break;
case "pt-ring": $ringback_value = "\'%(1000,5000,400.0,0.0)\'"; break;
case "rs-ring": $ringback_value = "\'%(1000,4000,425.0,0.0)\'"; break;
case "it-ring": $ringback_value = "\'%(1000,4000,425.0,0.0)\'"; break;
case "us-ring":
default:
$ringback = 'us-ring';
$ringback_value = "\'%(2000,4000,440.0,480.0)\'";
}
//determine call direction
$dir = (strlen($dest) < 7) ? 'local' : 'outbound';
//define a leg - set source to display the defined caller id name and number
$source_common = "{".
"click_to_call=true".
",origination_caller_id_name='".$src_cid_name."'".
",origination_caller_id_number=".$src_cid_number.
",instant_ringback=true".
",ringback=".$ringback_value.
",presence_id=".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'].
",call_direction=".$dir;
if (strlen($src) < 7) {
//source is a local extension
$source = $source_common.$sip_auto_answer.
",domain_uuid=".$domain_uuid.
",domain_name=".$_SESSION['domains'][$domain_uuid]['domain_name']."}user/".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
}
else {
//source is an external number
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $src);
$source = $source_common."}".$bridge_array[0];
}
unset($source_common);
//define b leg - set destination to display the defined caller id name and number
$destination_common = " &bridge({origination_caller_id_name='".$dest_cid_name."',origination_caller_id_number=".$dest_cid_number;
if (strlen($dest) < 7) {
//destination is a local extension
if (strpbrk($dest, '@') != FALSE) { //sip-uri
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
}
else { //not sip-uri
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
}
}
else {
//local extension (source) > external number (destination)
if (strlen($src) < 7 && strlen($dest_cid_number) == 0) {
//retrieve outbound caller id from the (source) extension
$sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' and extension = '".$src."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dest_cid_name = $row["outbound_caller_id_name"];
$dest_cid_number = $row["outbound_caller_id_number"];
break; //limit to 1 row
}
unset ($prep_statement);
}
if (permission_exists('click_to_call_call')) {
if (strpbrk($dest, '@') != FALSE) { //sip-uri
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
}
else { //not sip-uri
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $dest);
//$switch_cmd = $destination_common."}".$bridge_array[0].")"; // wouldn't set cdr destination correctly, so below used instead
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
}
}
}
unset($destination_common);
//create the even socket connection and send the event socket command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
//error message
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
}
else {
//display the last command
$switch_cmd = "api originate ".$source.$switch_cmd;
echo "<div align='center'>".$switch_cmd."<br /><br /><strong>".$src." has called ".$dest."</strong></div>\n";
//show the command result
$result = trim(event_socket_request($fp, $switch_cmd));
if (substr($result, 0,3) == "+OK") {
$uuid = substr($result, 4);
if ($rec == "true") {
//use the server's time zone to ensure it matches the time zone used by freeswitch
date_default_timezone_set($_SESSION['time_zone']['system']);
//create the api record command and send it over event socket
$switch_cmd = "api uuid_record ".$uuid." start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
$result2 = trim(event_socket_request($fp, $switch_cmd));
}
}
echo "<div align='center'><br />".$result."<br /><br /></div>\n";
}
}
//show html form
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"title\">\n";
echo " <strong>".$text['label-click2call']."</strong>\n";
echo " </span>\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " &nbsp;\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <span class=\"vexpl\">\n";
echo " ".$text['desc-click2call']."\n";
echo " </span>\n";
echo " </td>\n";
echo "\n";
echo " </tr>\n";
echo " </table>";
echo " <br />";
echo "<form>\n";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'\n";
echo "<tr>\n";
echo " <td class='vncellreq' width='40%'>".$text['label-src-caller-id-nam']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_name\" value='$src_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-caller-id-nam']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-src-caller-id-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_number\" value='$src_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-caller-id-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell' width='40%'>".$text['label-dest-caller-id-nam']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_name\" value='$dest_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-caller-id-nam']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell'>".$text['label-dest-caller-id-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_number\" value='$dest_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-caller-id-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-src-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src\" value='$src' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-dest-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest\" value='$dest' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo" <tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-auto-answer']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='auto_answer'>\n";
echo " <option value=''></option>\n";
if ($auto_answer == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($auto_answer == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-auto-answer']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-record']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='rec'>\n";
echo " <option value=''></option>\n";
if ($rec == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($rec == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-record']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-ringback']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='ringback'>\n";
echo " <option value=''></option>\n";
if ($ringback == "us-ring") {
echo " <option value='us-ring' selected='selected'>".$text['opt-usring']."</option>\n";
}
else {
echo " <option value='us-ring'>".$text['opt-usring']."</option>\n";
}
if ($ringback == "fr-ring") {
echo " <option value='fr-ring' selected='selected'>".$text['opt-frring']."</option>\n";
}
else {
echo " <option value='fr-ring'>".$text['opt-frring']."</option>\n";
}
if ($ringback == "pt-ring") {
echo " <option value='pt-ring' selected='selected'>".$text['opt-ptring']."</option>\n";
}
else {
echo " <option value='pt-ring'>".$text['opt-ptring']."</option>\n";
}
if ($ringback == "uk-ring") {
echo " <option value='uk-ring' selected='selected'>".$text['opt-ukring']."</option>\n";
}
else {
echo " <option value='uk-ring'>".$text['opt-ukring']."</option>\n";
}
if ($ringback == "rs-ring") {
echo " <option value='rs-ring' selected='selected'>".$text['opt-rsring']."</option>\n";
}
else {
echo " <option value='rs-ring'>".$text['opt-rsring']."</option>\n";
}
if ($ringback == "it-ring") {
echo " <option value='it-ring' selected='selected'>".$text['opt-itring']."</option>\n";
}
else {
echo " <option value='it-ring'>".$text['opt-itring']."</option>\n";
}
if ($ringback == "music") {
echo " <option value='music' selected='selected'>".$text['opt-moh']."</option>\n";
}
else {
echo " <option value='music'>".$text['opt-moh']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-ringback']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-call']."\">\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
echo "</form>";
//show the footer
require_once "resources/footer.php";
?>
<?php
/* $Id$ */
/*
call.php
Copyright (C) 2008, 2009 Mark J Crane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('click_to_call_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//include the header
require_once "resources/header.php";
if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])) {
//retrieve submitted variables
$src = check_str($_REQUEST['src']);
$src_cid_name = check_str($_REQUEST['src_cid_name']);
$src_cid_number = check_str($_REQUEST['src_cid_number']);
$dest = check_str($_REQUEST['dest']);
$dest_cid_name = check_str($_REQUEST['dest_cid_name']);
$dest_cid_number = check_str($_REQUEST['dest_cid_number']);
$auto_answer = check_str($_REQUEST['auto_answer']); //true,false
$rec = check_str($_REQUEST['rec']); //true,false
$ringback = check_str($_REQUEST['ringback']);
$context = $_SESSION['context'];
//clean up variable values
$src = str_replace(array('.','(',')','-',' '), '', $src);
$dest = (strpbrk($dest, '@') != FALSE) ? str_replace(array('(',')',' '), '', $dest) : str_replace(array('.','(',')','-',' '), '', $dest); //don't strip periods or dashes in sip-uri calls, only phone numbers
//adjust variable values
$sip_auto_answer = ($auto_answer == "true") ? ",sip_auto_answer=true" : null;
//mozilla thunderbird TBDialout workaround (seems it can only handle the first %NUM%)
$dest = ($dest == "%NUM%") ? $src_cid_number : $dest;
//translate ringback
switch ($ringback) {
case "music": $ringback_value = "\'local_stream://moh\'"; break;
case "uk-ring": $ringback_value = "\'%(400,200,400,450);%(400,2200,400,450)\'"; break;
case "fr-ring": $ringback_value = "\'%(1500,3500,440.0,0.0)\'"; break;
case "pt-ring": $ringback_value = "\'%(1000,5000,400.0,0.0)\'"; break;
case "rs-ring": $ringback_value = "\'%(1000,4000,425.0,0.0)\'"; break;
case "it-ring": $ringback_value = "\'%(1000,4000,425.0,0.0)\'"; break;
case "us-ring":
default:
$ringback = 'us-ring';
$ringback_value = "\'%(2000,4000,440.0,480.0)\'";
}
//determine call direction
$dir = (strlen($dest) < 7) ? 'local' : 'outbound';
//define a leg - set source to display the defined caller id name and number
$source_common = "{".
"click_to_call=true".
",origination_caller_id_name='".$src_cid_name."'".
",origination_caller_id_number=".$src_cid_number.
",instant_ringback=true".
",ringback=".$ringback_value.
",presence_id=".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'].
",call_direction=".$dir;
if (strlen($src) < 7) {
//source is a local extension
$source = $source_common.$sip_auto_answer.
",domain_uuid=".$domain_uuid.
",domain_name=".$_SESSION['domains'][$domain_uuid]['domain_name']."}user/".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
}
else {
//source is an external number
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $src);
$source = $source_common."}".$bridge_array[0];
}
unset($source_common);
//define b leg - set destination to display the defined caller id name and number
$destination_common = " &bridge({origination_caller_id_name='".$dest_cid_name."',origination_caller_id_number=".$dest_cid_number;
if (strlen($dest) < 7) {
//destination is a local extension
if (strpbrk($dest, '@') != FALSE) { //sip-uri
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
}
else { //not sip-uri
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
}
}
else {
//local extension (source) > external number (destination)
if (strlen($src) < 7 && strlen($dest_cid_number) == 0) {
//retrieve outbound caller id from the (source) extension
$sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' and extension = '".$src."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$dest_cid_name = $row["outbound_caller_id_name"];
$dest_cid_number = $row["outbound_caller_id_number"];
break; //limit to 1 row
}
unset ($prep_statement);
}
if (permission_exists('click_to_call_call')) {
if (strpbrk($dest, '@') != FALSE) { //sip-uri
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
}
else { //not sip-uri
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $dest);
//$switch_cmd = $destination_common."}".$bridge_array[0].")"; // wouldn't set cdr destination correctly, so below used instead
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
}
}
}
unset($destination_common);
//create the even socket connection and send the event socket command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
//error message
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
}
else {
//display the last command
$switch_cmd = "api originate ".$source.$switch_cmd;
echo "<div align='center'>".$switch_cmd."<br /><br /><strong>".$src." has called ".$dest."</strong></div>\n";
//show the command result
$result = trim(event_socket_request($fp, $switch_cmd));
if (substr($result, 0,3) == "+OK") {
$uuid = substr($result, 4);
if ($rec == "true") {
//use the server's time zone to ensure it matches the time zone used by freeswitch
date_default_timezone_set($_SESSION['time_zone']['system']);
//create the api record command and send it over event socket
$switch_cmd = "api uuid_record ".$uuid." start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
$result2 = trim(event_socket_request($fp, $switch_cmd));
}
}
echo "<div align='center'><br />".$result."<br /><br /></div>\n";
}
}
//show html form
echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"title\">\n";
echo " <strong>".$text['label-click2call']."</strong>\n";
echo " </span>\n";
echo " </td>\n";
echo " <td align='right'>\n";
echo " &nbsp;\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <span class=\"vexpl\">\n";
echo " ".$text['desc-click2call']."\n";
echo " </span>\n";
echo " </td>\n";
echo "\n";
echo " </tr>\n";
echo " </table>";
echo " <br />";
echo "<form>\n";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'\n";
echo "<tr>\n";
echo " <td class='vncellreq' width='40%'>".$text['label-src-caller-id-nam']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_name\" value='$src_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-caller-id-nam']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-src-caller-id-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src_cid_number\" value='$src_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-caller-id-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell' width='40%'>".$text['label-dest-caller-id-nam']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_name\" value='$dest_cid_name' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-caller-id-nam']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncell'>".$text['label-dest-caller-id-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest_cid_number\" value='$dest_cid_number' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-caller-id-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-src-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"src\" value='$src' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-src-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td class='vncellreq'>".$text['label-dest-num']."</td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input name=\"dest\" value='$dest' class='formfld'>\n";
echo " <br />\n";
echo " ".$text['desc-dest-num']."\n";
echo " </td>\n";
echo "</tr>\n";
echo" <tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-auto-answer']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='auto_answer'>\n";
echo " <option value=''></option>\n";
if ($auto_answer == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($auto_answer == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-auto-answer']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-record']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='rec'>\n";
echo " <option value=''></option>\n";
if ($rec == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($rec == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-record']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-ringback']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='ringback'>\n";
echo " <option value=''></option>\n";
if ($ringback == "us-ring") {
echo " <option value='us-ring' selected='selected'>".$text['opt-usring']."</option>\n";
}
else {
echo " <option value='us-ring'>".$text['opt-usring']."</option>\n";
}
if ($ringback == "fr-ring") {
echo " <option value='fr-ring' selected='selected'>".$text['opt-frring']."</option>\n";
}
else {
echo " <option value='fr-ring'>".$text['opt-frring']."</option>\n";
}
if ($ringback == "pt-ring") {
echo " <option value='pt-ring' selected='selected'>".$text['opt-ptring']."</option>\n";
}
else {
echo " <option value='pt-ring'>".$text['opt-ptring']."</option>\n";
}
if ($ringback == "uk-ring") {
echo " <option value='uk-ring' selected='selected'>".$text['opt-ukring']."</option>\n";
}
else {
echo " <option value='uk-ring'>".$text['opt-ukring']."</option>\n";
}
if ($ringback == "rs-ring") {
echo " <option value='rs-ring' selected='selected'>".$text['opt-rsring']."</option>\n";
}
else {
echo " <option value='rs-ring'>".$text['opt-rsring']."</option>\n";
}
if ($ringback == "it-ring") {
echo " <option value='it-ring' selected='selected'>".$text['opt-itring']."</option>\n";
}
else {
echo " <option value='it-ring'>".$text['opt-itring']."</option>\n";
}
if ($ringback == "music") {
echo " <option value='music' selected='selected'>".$text['opt-moh']."</option>\n";
}
else {
echo " <option value='music'>".$text['opt-moh']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-ringback']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-call']."\">\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
echo "</form>";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,21 +1,21 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Conferences";
$apps[$x]['menu'][0]['title']['es-cl'] = "Conferencias";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Conférences";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Conferencias";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "9f2a8c08-3e65-c41c-a716-3b53d42bc4d4";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/conferences/conferences.php";
//$apps[$x]['menu'][0]['groups'][] = "user";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Conferences";
$apps[$x]['menu'][0]['title']['es-cl'] = "Conferencias";
$apps[$x]['menu'][0]['title']['de-de'] = "";
$apps[$x]['menu'][0]['title']['de-ch'] = "";
$apps[$x]['menu'][0]['title']['de-at'] = "";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Conférences";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "Conferencias";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "9f2a8c08-3e65-c41c-a716-3b53d42bc4d4";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/conferences/conferences.php";
//$apps[$x]['menu'][0]['groups'][] = "user";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,219 +1,219 @@
<?php
if ($domains_processed == 1) {
//populate new phone_label values, phone_type_* values
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
if ($field_exists) {
//add multi-lingual support
$language = new text;
$text = $language->get();
// populate phone_type_* values
$sql = "update v_contact_phones set phone_type_voice = '1' ";
$sql .= "where phone_type = 'home' ";
$sql .= "or phone_type = 'work' ";
$sql .= "or phone_type = 'voice' ";
$sql .= "or phone_type = 'voicemail' ";
$sql .= "or phone_type = 'cell' ";
$sql .= "or phone_type = 'pcs' ";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_text = '1' where phone_type = 'cell' or phone_type = 'pager'";
$db->exec(check_sql($sql));
unset($sql);
// migrate phone_type values to phone_label, correct case and make multilingual where appropriate
$default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs');
$default_phone_labels = array($text['option-home'],$text['option-work'],'Pref','Voice',$text['option-fax'],$text['option-voicemail'],$text['option-mobile'],$text['option-pager'],'Modem','Car','ISDN','Video','PCS');
foreach ($default_phone_types as $index => $old) {
$new = $default_phone_labels[$index];
$sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'";
$db->exec(check_sql($sql));
unset($sql);
}
// empty phone_type field to prevent confusion in the future
$sql = "update v_contact_phones set phone_type = null";
$db->exec(check_sql($sql));
unset($sql);
}
unset($obj);
//populate primary email from deprecated field in v_contact table
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
if ($field_exists) {
// get email records
$sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sql = "insert into v_contact_emails ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_email_uuid, ";
$sql .= "email_primary, ";
$sql .= "email_address";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$row['domain_uuid']."', ";
$sql .= "'".$row['contact_uuid']."', ";
$sql .= "'".uuid()."', ";
$sql .= "1, ";
$sql .= "'".$row['contact_email']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//verify and remove value from old field
$sql2 = "select email_address from v_contact_emails ";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$sql2 .= "and email_address = '".$row['contact_email']."' ";
$prep_statement2 = $db->prepare(check_sql($sql2));
$prep_statement2->execute();
$result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2);
if ($result_count2 > 0) {
$sql3 = "update v_contacts set contact_email = '' ";
$sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$prep_statement3 = $db->prepare(check_sql($sql3));
$prep_statement3->execute();
unset($sql3, $prep_statement3);
}
unset($sql2, $result2, $prep_statement2);
}
}
}
unset($obj);
//populate primary url from deprecated field in v_contact table
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
if ($field_exists) {
// get email records
$sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sql = "insert into v_contact_urls ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_url_uuid, ";
$sql .= "url_primary, ";
$sql .= "url_address";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$row['domain_uuid']."', ";
$sql .= "'".$row['contact_uuid']."', ";
$sql .= "'".uuid()."', ";
$sql .= "1, ";
$sql .= "'".$row['contact_url']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//verify and remove value from old field
$sql2 = "select url_address from v_contact_urls ";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$sql2 .= "and url_address = '".$row['contact_url']."' ";
$prep_statement2 = $db->prepare(check_sql($sql2));
$prep_statement2->execute();
$result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2);
if ($result_count2 > 0) {
$sql3 = "update v_contacts set contact_url = '' ";
$sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$prep_statement3 = $db->prepare(check_sql($sql3));
$prep_statement3->execute();
unset($sql3, $prep_statement3);
}
unset($sql2, $result2, $prep_statement2);
}
}
}
unset($obj);
//set [name]_primary fields to 0 where null
$name_tables = array('phones','addresses','emails','urls');
$name_fields = array('phone','address','email','url');
foreach ($name_tables as $name_index => $name_table) {
$sql = "update v_contact_".$name_table." set ".$name_fields[$name_index]."_primary = 0 ";
$sql .= "where ".$name_fields[$name_index]."_primary is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql, $prep_statement);
}
unset($name_tables, $name_fields);
//move the users from the contact groups table into the contact users table
$sql = "select * from v_contact_groups ";
$sql .= "where group_uuid in (select user_uuid from v_users) ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$sql = "insert into v_contact_users ";
$sql .= "( ";
$sql .= "contact_user_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".uuid()."', ";
$sql .= "'".$row["domain_uuid"]."', ";
$sql .= "'".$row["contact_uuid"]."', ";
$sql .= "'".$row["group_uuid"]."' ";
$sql .= ");";
//echo $sql."\n";
$db->exec($sql);
unset($sql);
$sql = "delete from v_contact_groups ";
$sql .= "where contact_group_uuid = '".$row["contact_group_uuid"]."';";
//echo $sql."\n";
$db->exec($sql);
unset($sql);
}
unset ($prep_statement);
}
<?php
if ($domains_processed == 1) {
//populate new phone_label values, phone_type_* values
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contact_phones', 'phone_type'); //check if field exists
if ($field_exists) {
//add multi-lingual support
$language = new text;
$text = $language->get();
// populate phone_type_* values
$sql = "update v_contact_phones set phone_type_voice = '1' ";
$sql .= "where phone_type = 'home' ";
$sql .= "or phone_type = 'work' ";
$sql .= "or phone_type = 'voice' ";
$sql .= "or phone_type = 'voicemail' ";
$sql .= "or phone_type = 'cell' ";
$sql .= "or phone_type = 'pcs' ";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_fax = '1' where phone_type = 'fax'";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_video = '1' where phone_type = 'video'";
$db->exec(check_sql($sql));
unset($sql);
$sql = "update v_contact_phones set phone_type_text = '1' where phone_type = 'cell' or phone_type = 'pager'";
$db->exec(check_sql($sql));
unset($sql);
// migrate phone_type values to phone_label, correct case and make multilingual where appropriate
$default_phone_types = array('home','work','pref','voice','fax','msg','cell','pager','modem','car','isdn','video','pcs');
$default_phone_labels = array($text['option-home'],$text['option-work'],'Pref','Voice',$text['option-fax'],$text['option-voicemail'],$text['option-mobile'],$text['option-pager'],'Modem','Car','ISDN','Video','PCS');
foreach ($default_phone_types as $index => $old) {
$new = $default_phone_labels[$index];
$sql = "update v_contact_phones set phone_label = '".$new."' where phone_type = '".$old."'";
$db->exec(check_sql($sql));
unset($sql);
}
// empty phone_type field to prevent confusion in the future
$sql = "update v_contact_phones set phone_type = null";
$db->exec(check_sql($sql));
unset($sql);
}
unset($obj);
//populate primary email from deprecated field in v_contact table
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_email'); //check if field exists
if ($field_exists) {
// get email records
$sql = "select * from v_contacts where contact_email is not null and contact_email != ''";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sql = "insert into v_contact_emails ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_email_uuid, ";
$sql .= "email_primary, ";
$sql .= "email_address";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$row['domain_uuid']."', ";
$sql .= "'".$row['contact_uuid']."', ";
$sql .= "'".uuid()."', ";
$sql .= "1, ";
$sql .= "'".$row['contact_email']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//verify and remove value from old field
$sql2 = "select email_address from v_contact_emails ";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$sql2 .= "and email_address = '".$row['contact_email']."' ";
$prep_statement2 = $db->prepare(check_sql($sql2));
$prep_statement2->execute();
$result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2);
if ($result_count2 > 0) {
$sql3 = "update v_contacts set contact_email = '' ";
$sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$prep_statement3 = $db->prepare(check_sql($sql3));
$prep_statement3->execute();
unset($sql3, $prep_statement3);
}
unset($sql2, $result2, $prep_statement2);
}
}
}
unset($obj);
//populate primary url from deprecated field in v_contact table
$obj = new schema;
$obj->db = $db;
$obj->db_type = $db_type;
$obj->schema();
$field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url'); //check if field exists
if ($field_exists) {
// get email records
$sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sql = "insert into v_contact_urls ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_url_uuid, ";
$sql .= "url_primary, ";
$sql .= "url_address";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$row['domain_uuid']."', ";
$sql .= "'".$row['contact_uuid']."', ";
$sql .= "'".uuid()."', ";
$sql .= "1, ";
$sql .= "'".$row['contact_url']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//verify and remove value from old field
$sql2 = "select url_address from v_contact_urls ";
$sql2 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql2 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$sql2 .= "and url_address = '".$row['contact_url']."' ";
$prep_statement2 = $db->prepare(check_sql($sql2));
$prep_statement2->execute();
$result2 = $prep_statement2->fetchAll(PDO::FETCH_NAMED);
$result_count2 = count($result2);
if ($result_count2 > 0) {
$sql3 = "update v_contacts set contact_url = '' ";
$sql3 .= "where domain_uuid = '".$row['domain_uuid']."' ";
$sql3 .= "and contact_uuid = '".$row['contact_uuid']."' ";
$prep_statement3 = $db->prepare(check_sql($sql3));
$prep_statement3->execute();
unset($sql3, $prep_statement3);
}
unset($sql2, $result2, $prep_statement2);
}
}
}
unset($obj);
//set [name]_primary fields to 0 where null
$name_tables = array('phones','addresses','emails','urls');
$name_fields = array('phone','address','email','url');
foreach ($name_tables as $name_index => $name_table) {
$sql = "update v_contact_".$name_table." set ".$name_fields[$name_index]."_primary = 0 ";
$sql .= "where ".$name_fields[$name_index]."_primary is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql, $prep_statement);
}
unset($name_tables, $name_fields);
//move the users from the contact groups table into the contact users table
$sql = "select * from v_contact_groups ";
$sql .= "where group_uuid in (select user_uuid from v_users) ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$sql = "insert into v_contact_users ";
$sql .= "( ";
$sql .= "contact_user_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".uuid()."', ";
$sql .= "'".$row["domain_uuid"]."', ";
$sql .= "'".$row["contact_uuid"]."', ";
$sql .= "'".$row["group_uuid"]."' ";
$sql .= ");";
//echo $sql."\n";
$db->exec($sql);
unset($sql);
$sql = "delete from v_contact_groups ";
$sql .= "where contact_group_uuid = '".$row["contact_group_uuid"]."';";
//echo $sql."\n";
$db->exec($sql);
unset($sql);
}
unset ($prep_statement);
}
?>

View File

@@ -1,122 +1,122 @@
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
/*
echo "bang!";
exit;
*/
//add multi-lingual support
$language = new text;
$text = $language->get();
$_SESSION['contact_auth']['source'] = ($_SESSION['contact_auth']['source'] == '') ? $_REQUEST['source'] : $_SESSION['contact_auth']['source'];
$_SESSION['contact_auth']['target'] = ($_SESSION['contact_auth']['target'] == '') ? $_REQUEST['target'] : $_SESSION['contact_auth']['target'];
//google api authentication
if ($_SESSION['contact_auth']['source'] == 'google') {
if ($_REQUEST['error']) {
$_SESSION['message'] = ($text['message-'.$_REQUEST['error']] != '') ? $text['message-'.$_REQUEST['error']] : $_REQUEST['error'];
$_SESSION['message_mood'] = 'negative';
header("Location: ".$_SESSION['contact_auth']['referer']);
unset($_SESSION['contact_auth']);
exit;
}
if (isset($_REQUEST['signout'])) {
unset($_SESSION['contact_auth']['token']);
$_SESSION['message'] = $text['message-google_signed_out'];
header("Location: https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].PROJECT_PATH."/app/contacts/".$_SESSION['contact_auth']['referer']);
exit;
}
if ($_GET['code'] == '') {
header("Location: https://accounts.google.com/o/oauth2/auth?client_id=".$_SESSION['contact']['google_oauth_client_id']['text']."&redirect_uri=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."&scope=https://www.google.com/m8/feeds/&response_type=code");
exit;
}
else {
$auth_code = $_GET["code"];
}
/*******************************************************************************************/
// request access token
$fields = array(
'code' => urlencode($auth_code),
'client_id' => urlencode($_SESSION['contact']['google_oauth_client_id']['text']),
'client_secret' => urlencode($_SESSION['contact']['google_oauth_client_secret']['text']),
'redirect_uri' => urlencode((($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']),
'grant_type' => urlencode('authorization_code')
);
foreach($fields as $key => $value) {
$post_fields[] = $key.'='.$value;
}
$post_fields = implode("&", $post_fields);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://accounts.google.com/o/oauth2/token');
curl_setopt($curl, CURLOPT_POST, 5);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec($curl);
curl_close($curl);
$response = json_decode($result);
$access_token = $response->access_token;
if ($access_token != '') {
// redirect to target script
$_SESSION['contact_auth']['token'] = $access_token;
header("Location: ".$_SESSION['contact_auth']['target']);
exit;
}
}
else {
$_SESSION['message'] = $text['message-access_denied'];
$_SESSION['message_mood'] = 'negative';
header("Location: ".$_SESSION['contact_auth']['referer']);
unset($_SESSION['contact_auth']);
exit;
}
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
/*
echo "bang!";
exit;
*/
//add multi-lingual support
$language = new text;
$text = $language->get();
$_SESSION['contact_auth']['source'] = ($_SESSION['contact_auth']['source'] == '') ? $_REQUEST['source'] : $_SESSION['contact_auth']['source'];
$_SESSION['contact_auth']['target'] = ($_SESSION['contact_auth']['target'] == '') ? $_REQUEST['target'] : $_SESSION['contact_auth']['target'];
//google api authentication
if ($_SESSION['contact_auth']['source'] == 'google') {
if ($_REQUEST['error']) {
$_SESSION['message'] = ($text['message-'.$_REQUEST['error']] != '') ? $text['message-'.$_REQUEST['error']] : $_REQUEST['error'];
$_SESSION['message_mood'] = 'negative';
header("Location: ".$_SESSION['contact_auth']['referer']);
unset($_SESSION['contact_auth']);
exit;
}
if (isset($_REQUEST['signout'])) {
unset($_SESSION['contact_auth']['token']);
$_SESSION['message'] = $text['message-google_signed_out'];
header("Location: https://www.google.com/accounts/Logout?continue=https://appengine.google.com/_ah/logout?continue=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].PROJECT_PATH."/app/contacts/".$_SESSION['contact_auth']['referer']);
exit;
}
if ($_GET['code'] == '') {
header("Location: https://accounts.google.com/o/oauth2/auth?client_id=".$_SESSION['contact']['google_oauth_client_id']['text']."&redirect_uri=".(($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."&scope=https://www.google.com/m8/feeds/&response_type=code");
exit;
}
else {
$auth_code = $_GET["code"];
}
/*******************************************************************************************/
// request access token
$fields = array(
'code' => urlencode($auth_code),
'client_id' => urlencode($_SESSION['contact']['google_oauth_client_id']['text']),
'client_secret' => urlencode($_SESSION['contact']['google_oauth_client_secret']['text']),
'redirect_uri' => urlencode((($_SERVER["HTTPS"] == "on") ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']),
'grant_type' => urlencode('authorization_code')
);
foreach($fields as $key => $value) {
$post_fields[] = $key.'='.$value;
}
$post_fields = implode("&", $post_fields);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://accounts.google.com/o/oauth2/token');
curl_setopt($curl, CURLOPT_POST, 5);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
$result = curl_exec($curl);
curl_close($curl);
$response = json_decode($result);
$access_token = $response->access_token;
if ($access_token != '') {
// redirect to target script
$_SESSION['contact_auth']['token'] = $access_token;
header("Location: ".$_SESSION['contact_auth']['target']);
exit;
}
}
else {
$_SESSION['message'] = $text['message-access_denied'];
$_SESSION['message_mood'] = 'negative';
header("Location: ".$_SESSION['contact_auth']['referer']);
unset($_SESSION['contact_auth']);
exit;
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,342 +1,342 @@
<?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>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_relation_edit') || permission_exists('contact_relation_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_relation_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$relation_label = check_str($_POST["relation_label"]);
$relation_label_custom = check_str($_POST["relation_label_custom"]);
$relation_contact_uuid = check_str($_POST["relation_contact_uuid"]);
$relation_reciprocal = check_str($_POST["relation_reciprocal"]);
$relation_reciprocal_label = check_str($_POST["relation_reciprocal_label"]);
$relation_reciprocal_label_custom = check_str($_POST["relation_reciprocal_label_custom"]);
//use custom label(s), if set
$relation_label = ($relation_label_custom != '') ? $relation_label_custom : $relation_label;
$relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label;
}
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//set the uuid
if ($action == "update") {
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$relation_label."', ";
$sql .= "'".$relation_contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($relation_reciprocal) {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$relation_contact_uuid."', ";
$sql .= "'".$relation_reciprocal_label."', ";
$sql .= "'".$contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_relations set ";
$sql .= "relation_label = '".$relation_label."', ";
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$contact_relation_uuid = $_GET["id"];
$sql = "select * from v_contact_relations ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$relation_label = $row["relation_label"];
$relation_contact_uuid = $row["relation_contact_uuid"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
$document['title'] = $text['title-contact_relation'];
require_once "resources/header.php";
//javascript to toggle input/select boxes
echo "<script type='text/javascript'>";
echo " function toggle_custom(field) {";
echo " $('#'+field).toggle();";
echo " document.getElementById(field).selectedIndex = 0;";
echo " document.getElementById(field+'_custom').value = '';";
echo " $('#'+field+'_custom').toggle();";
echo " if ($('#'+field+'_custom').is(':visible')) { $('#'+field+'_custom').focus(); } else { $('#'+field).focus(); }";
echo " }";
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'>";
echo " <b>".$text['header-contact_relation']."</b>";
echo "</td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".$contact_uuid."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_label']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (is_array($_SESSION["contact"]["relation_label"])) {
sort($_SESSION["contact"]["relation_label"]);
foreach($_SESSION["contact"]["relation_label"] as $row) {
$relation_label_options[] = "<option value='".$row."' ".(($row == $relation_label) ? "selected='selected'" : null).">".$row."</option>";
}
$relation_label_found = (in_array($relation_label, $_SESSION["contact"]["relation_label"])) ? true : false;
}
else {
$selected[$relation_label] = "selected";
$default_labels[] = $text['label-contact_relation_option_parent'];
$default_labels[] = $text['label-contact_relation_option_child'];
$default_labels[] = $text['label-contact_relation_option_employee'];
$default_labels[] = $text['label-contact_relation_option_member'];
$default_labels[] = $text['label-contact_relation_option_associate'];
$default_labels[] = $text['label-contact_relation_option_other'];
foreach ($default_labels as $default_label) {
$relation_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
}
$relation_label_found = (in_array($relation_label, $default_labels)) ? true : false;
}
echo " <select class='formfld' ".((!$relation_label_found && $relation_label != '') ? "style='display: none;'" : null)." name='relation_label' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
echo " <option value=''></option>\n";
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
echo " </select>\n";
echo " <input type='text' class='formfld' ".(($relation_label_found || $relation_label == '') ? "style='display: none;'" : null)." name='relation_label_custom' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label) : null)."\">\n";
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('relation_label');\">\n";
echo "<br />\n";
echo $text['description-relation_label']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_contact']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$sql = "select contact_uuid, contact_organization, contact_name_given, contact_name_family from v_contacts ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid <> '".$contact_uuid."' ";
$sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
echo "<select class='formfld' name='relation_contact_uuid' id='relation_contact_uuid'>\n";
echo "<option value=''></option>\n";
foreach($result as $row) {
$contact_name = $row['contact_name_given'].(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).$row['contact_name_family'];
if ($row['contact_organization'] != '') {
if ($contact_name != '') {
$contact_name = $row['contact_organization'].', '.$contact_name;
}
else {
$contact_name = $row['contact_organization'];
}
}
echo "<option value='".$row['contact_uuid']."' ".(($row['contact_uuid'] == $relation_contact_uuid) ? "selected='selected'" : null).">".$contact_name."</option>\n";
}
unset($sql, $result, $row_count);
echo "</select>\n";
// echo "<br />\n";
// echo $text['description-related_contact']."\n";
echo "</td>\n";
echo "</tr>\n";
if ($action == 'add') {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal' id='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1'>".$text['option-true']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<div id='reciprocal_label' style='display: none;'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_reciprocal_label']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal_label' id='relation_reciprocal_label' onchange=\"getElementById('relation_reciprocal_label_custom').value='';\">\n";
echo " <option value=''></option>\n";
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
echo " </select>\n";
echo " <input type='text' class='formfld' style='display: none;' name='relation_reciprocal_label_custom' id='relation_reciprocal_label_custom' value=''>\n";
echo " <input type='button' id='btn_toggle_reciprocal_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('relation_reciprocal_label');\">\n";
echo "<br />\n";
echo $text['description-contact_relation_reciprocal_label']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
}
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".$contact_uuid."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_relation_uuid' value='".$contact_relation_uuid."'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_relation_edit') || permission_exists('contact_relation_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$contact_relation_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$relation_label = check_str($_POST["relation_label"]);
$relation_label_custom = check_str($_POST["relation_label_custom"]);
$relation_contact_uuid = check_str($_POST["relation_contact_uuid"]);
$relation_reciprocal = check_str($_POST["relation_reciprocal"]);
$relation_reciprocal_label = check_str($_POST["relation_reciprocal_label"]);
$relation_reciprocal_label_custom = check_str($_POST["relation_reciprocal_label_custom"]);
//use custom label(s), if set
$relation_label = ($relation_label_custom != '') ? $relation_label_custom : $relation_label;
$relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label;
}
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//set the uuid
if ($action == "update") {
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$relation_label."', ";
$sql .= "'".$relation_contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($relation_reciprocal) {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$relation_contact_uuid."', ";
$sql .= "'".$relation_reciprocal_label."', ";
$sql .= "'".$contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_relations set ";
$sql .= "relation_label = '".$relation_label."', ";
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$contact_relation_uuid = $_GET["id"];
$sql = "select * from v_contact_relations ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$relation_label = $row["relation_label"];
$relation_contact_uuid = $row["relation_contact_uuid"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
$document['title'] = $text['title-contact_relation'];
require_once "resources/header.php";
//javascript to toggle input/select boxes
echo "<script type='text/javascript'>";
echo " function toggle_custom(field) {";
echo " $('#'+field).toggle();";
echo " document.getElementById(field).selectedIndex = 0;";
echo " document.getElementById(field+'_custom').value = '';";
echo " $('#'+field+'_custom').toggle();";
echo " if ($('#'+field+'_custom').is(':visible')) { $('#'+field+'_custom').focus(); } else { $('#'+field).focus(); }";
echo " }";
echo "</script>";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' valign='top' nowrap='nowrap'>";
echo " <b>".$text['header-contact_relation']."</b>";
echo "</td>\n";
echo "<td align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='contact_edit.php?id=".$contact_uuid."'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_label']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (is_array($_SESSION["contact"]["relation_label"])) {
sort($_SESSION["contact"]["relation_label"]);
foreach($_SESSION["contact"]["relation_label"] as $row) {
$relation_label_options[] = "<option value='".$row."' ".(($row == $relation_label) ? "selected='selected'" : null).">".$row."</option>";
}
$relation_label_found = (in_array($relation_label, $_SESSION["contact"]["relation_label"])) ? true : false;
}
else {
$selected[$relation_label] = "selected";
$default_labels[] = $text['label-contact_relation_option_parent'];
$default_labels[] = $text['label-contact_relation_option_child'];
$default_labels[] = $text['label-contact_relation_option_employee'];
$default_labels[] = $text['label-contact_relation_option_member'];
$default_labels[] = $text['label-contact_relation_option_associate'];
$default_labels[] = $text['label-contact_relation_option_other'];
foreach ($default_labels as $default_label) {
$relation_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
}
$relation_label_found = (in_array($relation_label, $default_labels)) ? true : false;
}
echo " <select class='formfld' ".((!$relation_label_found && $relation_label != '') ? "style='display: none;'" : null)." name='relation_label' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
echo " <option value=''></option>\n";
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
echo " </select>\n";
echo " <input type='text' class='formfld' ".(($relation_label_found || $relation_label == '') ? "style='display: none;'" : null)." name='relation_label_custom' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label) : null)."\">\n";
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('relation_label');\">\n";
echo "<br />\n";
echo $text['description-relation_label']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_contact']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$sql = "select contact_uuid, contact_organization, contact_name_given, contact_name_family from v_contacts ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid <> '".$contact_uuid."' ";
$sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
echo "<select class='formfld' name='relation_contact_uuid' id='relation_contact_uuid'>\n";
echo "<option value=''></option>\n";
foreach($result as $row) {
$contact_name = $row['contact_name_given'].(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).$row['contact_name_family'];
if ($row['contact_organization'] != '') {
if ($contact_name != '') {
$contact_name = $row['contact_organization'].', '.$contact_name;
}
else {
$contact_name = $row['contact_organization'];
}
}
echo "<option value='".$row['contact_uuid']."' ".(($row['contact_uuid'] == $relation_contact_uuid) ? "selected='selected'" : null).">".$contact_name."</option>\n";
}
unset($sql, $result, $row_count);
echo "</select>\n";
// echo "<br />\n";
// echo $text['description-related_contact']."\n";
echo "</td>\n";
echo "</tr>\n";
if ($action == 'add') {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal' id='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1'>".$text['option-true']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<div id='reciprocal_label' style='display: none;'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-contact_relation_reciprocal_label']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal_label' id='relation_reciprocal_label' onchange=\"getElementById('relation_reciprocal_label_custom').value='';\">\n";
echo " <option value=''></option>\n";
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
echo " </select>\n";
echo " <input type='text' class='formfld' style='display: none;' name='relation_reciprocal_label_custom' id='relation_reciprocal_label_custom' value=''>\n";
echo " <input type='button' id='btn_toggle_reciprocal_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('relation_reciprocal_label');\">\n";
echo "<br />\n";
echo $text['description-contact_relation_reciprocal_label']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
}
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <br>\n";
echo " <input type='hidden' name='contact_uuid' value='".$contact_uuid."'>\n";
if ($action == "update") {
echo " <input type='hidden' name='contact_relation_uuid' value='".$contact_relation_uuid."'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -1,113 +1,113 @@
<?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>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_relation_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-contact_relations']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the related contacts
$sql = "select ";
$sql .= "cr.contact_relation_uuid, ";
$sql .= "cr.relation_label, ";
$sql .= "c.contact_uuid, ";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family ";
$sql .= "from ";
$sql .= "v_contact_relations as cr, ";
$sql .= "v_contacts as c ";
$sql .= "where ";
$sql .= "cr.relation_contact_uuid = c.contact_uuid ";
$sql .= "and cr.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and cr.contact_uuid = '".$contact_uuid."' ";
$sql .= "order by ";
$sql .= "c.contact_organization desc, ";
$sql .= "c.contact_name_given asc, ";
$sql .= "c.contact_name_family asc ";
//echo $sql."<br><br>";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-contact_relation_label']."</th>\n";
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
echo "<th>".$text['label-contact_relation_name']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_relation_add')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
if (permission_exists('contact_relation_edit')) {
$tr_link = "href='contact_relation_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_relation_uuid']."' ";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['relation_label']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".$row['contact_uuid']."'>".$row['contact_organization']."</a>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".$row['contact_uuid']."'>".$row['contact_name_given'].(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).$row['contact_name_family']."</a>&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_relation_edit')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."&id=".$row['contact_relation_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('contact_relation_delete')) {
echo "<a href='contact_relation_delete.php?contact_uuid=".$contact_uuid."&id=".$row['contact_relation_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</table>";
<?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>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('contact_relation_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//show the content
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['header-contact_relations']."</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
//get the related contacts
$sql = "select ";
$sql .= "cr.contact_relation_uuid, ";
$sql .= "cr.relation_label, ";
$sql .= "c.contact_uuid, ";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family ";
$sql .= "from ";
$sql .= "v_contact_relations as cr, ";
$sql .= "v_contacts as c ";
$sql .= "where ";
$sql .= "cr.relation_contact_uuid = c.contact_uuid ";
$sql .= "and cr.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and cr.contact_uuid = '".$contact_uuid."' ";
$sql .= "order by ";
$sql .= "c.contact_organization desc, ";
$sql .= "c.contact_name_given asc, ";
$sql .= "c.contact_name_family asc ";
//echo $sql."<br><br>";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' style='margin-bottom: 20px;' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-contact_relation_label']."</th>\n";
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
echo "<th>".$text['label-contact_relation_name']."</th>\n";
echo "<td class='list_control_icons'>";
if (permission_exists('contact_relation_add')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
if (permission_exists('contact_relation_edit')) {
$tr_link = "href='contact_relation_edit.php?contact_uuid=".$row['contact_uuid']."&id=".$row['contact_relation_uuid']."' ";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['relation_label']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".$row['contact_uuid']."'>".$row['contact_organization']."</a>&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'><a href='contact_edit.php?id=".$row['contact_uuid']."'>".$row['contact_name_given'].(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).$row['contact_name_family']."</a>&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('contact_relation_edit')) {
echo "<a href='contact_relation_edit.php?contact_uuid=".$contact_uuid."&id=".$row['contact_relation_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('contact_relation_delete')) {
echo "<a href='contact_relation_delete.php?contact_uuid=".$contact_uuid."&id=".$row['contact_relation_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</table>";
?>

View File

@@ -1,361 +1,361 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!permission_exists('contact_time_add')) { echo "access denied"; exit; }
//add multi-lingual support
$language = new text;
$text = $language->get();
//get contact uuid
$domain_uuid = check_str($_REQUEST['domain_uuid']);
$contact_uuid = check_str($_REQUEST['contact_uuid']);
//get posted variables & set time status
if (sizeof($_POST) > 0) {
$contact_time_uuid = check_str($_POST['contact_time_uuid']);
$contact_uuid = check_str($_POST['contact_uuid']);
$time_action = check_str($_POST['time_action']);
$time_description = check_str($_POST['time_description']);
if ($time_description == 'Description...') { unset($time_description); }
if ($time_action == 'start') {
$contact_time_uuid = uuid();
$sql = "insert into v_contact_times ";
$sql .= "( ";
$sql .= "domain_uuid, ";
$sql .= "contact_time_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid, ";
$sql .= "time_start, ";
$sql .= "time_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_time_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
$sql .= "'".date("Y-m-d H:i:s")."', ";
$sql .= "'".$time_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
if ($time_action == 'stop') {
$sql = "update v_contact_times ";
$sql .= "set ";
$sql .= "time_stop = '".date("Y-m-d H:i:s")."', ";
$sql .= "time_description = '".$time_description."' ";
$sql .= "where ";
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
$db->exec(check_sql($sql));
unset($sql);
}
header("Location: contact_timer.php?domain_uuid=".$domain_uuid."&contact_uuid=".$contact_uuid);
}
//get contact details
$sql = "select ";
$sql .= "contact_organization, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_family, ";
$sql .= "contact_nickname ";
$sql .= "from v_contacts ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$contact_organization = $result["contact_organization"];
$contact_name_given = $result["contact_name_given"];
$contact_name_family = $result["contact_name_family"];
$contact_nickname = $result["contact_nickname"];
}
else {
exit;
}
unset ($sql, $prep_statement, $result);
//determine timer state and action
$sql = "select ";
$sql .= "contact_time_uuid, ";
$sql .= "time_description ";
$sql .= "from v_contact_times ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and time_start is not null ";
$sql .= "and time_stop is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$contact_time_uuid = $result["contact_time_uuid"];
$time_description = $result["time_description"];
}
unset ($sql, $prep_statement, $result);
$timer_state = ($contact_time_uuid != '') ? 'running' : 'stopped';
$timer_action = ($timer_state == 'running') ? 'stop' : 'start';
//determine contact name to display
if ($contact_nickname != '') {
$contact = $contact_nickname;
}
else if ($contact_name_given != '') {
$contact = $contact_name_given;
}
if ($contact_name_family != '') {
$contact .= ($contact != '') ? ' '.$contact_name_family : $contact_name_family;
}
if ($contact_organization != '') {
$contact .= ($contact != '') ? ', '.$contact_organization : $contact_organization;
}
?>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<title><?php echo $text['label-time_timer']; ?>: <?php echo $contact; ?></title>
<style>
body {
color: #5f5f5f;
font-size: 12px;
font-family: arial;
margin: 0;
padding: 15px;
}
b {
color: #952424;
font-size: 15px;
font-family: arial;
}
a {
color: #004083;
width: 100%;
}
a:hover {
color: #5082ca;
}
form {
margin: 0;
}
input.btn, input.button {
font-family: Candara, Calibri, Segoe, "Segoe UI", Optima, Arial, sans-serif;
padding: 2px 6px 3px 6px;
color: #fff;
font-weight: bold;
cursor: pointer;
font-size: 11px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
background-image: -moz-linear-gradient(top, #524f59 25%, #000 64%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.25, #524f59), color-stop(0.64, #000));
border: 1px solid #26242a;
background-color: #000;
text-align: center;
text-transform: uppercase;
text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.85);
opacity: 0.9;
-moz-opacity: 0.9;
}
input.btn:hover, input.button:hover, img.list_control_icon:hover {
box-shadow: 0 0 5px #cddaf0;
-webkit-box-shadow: 0 0 5px #cddaf0;
-moz-box-shadow: 0 0 5px #cddaf0;
opacity: 1.0;
-moz-opacity: 1.0;
cursor: pointer;
}
input.txt, textarea.txt, select.txt, .formfld {
font-family: arial;
font-size: 12px;
color: #000;
text-align: left;
padding: 5px;
border: 1px solid #c0c0c0;
background-color: #fff;
box-shadow: 0 0 3px #cddaf0 inset;
-moz-box-shadow: 0 0 3px #cddaf0 inset;
-webkit-box-shadow: 0 0 3px #cddaf0 inset;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
input.txt, .formfld {
transition: width 0.25s;
-moz-transition: width 0.25s;
-webkit-transition: width 0.25s;
max-width: 500px;
}
input.txt:focus, .formfld:focus {
-webkit-box-shadow: 0 0 5px #cddaf0;
-moz-box-shadow: 0 0 5px #cddaf0;
box-shadow: 0 0 5px #cddaf0;
}
td {
color: #5f5f5f;
font-size: 12px;
font-family: arial;
}
.vncell {
border-bottom: 1px solid #fff;
background-color: #e5e9f0;
padding: 8px;
text-align: right;
color: #000;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border-right: 3px solid #e5e9f0;
}
DIV.timer_running {
vertical-align: middle;
padding-top: 7px;
line-height: 50px;
width: 100%;
height: 53px;
text-align: center;
background-color: #2C9DE8;
font-size: 50px;
color: #FFFFFF;
/*-webkit-text-shadow: 0px 0px 5px #000;*/
/*-moz-text-shadow: 0px 0px 5px #000;*/
/*text-shadow: 0px 0px 5px #000;*/
font-weight: bold;
letter-spacing: -0.05em;
font-family: "Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
DIV.timer_stopped {
vertical-align: middle;
padding-top: 7px;
line-height: 50px;
width: 100%;
height: 53px;
text-align: center;
background-color: #2C9DE8;
font-size: 50px;
color: #FFFFFF;
/*-webkit-text-shadow: 0px 0px 5px #000;*/
/*-moz-text-shadow: 0px 0px 5px #000;*/
/*text-shadow: 0px 0px 5px #000;*/
font-weight: bold;
letter-spacing: -0.05em;
font-family: "Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
</style>
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-1.11.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//ajax for refresh
var refresh = 1500;
var source_url = 'contact_timer_inc.php?domain_uuid=<?php echo $domain_uuid; ?>&contact_uuid=<?php echo $contact_uuid; ?>&contact_time_uuid=<?php echo $contact_time_uuid; ?>';
var ajax_get = function () {
$.ajax({
url: source_url, success: function(response){
$("#ajax_reponse").html(response);
}
});
setTimeout(ajax_get, refresh);
};
<?php if ($timer_state == 'running') { ?>
ajax_get();
<?php } ?>
});
//set window title to time when timer is running
function set_title(title_text) {
window.document.title = title_text;
}
</script>
</head>
<body>
<img src='resources/images/icon_timer.png' style='width: 24px; height: 24px; border: none; margin-left: 15px;' alt="<?php echo $text['label-time_timer']; ?>" align='right'>
<b><?php echo $text['label-time_timer']; ?></b>
<br><br>
<?php echo $text['description_timer']; ?>
<br><br>
<strong><a href="javascript:void(0);" onclick="window.opener.location.href='contact_edit.php?id=<?php echo $contact_uuid; ?>';"><?php echo $contact; ?></a></strong>
<br><br>
<div id='ajax_reponse' class='timer_<?php echo $timer_state;?>'>00:00:00</div>
<br>
<form name='frm' id='frm' method='post' action=''>
<input type='hidden' name='domain_uuid' value="<?php echo $domain_uuid; ?>">
<input type='hidden' name='contact_time_uuid' value="<?php echo $contact_time_uuid; ?>">
<input type='hidden' name='contact_uuid' value="<?php echo $contact_uuid; ?>">
<input type='hidden' name='time_action' value="<?php echo $timer_action; ?>">
<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
<tr>
<td class='vncell' style='text-align: center; padding: 10px;'>
<?php echo $text['label-description']; ?>
<textarea name='time_description' id='timer_description' class='formfld' style='width: 100%; height: 50px; margin-top: 5px;'><?php echo $time_description; ?></textarea>
<? if ($timer_state == 'stopped') { ?><script>document.getElementById('timer_description').focus();</script><? } ?>
</td>
</tr>
</table>
<br>
<center>
<?php if ($timer_state == 'running') { ?>
<input type='submit' class='btn' value="<?php echo $text['button-stop']; ?>">
<?php } else if ($timer_state == 'stopped') { ?>
<input type='submit' class='btn' value="<?php echo $text['button-start']; ?>">
<?php } ?>
</center>
</form>
</body>
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!permission_exists('contact_time_add')) { echo "access denied"; exit; }
//add multi-lingual support
$language = new text;
$text = $language->get();
//get contact uuid
$domain_uuid = check_str($_REQUEST['domain_uuid']);
$contact_uuid = check_str($_REQUEST['contact_uuid']);
//get posted variables & set time status
if (sizeof($_POST) > 0) {
$contact_time_uuid = check_str($_POST['contact_time_uuid']);
$contact_uuid = check_str($_POST['contact_uuid']);
$time_action = check_str($_POST['time_action']);
$time_description = check_str($_POST['time_description']);
if ($time_description == 'Description...') { unset($time_description); }
if ($time_action == 'start') {
$contact_time_uuid = uuid();
$sql = "insert into v_contact_times ";
$sql .= "( ";
$sql .= "domain_uuid, ";
$sql .= "contact_time_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid, ";
$sql .= "time_start, ";
$sql .= "time_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_time_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
$sql .= "'".date("Y-m-d H:i:s")."', ";
$sql .= "'".$time_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
if ($time_action == 'stop') {
$sql = "update v_contact_times ";
$sql .= "set ";
$sql .= "time_stop = '".date("Y-m-d H:i:s")."', ";
$sql .= "time_description = '".$time_description."' ";
$sql .= "where ";
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
$db->exec(check_sql($sql));
unset($sql);
}
header("Location: contact_timer.php?domain_uuid=".$domain_uuid."&contact_uuid=".$contact_uuid);
}
//get contact details
$sql = "select ";
$sql .= "contact_organization, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_family, ";
$sql .= "contact_nickname ";
$sql .= "from v_contacts ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$contact_organization = $result["contact_organization"];
$contact_name_given = $result["contact_name_given"];
$contact_name_family = $result["contact_name_family"];
$contact_nickname = $result["contact_nickname"];
}
else {
exit;
}
unset ($sql, $prep_statement, $result);
//determine timer state and action
$sql = "select ";
$sql .= "contact_time_uuid, ";
$sql .= "time_description ";
$sql .= "from v_contact_times ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and time_start is not null ";
$sql .= "and time_stop is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$contact_time_uuid = $result["contact_time_uuid"];
$time_description = $result["time_description"];
}
unset ($sql, $prep_statement, $result);
$timer_state = ($contact_time_uuid != '') ? 'running' : 'stopped';
$timer_action = ($timer_state == 'running') ? 'stop' : 'start';
//determine contact name to display
if ($contact_nickname != '') {
$contact = $contact_nickname;
}
else if ($contact_name_given != '') {
$contact = $contact_name_given;
}
if ($contact_name_family != '') {
$contact .= ($contact != '') ? ' '.$contact_name_family : $contact_name_family;
}
if ($contact_organization != '') {
$contact .= ($contact != '') ? ', '.$contact_organization : $contact_organization;
}
?>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<title><?php echo $text['label-time_timer']; ?>: <?php echo $contact; ?></title>
<style>
body {
color: #5f5f5f;
font-size: 12px;
font-family: arial;
margin: 0;
padding: 15px;
}
b {
color: #952424;
font-size: 15px;
font-family: arial;
}
a {
color: #004083;
width: 100%;
}
a:hover {
color: #5082ca;
}
form {
margin: 0;
}
input.btn, input.button {
font-family: Candara, Calibri, Segoe, "Segoe UI", Optima, Arial, sans-serif;
padding: 2px 6px 3px 6px;
color: #fff;
font-weight: bold;
cursor: pointer;
font-size: 11px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
border-radius: 3px;
background-image: -moz-linear-gradient(top, #524f59 25%, #000 64%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.25, #524f59), color-stop(0.64, #000));
border: 1px solid #26242a;
background-color: #000;
text-align: center;
text-transform: uppercase;
text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.85);
opacity: 0.9;
-moz-opacity: 0.9;
}
input.btn:hover, input.button:hover, img.list_control_icon:hover {
box-shadow: 0 0 5px #cddaf0;
-webkit-box-shadow: 0 0 5px #cddaf0;
-moz-box-shadow: 0 0 5px #cddaf0;
opacity: 1.0;
-moz-opacity: 1.0;
cursor: pointer;
}
input.txt, textarea.txt, select.txt, .formfld {
font-family: arial;
font-size: 12px;
color: #000;
text-align: left;
padding: 5px;
border: 1px solid #c0c0c0;
background-color: #fff;
box-shadow: 0 0 3px #cddaf0 inset;
-moz-box-shadow: 0 0 3px #cddaf0 inset;
-webkit-box-shadow: 0 0 3px #cddaf0 inset;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
input.txt, .formfld {
transition: width 0.25s;
-moz-transition: width 0.25s;
-webkit-transition: width 0.25s;
max-width: 500px;
}
input.txt:focus, .formfld:focus {
-webkit-box-shadow: 0 0 5px #cddaf0;
-moz-box-shadow: 0 0 5px #cddaf0;
box-shadow: 0 0 5px #cddaf0;
}
td {
color: #5f5f5f;
font-size: 12px;
font-family: arial;
}
.vncell {
border-bottom: 1px solid #fff;
background-color: #e5e9f0;
padding: 8px;
text-align: right;
color: #000;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
border-right: 3px solid #e5e9f0;
}
DIV.timer_running {
vertical-align: middle;
padding-top: 7px;
line-height: 50px;
width: 100%;
height: 53px;
text-align: center;
background-color: #2C9DE8;
font-size: 50px;
color: #FFFFFF;
/*-webkit-text-shadow: 0px 0px 5px #000;*/
/*-moz-text-shadow: 0px 0px 5px #000;*/
/*text-shadow: 0px 0px 5px #000;*/
font-weight: bold;
letter-spacing: -0.05em;
font-family: "Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
DIV.timer_stopped {
vertical-align: middle;
padding-top: 7px;
line-height: 50px;
width: 100%;
height: 53px;
text-align: center;
background-color: #2C9DE8;
font-size: 50px;
color: #FFFFFF;
/*-webkit-text-shadow: 0px 0px 5px #000;*/
/*-moz-text-shadow: 0px 0px 5px #000;*/
/*text-shadow: 0px 0px 5px #000;*/
font-weight: bold;
letter-spacing: -0.05em;
font-family: "Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
</style>
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-1.11.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//ajax for refresh
var refresh = 1500;
var source_url = 'contact_timer_inc.php?domain_uuid=<?php echo $domain_uuid; ?>&contact_uuid=<?php echo $contact_uuid; ?>&contact_time_uuid=<?php echo $contact_time_uuid; ?>';
var ajax_get = function () {
$.ajax({
url: source_url, success: function(response){
$("#ajax_reponse").html(response);
}
});
setTimeout(ajax_get, refresh);
};
<?php if ($timer_state == 'running') { ?>
ajax_get();
<?php } ?>
});
//set window title to time when timer is running
function set_title(title_text) {
window.document.title = title_text;
}
</script>
</head>
<body>
<img src='resources/images/icon_timer.png' style='width: 24px; height: 24px; border: none; margin-left: 15px;' alt="<?php echo $text['label-time_timer']; ?>" align='right'>
<b><?php echo $text['label-time_timer']; ?></b>
<br><br>
<?php echo $text['description_timer']; ?>
<br><br>
<strong><a href="javascript:void(0);" onclick="window.opener.location.href='contact_edit.php?id=<?php echo $contact_uuid; ?>';"><?php echo $contact; ?></a></strong>
<br><br>
<div id='ajax_reponse' class='timer_<?php echo $timer_state;?>'>00:00:00</div>
<br>
<form name='frm' id='frm' method='post' action=''>
<input type='hidden' name='domain_uuid' value="<?php echo $domain_uuid; ?>">
<input type='hidden' name='contact_time_uuid' value="<?php echo $contact_time_uuid; ?>">
<input type='hidden' name='contact_uuid' value="<?php echo $contact_uuid; ?>">
<input type='hidden' name='time_action' value="<?php echo $timer_action; ?>">
<table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
<tr>
<td class='vncell' style='text-align: center; padding: 10px;'>
<?php echo $text['label-description']; ?>
<textarea name='time_description' id='timer_description' class='formfld' style='width: 100%; height: 50px; margin-top: 5px;'><?php echo $time_description; ?></textarea>
<? if ($timer_state == 'stopped') { ?><script>document.getElementById('timer_description').focus();</script><? } ?>
</td>
</tr>
</table>
<br>
<center>
<?php if ($timer_state == 'running') { ?>
<input type='submit' class='btn' value="<?php echo $text['button-stop']; ?>">
<?php } else if ($timer_state == 'stopped') { ?>
<input type='submit' class='btn' value="<?php echo $text['button-start']; ?>">
<?php } ?>
</center>
</form>
</body>
</html>

View File

@@ -1,57 +1,57 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!permission_exists('contact_time_add')) { echo "access denied"; exit; }
//get contact and time uuids
$domain_uuid = check_str($_REQUEST['domain_uuid']);
$contact_uuid = check_str($_REQUEST['contact_uuid']);
$contact_time_uuid = check_str($_REQUEST['contact_time_uuid']);
//get time quantity
$sql = "select ";
$sql .= "time_start ";
$sql .= "from v_contact_times ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and time_start is not null ";
$sql .= "and time_stop is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$time_start = strtotime($result["time_start"]);
$time_now = strtotime(date("Y-m-d H:i:s"));
$time_diff = gmdate("H:i:s", ($time_now - $time_start));
echo $time_diff;
echo "<script id='title_script'>set_title('".$time_diff."');</script>";
}
unset ($sql, $prep_statement, $result);
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!permission_exists('contact_time_add')) { echo "access denied"; exit; }
//get contact and time uuids
$domain_uuid = check_str($_REQUEST['domain_uuid']);
$contact_uuid = check_str($_REQUEST['contact_uuid']);
$contact_time_uuid = check_str($_REQUEST['contact_time_uuid']);
//get time quantity
$sql = "select ";
$sql .= "time_start ";
$sql .= "from v_contact_times ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and time_start is not null ";
$sql .= "and time_stop is null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetch(PDO::FETCH_NAMED);
if (sizeof($result) > 0) {
$time_start = strtotime($result["time_start"]);
$time_now = strtotime(date("Y-m-d H:i:s"));
$time_diff = gmdate("H:i:s", ($time_now - $time_start));
echo $time_diff;
echo "<script id='title_script'>set_title('".$time_diff."');</script>";
}
unset ($sql, $prep_statement, $result);
?>

View File

@@ -1,114 +1,114 @@
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
function google_get_contacts($token, $max_results = 50) {
//global $records;
global $groups;
//$url = 'https://www.google.com/m8/feeds/contacts/default/full?max-results='.$max_results.'&oauth_token='.$_SESSION['contact_auth']['token']; // all contacts as xml
//$url = 'https://www.google.com/m8/feeds/contacts/default/full/78967d550d3fdd99?alt=json&v=3.0&oauth_token='.$_SESSION['contact_auth']['token']; // single contact
$url = 'https://www.google.com/m8/feeds/contacts/default/full?max-results='.$max_results.'&alt=json&v=3.0&oauth_token='.$token; // all contacts as json
$xml_response = curl_file_get_contents($url);
$records = json_decode($xml_response, true);
//check for authentication errors (logged out of google account, or app access permission revoked, etc)
if ($records['error']['code']) {
header("Location: contact_auth.php?source=google&target=".substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],'/')+1));
exit;
}
//create new array of contacts
foreach($records['feed']['entry'] as $contact['number'] => $contact) {
$contact_id = substr($contact['id']['$t'], strrpos($contact['id']['$t'], "/")+1);
$contacts[$contact_id]['etag'] = $contact['gd$etag'];
$contacts[$contact_id]['updated'] = $contact['updated']['$t'];
$contacts[$contact_id]['name_prefix'] = $contact['gd$name']['gd$namePrefix']['$t'];
$contacts[$contact_id]['name_given'] = $contact['gd$name']['gd$givenName']['$t'];
$contacts[$contact_id]['name_middle'] = $contact['gd$name']['gd$additionalName']['$t'];
$contacts[$contact_id]['name_family'] = $contact['gd$name']['gd$familyName']['$t'];
$contacts[$contact_id]['name_suffix'] = $contact['gd$name']['gd$nameSuffix']['$t'];
$contacts[$contact_id]['nickname'] = $contact['gContact$nickname']['$t'];
$contacts[$contact_id]['title'] = $contact['gd$organization'][0]['gd$orgTitle']['$t'];
$contacts[$contact_id]['organization'] = $contact['gd$organization'][0]['gd$orgName']['$t'];
foreach ($contact['gd$email'] as $contact_email['number'] => $contact_email) {
if ($contact_email['label']) {
$contact_email_label = $contact_email['label'];
}
else {
$contact_email_label = substr($contact_email['rel'], strpos($contact_email['rel'], "#")+1);
$contact_email_label = ucwords(str_replace("_", " ", $contact_email_label));
}
$contacts[$contact_id]['emails'][$contact_email['number']]['label'] = $contact_email_label;
$contacts[$contact_id]['emails'][$contact_email['number']]['address'] = $contact_email['address'];
$contacts[$contact_id]['emails'][$contact_email['number']]['primary'] = ($contact_email['primary']) ? 1 : 0;
}
foreach ($contact['gd$phoneNumber'] as $contact_phone['number'] => $contact_phone) {
if ($contact_phone['label']) {
$contact_phone_label = $contact_phone['label'];
}
else {
$contact_phone_label = substr($contact_phone['rel'], strpos($contact_phone['rel'], "#")+1);
$contact_phone_label = ucwords(str_replace("_", " ", $contact_phone_label));
}
$contacts[$contact_id]['numbers'][$contact_phone['number']]['label'] = $contact_phone_label;
$contacts[$contact_id]['numbers'][$contact_phone['number']]['number'] = preg_replace('{\D}', '', $contact_phone['$t']);
}
foreach ($contact['gContact$website'] as $contact_website['number'] => $contact_website) {
$contact_website_label = ($contact_website['label']) ? $contact_website['label'] : ucwords(str_replace("_", " ", $contact_website['rel']));
$contacts[$contact_id]['urls'][$contact_website['number']]['label'] = $contact_website_label;
$contacts[$contact_id]['urls'][$contact_website['number']]['url'] = $contact_website['href'];
}
foreach ($contact['gd$structuredPostalAddress'] as $contact_address['number'] => $contact_address) {
if ($contact_address['label']) {
$contact_address_label = $contact_address['label'];
}
else {
$contact_address_label = substr($contact_address['rel'], strpos($contact_address['rel'], "#")+1);
$contact_address_label = ucwords(str_replace("_", " ", $contact_address_label));
}
$contacts[$contact_id]['addresses'][$contact_address['number']]['label'] = $contact_address_label;
$contacts[$contact_id]['addresses'][$contact_address['number']]['street'] = $contact_address['gd$street']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['extended'] = $contact_address['gd$pobox']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['community'] = $contact_address['gd$neighborhood']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['locality'] = $contact_address['gd$city']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['region'] = $contact_address['gd$region']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['postal_code'] = $contact_address['gd$postcode']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['country'] = $contact_address['gd$country']['$t'];
}
foreach ($contact['gContact$groupMembershipInfo'] as $contact_group['number'] => $contact_group) {
$contact_group_id = substr($contact_group['href'], strrpos($contact_group['href'], "/")+1);
$contacts[$contact_id]['groups'][$contact_group_id] = $groups[$contact_group_id]['name'];
}
$contacts[$contact_id]['notes'] = $contact['content']['$t'];
}
//set account holder info
$_SESSION['contact_auth']['name'] = $records['feed']['author'][0]['name']['$t'];
$_SESSION['contact_auth']['email'] = $records['feed']['author'][0]['email']['$t'];
return $contacts;
}
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
function google_get_contacts($token, $max_results = 50) {
//global $records;
global $groups;
//$url = 'https://www.google.com/m8/feeds/contacts/default/full?max-results='.$max_results.'&oauth_token='.$_SESSION['contact_auth']['token']; // all contacts as xml
//$url = 'https://www.google.com/m8/feeds/contacts/default/full/78967d550d3fdd99?alt=json&v=3.0&oauth_token='.$_SESSION['contact_auth']['token']; // single contact
$url = 'https://www.google.com/m8/feeds/contacts/default/full?max-results='.$max_results.'&alt=json&v=3.0&oauth_token='.$token; // all contacts as json
$xml_response = curl_file_get_contents($url);
$records = json_decode($xml_response, true);
//check for authentication errors (logged out of google account, or app access permission revoked, etc)
if ($records['error']['code']) {
header("Location: contact_auth.php?source=google&target=".substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],'/')+1));
exit;
}
//create new array of contacts
foreach($records['feed']['entry'] as $contact['number'] => $contact) {
$contact_id = substr($contact['id']['$t'], strrpos($contact['id']['$t'], "/")+1);
$contacts[$contact_id]['etag'] = $contact['gd$etag'];
$contacts[$contact_id]['updated'] = $contact['updated']['$t'];
$contacts[$contact_id]['name_prefix'] = $contact['gd$name']['gd$namePrefix']['$t'];
$contacts[$contact_id]['name_given'] = $contact['gd$name']['gd$givenName']['$t'];
$contacts[$contact_id]['name_middle'] = $contact['gd$name']['gd$additionalName']['$t'];
$contacts[$contact_id]['name_family'] = $contact['gd$name']['gd$familyName']['$t'];
$contacts[$contact_id]['name_suffix'] = $contact['gd$name']['gd$nameSuffix']['$t'];
$contacts[$contact_id]['nickname'] = $contact['gContact$nickname']['$t'];
$contacts[$contact_id]['title'] = $contact['gd$organization'][0]['gd$orgTitle']['$t'];
$contacts[$contact_id]['organization'] = $contact['gd$organization'][0]['gd$orgName']['$t'];
foreach ($contact['gd$email'] as $contact_email['number'] => $contact_email) {
if ($contact_email['label']) {
$contact_email_label = $contact_email['label'];
}
else {
$contact_email_label = substr($contact_email['rel'], strpos($contact_email['rel'], "#")+1);
$contact_email_label = ucwords(str_replace("_", " ", $contact_email_label));
}
$contacts[$contact_id]['emails'][$contact_email['number']]['label'] = $contact_email_label;
$contacts[$contact_id]['emails'][$contact_email['number']]['address'] = $contact_email['address'];
$contacts[$contact_id]['emails'][$contact_email['number']]['primary'] = ($contact_email['primary']) ? 1 : 0;
}
foreach ($contact['gd$phoneNumber'] as $contact_phone['number'] => $contact_phone) {
if ($contact_phone['label']) {
$contact_phone_label = $contact_phone['label'];
}
else {
$contact_phone_label = substr($contact_phone['rel'], strpos($contact_phone['rel'], "#")+1);
$contact_phone_label = ucwords(str_replace("_", " ", $contact_phone_label));
}
$contacts[$contact_id]['numbers'][$contact_phone['number']]['label'] = $contact_phone_label;
$contacts[$contact_id]['numbers'][$contact_phone['number']]['number'] = preg_replace('{\D}', '', $contact_phone['$t']);
}
foreach ($contact['gContact$website'] as $contact_website['number'] => $contact_website) {
$contact_website_label = ($contact_website['label']) ? $contact_website['label'] : ucwords(str_replace("_", " ", $contact_website['rel']));
$contacts[$contact_id]['urls'][$contact_website['number']]['label'] = $contact_website_label;
$contacts[$contact_id]['urls'][$contact_website['number']]['url'] = $contact_website['href'];
}
foreach ($contact['gd$structuredPostalAddress'] as $contact_address['number'] => $contact_address) {
if ($contact_address['label']) {
$contact_address_label = $contact_address['label'];
}
else {
$contact_address_label = substr($contact_address['rel'], strpos($contact_address['rel'], "#")+1);
$contact_address_label = ucwords(str_replace("_", " ", $contact_address_label));
}
$contacts[$contact_id]['addresses'][$contact_address['number']]['label'] = $contact_address_label;
$contacts[$contact_id]['addresses'][$contact_address['number']]['street'] = $contact_address['gd$street']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['extended'] = $contact_address['gd$pobox']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['community'] = $contact_address['gd$neighborhood']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['locality'] = $contact_address['gd$city']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['region'] = $contact_address['gd$region']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['postal_code'] = $contact_address['gd$postcode']['$t'];
$contacts[$contact_id]['addresses'][$contact_address['number']]['country'] = $contact_address['gd$country']['$t'];
}
foreach ($contact['gContact$groupMembershipInfo'] as $contact_group['number'] => $contact_group) {
$contact_group_id = substr($contact_group['href'], strrpos($contact_group['href'], "/")+1);
$contacts[$contact_id]['groups'][$contact_group_id] = $groups[$contact_group_id]['name'];
}
$contacts[$contact_id]['notes'] = $contact['content']['$t'];
}
//set account holder info
$_SESSION['contact_auth']['name'] = $records['feed']['author'][0]['name']['$t'];
$_SESSION['contact_auth']['email'] = $records['feed']['author'][0]['email']['$t'];
return $contacts;
}
?>

View File

@@ -1,54 +1,54 @@
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
function google_get_groups($token) {
// retrieve groups
$url = 'https://www.google.com/m8/feeds/groups/default/full?alt=json&v=3.0&oauth_token='.$token;
$xml_response = curl_file_get_contents($url);
$records = json_decode($xml_response, true);
//check for authentication errors
if ($records['error']['code']) {
header("Location: contact_auth.php?source=google&target=".substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],'/')+1));
exit;
}
//create new array of groups
foreach($records['feed']['entry'] as $group['number'] => $group) {
$group_id = substr($group['id']['$t'], strrpos($group['id']['$t'], "/")+1);
$groups[$group_id]['name'] = ($group['gContact$systemGroup']['id']) ? $group['gContact$systemGroup']['id'] : $group['title']['$t'];
$groups[$group_id]['count'] = 0;
unset($group_id);
}
unset($group);
//set account holder info
$_SESSION['contact_auth']['name'] = $records['feed']['author'][0]['name']['$t'];
$_SESSION['contact_auth']['email'] = $records['feed']['author'][0]['email']['$t'];
return $groups;
}
<?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-2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
function google_get_groups($token) {
// retrieve groups
$url = 'https://www.google.com/m8/feeds/groups/default/full?alt=json&v=3.0&oauth_token='.$token;
$xml_response = curl_file_get_contents($url);
$records = json_decode($xml_response, true);
//check for authentication errors
if ($records['error']['code']) {
header("Location: contact_auth.php?source=google&target=".substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],'/')+1));
exit;
}
//create new array of groups
foreach($records['feed']['entry'] as $group['number'] => $group) {
$group_id = substr($group['id']['$t'], strrpos($group['id']['$t'], "/")+1);
$groups[$group_id]['name'] = ($group['gContact$systemGroup']['id']) ? $group['gContact$systemGroup']['id'] : $group['title']['$t'];
$groups[$group_id]['count'] = 0;
unset($group_id);
}
unset($group);
//set account holder info
$_SESSION['contact_auth']['name'] = $records['feed']['author'][0]['name']['$t'];
$_SESSION['contact_auth']['email'] = $records['feed']['author'][0]['email']['$t'];
return $groups;
}
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,54 +1,54 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//set all lines to enabled (true) where null or empty string
$sql = "update v_device_lines set ";
$sql .= "enabled = 'true' ";
$sql .= "where enabled is null ";
$sql .= "or enabled = '' ";
$db->exec(check_sql($sql));
unset($sql);
//set the device key vendor
$sql = "select * from v_device_keys as k, v_devices as d ";
$sql .= "where d.device_uuid = k.device_uuid ";
$sql .= "and k.device_uuid is not null ";
$sql .= "and k.device_key_vendor is null ";
$s = $db->prepare($sql);
$s->execute();
$device_keys = $s->fetchAll(PDO::FETCH_ASSOC);
foreach ($device_keys as &$row) {
$sql = "update v_device_keys ";
$sql .= "set device_key_vendor = '".$row["device_vendor"]."' ";
$sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n ";
$db->exec(check_sql($sql));
}
unset($device_keys, $sql);
}
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//set all lines to enabled (true) where null or empty string
$sql = "update v_device_lines set ";
$sql .= "enabled = 'true' ";
$sql .= "where enabled is null ";
$sql .= "or enabled = '' ";
$db->exec(check_sql($sql));
unset($sql);
//set the device key vendor
$sql = "select * from v_device_keys as k, v_devices as d ";
$sql .= "where d.device_uuid = k.device_uuid ";
$sql .= "and k.device_uuid is not null ";
$sql .= "and k.device_key_vendor is null ";
$s = $db->prepare($sql);
$s->execute();
$device_keys = $s->fetchAll(PDO::FETCH_ASSOC);
foreach ($device_keys as &$row) {
$sql = "update v_device_keys ";
$sql .= "set device_key_vendor = '".$row["device_vendor"]."' ";
$sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n ";
$db->exec(check_sql($sql));
}
unset($device_keys, $sql);
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,161 +1,161 @@
<?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>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
<?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>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
?>

View File

@@ -698,13 +698,11 @@ require_once "resources/require.php";
}
}
}
closedir($dh_sub);
}
echo "</optgroup>";
}
}
}
closedir($dh);
}
echo "</select>\n";
echo "<br />\n";

View File

@@ -1,161 +1,161 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"]) && isset($_REQUEST["mac"])) {
$device_uuid = check_str($_REQUEST["id"]);
$mac_address_new = check_str($_REQUEST["mac"]);
$mac_address_new = preg_replace('#[^a-fA-F0-9./]#', '', $mac_address_new);
}
//set the default
$save = true;
//check to see if the mac address exists
if ($mac_address_new == "" || $mac_address_new == "000000000000") {
//allow duplicates to be used as templaes
}
else {
$sql = "SELECT count(*) AS num_rows FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac_address_new."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == "0") {
$save = true;
}
else {
$save = false;
$_SESSION['message'] = $text['message-duplicate'];
}
}
unset($prep_statement);
}
//get the device
$sql = "SELECT * FROM v_devices ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$devices = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
$sql .= "order by line_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_lines = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device keys
$sql = "SELECT * FROM v_device_keys ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
$sql .= "cast(device_key_id as numeric) asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get device settings
$sql = "SELECT * FROM v_device_settings ";
$sql .= "WHERE device_uuid = '".$device_uuid."' ";
$sql .= "ORDER by device_setting_subcategory asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//prepare the devices array
unset($devices[0]["device_uuid"]);
//add copy to the device description
$devices[0]["device_description"] = $text['button-copy']." ".$devices[0]["device_description"];
//prepare the device_lines array
$x = 0;
foreach ($device_lines as $row) {
unset($device_lines[$x]["device_uuid"]);
unset($device_lines[$x]["device_line_uuid"]);
$x++;
}
//prepare the device_keys array
$x = 0;
foreach ($device_keys as $row) {
unset($device_keys[$x]["device_uuid"]);
unset($device_keys[$x]["device_key_uuid"]);
$x++;
}
//prepare the device_settings array
$x = 0;
foreach ($device_settings as $row) {
unset($device_settings[$x]["device_uuid"]);
unset($device_settings[$x]["device_setting_uuid"]);
$x++;
}
//create the device array
$device = $devices[0];
$device["device_mac_address"] = $mac_address_new;
$device["device_lines"] = $device_lines;
$device["device_keys"] = $device_keys;
$device["device_settings"] = $device_settings;
//copy the device
if ($save) {
$orm = new orm;
$orm->name('devices');
$orm->save($device);
$response = $orm->message;
$_SESSION["message"] = $text['message-copy'];
}
//redirect
header("Location: devices.php");
return;
?>

View File

@@ -1,76 +1,76 @@
<?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>
Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (isset($_GET["id"])) {
$id = $_GET["id"];
}
//delete the data and subdata
if (is_uuid($id)) {
//delete device profile keys
$sql = "delete from v_device_keys ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//delete device profile
$sql = "delete from v_device_profiles ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//remove device profile uuid from any assigned devices
$sql = "update v_devices set ";
$sql .= "device_profile_uuid = null ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
}
//write the provision files
require_once "app/provision/provision_write.php";
//set the message and redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: device_profiles.php");
return;
<?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>
Copyright (C) 2008-2015 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (isset($_GET["id"])) {
$id = $_GET["id"];
}
//delete the data and subdata
if (is_uuid($id)) {
//delete device profile keys
$sql = "delete from v_device_keys ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//delete device profile
$sql = "delete from v_device_profiles ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
//remove device profile uuid from any assigned devices
$sql = "update v_devices set ";
$sql .= "device_profile_uuid = null ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec($sql);
unset($sql);
}
//write the provision files
require_once "app/provision/provision_write.php";
//set the message and redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: device_profiles.php");
return;
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,177 +1,177 @@
<?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>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//additional includes
require_once "resources/header.php";
$document['title'] = $text['title-profiles'];
require_once "resources/paging.php";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-profiles']."</b>";
echo " <br /><br />";
echo " ".$text['description-profiles'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>&nbsp;&nbsp;&nbsp;&nbsp;";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by device_profile_name asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
echo th_order_by('enabled', $text['label-profile_enabled'], $order_by, $order);
echo th_order_by('description', $text['label-profile_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo (permission_exists('device_profile_edit')) ? "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."'>".$row['device_profile_name']."</a>" : $row['device_profile_name'];
echo ($row['domain_uuid'] == '') ? "&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: #888; font-size: 80%'>".$text['select-global']."</span>" : null;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_edit')) {
echo "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('device_profile_delete')) {
echo "<a href='device_profile_delete.php?id=".$row['device_profile_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='4'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//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>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//additional includes
require_once "resources/header.php";
$document['title'] = $text['title-profiles'];
require_once "resources/paging.php";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-profiles']."</b>";
echo " <br /><br />";
echo " ".$text['description-profiles'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>&nbsp;&nbsp;&nbsp;&nbsp;";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by device_profile_name asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
echo th_order_by('enabled', $text['label-profile_enabled'], $order_by, $order);
echo th_order_by('description', $text['label-profile_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo (permission_exists('device_profile_edit')) ? "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."'>".$row['device_profile_name']."</a>" : $row['device_profile_name'];
echo ($row['domain_uuid'] == '') ? "&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: #888; font-size: 80%'>".$text['select-global']."</span>" : null;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_edit')) {
echo "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('device_profile_delete')) {
echo "<a href='device_profile_delete.php?id=".$row['device_profile_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='4'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -26,6 +26,7 @@
//make sure that enum uses sofia internal in the enum.conf.xml file
if ($domains_processed == 1) {
$switch_conf_dir = $_SESSION['switch']['conf']['dir'];
$file_contents = file_get_contents($switch_conf_dir."/autoload_configs/enum.conf.xml");
$file_contents_new = str_replace("service=\"E2U+SIP\" regex=\"sip:(.*)\" replace=\"sofia/\${use_profile}/\$1", "service=\"E2U+SIP\" regex=\"sip:(.*)\" replace=\"sofia/internal/\$1", $file_contents);
if ($file_contents != $file_contents_new) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,89 +1,89 @@
<?php
if ($domains_processed == 1) {
//define array of editor settings
$x = 0;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'font_size';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '14px';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default text size for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'indent_guides';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default visibility of indent guides for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'invisibles';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default state of invisible characters for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'line_numbers';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default visibility of line numbers for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'live_previews';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Enable or disable live previewing of syntax, text size and theme changes.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'theme';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'Cobalt';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default theme.';
//get an array of the default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'editor' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//find the missing default settings
$x = 0;
foreach ($array as $setting) {
$found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true;
//remove items from the array that were found
unset($missing[$x]);
}
}
$x++;
}
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
//print_r($message);
}
unset($missing);
//unset the array variable
unset($array);
}
<?php
if ($domains_processed == 1) {
//define array of editor settings
$x = 0;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'font_size';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '14px';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default text size for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'indent_guides';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default visibility of indent guides for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'invisibles';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default state of invisible characters for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'line_numbers';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default visibility of line numbers for Editor.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'live_previews';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'false';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Enable or disable live previewing of syntax, text size and theme changes.';
$x++;
$array[$x]['default_setting_category'] = 'editor';
$array[$x]['default_setting_subcategory'] = 'theme';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'Cobalt';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set the default theme.';
//get an array of the default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_category = 'editor' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//find the missing default settings
$x = 0;
foreach ($array as $setting) {
$found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true;
//remove items from the array that were found
unset($missing[$x]);
}
}
$x++;
}
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
//print_r($message);
}
unset($missing);
//unset the array variable
unset($array);
}
?>

View File

@@ -1,89 +1,89 @@
<?php
$y = 0;
$apps[$x]['menu'][$y]['title']['en-us'] = "Script Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor de Scripts";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de script";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de Scripts";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "f1905fec-0577-daef-6045-59d09b7d3f94";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=scripts";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "XML Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor XML";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur XML";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor XML";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "16013877-606a-2a05-7d6a-c1b215839131";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=xml";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "Provision Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor de Provisionamiento";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de Provisioning";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de Provisionamento";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "57773542-a565-1a29-605d-6535da1a0870";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=provision";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "PHP Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor PHP";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur PHP";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de PHP";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "eae1f2d6-789b-807c-cc26-44501e848693";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "Grammar Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['es-mx'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de Grammaire";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "c3db739e-89f9-0fa2-44ce-0f4c2ff43b1a";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=grammar";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
<?php
$y = 0;
$apps[$x]['menu'][$y]['title']['en-us'] = "Script Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor de Scripts";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de script";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de Scripts";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "f1905fec-0577-daef-6045-59d09b7d3f94";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=scripts";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "XML Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor XML";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur XML";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor XML";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "16013877-606a-2a05-7d6a-c1b215839131";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=xml";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "Provision Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor de Provisionamiento";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de Provisioning";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de Provisionamento";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "57773542-a565-1a29-605d-6535da1a0870";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=provision";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "PHP Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor PHP";
$apps[$x]['menu'][$y]['title']['es-mx'] = "";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur PHP";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor de PHP";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "eae1f2d6-789b-807c-cc26-44501e848693";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['menu'][$y]['title']['en-us'] = "Grammar Editor";
$apps[$x]['menu'][$y]['title']['es-cl'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['es-mx'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['de-de'] = "";
$apps[$x]['menu'][$y]['title']['de-ch'] = "";
$apps[$x]['menu'][$y]['title']['de-at'] = "";
$apps[$x]['menu'][$y]['title']['fr-fr'] = "Editeur de Grammaire";
$apps[$x]['menu'][$y]['title']['fr-ca'] = "";
$apps[$x]['menu'][$y]['title']['fr-ch'] = "";
$apps[$x]['menu'][$y]['title']['pt-pt'] = "Editor Gramático";
$apps[$x]['menu'][$y]['title']['pt-br'] = "";
$apps[$x]['menu'][$y]['uuid'] = "c3db739e-89f9-0fa2-44ce-0f4c2ff43b1a";
$apps[$x]['menu'][$y]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
$apps[$x]['menu'][$y]['category'] = "external";
$apps[$x]['menu'][$y]['path'] = "/app/edit/index.php?dir=grammar";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,93 +1,93 @@
<?php
//application details
$apps[$x]['name'] = "Emails";
$apps[$x]['uuid'] = "bd64f590-9a24-468d-951f-6639ac728694";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Manage failed email messages.";
$apps[$x]['description']['es-cl'] = "Gestionar los mensajes fallidos.";
$apps[$x]['description']['es-mx'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "GÈrer les messages Èlectroniques ÈchouÈ.";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "Gerenciar mensagens de e-mail falhou.";
$apps[$x]['description']['pt-br'] = "";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "email_view";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_download";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_resend";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "emails_all";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
//schema details
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_emails";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_xml_cdr";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sent_date";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "status";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
?>
<?php
//application details
$apps[$x]['name'] = "Emails";
$apps[$x]['uuid'] = "bd64f590-9a24-468d-951f-6639ac728694";
$apps[$x]['category'] = "Switch";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Manage failed email messages.";
$apps[$x]['description']['es-cl'] = "Gestionar los mensajes fallidos.";
$apps[$x]['description']['es-mx'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "GÈrer les messages Èlectroniques ÈchouÈ.";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "Gerenciar mensagens de e-mail falhou.";
$apps[$x]['description']['pt-br'] = "";
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "email_view";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_download";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "email_resend";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "emails_all";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
//schema details
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = "v_emails";
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_xml_cdr";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sent_date";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "status";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
?>

View File

@@ -1,65 +1,65 @@
<?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>
Copyright (C) 2008-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get posted values, if any
$email_uuid = $_REQUEST["id"];
if ($email_uuid != '') {
$sql = "delete from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$sql .= "";
} else {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql, $prep_statement);
//set message
if ($_SESSION["message"] == '') {
$_SESSION["message"] = $text['message-delete'];
}
}
//redirect user
header("Location: emails.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>
Copyright (C) 2008-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get posted values, if any
$email_uuid = $_REQUEST["id"];
if ($email_uuid != '') {
$sql = "delete from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$sql .= "";
} else {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql, $prep_statement);
//set message
if ($_SESSION["message"] == '') {
$_SESSION["message"] = $text['message-delete'];
}
}
//redirect user
header("Location: emails.php");
?>

View File

@@ -1,207 +1,207 @@
<?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>
Copyright (C) 2008-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get email
$email_uuid = check_str($_REQUEST["id"]);
$msg_found = false;
if ($email_uuid != '') {
$sql = "select * from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sent = $row['sent_date'];
$type = $row['type'];
$status = $row['status'];
$email = $row['email'];
$msg_found = true;
break;
}
}
}
if (!$msg_found) {
$_SESSION["message"] = $text['message-invalid_email'];
header("Location: emails.php");
exit;
}
//includes
require('resources/pop3/mime_parser.php');
require('resources/pop3/rfc822_addresses.php');
//parse the email message
$mime = new mime_parser_class;
$mime->decode_bodies = 1;
$parameters = array('Data' => $email);
$success = $mime->Decode($parameters, $decoded);
if ($success) {
//get the headers
$headers = json_decode($decoded[0]["Headers"]["x-headers:"], true);
$subject = $decoded[0]["Headers"]["subject:"];
$from = $decoded[0]["Headers"]["from:"];
$reply_to = $decoded[0]["Headers"]["reply-to:"];
$to = $decoded[0]["Headers"]["to:"];
$subject = $decoded[0]["Headers"]["subject:"];
if (substr_count($subject, '=?utf-8?B?') > 0) {
$subject = str_replace('=?utf-8?B?', '', $subject);
$subject = str_replace('?=', '', $subject);
$subject = base64_decode($subject);
}
//get the body
$body = '';
$content_type = $decoded[0]['Headers']['content-type:'];
if (substr($content_type, 0, 15) == "multipart/mixed" || substr($content_type, 0, 21) == "multipart/alternative") {
foreach($decoded[0]["Parts"] as $row) {
$body_content_type = $row["Headers"]["content-type:"];
if (substr($body_content_type, 0, 9) == "text/html") { $body = $row["Body"]; }
if (substr($body_content_type, 0, 10) == "text/plain") { $body_plain = $row["Body"]; $body = $body_plain; }
}
}
else {
$content_type_array = explode(";", $content_type);
$body = $decoded[0]["Body"];
}
//get the attachments (if any)
foreach ($decoded[0]['Parts'] as &$parts_array) {
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"]; //audio/wav; name="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
$content_transfer_encoding = $parts_array["Parts"][0]["Headers"]["content-transfer-encoding:"]; //base64
$content_disposition = $parts_array["Parts"][0]["Headers"]["content-disposition"]; //attachment; filename="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
$file_name = $parts_array["FileName"];
$file_size = $parts_array["BodyLength"];
}
}
else {
$_SESSION["message"] = $text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null);
header("Location: emails.php");
exit;
}
//show the header
$document['title'] = $text['title-view_email'];
require_once "resources/header.php";
//show content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>";
echo " <td valign='top' align='left' nowrap>";
echo " <b>".$text['header-view_email']."</b>\n";
echo " </td>";
echo " <td valign='top' align='right' nowrap>";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location.href='emails.php';\" value='".$text['button-back']."'>";
if (permission_exists('email_download')) {
echo " <input type='button' class='btn' alt='".$text['button-download']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=download';\" value='".$text['button-download']."'>";
}
if (permission_exists('email_resend')) {
echo " <input type='button' class='btn' alt='".$text['button-resend']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=resend';\" value='".$text['button-resend']."'>";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>".$text['label-sent']."</td>\n";
echo "<td width='70%' class='vtable' align='left'>".$sent."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-type']."</td>\n";
echo "<td class='vtable' align='left'>".$text['label-type_'.$type]."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-status']."</td>\n";
echo "<td class='vtable' align='left'>".$text['label-status_'.$status]."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-from']."</td>\n";
echo "<td class='vtable' align='left'>".$from."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-to']."</td>\n";
echo "<td class='vtable' align='left'>".$to."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-subject']."</td>\n";
echo "<td class='vtable' align='left'>".$subject."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-message']."</td>\n";
echo "<td class='vtable' align='left'>";
echo " <iframe id='msg_display' width='100%' height='250' scrolling='auto' cellspacing='0' style='border: 1px solid #c5d1e5; overflow: scroll;'></iframe>\n";
echo " <textarea id='msg' width='1' height='1' style='width: 1px; height: 1px; display: none;'>".$body."</textarea>\n";
echo " <script>";
echo " var iframe = document.getElementById('msg_display');";
echo " iframe.contentDocument.write(document.getElementById('msg').value);";
echo " iframe.contentDocument.close();";
echo " </script>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-attachment']."</td>\n";
echo "<td class='vtable' align='left'>".$file_name." (".round($file_size/1024,2)." KB)</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
//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>
Copyright (C) 2008-2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get email
$email_uuid = check_str($_REQUEST["id"]);
$msg_found = false;
if ($email_uuid != '') {
$sql = "select * from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
foreach($result as $row) {
$sent = $row['sent_date'];
$type = $row['type'];
$status = $row['status'];
$email = $row['email'];
$msg_found = true;
break;
}
}
}
if (!$msg_found) {
$_SESSION["message"] = $text['message-invalid_email'];
header("Location: emails.php");
exit;
}
//includes
require('resources/pop3/mime_parser.php');
require('resources/pop3/rfc822_addresses.php');
//parse the email message
$mime = new mime_parser_class;
$mime->decode_bodies = 1;
$parameters = array('Data' => $email);
$success = $mime->Decode($parameters, $decoded);
if ($success) {
//get the headers
$headers = json_decode($decoded[0]["Headers"]["x-headers:"], true);
$subject = $decoded[0]["Headers"]["subject:"];
$from = $decoded[0]["Headers"]["from:"];
$reply_to = $decoded[0]["Headers"]["reply-to:"];
$to = $decoded[0]["Headers"]["to:"];
$subject = $decoded[0]["Headers"]["subject:"];
if (substr_count($subject, '=?utf-8?B?') > 0) {
$subject = str_replace('=?utf-8?B?', '', $subject);
$subject = str_replace('?=', '', $subject);
$subject = base64_decode($subject);
}
//get the body
$body = '';
$content_type = $decoded[0]['Headers']['content-type:'];
if (substr($content_type, 0, 15) == "multipart/mixed" || substr($content_type, 0, 21) == "multipart/alternative") {
foreach($decoded[0]["Parts"] as $row) {
$body_content_type = $row["Headers"]["content-type:"];
if (substr($body_content_type, 0, 9) == "text/html") { $body = $row["Body"]; }
if (substr($body_content_type, 0, 10) == "text/plain") { $body_plain = $row["Body"]; $body = $body_plain; }
}
}
else {
$content_type_array = explode(";", $content_type);
$body = $decoded[0]["Body"];
}
//get the attachments (if any)
foreach ($decoded[0]['Parts'] as &$parts_array) {
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"]; //audio/wav; name="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
$content_transfer_encoding = $parts_array["Parts"][0]["Headers"]["content-transfer-encoding:"]; //base64
$content_disposition = $parts_array["Parts"][0]["Headers"]["content-disposition"]; //attachment; filename="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
$file_name = $parts_array["FileName"];
$file_size = $parts_array["BodyLength"];
}
}
else {
$_SESSION["message"] = $text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null);
header("Location: emails.php");
exit;
}
//show the header
$document['title'] = $text['title-view_email'];
require_once "resources/header.php";
//show content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>";
echo " <td valign='top' align='left' nowrap>";
echo " <b>".$text['header-view_email']."</b>\n";
echo " </td>";
echo " <td valign='top' align='right' nowrap>";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location.href='emails.php';\" value='".$text['button-back']."'>";
if (permission_exists('email_download')) {
echo " <input type='button' class='btn' alt='".$text['button-download']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=download';\" value='".$text['button-download']."'>";
}
if (permission_exists('email_resend')) {
echo " <input type='button' class='btn' alt='".$text['button-resend']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=resend';\" value='".$text['button-resend']."'>";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>".$text['label-sent']."</td>\n";
echo "<td width='70%' class='vtable' align='left'>".$sent."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-type']."</td>\n";
echo "<td class='vtable' align='left'>".$text['label-type_'.$type]."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-status']."</td>\n";
echo "<td class='vtable' align='left'>".$text['label-status_'.$status]."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-from']."</td>\n";
echo "<td class='vtable' align='left'>".$from."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-to']."</td>\n";
echo "<td class='vtable' align='left'>".$to."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-subject']."</td>\n";
echo "<td class='vtable' align='left'>".$subject."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-message']."</td>\n";
echo "<td class='vtable' align='left'>";
echo " <iframe id='msg_display' width='100%' height='250' scrolling='auto' cellspacing='0' style='border: 1px solid #c5d1e5; overflow: scroll;'></iframe>\n";
echo " <textarea id='msg' width='1' height='1' style='width: 1px; height: 1px; display: none;'>".$body."</textarea>\n";
echo " <script>";
echo " var iframe = document.getElementById('msg_display');";
echo " iframe.contentDocument.write(document.getElementById('msg').value);";
echo " iframe.contentDocument.close();";
echo " </script>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-attachment']."</td>\n";
echo "<td class='vtable' align='left'>".$file_name." (".round($file_size/1024,2)." KB)</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -1,271 +1,271 @@
<?php
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = ($_GET["order_by"] != '') ? $_GET["order_by"] : 'sent_date';
$order = ($_GET["order"] != '') ? $_GET["order"] : 'desc';
//download email
if ($_REQUEST['a'] == 'download' && permission_exists('email_download')) {
$email_uuid = check_str($_REQUEST["id"]);
$msg_found = false;
if ($email_uuid != '') {
$sql = "select call_uuid, email from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
foreach($result as $row) {
$call_uuid = $row['call_uuid'];
$email = $row['email'];
$msg_found = true;
break;
}
}
unset ($prep_statement, $sql, $result, $result_count);
}
if ($msg_found) {
header("Content-Type: message/rfc822");
header('Content-Disposition: attachment; filename="'.$call_uuid.'.eml"');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Length: ".strlen($email));
echo $email;
exit;
}
}
//resend email
if ($_REQUEST['a'] == 'resend' && permission_exists('email_resend')) {
$email_uuid = check_str($_REQUEST["id"]);
$resend = true;
$msg_found = false;
if ($email_uuid != '') {
$sql = "select email from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
if (!permission_exists('emails_all') || $_REQUEST['showall'] != 'true') {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
foreach($result as $row) {
$email = $row['email'];
$msg_found = true;
break;
}
}
unset ($prep_statement, $sql, $result, $result_count);
}
if ($msg_found) {
$msg = $email;
require_once "secure/v_mailto.php";
if ($mailer_error == '') {
$_SESSION["message"] = $text['message-message_resent'];
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
header("Location: email_delete.php?id=".$email_uuid."&showall=true");
} else {
header("Location: email_delete.php?id=".$email_uuid);
}
}
else {
$_SESSION["message_mood"] = 'negative';
$_SESSION["message_delay"] = '4'; //sec
$_SESSION["message"] = $text['message-resend_failed'].": ".$mailer_error;
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
header("Location: emails.php?showall=true");
} else {
header("Location: emails.php");
}
}
}
exit;
}
//additional includes
$document['title'] = $text['title-emails'];
require_once "resources/header.php";
require_once "resources/paging.php";
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'>";
echo " <b>".$text['header-emails']."</b>";
echo " <br /><br />";
echo " ".$text['description-emails'];
echo " </td>\n";
echo " <td width='50%' align='right' valign='top'>\n";
if (permission_exists('emails_all')) {
if ($_REQUEST['showall'] != 'true') {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='emails.php?showall=true';\">\n";
}
}
echo " <input type='button' class='btn' alt=\"".$text['button-refresh']."\" onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_emails ";
if (permission_exists('emails_all')) {
if ($_REQUEST['showall'] != 'true') {
$sql .= "where domain_uuid = '".$domain_uuid."' ";
}
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$param .= "&showall=true";
} else {
$param = "";
}
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_emails ";
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$sql .= " join v_domains on v_emails.domain_uuid = v_domains.domain_uuid ";
} else {
$sql .= "where domain_uuid = '".$domain_uuid."' ";
}
if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; }
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param);
}
echo th_order_by('sent_date', $text['label-sent'], $order_by, $order, null, null, $param);
echo th_order_by('type', $text['label-type'], $order_by, $order, null, null, $param);
echo th_order_by('status', $text['label-status'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-message']."</th>\n";
echo "<th>".$text['label-reference']."</th>\n";
echo "<td class='list_control_icons'>&nbsp;</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
//get call details
$sql = "select caller_id_name, caller_id_number, destination_number from v_xml_cdr ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and uuid = '".$row['call_uuid']."' ";
//echo "<tr><td colspan='40'>".$sql."</td></tr>";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result2 as $row2) {
$caller_id_name = ($row2['caller_id_name'] != '') ? $row2['caller_id_name'] : null;
$caller_id_number = ($row2['caller_id_number'] != '') ? $row2['caller_id_number'] : null;
$destination_number = ($row2['destination_number'] != '') ? $row2['destination_number'] : null;
}
unset($prep_statement, $sql);
$tr_link = "href='email_view.php?id=".$row['email_uuid']."'";
echo "<tr ".$tr_link.">\n";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>";
$sent_date = explode('.', $row['sent_date']);
echo $sent_date[0];
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-type_'.$row['type']]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status_'.$row['status']]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>";
echo " <a href='email_view.php?id=".$row['email_uuid']."'>".$text['label-message_view']."</a>&nbsp;&nbsp;";
if (permission_exists('email_download')) {
echo " <a href='?id=".$row['email_uuid']."&a=download'>".$text['label-download']."</a>&nbsp;&nbsp;";
}
if (permission_exists('email_resend')) {
echo " <a href='?id=".$row['email_uuid']."&a=resend";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo "&showall=true";
}
echo "'>" . $text['label-resend']."</a>";
}
echo " </td>\n";
echo " <td valign='top' class='row_stylebg tr_link_void' style='white-space: nowrap; vertical-align: top;'>";
echo " <a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr_details.php?uuid=".$row['call_uuid']."'>".$text['label-reference_cdr']."</a>";
echo " ".($caller_id_name != '') ? "&nbsp;&nbsp;".$caller_id_name." (".format_phone($caller_id_number).")" : $caller_id_number;
echo "&nbsp;&nbsp;<span style='font-size: 150%; line-height: 10px;'>&#8674;</span>&nbsp;&nbsp;".$destination_number;
echo " </td>\n";
echo " <td class='list_control_icons'>";
echo "<a href='email_view.php?id=".$row['email_uuid']."' alt='".$text['label-message_view']."'>$v_link_label_view</a>";
if (permission_exists('email_delete')) {
echo "<a href='email_delete.php?id=".$row['email_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='21' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?php
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('email_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = ($_GET["order_by"] != '') ? $_GET["order_by"] : 'sent_date';
$order = ($_GET["order"] != '') ? $_GET["order"] : 'desc';
//download email
if ($_REQUEST['a'] == 'download' && permission_exists('email_download')) {
$email_uuid = check_str($_REQUEST["id"]);
$msg_found = false;
if ($email_uuid != '') {
$sql = "select call_uuid, email from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
foreach($result as $row) {
$call_uuid = $row['call_uuid'];
$email = $row['email'];
$msg_found = true;
break;
}
}
unset ($prep_statement, $sql, $result, $result_count);
}
if ($msg_found) {
header("Content-Type: message/rfc822");
header('Content-Disposition: attachment; filename="'.$call_uuid.'.eml"');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Content-Length: ".strlen($email));
echo $email;
exit;
}
}
//resend email
if ($_REQUEST['a'] == 'resend' && permission_exists('email_resend')) {
$email_uuid = check_str($_REQUEST["id"]);
$resend = true;
$msg_found = false;
if ($email_uuid != '') {
$sql = "select email from v_emails ";
$sql .= "where email_uuid = '".$email_uuid."' ";
if (!permission_exists('emails_all') || $_REQUEST['showall'] != 'true') {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
if ($result_count > 0) {
foreach($result as $row) {
$email = $row['email'];
$msg_found = true;
break;
}
}
unset ($prep_statement, $sql, $result, $result_count);
}
if ($msg_found) {
$msg = $email;
require_once "secure/v_mailto.php";
if ($mailer_error == '') {
$_SESSION["message"] = $text['message-message_resent'];
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
header("Location: email_delete.php?id=".$email_uuid."&showall=true");
} else {
header("Location: email_delete.php?id=".$email_uuid);
}
}
else {
$_SESSION["message_mood"] = 'negative';
$_SESSION["message_delay"] = '4'; //sec
$_SESSION["message"] = $text['message-resend_failed'].": ".$mailer_error;
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
header("Location: emails.php?showall=true");
} else {
header("Location: emails.php");
}
}
}
exit;
}
//additional includes
$document['title'] = $text['title-emails'];
require_once "resources/header.php";
require_once "resources/paging.php";
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'>";
echo " <b>".$text['header-emails']."</b>";
echo " <br /><br />";
echo " ".$text['description-emails'];
echo " </td>\n";
echo " <td width='50%' align='right' valign='top'>\n";
if (permission_exists('emails_all')) {
if ($_REQUEST['showall'] != 'true') {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='emails.php?showall=true';\">\n";
}
}
echo " <input type='button' class='btn' alt=\"".$text['button-refresh']."\" onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_emails ";
if (permission_exists('emails_all')) {
if ($_REQUEST['showall'] != 'true') {
$sql .= "where domain_uuid = '".$domain_uuid."' ";
}
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$param .= "&showall=true";
} else {
$param = "";
}
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_emails ";
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
$sql .= " join v_domains on v_emails.domain_uuid = v_domains.domain_uuid ";
} else {
$sql .= "where domain_uuid = '".$domain_uuid."' ";
}
if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; }
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param);
}
echo th_order_by('sent_date', $text['label-sent'], $order_by, $order, null, null, $param);
echo th_order_by('type', $text['label-type'], $order_by, $order, null, null, $param);
echo th_order_by('status', $text['label-status'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-message']."</th>\n";
echo "<th>".$text['label-reference']."</th>\n";
echo "<td class='list_control_icons'>&nbsp;</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
//get call details
$sql = "select caller_id_name, caller_id_number, destination_number from v_xml_cdr ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and uuid = '".$row['call_uuid']."' ";
//echo "<tr><td colspan='40'>".$sql."</td></tr>";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result2 as $row2) {
$caller_id_name = ($row2['caller_id_name'] != '') ? $row2['caller_id_name'] : null;
$caller_id_number = ($row2['caller_id_number'] != '') ? $row2['caller_id_number'] : null;
$destination_number = ($row2['destination_number'] != '') ? $row2['destination_number'] : null;
}
unset($prep_statement, $sql);
$tr_link = "href='email_view.php?id=".$row['email_uuid']."'";
echo "<tr ".$tr_link.">\n";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>";
$sent_date = explode('.', $row['sent_date']);
echo $sent_date[0];
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-type_'.$row['type']]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status_'.$row['status']]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>";
echo " <a href='email_view.php?id=".$row['email_uuid']."'>".$text['label-message_view']."</a>&nbsp;&nbsp;";
if (permission_exists('email_download')) {
echo " <a href='?id=".$row['email_uuid']."&a=download'>".$text['label-download']."</a>&nbsp;&nbsp;";
}
if (permission_exists('email_resend')) {
echo " <a href='?id=".$row['email_uuid']."&a=resend";
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
echo "&showall=true";
}
echo "'>" . $text['label-resend']."</a>";
}
echo " </td>\n";
echo " <td valign='top' class='row_stylebg tr_link_void' style='white-space: nowrap; vertical-align: top;'>";
echo " <a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr_details.php?uuid=".$row['call_uuid']."'>".$text['label-reference_cdr']."</a>";
echo " ".($caller_id_name != '') ? "&nbsp;&nbsp;".$caller_id_name." (".format_phone($caller_id_number).")" : $caller_id_number;
echo "&nbsp;&nbsp;<span style='font-size: 150%; line-height: 10px;'>&#8674;</span>&nbsp;&nbsp;".$destination_number;
echo " </td>\n";
echo " <td class='list_control_icons'>";
echo "<a href='email_view.php?id=".$row['email_uuid']."' alt='".$text['label-message_view']."'>$v_link_label_view</a>";
if (permission_exists('email_delete')) {
echo "<a href='email_delete.php?id=".$row['email_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='21' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,43 +1,43 @@
<?php
//application details
$apps[$x]['name'] = "Exec";
$apps[$x]['uuid'] = "1dd98ca6-95f1-e728-7e8f-137fe18dc23c";
$apps[$x]['category'] = "System";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Provides a conventient way to execute system, PHP, switch and SQL commands.";
$apps[$x]['description']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['es-mx'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "Offre un mode pour exécuter des commandes système, PHP ou switch.";
$apps[$x]['description']['fr-ca'] = "Il offre un mode d'exécuter des commandes du système, PHP ou switch.";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "Ofereçe uma forma conveniente para executar comandos de sistema, PHP e switch.";
$apps[$x]['description']['pt-br'] = "";
//permission details
$apps[$x]['permissions'][0]['name'] = "exec_view";
$apps[$x]['permissions'][0]['menu']['uuid'] = "06493580-9131-ce57-23cd-d42d69dd8526";
$apps[$x]['permissions'][0]['groups'][] = "superadmin";
$apps[$x]['permissions'][1]['name'] = "exec_command";
$apps[$x]['permissions'][1]['groups'][] = "superadmin";
$apps[$x]['permissions'][2]['name'] = "exec_php";
$apps[$x]['permissions'][2]['groups'][] = "superadmin";
$apps[$x]['permissions'][3]['name'] = "exec_switch";
$apps[$x]['permissions'][3]['groups'][] = "superadmin";
$apps[$x]['permissions'][4]['name'] = "exec_sql";
$apps[$x]['permissions'][4]['groups'][] = "superadmin";
$apps[$x]['permissions'][5]['name'] = "exec_sql_backup";
$apps[$x]['permissions'][5]['groups'][] = "superadmin";
<?php
//application details
$apps[$x]['name'] = "Exec";
$apps[$x]['uuid'] = "1dd98ca6-95f1-e728-7e8f-137fe18dc23c";
$apps[$x]['category'] = "System";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Provides a conventient way to execute system, PHP, switch and SQL commands.";
$apps[$x]['description']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['es-mx'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['fr-fr'] = "Offre un mode pour exécuter des commandes système, PHP ou switch.";
$apps[$x]['description']['fr-ca'] = "Il offre un mode d'exécuter des commandes du système, PHP ou switch.";
$apps[$x]['description']['fr-ch'] = "";
$apps[$x]['description']['pt-pt'] = "Ofereçe uma forma conveniente para executar comandos de sistema, PHP e switch.";
$apps[$x]['description']['pt-br'] = "";
//permission details
$apps[$x]['permissions'][0]['name'] = "exec_view";
$apps[$x]['permissions'][0]['menu']['uuid'] = "06493580-9131-ce57-23cd-d42d69dd8526";
$apps[$x]['permissions'][0]['groups'][] = "superadmin";
$apps[$x]['permissions'][1]['name'] = "exec_command";
$apps[$x]['permissions'][1]['groups'][] = "superadmin";
$apps[$x]['permissions'][2]['name'] = "exec_php";
$apps[$x]['permissions'][2]['groups'][] = "superadmin";
$apps[$x]['permissions'][3]['name'] = "exec_switch";
$apps[$x]['permissions'][3]['groups'][] = "superadmin";
$apps[$x]['permissions'][4]['name'] = "exec_sql";
$apps[$x]['permissions'][4]['groups'][] = "superadmin";
$apps[$x]['permissions'][5]['name'] = "exec_sql_backup";
$apps[$x]['permissions'][5]['groups'][] = "superadmin";
?>

View File

@@ -1,277 +1,277 @@
<?php
$text['title-databases']['en-us'] = "Databases";
$text['title-databases']['es-cl'] = "Bases de datos";
$text['title-databases']['pt-pt'] = "Bases de Dados";
$text['title-databases']['fr-fr'] = "Bases de données";
$text['title-databases']['pt-br'] = "Base de dados";
$text['title-databases']['pl'] = "Bazy danych";
$text['title-databases']['sv-se'] = "Databaser";
$text['title-databases']['uk'] = "Бази даних";
$text['title-databases']['de-at'] = "Datenbanken";
$text['title-command']['en-us'] = "Command";
$text['title-command']['es-cl'] = "Comando";
$text['title-command']['pt-pt'] = "Comando";
$text['title-command']['fr-fr'] = "Commande";
$text['title-command']['pt-br'] = "Comando";
$text['title-command']['pl'] = "Polecenie";
$text['title-command']['sv-se'] = "Kommando";
$text['title-command']['uk'] = "Команди";
$text['title-command']['de-at'] = "Befehl";
$text['option-result_type_view']['en-us'] = "View";
$text['option-result_type_view']['es-cl'] = "Ver";
$text['option-result_type_view']['pt-pt'] = "Ver";
$text['option-result_type_view']['fr-fr'] = "Voir";
$text['option-result_type_view']['pt-br'] = "Visualizar";
$text['option-result_type_view']['pl'] = "Widok";
$text['option-result_type_view']['sv-se'] = "Granska";
$text['option-result_type_view']['uk'] = "Перегляд";
$text['option-result_type_view']['de-at'] = "Ansicht";
$text['option-result_type_insert']['en-us'] = "SQL";
$text['option-result_type_insert']['es-cl'] = "SQL";
$text['option-result_type_insert']['pt-pt'] = "SQL";
$text['option-result_type_insert']['fr-fr'] = "SQL";
$text['option-result_type_insert']['pt-br'] = "SQL";
$text['option-result_type_insert']['pl'] = "SQL";
$text['option-result_type_insert']['sv-se'] = "SQL";
$text['option-result_type_insert']['uk'] = "SQL ";
$text['option-result_type_insert']['de-at'] = "SQL";
$text['option-result_type_csv']['en-us'] = "CSV";
$text['option-result_type_csv']['es-cl'] = "CSV";
$text['option-result_type_csv']['pt-pt'] = "CSV";
$text['option-result_type_csv']['fr-fr'] = "CSV";
$text['option-result_type_csv']['pt-br'] = "CSV";
$text['option-result_type_csv']['pl'] = "CSV";
$text['option-result_type_csv']['sv-se'] = "CSV";
$text['option-result_type_csv']['uk'] = "CSV ";
$text['option-result_type_csv']['de-at'] = "CSV";
$text['label-table']['en-us'] = "Table";
$text['label-table']['es-cl'] = "Tabla";
$text['label-table']['pt-pt'] = "Tabela";
$text['label-table']['fr-fr'] = "Table";
$text['label-table']['pt-br'] = "Tabela";
$text['label-table']['pl'] = "Tabela";
$text['label-table']['sv-se'] = "TAbell";
$text['label-table']['uk'] = "Таблиця";
$text['label-table']['de-at'] = "Tabelle";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['es-cl'] = "Comando de switch";
$text['label-switch']['pt-pt'] = "Comando Freeswitch";
$text['label-switch']['fr-fr'] = "Commande CLI Freeswitch";
$text['label-switch']['pt-br'] = "Comando Freeswitch ";
$text['label-switch']['pl'] = "PBX";
$text['label-switch']['sv-se'] = "Switch";
$text['label-switch']['uk'] = "FreeSwitch";
$text['label-switch']['de-at'] = "Switch";
$text['label-shell']['en-us'] = "Shell";
$text['label-shell']['es-cl'] = "Terminal de Comandos";
$text['label-shell']['pt-pt'] = "Comando Shell";
$text['label-shell']['fr-fr'] = "Commande Shell";
$text['label-shell']['pt-br'] = "Comando Shell ";
$text['label-shell']['pl'] = "Powłoka (shell)";
$text['label-shell']['sv-se'] = "Shell";
$text['label-shell']['uk'] = "Консоль";
$text['label-shell']['de-at'] = "Shell";
$text['label-results']['en-us'] = "Results";
$text['label-results']['es-cl'] = "Resultados";
$text['label-results']['pt-pt'] = "Resultados";
$text['label-results']['fr-fr'] = "Résultats";
$text['label-results']['pt-br'] = "Resultados";
$text['label-results']['pl'] = "Rezultaty";
$text['label-results']['sv-se'] = "Resultat";
$text['label-results']['uk'] = "Результати";
$text['label-results']['de-at'] = "Ergebnisse";
$text['label-result_type']['en-us'] = "Result";
$text['label-result_type']['es-cl'] = "Resultado";
$text['label-result_type']['pt-pt'] = "Resultado";
$text['label-result_type']['fr-fr'] = "Résultat";
$text['label-result_type']['pt-br'] = "Resultado";
$text['label-result_type']['pl'] = "Rezultat";
$text['label-result_type']['sv-se'] = "Resultat";
$text['label-result_type']['uk'] = "Результат";
$text['label-result_type']['de-at'] = "Ergebnis";
$text['label-response']['en-us'] = "Response";
$text['label-response']['es-cl'] = "Respuesta";
$text['label-response']['pt-pt'] = "Resposta";
$text['label-response']['fr-fr'] = "Réponse";
$text['label-response']['pt-br'] = "Resposta";
$text['label-response']['pl'] = "Odpowiedź";
$text['label-response']['sv-se'] = "Respons";
$text['label-response']['uk'] = "Відповідь";
$text['label-response']['de-at'] = "Antwort";
$text['label-reset']['en-us'] = "Reset";
$text['label-reset']['es-cl'] = "Reajustar";
$text['label-reset']['pt-pt'] = "Restabelecer";
$text['label-reset']['fr-fr'] = "Remettre";
$text['label-reset']['pt-br'] = "Restabelecer";
$text['label-reset']['pl'] = "Resetuj";
$text['label-reset']['he'] = "אפס";
$text['label-reset']['uk'] = "Скинути";
$text['label-reset']['sv-se'] = "Återställ";
$text['label-reset']['de-at'] = "Zurücksetzen";
$text['label-reset']['ro'] = "Inițializare";
$text['label-reset']['fa'] = "";
$text['label-reset']['ar-eg'] = "إعادة تعيين";
$text['label-records']['en-us'] = "Records";
$text['label-records']['es-cl'] = "Archivos";
$text['label-records']['pt-pt'] = "Registros";
$text['label-records']['fr-fr'] = "Enregistrements";
$text['label-records']['pt-br'] = "Registros";
$text['label-records']['pl'] = "Dokumentacja";
$text['label-records']['sv-se'] = "Uppgifter";
$text['label-records']['uk'] = "документація";
$text['label-records']['de-at'] = "Aufzeichnungen";
$text['label-sql']['en-us'] = "SQL";
$text['label-sql']['es-cl'] = "SQL";
$text['label-sql']['pt-pt'] = "SQL";
$text['label-sql']['fr-fr'] = "SQL";
$text['label-sql']['pt-br'] = "SQL";
$text['label-sql']['pl'] = "SQL";
$text['label-sql']['sv-se'] = "SQL";
$text['label-sql']['uk'] = "SQL";
$text['label-sql']['de-at'] = "SQL";
$text['label-php']['en-us'] = "PHP";
$text['label-php']['es-cl'] = "Comando PHP";
$text['label-php']['pt-pt'] = "Comandos PHP";
$text['label-php']['fr-fr'] = "Commande PHP";
$text['label-php']['pt-br'] = "Comandos PHP ";
$text['label-php']['pl'] = "PHP";
$text['label-php']['sv-se'] = "PHP";
$text['label-php']['uk'] = "PHP";
$text['label-php']['de-at'] = "PHP";
$text['label-execute']['en-us'] = "Execute Command";
$text['label-execute']['es-cl'] = "Ejecutar Comando";
$text['label-execute']['pt-pt'] = "Executar Comando";
$text['label-execute']['fr-fr'] = "Executer la Commande";
$text['label-execute']['pt-br'] = "Executar";
$text['label-execute']['pl'] = "Wykonywanie poleceń";
$text['label-execute']['sv-se'] = "Utför Kommando";
$text['label-execute']['uk'] = "Виконання команд";
$text['label-execute']['de-at'] = "Ausführen";
$text['label-error']['en-us'] = "Error";
$text['label-error']['es-cl'] = "Error";
$text['label-error']['pt-pt'] = "Erro";
$text['label-error']['fr-fr'] = "Erreur";
$text['label-error']['pt-br'] = "Erro";
$text['label-error']['pl'] = "Błąd";
$text['label-error']['sv-se'] = "Fel";
$text['label-error']['uk'] = "Помилка";
$text['label-error']['de-at'] = "Fehler";
$text['header-databases']['en-us'] = "Databases";
$text['header-databases']['es-cl'] = "Bases de datos";
$text['header-databases']['pt-pt'] = "Bases de Dados";
$text['header-databases']['fr-fr'] = "Bases de données";
$text['header-databases']['pt-br'] = "Base de dados";
$text['header-databases']['pl'] = "Bazy danych";
$text['header-databases']['sv-se'] = "Databaser";
$text['header-databases']['uk'] = "Бази даних";
$text['header-databases']['de-at'] = "Datenbanken";
$text['description-switch']['en-us'] = "Switch CLI. View valid commands with: 'help'.";
$text['description-switch']['es-cl'] = "Para un listado de comandos válidos use: help";
$text['description-switch']['pt-pt'] = "Para uma lista dos comandos válidos utilize: help";
$text['description-switch']['fr-fr'] = "Pour la liste des commandes valides, utiliser : help";
$text['description-switch']['pt-br'] = "Para verificar a lista de comandos válidos utilize: Ajuda";
$text['description-switch']['pl'] = "Aby uzyskać listę poprawnych poleceń użyj pomocy";
$text['description-switch']['sv-se'] = "För en lista med giltiga kommandon använd: help";
$text['description-switch']['uk'] = "Для перегляду списку команд виконайте команду: help";
$text['description-switch']['de-at'] = "Um eine Liste der gültigen Befehle zu bekommen tippen Sie: 'help'";
$text['description-shell']['en-us'] = "Execute system commands.";
$text['description-shell']['es-cl'] = "Comandos de sistema";
$text['description-shell']['pt-pt'] = "Comandos do sistema.";
$text['description-shell']['fr-fr'] = "Commande Système";
$text['description-shell']['pt-br'] = "Comando do sistema";
$text['description-shell']['pl'] = "Polecenia systemowe.";
$text['description-shell']['sv-se'] = "System Kommandon.";
$text['description-shell']['uk'] = "Системні команди";
$text['description-shell']['de-at'] = "System Befehle";
$text['description-sql']['en-us'] = "Execute statements against the database.";
$text['description-sql']['es-cl'] = "Ejecutar instrucciones de consulta contra la base de datos.";
$text['description-sql']['pt-pt'] = "Executar instruções de consulta no banco de dados.";
$text['description-sql']['fr-fr'] = "Exécuter les instructions de requête contre la base de données.";
$text['description-sql']['pt-br'] = "Executar instruções de consulta no banco de dados.";
$text['description-sql']['pl'] = "Wykonać polecenie zapytania do bazy danych.";
$text['description-sql']['sv-se'] = "Utför fråge uttalanden mot databasen.";
$text['description-sql']['uk'] = "Виконання операторів запитів до бази даних.";
$text['description-sql']['de-at'] = "Führen Sie Abfrage-Anweisungen für die Datenbank.";
$text['description-php']['en-us'] = "Execute PHP commands. See: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/' target='_blank'>Manual PHP</a>";
$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/' target='_blank'>Manuel PHP</a>";
$text['description-php']['pt-br'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['pl'] = "Aby użyć odniesienia do PHP kliknij na ten link: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['sv-se'] = "Använd följande länk som en referens gällande PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['uk'] = "Посилання на довідку PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['de-at'] = "Benutzen Sie folgenden Link als PHP Referenz: <a href='http://php.net/manual/>PHP Manual</a>";
$text['description-execute']['en-us'] = "Provides a conventient way to execute system, PHP, switch and SQL commands.";
$text['description-execute']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$text['description-execute']['pt-pt'] = "Oferece uma maneira fácil de executar comandos de sistema, PHP, e switch.";
$text['description-execute']['fr-fr'] = "Fournir un moyen pour executer des commandes système, PHP et switch. ";
$text['description-execute']['pt-br'] = "Utilize facilmente a execução de comandos do sistema, PHP e switch ";
$text['description-execute']['pl'] = "Ta funkcja zapewnia dogodny sposób wykonywania poleceń systemowych, PHP oraz switch.";
$text['description-execute']['sv-se'] = "Erbjuder ett smidigt sätt att köra system, PHP och switch kommandon.";
$text['description-execute']['uk'] = "Забезпечує зручний спосіб виконати команди PHP, switch, а також системні команди";
$text['description-execute']['de-at'] = "Bietet die Möglichkeit System, PHP und Switch Kommandos auszuführen.";
$text['description-databases']['en-us'] = "Select the database to execute SQL query statements against.";
$text['description-databases']['es-cl'] = "Seleccione la base de datos para ejecutar la consulta SQL.";
$text['description-databases']['pt-pt'] = "Escolha a base de dados a utilizar.";
$text['description-databases']['fr-fr'] = "Choisir la base de données utilisée par la requête SQL.";
$text['description-databases']['pt-br'] = "Informações sobre a base de dados";
$text['description-databases']['pl'] = "Informacje o bazie danych.";
$text['description-databases']['sv-se'] = "Välj databas att använda för SQL Fråga.";
$text['description-databases']['uk'] = "Інформація про базу даних.";
$text['description-databases']['de-at'] = "Wählen Sie die Datenbank für die SQL Abfrage aus.";
$text['button-select_database']['en-us'] = "Select Database";
$text['button-select_database']['es-cl'] = "Seleccionar Base de Datos";
$text['button-select_database']['pt-pt'] = "Seleccionar Base de Dados";
$text['button-select_database']['fr-fr'] = "Choisir la Base de données";
$text['button-select_database']['pt-br'] = "Selecionar base de dados";
$text['button-select_database']['pl'] = "Wybierz bazę danych";
$text['button-select_database']['sv-se'] = "Välj Databas";
$text['button-select_database']['uk'] = "Вибрати БД";
$text['button-select_database']['de-at'] = "Datenbank wählen";
$text['button-manage']['en-us'] = "Manage";
$text['button-manage']['es-cl'] = "Administrar";
$text['button-manage']['pt-pt'] = "Gerir";
$text['button-manage']['fr-fr'] = "Gérer";
$text['button-manage']['pt-br'] = "Gerenciar";
$text['button-manage']['pl'] = "Zarządzaj";
$text['button-manage']['sv-se'] = "Hantera";
$text['button-manage']['uk'] = "Керувати";
$text['button-manage']['de-at'] = "Verwalten";
$text['button-backup']['en-us'] = "Backup";
$text['button-backup']['es-cl'] = "Respaldar";
$text['button-backup']['pt-pt'] = "Backup";
$text['button-backup']['fr-fr'] = "Sauvegarder";
$text['button-backup']['pt-br'] = "Backup";
$text['button-backup']['pl'] = "Kopia Zapasowa";
$text['button-backup']['sv-se'] = "Backup";
$text['button-backup']['uk'] = "Резервна копія";
$text['button-backup']['de-at'] = "Sichern";
<?php
$text['title-databases']['en-us'] = "Databases";
$text['title-databases']['es-cl'] = "Bases de datos";
$text['title-databases']['pt-pt'] = "Bases de Dados";
$text['title-databases']['fr-fr'] = "Bases de données";
$text['title-databases']['pt-br'] = "Base de dados";
$text['title-databases']['pl'] = "Bazy danych";
$text['title-databases']['sv-se'] = "Databaser";
$text['title-databases']['uk'] = "Бази даних";
$text['title-databases']['de-at'] = "Datenbanken";
$text['title-command']['en-us'] = "Command";
$text['title-command']['es-cl'] = "Comando";
$text['title-command']['pt-pt'] = "Comando";
$text['title-command']['fr-fr'] = "Commande";
$text['title-command']['pt-br'] = "Comando";
$text['title-command']['pl'] = "Polecenie";
$text['title-command']['sv-se'] = "Kommando";
$text['title-command']['uk'] = "Команди";
$text['title-command']['de-at'] = "Befehl";
$text['option-result_type_view']['en-us'] = "View";
$text['option-result_type_view']['es-cl'] = "Ver";
$text['option-result_type_view']['pt-pt'] = "Ver";
$text['option-result_type_view']['fr-fr'] = "Voir";
$text['option-result_type_view']['pt-br'] = "Visualizar";
$text['option-result_type_view']['pl'] = "Widok";
$text['option-result_type_view']['sv-se'] = "Granska";
$text['option-result_type_view']['uk'] = "Перегляд";
$text['option-result_type_view']['de-at'] = "Ansicht";
$text['option-result_type_insert']['en-us'] = "SQL";
$text['option-result_type_insert']['es-cl'] = "SQL";
$text['option-result_type_insert']['pt-pt'] = "SQL";
$text['option-result_type_insert']['fr-fr'] = "SQL";
$text['option-result_type_insert']['pt-br'] = "SQL";
$text['option-result_type_insert']['pl'] = "SQL";
$text['option-result_type_insert']['sv-se'] = "SQL";
$text['option-result_type_insert']['uk'] = "SQL ";
$text['option-result_type_insert']['de-at'] = "SQL";
$text['option-result_type_csv']['en-us'] = "CSV";
$text['option-result_type_csv']['es-cl'] = "CSV";
$text['option-result_type_csv']['pt-pt'] = "CSV";
$text['option-result_type_csv']['fr-fr'] = "CSV";
$text['option-result_type_csv']['pt-br'] = "CSV";
$text['option-result_type_csv']['pl'] = "CSV";
$text['option-result_type_csv']['sv-se'] = "CSV";
$text['option-result_type_csv']['uk'] = "CSV ";
$text['option-result_type_csv']['de-at'] = "CSV";
$text['label-table']['en-us'] = "Table";
$text['label-table']['es-cl'] = "Tabla";
$text['label-table']['pt-pt'] = "Tabela";
$text['label-table']['fr-fr'] = "Table";
$text['label-table']['pt-br'] = "Tabela";
$text['label-table']['pl'] = "Tabela";
$text['label-table']['sv-se'] = "TAbell";
$text['label-table']['uk'] = "Таблиця";
$text['label-table']['de-at'] = "Tabelle";
$text['label-switch']['en-us'] = "Switch";
$text['label-switch']['es-cl'] = "Comando de switch";
$text['label-switch']['pt-pt'] = "Comando Freeswitch";
$text['label-switch']['fr-fr'] = "Commande CLI Freeswitch";
$text['label-switch']['pt-br'] = "Comando Freeswitch ";
$text['label-switch']['pl'] = "PBX";
$text['label-switch']['sv-se'] = "Switch";
$text['label-switch']['uk'] = "FreeSwitch";
$text['label-switch']['de-at'] = "Switch";
$text['label-shell']['en-us'] = "Shell";
$text['label-shell']['es-cl'] = "Terminal de Comandos";
$text['label-shell']['pt-pt'] = "Comando Shell";
$text['label-shell']['fr-fr'] = "Commande Shell";
$text['label-shell']['pt-br'] = "Comando Shell ";
$text['label-shell']['pl'] = "Powłoka (shell)";
$text['label-shell']['sv-se'] = "Shell";
$text['label-shell']['uk'] = "Консоль";
$text['label-shell']['de-at'] = "Shell";
$text['label-results']['en-us'] = "Results";
$text['label-results']['es-cl'] = "Resultados";
$text['label-results']['pt-pt'] = "Resultados";
$text['label-results']['fr-fr'] = "Résultats";
$text['label-results']['pt-br'] = "Resultados";
$text['label-results']['pl'] = "Rezultaty";
$text['label-results']['sv-se'] = "Resultat";
$text['label-results']['uk'] = "Результати";
$text['label-results']['de-at'] = "Ergebnisse";
$text['label-result_type']['en-us'] = "Result";
$text['label-result_type']['es-cl'] = "Resultado";
$text['label-result_type']['pt-pt'] = "Resultado";
$text['label-result_type']['fr-fr'] = "Résultat";
$text['label-result_type']['pt-br'] = "Resultado";
$text['label-result_type']['pl'] = "Rezultat";
$text['label-result_type']['sv-se'] = "Resultat";
$text['label-result_type']['uk'] = "Результат";
$text['label-result_type']['de-at'] = "Ergebnis";
$text['label-response']['en-us'] = "Response";
$text['label-response']['es-cl'] = "Respuesta";
$text['label-response']['pt-pt'] = "Resposta";
$text['label-response']['fr-fr'] = "Réponse";
$text['label-response']['pt-br'] = "Resposta";
$text['label-response']['pl'] = "Odpowiedź";
$text['label-response']['sv-se'] = "Respons";
$text['label-response']['uk'] = "Відповідь";
$text['label-response']['de-at'] = "Antwort";
$text['label-reset']['en-us'] = "Reset";
$text['label-reset']['es-cl'] = "Reajustar";
$text['label-reset']['pt-pt'] = "Restabelecer";
$text['label-reset']['fr-fr'] = "Remettre";
$text['label-reset']['pt-br'] = "Restabelecer";
$text['label-reset']['pl'] = "Resetuj";
$text['label-reset']['he'] = "אפס";
$text['label-reset']['uk'] = "Скинути";
$text['label-reset']['sv-se'] = "Återställ";
$text['label-reset']['de-at'] = "Zurücksetzen";
$text['label-reset']['ro'] = "Inițializare";
$text['label-reset']['fa'] = "";
$text['label-reset']['ar-eg'] = "إعادة تعيين";
$text['label-records']['en-us'] = "Records";
$text['label-records']['es-cl'] = "Archivos";
$text['label-records']['pt-pt'] = "Registros";
$text['label-records']['fr-fr'] = "Enregistrements";
$text['label-records']['pt-br'] = "Registros";
$text['label-records']['pl'] = "Dokumentacja";
$text['label-records']['sv-se'] = "Uppgifter";
$text['label-records']['uk'] = "документація";
$text['label-records']['de-at'] = "Aufzeichnungen";
$text['label-sql']['en-us'] = "SQL";
$text['label-sql']['es-cl'] = "SQL";
$text['label-sql']['pt-pt'] = "SQL";
$text['label-sql']['fr-fr'] = "SQL";
$text['label-sql']['pt-br'] = "SQL";
$text['label-sql']['pl'] = "SQL";
$text['label-sql']['sv-se'] = "SQL";
$text['label-sql']['uk'] = "SQL";
$text['label-sql']['de-at'] = "SQL";
$text['label-php']['en-us'] = "PHP";
$text['label-php']['es-cl'] = "Comando PHP";
$text['label-php']['pt-pt'] = "Comandos PHP";
$text['label-php']['fr-fr'] = "Commande PHP";
$text['label-php']['pt-br'] = "Comandos PHP ";
$text['label-php']['pl'] = "PHP";
$text['label-php']['sv-se'] = "PHP";
$text['label-php']['uk'] = "PHP";
$text['label-php']['de-at'] = "PHP";
$text['label-execute']['en-us'] = "Execute Command";
$text['label-execute']['es-cl'] = "Ejecutar Comando";
$text['label-execute']['pt-pt'] = "Executar Comando";
$text['label-execute']['fr-fr'] = "Executer la Commande";
$text['label-execute']['pt-br'] = "Executar";
$text['label-execute']['pl'] = "Wykonywanie poleceń";
$text['label-execute']['sv-se'] = "Utför Kommando";
$text['label-execute']['uk'] = "Виконання команд";
$text['label-execute']['de-at'] = "Ausführen";
$text['label-error']['en-us'] = "Error";
$text['label-error']['es-cl'] = "Error";
$text['label-error']['pt-pt'] = "Erro";
$text['label-error']['fr-fr'] = "Erreur";
$text['label-error']['pt-br'] = "Erro";
$text['label-error']['pl'] = "Błąd";
$text['label-error']['sv-se'] = "Fel";
$text['label-error']['uk'] = "Помилка";
$text['label-error']['de-at'] = "Fehler";
$text['header-databases']['en-us'] = "Databases";
$text['header-databases']['es-cl'] = "Bases de datos";
$text['header-databases']['pt-pt'] = "Bases de Dados";
$text['header-databases']['fr-fr'] = "Bases de données";
$text['header-databases']['pt-br'] = "Base de dados";
$text['header-databases']['pl'] = "Bazy danych";
$text['header-databases']['sv-se'] = "Databaser";
$text['header-databases']['uk'] = "Бази даних";
$text['header-databases']['de-at'] = "Datenbanken";
$text['description-switch']['en-us'] = "Switch CLI. View valid commands with: 'help'.";
$text['description-switch']['es-cl'] = "Para un listado de comandos válidos use: help";
$text['description-switch']['pt-pt'] = "Para uma lista dos comandos válidos utilize: help";
$text['description-switch']['fr-fr'] = "Pour la liste des commandes valides, utiliser : help";
$text['description-switch']['pt-br'] = "Para verificar a lista de comandos válidos utilize: Ajuda";
$text['description-switch']['pl'] = "Aby uzyskać listę poprawnych poleceń użyj pomocy";
$text['description-switch']['sv-se'] = "För en lista med giltiga kommandon använd: help";
$text['description-switch']['uk'] = "Для перегляду списку команд виконайте команду: help";
$text['description-switch']['de-at'] = "Um eine Liste der gültigen Befehle zu bekommen tippen Sie: 'help'";
$text['description-shell']['en-us'] = "Execute system commands.";
$text['description-shell']['es-cl'] = "Comandos de sistema";
$text['description-shell']['pt-pt'] = "Comandos do sistema.";
$text['description-shell']['fr-fr'] = "Commande Système";
$text['description-shell']['pt-br'] = "Comando do sistema";
$text['description-shell']['pl'] = "Polecenia systemowe.";
$text['description-shell']['sv-se'] = "System Kommandon.";
$text['description-shell']['uk'] = "Системні команди";
$text['description-shell']['de-at'] = "System Befehle";
$text['description-sql']['en-us'] = "Execute statements against the database.";
$text['description-sql']['es-cl'] = "Ejecutar instrucciones de consulta contra la base de datos.";
$text['description-sql']['pt-pt'] = "Executar instruções de consulta no banco de dados.";
$text['description-sql']['fr-fr'] = "Exécuter les instructions de requête contre la base de données.";
$text['description-sql']['pt-br'] = "Executar instruções de consulta no banco de dados.";
$text['description-sql']['pl'] = "Wykonać polecenie zapytania do bazy danych.";
$text['description-sql']['sv-se'] = "Utför fråge uttalanden mot databasen.";
$text['description-sql']['uk'] = "Виконання операторів запитів до бази даних.";
$text['description-sql']['de-at'] = "Führen Sie Abfrage-Anweisungen für die Datenbank.";
$text['description-php']['en-us'] = "Execute PHP commands. See: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['es-cl'] = "Utilice el siguiente enlace como referencia para PHP: <a href='http://php.net/manual/' target='_blank'>Manual PHP</a>";
$text['description-php']['pt-pt'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['fr-fr'] = "Utiliser le lien suivant comme référence pour le PHP: <a href='http://php.net/manual/' target='_blank'>Manuel PHP</a>";
$text['description-php']['pt-br'] = "Utilize a ligação seguinte como referência para o PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['pl'] = "Aby użyć odniesienia do PHP kliknij na ten link: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['sv-se'] = "Använd följande länk som en referens gällande PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['uk'] = "Посилання на довідку PHP: <a href='http://php.net/manual/' target='_blank'>PHP Manual</a>";
$text['description-php']['de-at'] = "Benutzen Sie folgenden Link als PHP Referenz: <a href='http://php.net/manual/>PHP Manual</a>";
$text['description-execute']['en-us'] = "Provides a conventient way to execute system, PHP, switch and SQL commands.";
$text['description-execute']['es-cl'] = "Provee un modo conveniente de ejecutar comandos de sistema, PHP o del switch.";
$text['description-execute']['pt-pt'] = "Oferece uma maneira fácil de executar comandos de sistema, PHP, e switch.";
$text['description-execute']['fr-fr'] = "Fournir un moyen pour executer des commandes système, PHP et switch. ";
$text['description-execute']['pt-br'] = "Utilize facilmente a execução de comandos do sistema, PHP e switch ";
$text['description-execute']['pl'] = "Ta funkcja zapewnia dogodny sposób wykonywania poleceń systemowych, PHP oraz switch.";
$text['description-execute']['sv-se'] = "Erbjuder ett smidigt sätt att köra system, PHP och switch kommandon.";
$text['description-execute']['uk'] = "Забезпечує зручний спосіб виконати команди PHP, switch, а також системні команди";
$text['description-execute']['de-at'] = "Bietet die Möglichkeit System, PHP und Switch Kommandos auszuführen.";
$text['description-databases']['en-us'] = "Select the database to execute SQL query statements against.";
$text['description-databases']['es-cl'] = "Seleccione la base de datos para ejecutar la consulta SQL.";
$text['description-databases']['pt-pt'] = "Escolha a base de dados a utilizar.";
$text['description-databases']['fr-fr'] = "Choisir la base de données utilisée par la requête SQL.";
$text['description-databases']['pt-br'] = "Informações sobre a base de dados";
$text['description-databases']['pl'] = "Informacje o bazie danych.";
$text['description-databases']['sv-se'] = "Välj databas att använda för SQL Fråga.";
$text['description-databases']['uk'] = "Інформація про базу даних.";
$text['description-databases']['de-at'] = "Wählen Sie die Datenbank für die SQL Abfrage aus.";
$text['button-select_database']['en-us'] = "Select Database";
$text['button-select_database']['es-cl'] = "Seleccionar Base de Datos";
$text['button-select_database']['pt-pt'] = "Seleccionar Base de Dados";
$text['button-select_database']['fr-fr'] = "Choisir la Base de données";
$text['button-select_database']['pt-br'] = "Selecionar base de dados";
$text['button-select_database']['pl'] = "Wybierz bazę danych";
$text['button-select_database']['sv-se'] = "Välj Databas";
$text['button-select_database']['uk'] = "Вибрати БД";
$text['button-select_database']['de-at'] = "Datenbank wählen";
$text['button-manage']['en-us'] = "Manage";
$text['button-manage']['es-cl'] = "Administrar";
$text['button-manage']['pt-pt'] = "Gerir";
$text['button-manage']['fr-fr'] = "Gérer";
$text['button-manage']['pt-br'] = "Gerenciar";
$text['button-manage']['pl'] = "Zarządzaj";
$text['button-manage']['sv-se'] = "Hantera";
$text['button-manage']['uk'] = "Керувати";
$text['button-manage']['de-at'] = "Verwalten";
$text['button-backup']['en-us'] = "Backup";
$text['button-backup']['es-cl'] = "Respaldar";
$text['button-backup']['pt-pt'] = "Backup";
$text['button-backup']['fr-fr'] = "Sauvegarder";
$text['button-backup']['pt-br'] = "Backup";
$text['button-backup']['pl'] = "Kopia Zapasowa";
$text['button-backup']['sv-se'] = "Backup";
$text['button-backup']['uk'] = "Резервна копія";
$text['button-backup']['de-at'] = "Sichern";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -207,27 +207,27 @@ else {
if (strlen($db_host) == 0 && strlen($db_port) == 0) {
//if both host and port are empty use the unix socket
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); }
$db_dest = new PDO("mysql:host=$db_host;unix_socket=/var/run/mysqld/mysqld.sock;charset=utf8;", $db_create_username, $db_create_password); }
}
else {
if (strlen($db_port) == 0) {
//leave out port if it is empty
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db_dest = new PDO("mysql:host=$db_host;charset=utf8;", $db_create_username, $db_create_password);
}
}
else {
if (strlen($db_create_username) == 0) {
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;", $db_username, $db_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_username, $db_password);
}
else {
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;", $db_create_username, $db_create_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
$db_dest = new PDO("mysql:host=$db_host;port=$db_port;charset=utf8;", $db_create_username, $db_create_password);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -926,7 +926,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the users
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
foreach($assigned_user_uuids as $assigned_user_uuid) {
if (isset($assigned_user_uuids)) foreach($assigned_user_uuids as $assigned_user_uuid) {
$sql .= "and user_uuid <> '".$assigned_user_uuid."' ";
}
unset($assigned_user_uuids);
@@ -1289,13 +1289,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
}
closedir($dh_sub);
}
echo "</optgroup>";
}
}
}
closedir($dh);
}
echo "</select>\n";
echo " </td>\n";

View File

@@ -64,7 +64,7 @@ require_once "resources/paging.php";
$sql = "select ";
$sql .= "(select count(*) from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."') as num_rows ";
if ($db_type == "pgsql") {
$sql .= ",(select count(*) from v_extensions ";
$sql .= ",(select count(*) as count from v_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and extension ~ '^[0-9]+$') as numeric_extensions";
}
@@ -73,7 +73,7 @@ require_once "resources/paging.php";
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_extensions = $row['num_rows'];
if ($db_type == "pgsql") {
if (($db_type == "pgsql") or ($db_type == "mysql")) {
$numeric_extensions = $row['numeric_extensions'];
}
}

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,175 +1,175 @@
<?php
if ($domains_processed == 1) {
//define array of settings
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.pdf';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.tif';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.tiff';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_logo';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Path to image/logo file displayed in the header of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_font';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'times';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Font used to generate cover page. Can be full path to .ttf file or font name alredy installed.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_footer';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system.";
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Notice displayed in the footer of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_header';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Default information displayed beneath the logo in the header of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'page_size';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'letter';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the default page size of new faxes.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'resolution';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'normal';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the default transmission quality of new faxes.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'variable';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = 'fax_enable_t38=true';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Enable T.38';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'variable';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = 'fax_enable_t38_request=false';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Send a T38 reinvite when a fax tone is detected.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'keep_local';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Keep the file after sending or receiving the fax.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_mode';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'queue';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '5';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of attempts to send fax (count only calls with answer)';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '15';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of unanswered attempts in sequence';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '30';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after no answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Giveup reach the destination after this number of sequences';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '300';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before next call sequence';
$x++;
//get an array of the default settings
$sql = "select * from v_default_settings ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//find the missing default settings
$x = 0;
foreach ($array as $setting) {
$found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true;
//remove items from the array that were found
unset($missing[$x]);
}
}
$x++;
}
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
}
unset($missing);
}
<?php
if ($domains_processed == 1) {
//define array of settings
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.pdf';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.tif';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x = 0;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'allowed_extension';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = '.tiff';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_logo';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Path to image/logo file displayed in the header of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_font';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'times';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Font used to generate cover page. Can be full path to .ttf file or font name alredy installed.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_footer';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system.";
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Notice displayed in the footer of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'cover_header';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = '';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Default information displayed beneath the logo in the header of the cover sheet.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'page_size';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'letter';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the default page size of new faxes.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'resolution';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'normal';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Set the default transmission quality of new faxes.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'variable';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = 'fax_enable_t38=true';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Enable T.38';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'variable';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = 'fax_enable_t38_request=false';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Send a T38 reinvite when a fax tone is detected.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'keep_local';
$array[$x]['default_setting_name'] = 'boolean';
$array[$x]['default_setting_value'] = 'true';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Keep the file after sending or receiving the fax.';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_mode';
$array[$x]['default_setting_name'] = 'text';
$array[$x]['default_setting_value'] = 'queue';
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = '';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '5';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of attempts to send fax (count only calls with answer)';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '15';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Number of unanswered attempts in sequence';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_retry_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '30';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before we make next call after no answered call';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_limit';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '3';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Giveup reach the destination after this number of sequences';
$x++;
$array[$x]['default_setting_category'] = 'fax';
$array[$x]['default_setting_subcategory'] = 'send_no_answer_interval';
$array[$x]['default_setting_name'] = 'numeric';
$array[$x]['default_setting_value'] = '300';
$array[$x]['default_setting_enabled'] = 'true';
$array[$x]['default_setting_description'] = 'Delay before next call sequence';
$x++;
//get an array of the default settings
$sql = "select * from v_default_settings ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//find the missing default settings
$x = 0;
foreach ($array as $setting) {
$found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true;
//remove items from the array that were found
unset($missing[$x]);
}
}
$x++;
}
//add the missing default settings
foreach ($missing as $row) {
//add the default settings
$orm = new orm;
$orm->name('default_settings');
$orm->save($row);
$message = $orm->message;
unset($orm);
}
unset($missing);
}
?>

View File

@@ -1,146 +1,146 @@
<?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>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
if (permission_exists('fax_extension_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"])) {
$fax_uuid = check_str($_REQUEST["id"]);
}
//get the data
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
echo "access denied";
exit;
}
foreach ($result as &$row) {
$fax_extension = $row["fax_extension"];
$fax_name = $row["fax_name"];
$fax_email = $row["fax_email"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
$fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
$fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
$fax_pin_number = $row["fax_pin_number"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_forward_number = $row["fax_forward_number"];
$fax_description = 'copy: '.$row["fax_description"];
}
unset ($prep_statement);
//copy the fax extension
$fax_uuid = uuid();
$dialplan_uuid = uuid();
$sql = "insert into v_fax ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "fax_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "fax_extension, ";
$sql .= "fax_name, ";
$sql .= "fax_email, ";
$sql .= "fax_email_connection_type, ";
$sql .= "fax_email_connection_host, ";
$sql .= "fax_email_connection_port, ";
$sql .= "fax_email_connection_security, ";
$sql .= "fax_email_connection_validate, ";
$sql .= "fax_email_connection_username, ";
$sql .= "fax_email_connection_password, ";
$sql .= "fax_email_connection_mailbox, ";
$sql .= "fax_email_inbound_subject_tag, ";
$sql .= "fax_email_outbound_subject_tag, ";
$sql .= "fax_email_outbound_authorized_senders, ";
$sql .= "fax_pin_number, ";
$sql .= "fax_caller_id_name, ";
$sql .= "fax_caller_id_number, ";
if (strlen($fax_forward_number) > 0) {
$sql .= "fax_forward_number, ";
}
$sql .= "fax_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$fax_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$fax_extension', ";
$sql .= "'$fax_name', ";
$sql .= "'$fax_email', ";
$sql .= "'$fax_email_connection_type', ";
$sql .= "'$fax_email_connection_host', ";
$sql .= "'$fax_email_connection_port', ";
$sql .= "'$fax_email_connection_security', ";
$sql .= "'$fax_email_connection_validate', ";
$sql .= "'$fax_email_connection_username', ";
$sql .= "'$fax_email_connection_password', ";
$sql .= "'$fax_email_connection_mailbox', ";
$sql .= "'$fax_email_inbound_subject_tag', ";
$sql .= "'$fax_email_outbound_subject_tag', ";
$sql .= "'$fax_email_outbound_authorized_senders', ";
$sql .= "'$fax_pin_number', ";
$sql .= "'$fax_caller_id_name', ";
$sql .= "'$fax_caller_id_number', ";
if (strlen($fax_forward_number) > 0) {
$sql .= "'$fax_forward_number', ";
}
$sql .= "'$fax_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//redirect the user
$_SESSION["message"] = $text['confirm-copy'];
header("Location: fax.php");
return;
<?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>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
if (permission_exists('fax_extension_add')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"])) {
$fax_uuid = check_str($_REQUEST["id"]);
}
//get the data
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
echo "access denied";
exit;
}
foreach ($result as &$row) {
$fax_extension = $row["fax_extension"];
$fax_name = $row["fax_name"];
$fax_email = $row["fax_email"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
$fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
$fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
$fax_pin_number = $row["fax_pin_number"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_forward_number = $row["fax_forward_number"];
$fax_description = 'copy: '.$row["fax_description"];
}
unset ($prep_statement);
//copy the fax extension
$fax_uuid = uuid();
$dialplan_uuid = uuid();
$sql = "insert into v_fax ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "fax_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "fax_extension, ";
$sql .= "fax_name, ";
$sql .= "fax_email, ";
$sql .= "fax_email_connection_type, ";
$sql .= "fax_email_connection_host, ";
$sql .= "fax_email_connection_port, ";
$sql .= "fax_email_connection_security, ";
$sql .= "fax_email_connection_validate, ";
$sql .= "fax_email_connection_username, ";
$sql .= "fax_email_connection_password, ";
$sql .= "fax_email_connection_mailbox, ";
$sql .= "fax_email_inbound_subject_tag, ";
$sql .= "fax_email_outbound_subject_tag, ";
$sql .= "fax_email_outbound_authorized_senders, ";
$sql .= "fax_pin_number, ";
$sql .= "fax_caller_id_name, ";
$sql .= "fax_caller_id_number, ";
if (strlen($fax_forward_number) > 0) {
$sql .= "fax_forward_number, ";
}
$sql .= "fax_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$fax_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$fax_extension', ";
$sql .= "'$fax_name', ";
$sql .= "'$fax_email', ";
$sql .= "'$fax_email_connection_type', ";
$sql .= "'$fax_email_connection_host', ";
$sql .= "'$fax_email_connection_port', ";
$sql .= "'$fax_email_connection_security', ";
$sql .= "'$fax_email_connection_validate', ";
$sql .= "'$fax_email_connection_username', ";
$sql .= "'$fax_email_connection_password', ";
$sql .= "'$fax_email_connection_mailbox', ";
$sql .= "'$fax_email_inbound_subject_tag', ";
$sql .= "'$fax_email_outbound_subject_tag', ";
$sql .= "'$fax_email_outbound_authorized_senders', ";
$sql .= "'$fax_pin_number', ";
$sql .= "'$fax_caller_id_name', ";
$sql .= "'$fax_caller_id_number', ";
if (strlen($fax_forward_number) > 0) {
$sql .= "'$fax_forward_number', ";
}
$sql .= "'$fax_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//redirect the user
$_SESSION["message"] = $text['confirm-copy'];
header("Location: fax.php");
return;
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,387 +1,387 @@
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_message.php";
require_once "resources/classes/text.php";
//get accounts to monitor
$sql = "select * from v_fax ";
$sql .= "where fax_email_connection_host <> '' ";
$sql .= "and fax_email_connection_host is not null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
function arr_to_map(&$arr){
if(is_array($arr)){
$map = Array();
foreach($arr as &$val){
$map[$val] = true;
}
return $map;
}
return false;
}
if (sizeof($result) != 0) {
//load default settings
$default_settings = load_default_settings();
//get event socket connection parameters
$sql = "select event_socket_ip_address, event_socket_port, event_socket_password from v_settings";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$record = $prep_statement->fetch(PDO::FETCH_NAMED);
$event_socket['ip_address'] = $record['event_socket_ip_address'];
$event_socket['port'] = $record['event_socket_port'];
$event_socket['password'] = $record['event_socket_password'];
unset($sql, $prep_statement, $record);
$fax_send_mode_default = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode_default) == 0){
$fax_send_mode_default = 'direct';
}
$fax_cover_font_default = $_SESSION['fax']['cover_font']['text'];
$fax_allowed_extension_default = arr_to_map($_SESSION['fax']['allowed_extension']);
if($fax_allowed_extension_default == false){
$tmp = Array('.pdf', '.tiff', '.tif');
$fax_allowed_extension_default = arr_to_map($tmp);
}
foreach ($result as $row) {
//get fax server and account connection details
$fax_uuid = $row["fax_uuid"];
$domain_uuid = $row["domain_uuid"];
$fax_extension = $row["fax_extension"];
$fax_email = $row["fax_email"];
$fax_pin_number = $row["fax_pin_number"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
$fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
$fax_send_greeting = $row["fax_send_greeting"];
//load default settings, then domain settings over top
unset($_SESSION);
$_SESSION = $default_settings;
load_domain_settings($domain_uuid);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode) == 0){
$fax_send_mode = $fax_send_mode_default;
}
$fax_cover_font = $_SESSION['fax']['cover_font']['text'];
if(strlen($fax_cover_font) == 0){
$fax_cover_font = $fax_cover_font_default;
}
$fax_allowed_extension = arr_to_map($_SESSION['fax']['allowed_extension']);
if($fax_allowed_extension == false){
$fax_allowed_extension = $fax_allowed_extension_default;
}
//load event socket connection parameters
$_SESSION['event_socket_ip_address'] = $event_socket['ip_address'];
$_SESSION['event_socket_port'] = $event_socket['port'];
$_SESSION['event_socket_password'] = $event_socket['password'];
//get domain name, set local and session variables
$sql = "select domain_name from v_domains where domain_uuid = '".$domain_uuid."'";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$record = $prep_statement->fetch(PDO::FETCH_NAMED);
$domain_name = $record['domain_name'];
$_SESSION['domain_name'] = $record['domain_name'];
$_SESSION['domain_uuid'] = $domain_uuid;
unset($sql, $prep_statement, $record);
//set needed variables
$fax_page_size = $_SESSION['fax']['page_size']['text'];
$fax_resolution = $_SESSION['fax']['resolution']['text'];
$fax_header = $_SESSION['fax']['cover_header']['text'];
$fax_footer = $_SESSION['fax']['cover_footer']['text'];
$fax_sender = $fax_caller_id_name;
//open account connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
print_r(imap_errors());
continue; // try next account
}
//get emails
if ($emails = imap_search($connection, "SUBJECT \"[".$fax_email_outbound_subject_tag."]\"", SE_UID)) {
//get authorized sender(s)
if (substr_count($fax_email_outbound_authorized_senders, ',') > 0) {
$authorized_senders = explode(',', $fax_email_outbound_authorized_senders);
}
else {
$authorized_senders[] = $fax_email_outbound_authorized_senders;
}
sort($emails); // oldest first
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
//format from address
$tmp = object_to_array(imap_rfc822_parse_adrlist($metadata[0]['from'], null));
$metadata[0]['from'] = $tmp[0]['mailbox']."@".$tmp[0]['host'];
//check sender
$sender_authorized = false;
foreach ($authorized_senders as $authorized_sender) {
if (substr_count($metadata[0]['from'], $authorized_sender) > 0) { $sender_authorized = true; }
}
if ($sender_authorized) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//sent sender address (used in api call)
$mailto_address_user = $metadata[0]['from'];
//parse recipient fax number(s)
$fax_subject = $metadata[0]['subject'];
$tmp = explode(']', $fax_subject); //closing bracket of subject tag
$tmp = $tmp[1];
$tmp = str_replace(':', ',', $tmp);
$tmp = str_replace(';', ',', $tmp);
$tmp = str_replace('|', ',', $tmp);
if (substr_count($tmp, ',') > 0) {
$fax_numbers = explode(',', $tmp);
}
else {
$fax_numbers[] = $tmp;
}
unset($fax_subject); //clear so not on cover page
$message = parse_message($connection, $email_id, FT_UID);
//get email body (if any) for cover page
$fax_message = '';
//Debug print
print('attachments:' . "\n");
foreach($message['attachments'] as &$attachment){
print(' - ' . $attachment['type'] . ' - ' . $attachment['name'] . ': ' . $attachment['size'] . ' disposition: ' . $attachment['disposition'] . "\n");
}
print('messages:' . "\n");
foreach($message['messages'] as &$msg){
print(' - ' . $msg['type'] . ' - ' . $msg['size'] . "\n");
// print($msg['data']);
// print("\n--------------------------------------------------------\n");
}
foreach($message['messages'] as &$msg){
if(($msg['size'] > 0) && ($msg['type'] == 'text/plain')) {
$fax_message = $msg['data'];
break;
}
}
if ($fax_message != '') {
$fax_message = strip_tags($fax_message);
$fax_message = str_replace("\r\n\r\n", "\r\n", $fax_message);
}
// set fax directory (used for pdf creation - cover and/or attachments)
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.(($domain_name != '') ? '/'.$domain_name : null);
//handle attachments (if any)
$emailed_files = Array();
$attachments = $message['attachments'];
if (sizeof($attachments) > 0) {
foreach ($attachments as &$attachment) {
$fax_file_extension = pathinfo($attachment['name'], PATHINFO_EXTENSION);
//block unknown files
if ($fax_file_extension == '') {continue; }
//block unauthorized files
if (!$fax_allowed_extension['.' . $fax_file_extension]) { continue; }
//support only attachments
if($attachment['disposition'] != 'attachment'){ continue; }
//store attachment in local fax temp folder
$local_filepath = $fax_dir.'/'.$fax_extension.'/temp/'.$attachment['name'];
file_put_contents($local_filepath, $attachment['data']);
//load files array with attachments
$emailed_files['error'][] = 0;
$emailed_files['size'][] = $attachment['size'];
$emailed_files['tmp_name'][] = $attachment['name'];
$emailed_files['name'][] = $attachment['name'];
}
}
//Debug print
print('***********************' . "\n");
print('fax message:' . "\n");
print(' - length: ' . strlen($fax_message) . "\n");
print('fax files [' . sizeof($emailed_files['name']) . ']:' . "\n");
for($i = 0; $i < sizeof($emailed_files['name']);++$i){
print(' - ' . $emailed_files['name'][$i] . ' - ' . $emailed_files['size'][$i] . "\n");
}
print('***********************' . "\n");
//send fax
$cwd = getcwd();
$included = true;
require("fax_send.php");
if($cwd){
chdir($cwd);
}
//reset variables
unset($fax_numbers);
}
//delete email
if (imap_delete($connection, $email_id, FT_UID)) {
imap_expunge($connection);
}
}
unset($authorized_senders);
}
//close account connection
imap_close($connection);
}
}
//functions used above
function load_default_settings() {
global $db;
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_enabled = 'true' ";
try {
$prep_statement = $db->prepare($sql . " order by default_setting_order asc ");
$prep_statement->execute();
}
catch(PDOException $e) {
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
}
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//load the settings into an array
foreach ($result as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if (strlen($subcategory) == 0) {
if ($name == "array") {
$settings[$category][] = $row['default_setting_value'];
}
else {
$settings[$category][$name] = $row['default_setting_value'];
}
} else {
if ($name == "array") {
$settings[$category][$subcategory][] = $row['default_setting_value'];
}
else {
$settings[$category][$subcategory][$name] = $row['default_setting_value'];
$settings[$category][$subcategory][$name] = $row['default_setting_value'];
}
}
}
return $settings;
}
function load_domain_settings($domain_uuid) {
global $db;
if ($domain_uuid) {
$sql = "select * from v_domain_settings ";
$sql .= "where domain_uuid = '" . $domain_uuid . "' ";
$sql .= "and domain_setting_enabled = 'true' ";
try {
$prep_statement = $db->prepare($sql . " order by domain_setting_order asc ");
$prep_statement->execute();
}
catch(PDOException $e) {
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
}
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//unset the arrays that domains are overriding
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if ($name == "array") {
unset($_SESSION[$category][$subcategory]);
}
}
//set the settings as a session
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if (strlen($subcategory) == 0) {
//$$category[$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][] = $row['domain_setting_value'];
}
else {
$_SESSION[$category][$name] = $row['domain_setting_value'];
}
} else {
//$$category[$subcategory][$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][$subcategory][] = $row['domain_setting_value'];
}
else {
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
}
}
}
}
}
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_message.php";
require_once "resources/classes/text.php";
//get accounts to monitor
$sql = "select * from v_fax ";
$sql .= "where fax_email_connection_host <> '' ";
$sql .= "and fax_email_connection_host is not null ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
function arr_to_map(&$arr){
if(is_array($arr)){
$map = Array();
foreach($arr as &$val){
$map[$val] = true;
}
return $map;
}
return false;
}
if (sizeof($result) != 0) {
//load default settings
$default_settings = load_default_settings();
//get event socket connection parameters
$sql = "select event_socket_ip_address, event_socket_port, event_socket_password from v_settings";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$record = $prep_statement->fetch(PDO::FETCH_NAMED);
$event_socket['ip_address'] = $record['event_socket_ip_address'];
$event_socket['port'] = $record['event_socket_port'];
$event_socket['password'] = $record['event_socket_password'];
unset($sql, $prep_statement, $record);
$fax_send_mode_default = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode_default) == 0){
$fax_send_mode_default = 'direct';
}
$fax_cover_font_default = $_SESSION['fax']['cover_font']['text'];
$fax_allowed_extension_default = arr_to_map($_SESSION['fax']['allowed_extension']);
if($fax_allowed_extension_default == false){
$tmp = Array('.pdf', '.tiff', '.tif');
$fax_allowed_extension_default = arr_to_map($tmp);
}
foreach ($result as $row) {
//get fax server and account connection details
$fax_uuid = $row["fax_uuid"];
$domain_uuid = $row["domain_uuid"];
$fax_extension = $row["fax_extension"];
$fax_email = $row["fax_email"];
$fax_pin_number = $row["fax_pin_number"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
$fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
$fax_send_greeting = $row["fax_send_greeting"];
//load default settings, then domain settings over top
unset($_SESSION);
$_SESSION = $default_settings;
load_domain_settings($domain_uuid);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode) == 0){
$fax_send_mode = $fax_send_mode_default;
}
$fax_cover_font = $_SESSION['fax']['cover_font']['text'];
if(strlen($fax_cover_font) == 0){
$fax_cover_font = $fax_cover_font_default;
}
$fax_allowed_extension = arr_to_map($_SESSION['fax']['allowed_extension']);
if($fax_allowed_extension == false){
$fax_allowed_extension = $fax_allowed_extension_default;
}
//load event socket connection parameters
$_SESSION['event_socket_ip_address'] = $event_socket['ip_address'];
$_SESSION['event_socket_port'] = $event_socket['port'];
$_SESSION['event_socket_password'] = $event_socket['password'];
//get domain name, set local and session variables
$sql = "select domain_name from v_domains where domain_uuid = '".$domain_uuid."'";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$record = $prep_statement->fetch(PDO::FETCH_NAMED);
$domain_name = $record['domain_name'];
$_SESSION['domain_name'] = $record['domain_name'];
$_SESSION['domain_uuid'] = $domain_uuid;
unset($sql, $prep_statement, $record);
//set needed variables
$fax_page_size = $_SESSION['fax']['page_size']['text'];
$fax_resolution = $_SESSION['fax']['resolution']['text'];
$fax_header = $_SESSION['fax']['cover_header']['text'];
$fax_footer = $_SESSION['fax']['cover_footer']['text'];
$fax_sender = $fax_caller_id_name;
//open account connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
print_r(imap_errors());
continue; // try next account
}
//get emails
if ($emails = imap_search($connection, "SUBJECT \"[".$fax_email_outbound_subject_tag."]\"", SE_UID)) {
//get authorized sender(s)
if (substr_count($fax_email_outbound_authorized_senders, ',') > 0) {
$authorized_senders = explode(',', $fax_email_outbound_authorized_senders);
}
else {
$authorized_senders[] = $fax_email_outbound_authorized_senders;
}
sort($emails); // oldest first
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
//format from address
$tmp = object_to_array(imap_rfc822_parse_adrlist($metadata[0]['from'], null));
$metadata[0]['from'] = $tmp[0]['mailbox']."@".$tmp[0]['host'];
//check sender
$sender_authorized = false;
foreach ($authorized_senders as $authorized_sender) {
if (substr_count($metadata[0]['from'], $authorized_sender) > 0) { $sender_authorized = true; }
}
if ($sender_authorized) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//sent sender address (used in api call)
$mailto_address_user = $metadata[0]['from'];
//parse recipient fax number(s)
$fax_subject = $metadata[0]['subject'];
$tmp = explode(']', $fax_subject); //closing bracket of subject tag
$tmp = $tmp[1];
$tmp = str_replace(':', ',', $tmp);
$tmp = str_replace(';', ',', $tmp);
$tmp = str_replace('|', ',', $tmp);
if (substr_count($tmp, ',') > 0) {
$fax_numbers = explode(',', $tmp);
}
else {
$fax_numbers[] = $tmp;
}
unset($fax_subject); //clear so not on cover page
$message = parse_message($connection, $email_id, FT_UID);
//get email body (if any) for cover page
$fax_message = '';
//Debug print
print('attachments:' . "\n");
foreach($message['attachments'] as &$attachment){
print(' - ' . $attachment['type'] . ' - ' . $attachment['name'] . ': ' . $attachment['size'] . ' disposition: ' . $attachment['disposition'] . "\n");
}
print('messages:' . "\n");
foreach($message['messages'] as &$msg){
print(' - ' . $msg['type'] . ' - ' . $msg['size'] . "\n");
// print($msg['data']);
// print("\n--------------------------------------------------------\n");
}
foreach($message['messages'] as &$msg){
if(($msg['size'] > 0) && ($msg['type'] == 'text/plain')) {
$fax_message = $msg['data'];
break;
}
}
if ($fax_message != '') {
$fax_message = strip_tags($fax_message);
$fax_message = str_replace("\r\n\r\n", "\r\n", $fax_message);
}
// set fax directory (used for pdf creation - cover and/or attachments)
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax'.(($domain_name != '') ? '/'.$domain_name : null);
//handle attachments (if any)
$emailed_files = Array();
$attachments = $message['attachments'];
if (sizeof($attachments) > 0) {
foreach ($attachments as &$attachment) {
$fax_file_extension = pathinfo($attachment['name'], PATHINFO_EXTENSION);
//block unknown files
if ($fax_file_extension == '') {continue; }
//block unauthorized files
if (!$fax_allowed_extension['.' . $fax_file_extension]) { continue; }
//support only attachments
if($attachment['disposition'] != 'attachment'){ continue; }
//store attachment in local fax temp folder
$local_filepath = $fax_dir.'/'.$fax_extension.'/temp/'.$attachment['name'];
file_put_contents($local_filepath, $attachment['data']);
//load files array with attachments
$emailed_files['error'][] = 0;
$emailed_files['size'][] = $attachment['size'];
$emailed_files['tmp_name'][] = $attachment['name'];
$emailed_files['name'][] = $attachment['name'];
}
}
//Debug print
print('***********************' . "\n");
print('fax message:' . "\n");
print(' - length: ' . strlen($fax_message) . "\n");
print('fax files [' . sizeof($emailed_files['name']) . ']:' . "\n");
for($i = 0; $i < sizeof($emailed_files['name']);++$i){
print(' - ' . $emailed_files['name'][$i] . ' - ' . $emailed_files['size'][$i] . "\n");
}
print('***********************' . "\n");
//send fax
$cwd = getcwd();
$included = true;
require("fax_send.php");
if($cwd){
chdir($cwd);
}
//reset variables
unset($fax_numbers);
}
//delete email
if (imap_delete($connection, $email_id, FT_UID)) {
imap_expunge($connection);
}
}
unset($authorized_senders);
}
//close account connection
imap_close($connection);
}
}
//functions used above
function load_default_settings() {
global $db;
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_enabled = 'true' ";
try {
$prep_statement = $db->prepare($sql . " order by default_setting_order asc ");
$prep_statement->execute();
}
catch(PDOException $e) {
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
}
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//load the settings into an array
foreach ($result as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if (strlen($subcategory) == 0) {
if ($name == "array") {
$settings[$category][] = $row['default_setting_value'];
}
else {
$settings[$category][$name] = $row['default_setting_value'];
}
} else {
if ($name == "array") {
$settings[$category][$subcategory][] = $row['default_setting_value'];
}
else {
$settings[$category][$subcategory][$name] = $row['default_setting_value'];
$settings[$category][$subcategory][$name] = $row['default_setting_value'];
}
}
}
return $settings;
}
function load_domain_settings($domain_uuid) {
global $db;
if ($domain_uuid) {
$sql = "select * from v_domain_settings ";
$sql .= "where domain_uuid = '" . $domain_uuid . "' ";
$sql .= "and domain_setting_enabled = 'true' ";
try {
$prep_statement = $db->prepare($sql . " order by domain_setting_order asc ");
$prep_statement->execute();
}
catch(PDOException $e) {
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
}
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//unset the arrays that domains are overriding
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if ($name == "array") {
unset($_SESSION[$category][$subcategory]);
}
}
//set the settings as a session
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if (strlen($subcategory) == 0) {
//$$category[$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][] = $row['domain_setting_value'];
}
else {
$_SESSION[$category][$name] = $row['domain_setting_value'];
}
} else {
//$$category[$subcategory][$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][$subcategory][] = $row['domain_setting_value'];
}
else {
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
}
}
}
}
}
?>

View File

@@ -1,103 +1,103 @@
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('fax_file_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the id
if (isset($_REQUEST["id"])) {
$fax_file_uuid = check_str($_REQUEST["id"]);
}
//validate the id
if (strlen($fax_file_uuid) > 0) {
//get the fax file data
$sql = "select * from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$fax_uuid = $row["fax_uuid"];
$fax_mode = $row["fax_mode"];
$fax_file_path = $row["fax_file_path"];
$fax_file_type = $row["fax_file_type"];
}
unset($prep_statement);
//set the type
if ($fax_mode == 'rx') { $type = 'inbox'; }
if ($fax_mode == 'tx') { $type = 'sent'; }
//delete fax file(s)
if (substr_count($fax_file_path, '/temp/') > 0) {
$fax_file_path = str_replace('/temp/', '/'.$type.'/', $fax_file_path);
}
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
if ($fax_file_type == 'tif') {
$fax_file_path = str_replace('.tif', '.pdf', $fax_file_path);
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
}
else if ($fax_file_type == 'pdf') {
$fax_file_path = str_replace('.pdf', '.tif', $fax_file_path);
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
}
//delete fax file record
$sql = "delete from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement);
$_SESSION['message'] = $text['message-delete'];
}
//redirect the user
header('Location: fax_files.php?id='.$fax_uuid.'&box='.$type);
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('fax_file_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the id
if (isset($_REQUEST["id"])) {
$fax_file_uuid = check_str($_REQUEST["id"]);
}
//validate the id
if (strlen($fax_file_uuid) > 0) {
//get the fax file data
$sql = "select * from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$fax_uuid = $row["fax_uuid"];
$fax_mode = $row["fax_mode"];
$fax_file_path = $row["fax_file_path"];
$fax_file_type = $row["fax_file_type"];
}
unset($prep_statement);
//set the type
if ($fax_mode == 'rx') { $type = 'inbox'; }
if ($fax_mode == 'tx') { $type = 'sent'; }
//delete fax file(s)
if (substr_count($fax_file_path, '/temp/') > 0) {
$fax_file_path = str_replace('/temp/', '/'.$type.'/', $fax_file_path);
}
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
if ($fax_file_type == 'tif') {
$fax_file_path = str_replace('.tif', '.pdf', $fax_file_path);
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
}
else if ($fax_file_type == 'pdf') {
$fax_file_path = str_replace('.pdf', '.tif', $fax_file_path);
if (file_exists($fax_file_path)) {
@unlink($fax_file_path);
}
}
//delete fax file record
$sql = "delete from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement);
$_SESSION['message'] = $text['message-delete'];
}
//redirect the user
header('Location: fax_files.php?id='.$fax_uuid.'&box='.$type);
?>

View File

@@ -1,394 +1,394 @@
<?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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('fax_file_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//get fax extension
if (strlen($_GET['id']) > 0) {
if (is_uuid($_GET["id"])) {
$fax_uuid = $_GET["id"];
}
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select fax_name, fax_extension from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select fax_name, fax_extension from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (if_group("superadmin") || if_group("admin")) {
//allow access
}
else {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
//set database fields as variables
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
//limit to one row
break;
}
unset ($prep_statement);
}
//set the fax directory
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
//download the fax
if ($_GET['a'] == "download") {
session_cache_limiter('public');
//test to see if it is in the inbox or sent directory.
if ($_GET['type'] == "fax_inbox") {
if (file_exists($fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']))) {
$tmp_faxdownload_file = $fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']);
}
}
else if ($_GET['type'] == "fax_sent") {
if (file_exists($fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']))) {
$tmp_faxdownload_file = $fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']);
}
}
//let's see if we found it.
if (strlen($tmp_faxdownload_file) > 0) {
$fd = fopen($tmp_faxdownload_file, "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="'.check_str($_GET['filename']).'"');
}
else {
$file_ext = substr(check_str($_GET['filename']), -3);
if ($file_ext == "tif") {
header("Content-Type: image/tiff");
}
else if ($file_ext == "png") {
header("Content-Type: image/png");
}
else if ($file_ext == "jpg") {
header('Content-Type: image/jpeg');
}
else if ($file_ext == "pdf") {
header("Content-Type: application/pdf");
}
}
header('Accept-Ranges: bytes');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: " . filesize($tmp_faxdownload_file));
fpassthru($fd);
}
else {
echo "".$text['label-file']."";
}
exit;
}
//get the fax extension
if (strlen($fax_extension) > 0) {
//set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
$dir_fax_inbox = $fax_dir.'/'.$fax_extension.'/inbox';
$dir_fax_sent = $fax_dir.'/'.$fax_extension.'/sent';
$dir_fax_temp = $fax_dir.'/'.$fax_extension.'/temp';
//make sure the directories exist
if (!is_dir($_SESSION['switch']['storage']['dir'])) {
mkdir($_SESSION['switch']['storage']['dir']);
chmod($dir_fax_sent,0774);
}
if (!is_dir($fax_dir.'/'.$fax_extension)) {
mkdir($fax_dir.'/'.$fax_extension,0774,true);
chmod($fax_dir.'/'.$fax_extension,0774);
}
if (!is_dir($dir_fax_inbox)) {
mkdir($dir_fax_inbox,0774,true);
chmod($dir_fax_inbox,0774);
}
if (!is_dir($dir_fax_sent)) {
mkdir($dir_fax_sent,0774,true);
chmod($dir_fax_sent,0774);
}
if (!is_dir($dir_fax_temp)) {
mkdir($dir_fax_temp,0774,true);
chmod($dir_fax_temp,0774);
}
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
if ($_REQUEST['box'] == 'inbox') {
$sql .= "and fax_mode = 'rx' ";
}
if ($_REQUEST['box'] == 'sent') {
$sql .= "and fax_mode = 'tx' ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&id=".$_GET['id']."&box=".$_GET['box']."&order_by=".$_GET['order_by']."&order=".$_GET['order'];
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
if ($_REQUEST['box'] == 'inbox') {
$sql .= "and fax_mode = 'rx' ";
}
if ($_REQUEST['box'] == 'sent') {
$sql .= "and fax_mode = 'tx' ";
}
$sql .= "order by ".((strlen($order_by) > 0) ? $order_by.' '.$order : "fax_date desc")." ";
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//show the header
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br>\n";
//show the table and content
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('fax_caller_id_name', $text['label-fax_caller_id_name'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo th_order_by('fax_caller_id_number', $text['label-fax_caller_id_number'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
if ($_REQUEST['box'] == 'sent') {
echo th_order_by('fax_destination', $text['label-fax_destination'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
}
echo "<th width=''>".$text['table-file']."</th>\n";
echo "<th width='10%'>".$text['table-view']."</th>\n";
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo "<td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
echo "</tr>\n";
if ($num_rows > 0) {
foreach($fax_files as $row) {
$file = basename($row['fax_file_path']);
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
$file_name = substr($file, 0, (strlen($file) -4));
}
$file_ext = $row['fax_file_type'];
//decode the base64
if (strlen($row['fax_base64']) > 0) {
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
if (!file_exists($dir_fax_inbox.'/'.$file)) {
file_put_contents($dir_fax_inbox.'/'.$file, base64_decode($row['fax_base64']));
}
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
if (!file_exists($dir_fax_sent.'/'.$file)) {
//decode the base64
file_put_contents($dir_fax_sent.'/'.$file, base64_decode($row['fax_base64']));
}
}
}
//convert the tif to pdf
unset($dir_fax);
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
if (!file_exists($dir_fax_inbox.'/'.$file_name.".pdf")) {
$dir_fax = $dir_fax_inbox;
}
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
if (!file_exists($dir_fax_sent.'/'.$file_name.".pdf")) {
$dir_fax = $dir_fax_sent;
}
}
if ($dir_fax != '') {
chdir($dir_fax);
//get fax resolution (ppi, W & H)
$resp = exec("tiffinfo ".$file_name.".tif | grep 'Resolution:'");
$resp_array = explode(' ', trim($resp));
$ppi_w = (int) $resp_array[1];
$ppi_h = (int) $resp_array[2];
unset($resp_array);
$gs_r = $ppi_w.'x'.$ppi_h; //used by ghostscript
//get page dimensions/size (pixels/inches, W & H)
$resp = exec("tiffinfo ".$file_name.".tif | grep 'Image Width:'");
$resp_array = explode(' ', trim($resp));
$pix_w = $resp_array[2];
$pix_h = $resp_array[5];
unset($resp_array);
$gs_g = $pix_w.'x'.$pix_h; //used by ghostscript
$page_width = $pix_w / $ppi_w;
$page_height = $pix_h / $ppi_h;
if ($page_width > 8.4 && $page_height > 13) {
$page_width = 8.5;
$page_height = 14;
$page_size = 'legal';
}
else if ($page_width > 8.4 && $page_height < 12) {
$page_width = 8.5;
$page_height = 11;
$page_size = 'letter';
}
else if ($page_width < 8.4 && $page_height > 11) {
$page_width = 8.3;
$page_height = 11.7;
$page_size = 'a4';
}
//generate pdf (a work around, as tiff2pdf improperly inverts the colors)
$cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax_temp.'/'.$file_name.".pdf ".$dir_fax.'/'.$file_name.".tif";
//echo $cmd_tif2pdf."<br>";
exec($cmd_tif2pdf);
chdir($dir_fax_temp);
$cmd_pdf2tif = "gs -q -sDEVICE=tiffg3 -r".$gs_r." -g".$gs_g." -dNOPAUSE -sOutputFile=".$file_name."_temp.tif -- ".$file_name.".pdf -c quit";
//echo $cmd_pdf2tif."<br>";
exec($cmd_pdf2tif); //convert pdf to tif
@unlink($dir_fax_temp.'/'.$file_name.".pdf");
$cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax.'/'.$file_name.".pdf ".$dir_fax_temp.'/'.$file_name."_temp.tif";
//echo $cmd_tif2pdf."<br>";
exec($cmd_tif2pdf);
@unlink($dir_fax_temp.'/'.$file_name."_temp.tif");
}
echo "</td></tr>";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['fax_caller_id_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".format_phone($row['fax_caller_id_number'])."&nbsp;</td>\n";
if ($_REQUEST['box'] == 'sent') {
echo " <td valign='top' class='".$row_style[$c]."'>".format_phone($row['fax_destination'])."&nbsp;</td>\n";
}
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
}
echo " $file_name";
echo " </a>";
echo " </td>\n";
echo " <td class='".$row_style[$c]."' ondblclick=''>\n";
if ($_REQUEST['box'] == 'inbox') {
$dir_fax = $dir_fax_inbox;
}
if ($_REQUEST['box'] == 'sent') {
$dir_fax = $dir_fax_sent;
}
if (file_exists($dir_fax.'/'.$file_name.".pdf")) {
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">PDF</a>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">PDF</a>\n";
}
}
else {
echo "&nbsp;\n";
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".date("F d Y H:i:s", strtotime($row['fax_date']))."&nbsp;</td>\n";
echo " <td style='width: 25px;' class='list_control_icons'>";
if (permission_exists('fax_file_delete')) {
echo "<a href='fax_file_delete.php?id=".$row['fax_file_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($sql, $fax_files);
} //end if results
//show the paging controls
echo "</table>";
echo "<br /><br />";
echo "<div align='center'>".$paging_controls."</div>\n";
echo "<br /><br />";
//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) 2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('fax_file_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//get fax extension
if (strlen($_GET['id']) > 0) {
if (is_uuid($_GET["id"])) {
$fax_uuid = $_GET["id"];
}
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select fax_name, fax_extension from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select fax_name, fax_extension from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (if_group("superadmin") || if_group("admin")) {
//allow access
}
else {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
//set database fields as variables
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
//limit to one row
break;
}
unset ($prep_statement);
}
//set the fax directory
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
//download the fax
if ($_GET['a'] == "download") {
session_cache_limiter('public');
//test to see if it is in the inbox or sent directory.
if ($_GET['type'] == "fax_inbox") {
if (file_exists($fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']))) {
$tmp_faxdownload_file = $fax_dir.'/'.check_str($_GET['ext']).'/inbox/'.check_str($_GET['filename']);
}
}
else if ($_GET['type'] == "fax_sent") {
if (file_exists($fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']))) {
$tmp_faxdownload_file = $fax_dir.'/'.check_str($_GET['ext']).'/sent/'.check_str($_GET['filename']);
}
}
//let's see if we found it.
if (strlen($tmp_faxdownload_file) > 0) {
$fd = fopen($tmp_faxdownload_file, "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="'.check_str($_GET['filename']).'"');
}
else {
$file_ext = substr(check_str($_GET['filename']), -3);
if ($file_ext == "tif") {
header("Content-Type: image/tiff");
}
else if ($file_ext == "png") {
header("Content-Type: image/png");
}
else if ($file_ext == "jpg") {
header('Content-Type: image/jpeg');
}
else if ($file_ext == "pdf") {
header("Content-Type: application/pdf");
}
}
header('Accept-Ranges: bytes');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: " . filesize($tmp_faxdownload_file));
fpassthru($fd);
}
else {
echo "".$text['label-file']."";
}
exit;
}
//get the fax extension
if (strlen($fax_extension) > 0) {
//set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
$dir_fax_inbox = $fax_dir.'/'.$fax_extension.'/inbox';
$dir_fax_sent = $fax_dir.'/'.$fax_extension.'/sent';
$dir_fax_temp = $fax_dir.'/'.$fax_extension.'/temp';
//make sure the directories exist
if (!is_dir($_SESSION['switch']['storage']['dir'])) {
mkdir($_SESSION['switch']['storage']['dir']);
chmod($dir_fax_sent,0774);
}
if (!is_dir($fax_dir.'/'.$fax_extension)) {
mkdir($fax_dir.'/'.$fax_extension,0774,true);
chmod($fax_dir.'/'.$fax_extension,0774);
}
if (!is_dir($dir_fax_inbox)) {
mkdir($dir_fax_inbox,0774,true);
chmod($dir_fax_inbox,0774);
}
if (!is_dir($dir_fax_sent)) {
mkdir($dir_fax_sent,0774,true);
chmod($dir_fax_sent,0774);
}
if (!is_dir($dir_fax_temp)) {
mkdir($dir_fax_temp,0774,true);
chmod($dir_fax_temp,0774);
}
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
if ($_REQUEST['box'] == 'inbox') {
$sql .= "and fax_mode = 'rx' ";
}
if ($_REQUEST['box'] == 'sent') {
$sql .= "and fax_mode = 'tx' ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
$num_rows = '0';
}
}
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&id=".$_GET['id']."&box=".$_GET['box']."&order_by=".$_GET['order_by']."&order=".$_GET['order'];
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
if ($_REQUEST['box'] == 'inbox') {
$sql .= "and fax_mode = 'rx' ";
}
if ($_REQUEST['box'] == 'sent') {
$sql .= "and fax_mode = 'tx' ";
}
$sql .= "order by ".((strlen($order_by) > 0) ? $order_by.' '.$order : "fax_date desc")." ";
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//show the header
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br>\n";
//show the table and content
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('fax_caller_id_name', $text['label-fax_caller_id_name'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo th_order_by('fax_caller_id_number', $text['label-fax_caller_id_number'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
if ($_REQUEST['box'] == 'sent') {
echo th_order_by('fax_destination', $text['label-fax_destination'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
}
echo "<th width=''>".$text['table-file']."</th>\n";
echo "<th width='10%'>".$text['table-view']."</th>\n";
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo "<td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
echo "</tr>\n";
if ($num_rows > 0) {
foreach($fax_files as $row) {
$file = basename($row['fax_file_path']);
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
$file_name = substr($file, 0, (strlen($file) -4));
}
$file_ext = $row['fax_file_type'];
//decode the base64
if (strlen($row['fax_base64']) > 0) {
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
if (!file_exists($dir_fax_inbox.'/'.$file)) {
file_put_contents($dir_fax_inbox.'/'.$file, base64_decode($row['fax_base64']));
}
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
if (!file_exists($dir_fax_sent.'/'.$file)) {
//decode the base64
file_put_contents($dir_fax_sent.'/'.$file, base64_decode($row['fax_base64']));
}
}
}
//convert the tif to pdf
unset($dir_fax);
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
if (!file_exists($dir_fax_inbox.'/'.$file_name.".pdf")) {
$dir_fax = $dir_fax_inbox;
}
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
if (!file_exists($dir_fax_sent.'/'.$file_name.".pdf")) {
$dir_fax = $dir_fax_sent;
}
}
if ($dir_fax != '') {
chdir($dir_fax);
//get fax resolution (ppi, W & H)
$resp = exec("tiffinfo ".$file_name.".tif | grep 'Resolution:'");
$resp_array = explode(' ', trim($resp));
$ppi_w = (int) $resp_array[1];
$ppi_h = (int) $resp_array[2];
unset($resp_array);
$gs_r = $ppi_w.'x'.$ppi_h; //used by ghostscript
//get page dimensions/size (pixels/inches, W & H)
$resp = exec("tiffinfo ".$file_name.".tif | grep 'Image Width:'");
$resp_array = explode(' ', trim($resp));
$pix_w = $resp_array[2];
$pix_h = $resp_array[5];
unset($resp_array);
$gs_g = $pix_w.'x'.$pix_h; //used by ghostscript
$page_width = $pix_w / $ppi_w;
$page_height = $pix_h / $ppi_h;
if ($page_width > 8.4 && $page_height > 13) {
$page_width = 8.5;
$page_height = 14;
$page_size = 'legal';
}
else if ($page_width > 8.4 && $page_height < 12) {
$page_width = 8.5;
$page_height = 11;
$page_size = 'letter';
}
else if ($page_width < 8.4 && $page_height > 11) {
$page_width = 8.3;
$page_height = 11.7;
$page_size = 'a4';
}
//generate pdf (a work around, as tiff2pdf improperly inverts the colors)
$cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax_temp.'/'.$file_name.".pdf ".$dir_fax.'/'.$file_name.".tif";
//echo $cmd_tif2pdf."<br>";
exec($cmd_tif2pdf);
chdir($dir_fax_temp);
$cmd_pdf2tif = "gs -q -sDEVICE=tiffg3 -r".$gs_r." -g".$gs_g." -dNOPAUSE -sOutputFile=".$file_name."_temp.tif -- ".$file_name.".pdf -c quit";
//echo $cmd_pdf2tif."<br>";
exec($cmd_pdf2tif); //convert pdf to tif
@unlink($dir_fax_temp.'/'.$file_name.".pdf");
$cmd_tif2pdf = "tiff2pdf -i -u i -p ".$page_size." -w ".$page_width." -l ".$page_height." -f -o ".$dir_fax.'/'.$file_name.".pdf ".$dir_fax_temp.'/'.$file_name."_temp.tif";
//echo $cmd_tif2pdf."<br>";
exec($cmd_tif2pdf);
@unlink($dir_fax_temp.'/'.$file_name."_temp.tif");
}
echo "</td></tr>";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['fax_caller_id_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".format_phone($row['fax_caller_id_number'])."&nbsp;</td>\n";
if ($_REQUEST['box'] == 'sent') {
echo " <td valign='top' class='".$row_style[$c]."'>".format_phone($row['fax_destination'])."&nbsp;</td>\n";
}
echo " <td class='".$row_style[$c]."' ondblclick=\"\">\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file)."\">\n";
}
echo " $file_name";
echo " </a>";
echo " </td>\n";
echo " <td class='".$row_style[$c]."' ondblclick=''>\n";
if ($_REQUEST['box'] == 'inbox') {
$dir_fax = $dir_fax_inbox;
}
if ($_REQUEST['box'] == 'sent') {
$dir_fax = $dir_fax_sent;
}
if (file_exists($dir_fax.'/'.$file_name.".pdf")) {
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_inbox&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">PDF</a>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <a href=\"fax_files.php?id=".$fax_uuid."&a=download&type=fax_sent&t=bin&ext=".urlencode($fax_extension)."&filename=".urlencode($file_name).".pdf\">PDF</a>\n";
}
}
else {
echo "&nbsp;\n";
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".date("F d Y H:i:s", strtotime($row['fax_date']))."&nbsp;</td>\n";
echo " <td style='width: 25px;' class='list_control_icons'>";
if (permission_exists('fax_file_delete')) {
echo "<a href='fax_file_delete.php?id=".$row['fax_file_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($sql, $fax_files);
} //end if results
//show the paging controls
echo "</table>";
echo "<br /><br />";
echo "<div align='center'>".$paging_controls."</div>\n";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -1,243 +1,243 @@
<?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>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_attachments.php";
if (permission_exists('fax_inbox_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get fax server uuid, set connection parameters
if (strlen($_GET['id']) > 0) {
$fax_uuid = check_str($_GET["id"]);
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select * from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (!if_group("superadmin") && !if_group("admin")) {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
break;
}
unset ($prep_statement);
// make connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
$_SESSION["message_mood"] = 'negative';
$_SESSION["message"] = $text['message-cannot_connect']."(".imap_last_error().")";
header("Location: fax.php");
exit;
}
}
else {
header("Location: fax.php");
exit;
}
//message action
if ($_GET['email_id'] != '') {
$email_id = check_str($_GET['email_id']);
//download attachment
if (isset($_GET['download'])) {
$attachment = parse_attachments($connection, $email_id, FT_UID);
$file_type = pathinfo($attachment[0]['filename'], PATHINFO_EXTENSION);
switch ($file_type) {
case "pdf" : header("Content-Type: application/pdf"); break;
case "tif" : header("Contet-Type: image/tiff"); break;
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: ".strlen($attachment[0]['attachment']));
$browser = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/MSIE 5.5/", $browser) || preg_match("/MSIE 6.0/", $browser)) {
header("Content-Disposition: filename=\"".$attachment[0]['filename']."\"");
}
else {
header("Content-Disposition: attachment; filename=\"".$attachment[0]['filename']."\"");
}
header("Content-Transfer-Encoding: binary");
echo $attachment[0]['attachment'];
exit;
}
//delete email
if (isset($_GET['delete']) && permission_exists('fax_inbox_delete')) {
$attachment = parse_attachments($connection, $email_id, FT_UID);
if (imap_delete($connection, $email_id, FT_UID)) {
if (imap_expunge($connection)) {
//clean up local inbox copy
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment[0]['filename']);
//redirect user
$_SESSION["message"] = $text['message-delete'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
$_SESSION["message_mood"] = "negative";
$_SESSION["message"] = $text['message-delete_failed'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
$_SESSION["message_mood"] = "negative";
$_SESSION["message"] = $text['message-delete_failed'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
//get emails
$emails = imap_search($connection, "SUBJECT \"".$fax_email_inbound_subject_tag."\"", SE_UID);
//show the header
require_once "resources/header.php";
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the inbox
$c = 0;
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='fax.php';\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' alt='".$text['button-refresh']."' onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th>".$text['label-fax_caller_id_name']."</th>\n";
echo " <th>".$text['label-fax_caller_id_number']."</th>\n";
echo " <th>".$text['table-file']."</th>\n";
echo " <th>".$text['label-email_size']."</th>\n";
echo " <th>".$text['label-email_received']."</th>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
}
echo " </tr>";
if ($emails) {
rsort($emails); // most recent on top
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
$attachment = parse_attachments($connection, $email_id, FT_UID);
$file_name = $attachment[0]['filename'];
$caller_id_name = substr($file_name, 0, strpos($file_name, '-'));
$caller_id_number = (is_numeric($caller_id_name)) ? format_phone((int) $caller_id_name) : null;
echo " <tr ".(($metadata[0]['seen'] == 0) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_name."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_number."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='?id=".$fax_uuid."&email_id=".$email_id."&download'>".$file_name."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".byte_convert(strlen($attachment[0]['attachment']))."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$metadata[0]['date']."</td>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'><a href='?id=".$fax_uuid."&email_id=".$email_id."&delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a></td>\n";
}
echo " </tr>\n";
// $fax_message = imap_fetchbody($connection, $email_id, '1.1', FT_UID);
// if ($fax_message == '') {
// $fax_message = imap_fetchbody($connection, $email_id, '1', FT_UID);
// }
$c = ($c) ? 0 : 1;
}
}
else {
echo "<tr valign='top'>\n";
echo " <td colspan='4' style='text-align: center;'><br><br>".$text['message-no_faxes_found']."<br><br></td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "<br><br>";
/* close the connection */
imap_close($inbox);
//show 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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_attachments.php";
if (permission_exists('fax_inbox_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get fax server uuid, set connection parameters
if (strlen($_GET['id']) > 0) {
$fax_uuid = check_str($_GET["id"]);
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select * from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (!if_group("superadmin") && !if_group("admin")) {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
break;
}
unset ($prep_statement);
// make connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
$_SESSION["message_mood"] = 'negative';
$_SESSION["message"] = $text['message-cannot_connect']."(".imap_last_error().")";
header("Location: fax.php");
exit;
}
}
else {
header("Location: fax.php");
exit;
}
//message action
if ($_GET['email_id'] != '') {
$email_id = check_str($_GET['email_id']);
//download attachment
if (isset($_GET['download'])) {
$attachment = parse_attachments($connection, $email_id, FT_UID);
$file_type = pathinfo($attachment[0]['filename'], PATHINFO_EXTENSION);
switch ($file_type) {
case "pdf" : header("Content-Type: application/pdf"); break;
case "tif" : header("Contet-Type: image/tiff"); break;
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: ".strlen($attachment[0]['attachment']));
$browser = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/MSIE 5.5/", $browser) || preg_match("/MSIE 6.0/", $browser)) {
header("Content-Disposition: filename=\"".$attachment[0]['filename']."\"");
}
else {
header("Content-Disposition: attachment; filename=\"".$attachment[0]['filename']."\"");
}
header("Content-Transfer-Encoding: binary");
echo $attachment[0]['attachment'];
exit;
}
//delete email
if (isset($_GET['delete']) && permission_exists('fax_inbox_delete')) {
$attachment = parse_attachments($connection, $email_id, FT_UID);
if (imap_delete($connection, $email_id, FT_UID)) {
if (imap_expunge($connection)) {
//clean up local inbox copy
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment[0]['filename']);
//redirect user
$_SESSION["message"] = $text['message-delete'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
$_SESSION["message_mood"] = "negative";
$_SESSION["message"] = $text['message-delete_failed'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
$_SESSION["message_mood"] = "negative";
$_SESSION["message"] = $text['message-delete_failed'];
header("Location: ?id=".$fax_uuid);
exit;
}
}
//get emails
$emails = imap_search($connection, "SUBJECT \"".$fax_email_inbound_subject_tag."\"", SE_UID);
//show the header
require_once "resources/header.php";
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the inbox
$c = 0;
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='fax.php';\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' alt='".$text['button-refresh']."' onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th>".$text['label-fax_caller_id_name']."</th>\n";
echo " <th>".$text['label-fax_caller_id_number']."</th>\n";
echo " <th>".$text['table-file']."</th>\n";
echo " <th>".$text['label-email_size']."</th>\n";
echo " <th>".$text['label-email_received']."</th>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
}
echo " </tr>";
if ($emails) {
rsort($emails); // most recent on top
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
$attachment = parse_attachments($connection, $email_id, FT_UID);
$file_name = $attachment[0]['filename'];
$caller_id_name = substr($file_name, 0, strpos($file_name, '-'));
$caller_id_number = (is_numeric($caller_id_name)) ? format_phone((int) $caller_id_name) : null;
echo " <tr ".(($metadata[0]['seen'] == 0) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_name."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_number."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='?id=".$fax_uuid."&email_id=".$email_id."&download'>".$file_name."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".byte_convert(strlen($attachment[0]['attachment']))."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$metadata[0]['date']."</td>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'><a href='?id=".$fax_uuid."&email_id=".$email_id."&delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a></td>\n";
}
echo " </tr>\n";
// $fax_message = imap_fetchbody($connection, $email_id, '1.1', FT_UID);
// if ($fax_message == '') {
// $fax_message = imap_fetchbody($connection, $email_id, '1', FT_UID);
// }
$c = ($c) ? 0 : 1;
}
}
else {
echo "<tr valign='top'>\n";
echo " <td colspan='4' style='text-align: center;'><br><br>".$text['message-no_faxes_found']."<br><br></td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "<br><br>";
/* close the connection */
imap_close($connection);
//show the footer
require_once "resources/footer.php";
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,248 +1,248 @@
<?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>
Copyright (C) 2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* cache class provides an abstracted cache
*
* @method string dialplan - builds the dialplan for the fax servers
*/
//define the fax class
if (!class_exists('fax')) {
class fax {
/**
* define the variables
*/
public $domain_uuid;
public $fax_uuid;
public $dialplan_uuid;
public $fax_name;
public $fax_description;
public $fax_extension;
public $fax_forward_number;
public $destination_number;
private $forward_prefix;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan() {
//normalize the fax forward number
if (strlen($this->fax_forward_number) > 3) {
//$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
$this->fax_forward_number = str_replace(" ", "", $this->fax_forward_number);
$this->fax_forward_number = str_replace("-", "", $this->fax_forward_number);
}
//set the forward prefix
if (strripos($this->fax_forward_number, '$1') === false) {
$this->forward_prefix = ''; //not found
} else {
$this->forward_prefix = $this->forward_prefix.$this->fax_forward_number.'#'; //found
}
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "24108154-4ac3-1db6-1551-4731703a4440";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->fax_extension;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "310";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->fax_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^".$this->destination_number."\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=".$this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data,0,8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data,8,strlen($data));
}
elseif (substr($data,0,9) == "outbound:") {}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=".$_SESSION['fax']['last_fax']['text'];
}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "silence_stream://2000";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif';
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_fax ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "where fax_uuid = '".$this->fax_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
}
}
/*
$o = new fax;
$c->domain_uuid = "";
$c->dialplan_uuid = "";
$c->fax_name = "";
$c->fax_extension = $fax_extension;
$c->fax_forward_number = $fax_forward_number;
$c->destination_number = $fax_destination_number;
$c->fax_description = $fax_description;
$c->dialplan();
*/
<?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>
Copyright (C) 2015
All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* cache class provides an abstracted cache
*
* @method string dialplan - builds the dialplan for the fax servers
*/
//define the fax class
if (!class_exists('fax')) {
class fax {
/**
* define the variables
*/
public $domain_uuid;
public $fax_uuid;
public $dialplan_uuid;
public $fax_name;
public $fax_description;
public $fax_extension;
public $fax_forward_number;
public $destination_number;
private $forward_prefix;
/**
* Called when the object is created
*/
public function __construct() {
//place holder
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Add a dialplan for call center
* @var string $domain_uuid the multi-tenant id
* @var string $value string to be cached
*/
public function dialplan() {
//normalize the fax forward number
if (strlen($this->fax_forward_number) > 3) {
//$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
$this->fax_forward_number = str_replace(" ", "", $this->fax_forward_number);
$this->fax_forward_number = str_replace("-", "", $this->fax_forward_number);
}
//set the forward prefix
if (strripos($this->fax_forward_number, '$1') === false) {
$this->forward_prefix = ''; //not found
} else {
$this->forward_prefix = $this->forward_prefix.$this->fax_forward_number.'#'; //found
}
//delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
//delete the previous dialplan
$sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
$sql = "delete from v_dialplan_details ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
}
unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "24108154-4ac3-1db6-1551-4731703a4440";
$dialplan["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_name"] = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number);
$dialplan["dialplan_number"] = $this->fax_extension;
$dialplan["dialplan_context"] = $_SESSION['context'];
$dialplan["dialplan_continue"] = "false";
$dialplan["dialplan_order"] = "310";
$dialplan["dialplan_enabled"] = "true";
$dialplan["dialplan_description"] = $this->fax_description;
$dialplan_detail_order = 10;
//add the public condition
$y = 1;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^".$this->destination_number."\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=".$this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data,0,8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data,8,strlen($data));
}
elseif (substr($data,0,9) == "outbound:") {}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=".$_SESSION['fax']['last_fax']['text'];
}
else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "silence_stream://2000";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.$this->fax_extension.'/inbox/'.$this->forward_prefix.'${last_fax}.tif';
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_fax ";
$sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "where fax_uuid = '".$this->fax_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache;
$cache->delete("dialplan:".$_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
}
}
/*
$o = new fax;
$c->domain_uuid = "";
$c->dialplan_uuid = "";
$c->fax_name = "";
$c->fax_extension = $fax_extension;
$c->fax_forward_number = $fax_forward_number;
$c->destination_number = $fax_destination_number;
$c->fax_description = $fax_description;
$c->dialplan();
*/
?>

View File

@@ -1,9 +1,9 @@
<?php
function object_to_array($obj) {
if (!is_object($obj) && !is_array($obj)) { return $obj; }
if (is_object($obj)) { $obj = get_object_vars($obj); }
return array_map('object_to_array', $obj);
}
<?php
function object_to_array($obj) {
if (!is_object($obj) && !is_array($obj)) { return $obj; }
if (is_object($obj)) { $obj = get_object_vars($obj); }
return array_map('object_to_array', $obj);
}
?>

View File

@@ -0,0 +1,48 @@
<?php
function parse_attachments($connection, $message_number, $option = '') {
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
if(isset($structure->parts) && count($structure->parts)) {
for($i = 0; $i < count($structure->parts); $i++) {
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
unset($attachments[$i]['is_attachment']);
}
}
return array_values($attachments); //reindex
}
?>

View File

@@ -1,145 +1,145 @@
<?php
function parse_message($connection, $message_number, $option = null, $to_charset = 'UTF-8') {
$result = Array('messages'=>Array(),'attachments'=>Array());
$structure = imap_fetchstructure($connection, $message_number, $option);
if (isset($structure->parts)) {
$flatten = parse_message_flatten($structure->parts);
}
else {
$flatten = Array(1 => $structure);
}
foreach($flatten as $id => &$part){
switch($part->type) {
case TYPETEXT:
$message = parse_message_decode_text($connection, $part, $message_number, $id, $option, $to_charset);
$result['messages'][] = $message;
break;
case TYPEAPPLICATION: case TYPEAUDIO: case TYPEIMAGE: case TYPEVIDEO: case TYPEOTHER:
$attachment = parse_message_decode_attach($connection, $part, $message_number, $id, $option);
if($attachment){
$result['attachments'][] = $attachment;
}
break;
case TYPEMULTIPART: case TYPEMESSAGE:
break;
}
}
return $result;
}
function parse_message_decode_text($connection, &$part, $message_number, $id, $option, $to_charset){
$msg = parse_message_fetch_body($connection, $part, $message_number, $id, $option);
if($msg && $to_charset){
$charset = '';
if(isset($part->parameters) && count($part->parameters)) {
foreach($part->parameters as &$parameter){
if($parameter->attribute == 'CHARSET') {
$charset = $parameter->value;
break;
}
}
}
if($charset){
$msg = mb_convert_encoding($msg, $to_charset, $charset);
}
$msg = trim($msg);
}
return Array(
'data' => $msg,
'type' => parse_message_get_type($part),
'size' => strlen($msg),
);
}
function parse_message_decode_attach($connection, &$part, $message_number, $id, $option){
$filename = false;
if($part->ifdparameters) {
foreach($part->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$filename = $object->value;
break;
}
}
}
if($part->ifparameters) {
foreach($part->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$filename = $object->value;
break;
}
}
}
if(!$filename) {
return false;
}
$body = parse_message_fetch_body($connection, $part, $message_number, $id, $option);
return Array(
'data' => $body,
'type' => parse_message_get_type($part),
'name' => $filename,
'size' => strlen($body),
'disposition' => $part->disposition,
);
}
function parse_message_fetch_body($connection, &$part, $message_number, $id, $option){
$body = imap_fetchbody($connection, $message_number, $id, $option);
if($part->encoding == ENCBASE64){
$body = base64_decode($body);
}
else if($part->encoding == ENCQUOTEDPRINTABLE){
$body = quoted_printable_decode($body);
}
return $body;
}
function parse_message_get_type(&$part){
$types = Array(
TYPEMESSAGE => 'message',
TYPEMULTIPART => 'multipart',
TYPEAPPLICATION => 'application',
TYPEAUDIO => 'audio',
TYPEIMAGE => 'image',
TYPETEXT => 'text',
TYPEVIDEO => 'video',
TYPEMODEL => 'model',
TYPEOTHER => 'other',
);
return $types[$part->type] . '/' . strtolower($part->subtype);
}
function parse_message_flatten(&$structure, &$result = array(), $prefix = '', $index = 1, $fullPrefix = true) {
foreach($structure as &$part) {
if(isset($part->parts)) {
if($part->type == TYPEMESSAGE) {
parse_message_flatten($part->parts, $result, $prefix.$index.'.', 0, false);
}
elseif($fullPrefix) {
parse_message_flatten($part->parts, $result, $prefix.$index.'.');
}
else {
parse_message_flatten($part->parts, $result, $prefix);
}
}
else {
$result[$prefix.$index] = $part;
}
$index++;
}
return $result;
}
<?php
function parse_message($connection, $message_number, $option = null, $to_charset = 'UTF-8') {
$result = Array('messages'=>Array(),'attachments'=>Array());
$structure = imap_fetchstructure($connection, $message_number, $option);
if (isset($structure->parts)) {
$flatten = parse_message_flatten($structure->parts);
}
else {
$flatten = Array(1 => $structure);
}
foreach($flatten as $id => &$part){
switch($part->type) {
case TYPETEXT:
$message = parse_message_decode_text($connection, $part, $message_number, $id, $option, $to_charset);
$result['messages'][] = $message;
break;
case TYPEAPPLICATION: case TYPEAUDIO: case TYPEIMAGE: case TYPEVIDEO: case TYPEOTHER:
$attachment = parse_message_decode_attach($connection, $part, $message_number, $id, $option);
if($attachment){
$result['attachments'][] = $attachment;
}
break;
case TYPEMULTIPART: case TYPEMESSAGE:
break;
}
}
return $result;
}
function parse_message_decode_text($connection, &$part, $message_number, $id, $option, $to_charset){
$msg = parse_message_fetch_body($connection, $part, $message_number, $id, $option);
if($msg && $to_charset){
$charset = '';
if(isset($part->parameters) && count($part->parameters)) {
foreach($part->parameters as &$parameter){
if($parameter->attribute == 'CHARSET') {
$charset = $parameter->value;
break;
}
}
}
if($charset){
$msg = mb_convert_encoding($msg, $to_charset, $charset);
}
$msg = trim($msg);
}
return Array(
'data' => $msg,
'type' => parse_message_get_type($part),
'size' => strlen($msg),
);
}
function parse_message_decode_attach($connection, &$part, $message_number, $id, $option){
$filename = false;
if($part->ifdparameters) {
foreach($part->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$filename = $object->value;
break;
}
}
}
if($part->ifparameters) {
foreach($part->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$filename = $object->value;
break;
}
}
}
if(!$filename) {
return false;
}
$body = parse_message_fetch_body($connection, $part, $message_number, $id, $option);
return Array(
'data' => $body,
'type' => parse_message_get_type($part),
'name' => $filename,
'size' => strlen($body),
'disposition' => $part->disposition,
);
}
function parse_message_fetch_body($connection, &$part, $message_number, $id, $option){
$body = imap_fetchbody($connection, $message_number, $id, $option);
if($part->encoding == ENCBASE64){
$body = base64_decode($body);
}
else if($part->encoding == ENCQUOTEDPRINTABLE){
$body = quoted_printable_decode($body);
}
return $body;
}
function parse_message_get_type(&$part){
$types = Array(
TYPEMESSAGE => 'message',
TYPEMULTIPART => 'multipart',
TYPEAPPLICATION => 'application',
TYPEAUDIO => 'audio',
TYPEIMAGE => 'image',
TYPETEXT => 'text',
TYPEVIDEO => 'video',
TYPEMODEL => 'model',
TYPEOTHER => 'other',
);
return $types[$part->type] . '/' . strtolower($part->subtype);
}
function parse_message_flatten(&$structure, &$result = array(), $prefix = '', $index = 1, $fullPrefix = true) {
foreach($structure as &$part) {
if(isset($part->parts)) {
if($part->type == TYPEMESSAGE) {
parse_message_flatten($part->parts, $result, $prefix.$index.'.', 0, false);
}
elseif($fullPrefix) {
parse_message_flatten($part->parts, $result, $prefix.$index.'.');
}
else {
parse_message_flatten($part->parts, $result, $prefix);
}
}
else {
$result[$prefix.$index] = $part;
}
$index++;
}
return $result;
}

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,21 +1,21 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Follow Me";
$apps[$x]['menu'][0]['title']['es-mx'] = "Sígueme";
$apps[$x]['menu'][0]['title']['de-de'] = "Follow Me";
$apps[$x]['menu'][0]['title']['de-ch'] = "Follow Me";
$apps[$x]['menu'][0]['title']['de-at'] = "Follow Me";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Follow Me";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "a1144e12-873e-4722-9818-02da1adb6ba3";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/calls/calls.php";
$apps[$x]['menu'][0]['groups'][] = "user";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>
<?php
$apps[$x]['menu'][0]['title']['en-us'] = "Follow Me";
$apps[$x]['menu'][0]['title']['es-mx'] = "Sígueme";
$apps[$x]['menu'][0]['title']['de-de'] = "Follow Me";
$apps[$x]['menu'][0]['title']['de-ch'] = "Follow Me";
$apps[$x]['menu'][0]['title']['de-at'] = "Follow Me";
$apps[$x]['menu'][0]['title']['fr-fr'] = "Follow Me";
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
$apps[$x]['menu'][0]['title']['pt-pt'] = "";
$apps[$x]['menu'][0]['title']['pt-br'] = "";
$apps[$x]['menu'][0]['uuid'] = "a1144e12-873e-4722-9818-02da1adb6ba3";
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][0]['category'] = "internal";
$apps[$x]['menu'][0]['path'] = "/app/calls/calls.php";
$apps[$x]['menu'][0]['groups'][] = "user";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,44 +1,44 @@
<?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-2010
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//process this only one time
if ($domains_processed == 1) {
//set the sip_profiles directory for older installs
if (isset($_SESSION['switch']['gateways']['dir'])) {
$orm = new orm;
$orm->name('default_settings');
$orm->uuid($_SESSION['switch']['gateways']['uuid']);
$array['default_setting_category'] = 'switch';
$array['default_setting_subcategory'] = 'sip_profiles';
$array['default_setting_name'] = 'dir';
//$array['default_setting_value'] = '';
//$array['default_setting_enabled'] = 'true';
$orm->save($array);
unset($array);
}
}
<?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-2010
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//process this only one time
if ($domains_processed == 1) {
//set the sip_profiles directory for older installs
if (isset($_SESSION['switch']['gateways']['dir'])) {
$orm = new orm;
$orm->name('default_settings');
$orm->uuid($_SESSION['switch']['gateways']['uuid']);
$array['default_setting_category'] = 'switch';
$array['default_setting_subcategory'] = 'sip_profiles';
$array['default_setting_name'] = 'dir';
//$array['default_setting_value'] = '';
//$array['default_setting_enabled'] = 'true';
$orm->save($array);
unset($array);
}
}
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,12 +1,12 @@
<?php
//$apps[$x]['menu'][0]['title']['en-us'] = "Users";
//$apps[$x]['menu'][0]['uuid'] = "8d4920dc-7077-47ab-86c7-cc377ba2a5f5";
//$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
//$apps[$x]['menu'][0]['category'] = "internal";
//$apps[$x]['menu'][0]['path'] = "/app/meeting_users/meeting_users.php";
//$apps[$x]['menu'][0]['groups'][] = "user";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
<?php
//$apps[$x]['menu'][0]['title']['en-us'] = "Users";
//$apps[$x]['menu'][0]['uuid'] = "8d4920dc-7077-47ab-86c7-cc377ba2a5f5";
//$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
//$apps[$x]['menu'][0]['category'] = "internal";
//$apps[$x]['menu'][0]['path'] = "/app/meeting_users/meeting_users.php";
//$apps[$x]['menu'][0]['groups'][] = "user";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,443 +1,443 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('operator_panel_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set user status
if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
$user_status = check_str($_REQUEST['status']);
//sql update
$sql = "update v_users set ";
$sql .= "user_status = '".$user_status."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
if (permission_exists("user_account_setting_edit")) {
$count = $db->exec(check_sql($sql));
}
//if call center app is installed then update the user_status
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/call_center')) {
//update the user_status
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." '".$user_status."'";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//update the user state
$cmd = "api callcenter_config agent set state ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
exit;
}
$document['title'] = $text['title-operator_panel'];
require_once "resources/header.php";
?>
<!-- virtual_drag function holding elements -->
<input type='hidden' class='formfld' id='vd_call_id' value=''>
<input type='hidden' class='formfld' id='vd_ext_from' value=''>
<input type='hidden' class='formfld' id='vd_ext_to' value=''>
<!-- autocomplete for contact lookup -->
<link rel="stylesheet" type="text/css" href="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui.css">
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript">
//ajax refresh
var refresh = 1500;
var source_url = 'index_inc.php?' <?php if (isset($_GET['debug'])) { echo " + '&debug'"; } ?>;
var interval_timer_id;
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = source_url;
url += '&vd_ext_from=' + document.getElementById('vd_ext_from').value;
url += '&vd_ext_to=' + document.getElementById('vd_ext_to').value;
url += '&group=' + ((document.getElementById('group')) ? document.getElementById('group').value : '');
url += '&eavesdrop_dest=' + ((document.getElementById('eavesdrop_dest')) ? document.getElementById('eavesdrop_dest').value : '');
<?php
if (isset($_GET['debug'])) {
echo "url += '&debug';";
}
?>
new loadXmlHttp(url, 'ajax_reponse');
refresh_start();
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
//drag/drop functionality
var ie_workaround = false;
function drag(ev, from_ext) {
refresh_stop();
try {
ev.dataTransfer.setData("Call", ev.target.id);
ev.dataTransfer.setData("From", from_ext);
virtual_drag_reset();
}
catch (err) {
// likely internet explorer being used, do workaround
virtual_drag(ev.target.id, from_ext);
ie_workaround = true;
}
}
function allowDrop(ev, target_id) {
ev.preventDefault();
}
function discardDrop(ev, target_id) {
ev.preventDefault();
}
function drop(ev, to_ext) {
ev.preventDefault();
if (ie_workaround) { // potentially set on drag() function above
var call_id = document.getElementById('vd_call_id').value;
var from_ext = document.getElementById('vd_ext_from').value;
virtual_drag_reset();
}
else {
var call_id = ev.dataTransfer.getData("Call");
var from_ext = ev.dataTransfer.getData("From");
}
var to_ext = to_ext;
var cmd;
if (call_id != '') {
cmd = get_transfer_cmd(call_id, to_ext); //transfer a call
}
else {
if (from_ext != to_ext) { // prevent user from dragging extention onto self
cmd = get_originate_cmd(from_ext+'@<?php echo $_SESSION["domain_name"]?>', to_ext); //make a call
}
}
if (cmd != '') { send_cmd('exec.php?cmd='+escape(cmd)); }
refresh_start();
}
//refresh controls
function refresh_stop() {
clearInterval(interval_timer_id);
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">"; }
}
function refresh_start() {
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' alt=\"<?php echo $text['label-refresh_pause']?>\" title=\"<?php echo $text['label-refresh_pause']?>\">"; }
refresh_stop();
interval_timer_id = setInterval( function() {
url = source_url;
url += '&vd_ext_from=' + document.getElementById('vd_ext_from').value;
url += '&vd_ext_to=' + document.getElementById('vd_ext_to').value;
url += '&group=' + ((document.getElementById('group')) ? document.getElementById('group').value : '');
url += '&eavesdrop_dest=' + ((document.getElementById('eavesdrop_dest')) ? document.getElementById('eavesdrop_dest').value : '');
<?php
if (isset($_GET['debug'])) {
echo "url += '&debug';";
}
?>
new loadXmlHttp(url, 'ajax_reponse');
}, refresh);
}
//call or transfer to destination
function go_destination(from_ext, destination, which, call_id) {
call_id = typeof call_id !== 'undefined' ? call_id : '';
if (destination != '') {
if (!isNaN(parseFloat(destination)) && isFinite(destination)) {
if (call_id == '') {
cmd = get_originate_cmd(from_ext+'@<?php echo $_SESSION["domain_name"]?>', destination); //make a call
}
else {
cmd = get_transfer_cmd(call_id, destination);
}
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
$('#destination_'+from_ext+'_'+which).removeAttr('onblur');
toggle_destination(from_ext, which);
}
}
}
}
//kill call
function kill_call(call_id) {
if (call_id != '') {
cmd = 'uuid_kill ' + call_id;
send_cmd('exec.php?cmd='+escape(cmd));
}
}
//eavesdrop call
function eavesdrop_call(ext, chan_uuid) {
if (ext != '' && chan_uuid != '') {
cmd = get_eavesdrop_cmd(ext, chan_uuid);
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
}
}
}
//record call
function record_call(chan_uuid) {
if (chan_uuid != '') {
cmd = get_record_cmd(chan_uuid);
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
}
}
}
//used by call control and ajax refresh functions
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
}
//hide/show destination input field
function toggle_destination(ext, which) {
refresh_stop();
if (which == 'call') {
if ($('#destination_'+ext+'_call').is(':visible')) {
$('#destination_'+ext+'_call').val('');
$('#destination_'+ext+'_call').autocomplete('destroy');
$('#destination_'+ext+'_call').hide(0, function() {
$('.call_control').children().attr('onmouseout', "refresh_start();");
$('.destination_control').attr('onmouseout', "refresh_start();");
refresh_start();
});
}
else {
$('#destination_'+ext+'_call').show(0, function() {
$('#destination_'+ext+'_call').focus();
$('#destination_'+ext+'_call').autocomplete({
source: "autocomplete.php",
minLength: 3,
select: function(event, ui) {
$('#destination_'+ext+'_call').val(ui.item.value);
$('#frm_destination_'+ext+'_call').submit();
}
});
$('.call_control').children().removeAttr('onmouseout');
$('.destination_control').removeAttr('onmouseout');
});
}
}
else if (which == 'transfer') {
if ($('#destination_'+ext+'_transfer').is(':visible')) {
$('#destination_'+ext+'_transfer').val('');
$('#destination_'+ext+'_transfer').autocomplete('destroy');
$('#destination_'+ext+'_transfer').hide(0, function() {
$('#op_caller_details_'+ext).show();
$('.call_control').children().attr('onmouseout', "refresh_start();");
$('.destination_control').attr('onmouseout', "refresh_start();");
refresh_start();
});
}
else {
$('#op_caller_details_'+ext).hide(0, function() {
$('#destination_'+ext+'_transfer').show(0, function() {
$('#destination_'+ext+'_transfer').focus();
$('#destination_'+ext+'_transfer').autocomplete({
source: "autocomplete.php",
minLength: 3,
select: function(event, ui) {
$('#destination_'+ext+'_transfer').val(ui.item.value);
$('#frm_destination_'+ext+'_transfer').submit();
}
});
$('.call_control').children().removeAttr('onmouseout');
$('.destination_control').removeAttr('onmouseout');
});
});
}
}
}
function get_transfer_cmd(uuid, destination) {
cmd = "uuid_transfer " + uuid + " " + destination + " XML <?php echo trim($_SESSION['user_context'])?>";
return cmd;
}
function get_originate_cmd(source, destination) {
cmd = "bgapi originate {sip_auto_answer=true,origination_caller_id_number=" + destination + ",sip_h_Call-Info=_undef_}user/" + source + " " + destination + " XML <?php echo trim($_SESSION['user_context'])?>";
return cmd;
}
function get_eavesdrop_cmd(ext, chan_uuid) {
cmd = "bgapi originate {origination_caller_id_name=<?php echo $text['label-eavesdrop']?>,origination_caller_id_number=" + ext + "}user/"+(document.getElementById('eavesdrop_dest').value)+"@<?php echo $_SESSION['domain_name']?> &eavesdrop(" + chan_uuid + ")";
return cmd;
}
function get_record_cmd(uuid) {
cmd = "uuid_record " + uuid + " start <?php echo $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; ?>/archive/<?php echo date('Y')?>/<?php echo date('M')?>/<?php echo date('d')?>/" + uuid + ".wav";
return cmd;
}
//virtual functions
function virtual_drag(call_id, ext) {
if (document.getElementById('vd_ext_from').value != '' && document.getElementById('vd_ext_to').value != '') {
virtual_drag_reset();
}
if (call_id != '') {
document.getElementById('vd_call_id').value = call_id;
}
if (ext != '') {
if (document.getElementById('vd_ext_from').value == '') {
document.getElementById('vd_ext_from').value = ext;
document.getElementById(ext).style.borderStyle = 'dotted';
if (document.getElementById('vd_ext_to').value != '') {
document.getElementById(document.getElementById('vd_ext_to').value).style.borderStyle = '';
document.getElementById('vd_ext_to').value = '';
}
}
else {
document.getElementById('vd_ext_to').value = ext;
if (document.getElementById('vd_ext_from').value != document.getElementById('vd_ext_to').value) {
if (document.getElementById('vd_call_id').value != '') {
cmd = get_transfer_cmd(document.getElementById('vd_call_id').value, document.getElementById('vd_ext_to').value); //transfer a call
}
else {
cmd = get_originate_cmd(document.getElementById('vd_ext_from').value + '@<?php echo $_SESSION["domain_name"]?>', document.getElementById('vd_ext_to').value); //originate a call
}
if (cmd != '') {
//alert(cmd);
send_cmd('exec.php?cmd='+escape(cmd));
}
}
virtual_drag_reset();
}
}
}
function virtual_drag_reset(vd_var) {
if (!(vd_var === undefined)) {
document.getElementById(vd_var).value = '';
}
else {
document.getElementById('vd_call_id').value = '';
if (document.getElementById('vd_ext_from').value != '') {
document.getElementById(document.getElementById('vd_ext_from').value).style.borderStyle = '';
document.getElementById('vd_ext_from').value = '';
}
if (document.getElementById('vd_ext_to').value != '') {
document.getElementById(document.getElementById('vd_ext_to').value).style.borderStyle = '';
document.getElementById('vd_ext_to').value = '';
}
}
}
</script>
<style type="text/css">
TABLE {
border-spacing: 0px;
border-collapse: collapse;
border: none;
}
</style>
<?php
//create simple array of users own extensions
unset($_SESSION['user']['extensions']);
foreach ($_SESSION['user']['extension'] as $assigned_extensions) {
$_SESSION['user']['extensions'][] = $assigned_extensions['user'];
}
?>
<div id='ajax_reponse'></div>
<div id='cmd_reponse' style='display: none;'></div>
<br><br>
<?php
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) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('operator_panel_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set user status
if (isset($_REQUEST['status']) && $_REQUEST['status'] != '') {
$user_status = check_str($_REQUEST['status']);
//sql update
$sql = "update v_users set ";
$sql .= "user_status = '".$user_status."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_uuid = '".$_SESSION['user']['user_uuid']."' ";
if (permission_exists("user_account_setting_edit")) {
$count = $db->exec(check_sql($sql));
}
//if call center app is installed then update the user_status
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/call_center')) {
//update the user_status
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." '".$user_status."'";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//update the user state
$cmd = "api callcenter_config agent set state ".$_SESSION['user']['username']."@".$_SESSION['domain_name']." Waiting";
$response = event_socket_request($fp, $cmd);
}
exit;
}
$document['title'] = $text['title-operator_panel'];
require_once "resources/header.php";
?>
<!-- virtual_drag function holding elements -->
<input type='hidden' class='formfld' id='vd_call_id' value=''>
<input type='hidden' class='formfld' id='vd_ext_from' value=''>
<input type='hidden' class='formfld' id='vd_ext_to' value=''>
<!-- autocomplete for contact lookup -->
<link rel="stylesheet" type="text/css" href="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui.css">
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript">
//ajax refresh
var refresh = 1500;
var source_url = 'index_inc.php?' <?php if (isset($_GET['debug'])) { echo " + '&debug'"; } ?>;
var interval_timer_id;
function loadXmlHttp(url, id) {
var f = this;
f.xmlHttp = null;
/*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
/*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
@end @*/
if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
else if (/(object)|(function)/.test(typeof createRequest))
f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
else {
f.xmlHttp = null;
// Internet Explorer 5 to 6, includes IE 7+ when local //
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
@end @*/
}
if(f.xmlHttp != null){
f.el = document.getElementById(id);
f.xmlHttp.open("GET",url,true);
f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
f.xmlHttp.send(null);
}
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {
var url = source_url;
url += '&vd_ext_from=' + document.getElementById('vd_ext_from').value;
url += '&vd_ext_to=' + document.getElementById('vd_ext_to').value;
url += '&group=' + ((document.getElementById('group')) ? document.getElementById('group').value : '');
url += '&eavesdrop_dest=' + ((document.getElementById('eavesdrop_dest')) ? document.getElementById('eavesdrop_dest').value : '');
<?php
if (isset($_GET['debug'])) {
echo "url += '&debug';";
}
?>
new loadXmlHttp(url, 'ajax_reponse');
refresh_start();
}
if (window.addEventListener) {
window.addEventListener('load', requestTime, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', requestTime);
}
//drag/drop functionality
var ie_workaround = false;
function drag(ev, from_ext) {
refresh_stop();
try {
ev.dataTransfer.setData("Call", ev.target.id);
ev.dataTransfer.setData("From", from_ext);
virtual_drag_reset();
}
catch (err) {
// likely internet explorer being used, do workaround
virtual_drag(ev.target.id, from_ext);
ie_workaround = true;
}
}
function allowDrop(ev, target_id) {
ev.preventDefault();
}
function discardDrop(ev, target_id) {
ev.preventDefault();
}
function drop(ev, to_ext) {
ev.preventDefault();
if (ie_workaround) { // potentially set on drag() function above
var call_id = document.getElementById('vd_call_id').value;
var from_ext = document.getElementById('vd_ext_from').value;
virtual_drag_reset();
}
else {
var call_id = ev.dataTransfer.getData("Call");
var from_ext = ev.dataTransfer.getData("From");
}
var to_ext = to_ext;
var cmd;
if (call_id != '') {
cmd = get_transfer_cmd(call_id, to_ext); //transfer a call
}
else {
if (from_ext != to_ext) { // prevent user from dragging extention onto self
cmd = get_originate_cmd(from_ext+'@<?php echo $_SESSION["domain_name"]?>', to_ext); //make a call
}
}
if (cmd != '') { send_cmd('exec.php?cmd='+escape(cmd)); }
refresh_start();
}
//refresh controls
function refresh_stop() {
clearInterval(interval_timer_id);
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">"; }
}
function refresh_start() {
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' alt=\"<?php echo $text['label-refresh_pause']?>\" title=\"<?php echo $text['label-refresh_pause']?>\">"; }
refresh_stop();
interval_timer_id = setInterval( function() {
url = source_url;
url += '&vd_ext_from=' + document.getElementById('vd_ext_from').value;
url += '&vd_ext_to=' + document.getElementById('vd_ext_to').value;
url += '&group=' + ((document.getElementById('group')) ? document.getElementById('group').value : '');
url += '&eavesdrop_dest=' + ((document.getElementById('eavesdrop_dest')) ? document.getElementById('eavesdrop_dest').value : '');
<?php
if (isset($_GET['debug'])) {
echo "url += '&debug';";
}
?>
new loadXmlHttp(url, 'ajax_reponse');
}, refresh);
}
//call or transfer to destination
function go_destination(from_ext, destination, which, call_id) {
call_id = typeof call_id !== 'undefined' ? call_id : '';
if (destination != '') {
if (!isNaN(parseFloat(destination)) && isFinite(destination)) {
if (call_id == '') {
cmd = get_originate_cmd(from_ext+'@<?php echo $_SESSION["domain_name"]?>', destination); //make a call
}
else {
cmd = get_transfer_cmd(call_id, destination);
}
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
$('#destination_'+from_ext+'_'+which).removeAttr('onblur');
toggle_destination(from_ext, which);
}
}
}
}
//kill call
function kill_call(call_id) {
if (call_id != '') {
cmd = 'uuid_kill ' + call_id;
send_cmd('exec.php?cmd='+escape(cmd));
}
}
//eavesdrop call
function eavesdrop_call(ext, chan_uuid) {
if (ext != '' && chan_uuid != '') {
cmd = get_eavesdrop_cmd(ext, chan_uuid);
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
}
}
}
//record call
function record_call(chan_uuid) {
if (chan_uuid != '') {
cmd = get_record_cmd(chan_uuid);
if (cmd != '') {
send_cmd('exec.php?cmd='+escape(cmd));
}
}
}
//used by call control and ajax refresh functions
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
}
//hide/show destination input field
function toggle_destination(ext, which) {
refresh_stop();
if (which == 'call') {
if ($('#destination_'+ext+'_call').is(':visible')) {
$('#destination_'+ext+'_call').val('');
$('#destination_'+ext+'_call').autocomplete('destroy');
$('#destination_'+ext+'_call').hide(0, function() {
$('.call_control').children().attr('onmouseout', "refresh_start();");
$('.destination_control').attr('onmouseout', "refresh_start();");
refresh_start();
});
}
else {
$('#destination_'+ext+'_call').show(0, function() {
$('#destination_'+ext+'_call').focus();
$('#destination_'+ext+'_call').autocomplete({
source: "autocomplete.php",
minLength: 3,
select: function(event, ui) {
$('#destination_'+ext+'_call').val(ui.item.value);
$('#frm_destination_'+ext+'_call').submit();
}
});
$('.call_control').children().removeAttr('onmouseout');
$('.destination_control').removeAttr('onmouseout');
});
}
}
else if (which == 'transfer') {
if ($('#destination_'+ext+'_transfer').is(':visible')) {
$('#destination_'+ext+'_transfer').val('');
$('#destination_'+ext+'_transfer').autocomplete('destroy');
$('#destination_'+ext+'_transfer').hide(0, function() {
$('#op_caller_details_'+ext).show();
$('.call_control').children().attr('onmouseout', "refresh_start();");
$('.destination_control').attr('onmouseout', "refresh_start();");
refresh_start();
});
}
else {
$('#op_caller_details_'+ext).hide(0, function() {
$('#destination_'+ext+'_transfer').show(0, function() {
$('#destination_'+ext+'_transfer').focus();
$('#destination_'+ext+'_transfer').autocomplete({
source: "autocomplete.php",
minLength: 3,
select: function(event, ui) {
$('#destination_'+ext+'_transfer').val(ui.item.value);
$('#frm_destination_'+ext+'_transfer').submit();
}
});
$('.call_control').children().removeAttr('onmouseout');
$('.destination_control').removeAttr('onmouseout');
});
});
}
}
}
function get_transfer_cmd(uuid, destination) {
cmd = "uuid_transfer " + uuid + " " + destination + " XML <?php echo trim($_SESSION['user_context'])?>";
return cmd;
}
function get_originate_cmd(source, destination) {
cmd = "bgapi originate {sip_auto_answer=true,origination_caller_id_number=" + destination + ",sip_h_Call-Info=_undef_}user/" + source + " " + destination + " XML <?php echo trim($_SESSION['user_context'])?>";
return cmd;
}
function get_eavesdrop_cmd(ext, chan_uuid) {
cmd = "bgapi originate {origination_caller_id_name=<?php echo $text['label-eavesdrop']?>,origination_caller_id_number=" + ext + "}user/"+(document.getElementById('eavesdrop_dest').value)+"@<?php echo $_SESSION['domain_name']?> &eavesdrop(" + chan_uuid + ")";
return cmd;
}
function get_record_cmd(uuid) {
cmd = "uuid_record " + uuid + " start <?php echo $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']; ?>/archive/<?php echo date('Y')?>/<?php echo date('M')?>/<?php echo date('d')?>/" + uuid + ".wav";
return cmd;
}
//virtual functions
function virtual_drag(call_id, ext) {
if (document.getElementById('vd_ext_from').value != '' && document.getElementById('vd_ext_to').value != '') {
virtual_drag_reset();
}
if (call_id != '') {
document.getElementById('vd_call_id').value = call_id;
}
if (ext != '') {
if (document.getElementById('vd_ext_from').value == '') {
document.getElementById('vd_ext_from').value = ext;
document.getElementById(ext).style.borderStyle = 'dotted';
if (document.getElementById('vd_ext_to').value != '') {
document.getElementById(document.getElementById('vd_ext_to').value).style.borderStyle = '';
document.getElementById('vd_ext_to').value = '';
}
}
else {
document.getElementById('vd_ext_to').value = ext;
if (document.getElementById('vd_ext_from').value != document.getElementById('vd_ext_to').value) {
if (document.getElementById('vd_call_id').value != '') {
cmd = get_transfer_cmd(document.getElementById('vd_call_id').value, document.getElementById('vd_ext_to').value); //transfer a call
}
else {
cmd = get_originate_cmd(document.getElementById('vd_ext_from').value + '@<?php echo $_SESSION["domain_name"]?>', document.getElementById('vd_ext_to').value); //originate a call
}
if (cmd != '') {
//alert(cmd);
send_cmd('exec.php?cmd='+escape(cmd));
}
}
virtual_drag_reset();
}
}
}
function virtual_drag_reset(vd_var) {
if (!(vd_var === undefined)) {
document.getElementById(vd_var).value = '';
}
else {
document.getElementById('vd_call_id').value = '';
if (document.getElementById('vd_ext_from').value != '') {
document.getElementById(document.getElementById('vd_ext_from').value).style.borderStyle = '';
document.getElementById('vd_ext_from').value = '';
}
if (document.getElementById('vd_ext_to').value != '') {
document.getElementById(document.getElementById('vd_ext_to').value).style.borderStyle = '';
document.getElementById('vd_ext_to').value = '';
}
}
}
</script>
<style type="text/css">
TABLE {
border-spacing: 0px;
border-collapse: collapse;
border: none;
}
</style>
<?php
//create simple array of users own extensions
unset($_SESSION['user']['extensions']);
foreach ($_SESSION['user']['extension'] as $assigned_extensions) {
$_SESSION['user']['extensions'][] = $assigned_extensions['user'];
}
?>
<div id='ajax_reponse'></div>
<div id='cmd_reponse' style='display: none;'></div>
<br><br>
<?php
require_once "resources/footer.php";
?>

View File

@@ -1,450 +1,450 @@
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "./resources/functions/get_call_activity.php";
if (permission_exists('operator_panel_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
$activity = get_call_activity();
foreach ($activity as $extension => $fields) {
if (substr_count($fields['call_group'], ',')) {
$tmp = explode(',', $fields['call_group']);
foreach ($tmp as $tmp_index => $tmp_value) {
if (trim($tmp_value) == '') { unset($tmp[$tmp_index]); }
else { $groups[] = $tmp_value; }
}
}
else if ($fields['call_group'] != '') {
$groups[] = $fields['call_group'];
}
}
$groups = array_unique($groups);
sort($groups);
$onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'";
echo "<table width='100%'>";
echo " <tr>";
echo " <td valign='top' align='left' width='50%' nowrap>";
echo " <b>".$text['title-operator_panel']."</b>";
echo " </td>";
echo " <td valign='top' align='center' nowrap>";
if (sizeof($_SESSION['user']['extensions']) > 0) {
$status_options[1]['status'] = "Available";
$status_options[1]['label'] = $text['label-status_available'];
$status_options[1]['style'] = "op_btn_status_available";
if (permission_exists('operator_panel_on_demand')) {
$status_options[2]['status'] = "Available (On Demand)";
$status_options[2]['label'] = $text['label-status_on_demand'];
$status_options[2]['style'] = "op_btn_status_available_on_demand";
}
$status_options[3]['status'] = "On Break";
$status_options[3]['label'] = $text['label-status_on_break'];
$status_options[3]['style'] = "op_btn_status_on_break";
$status_options[4]['status'] = "Do Not Disturb";
$status_options[4]['label'] = $text['label-status_do_not_disturb'];
$status_options[4]['style'] = "op_btn_status_do_not_disturb";
$status_options[5]['status'] = "Logged Out";
$status_options[5]['label'] = $text['label-status_logged_out'];
$status_options[5]['style'] = "op_btn_status_logged_out";
foreach ($status_options as $status_option) {
echo " <input type='button' id='".$status_option['style']."' class='btn' value=\"".$status_option['label']."\" onclick=\"send_cmd('index.php?status='+escape('".$status_option['status']."')); this.disabled='disabled'; refresh_start();\" ".$onhover_pause_refresh.">\n";
}
}
echo " </td>";
echo " <td valign='top' align='right' width='50%' nowrap>";
echo " <table cellpadding='0' cellspacing='0' border='0'>";
echo " <tr>";
echo " <td valign='middle' nowrap='nowrap' style='padding-right: 15px' id='refresh_state'>";
echo " <img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\">";
echo " </td>";
if (permission_exists('operator_panel_eavesdrop')) {
echo " <td valign='top' nowrap='nowrap'>";
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : $_REQUEST['eavesdrop_dest'])."\">";
echo " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 0px 5px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'>";
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";
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".$user_extension."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".$user_extension."</option>\n";
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".$_SESSION['user']['extension'][0]['destination']."\">";
}
echo " </td>";
}
if (sizeof($groups) > 0) {
echo " <td valign='top' nowrap='nowrap'>";
echo " <input type='hidden' id='group' value=\"".$_REQUEST['group']."\">";
if (sizeof($groups) > 5) {
//show select box
echo " <select class='formfld' onchange=\"document.getElementById('group').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
echo " <option value='' ".(($_REQUEST['group'] == '') ? "selected" : null).">".$text['label-call_group']."</option>";
echo " <option value=''>".$text['button-all']."</option>";
foreach ($groups as $group) {
echo " <option value='".$group."' ".(($_REQUEST['group'] == $group) ? "selected" : null).">".$group."</option>\n";
}
echo " </select>\n";
}
else {
//show buttons
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$text['button-all']."\" onclick=\"document.getElementById('group').value = '';\" ".$onhover_pause_refresh.">";
foreach ($groups as $group) {
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\" ".$onhover_pause_refresh.">";
}
}
echo " </td>";
}
echo " </tr>";
echo " </table>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>";
foreach ($activity as $extension => $ext) {
unset($block);
//filter by group, if defined
if ($_REQUEST['group'] != '' && substr_count($ext['call_group'], $_REQUEST['group']) == 0 && !in_array($extension, $_SESSION['user']['extensions'])) { continue; }
//check if feature code being called
$format_number = (substr($ext['dest'], 0, 1) == '*') ? false : true;
//determine extension state, direction icon, and displayed name/number for caller/callee
if ($ext['state'] == 'CS_EXECUTE') {
if (($ext['callstate'] == 'RINGING' || $ext['callstate'] == 'EARLY' || $ext['callstate'] == 'RING_WAIT') && $ext['direction'] == 'inbound') {
$ext_state = 'ringing';
}
else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') {
$ext_state = 'active';
}
else if ($ext['callstate'] == 'RING_WAIT' && $ext['direction'] == 'outbound') {
$ext_state = 'ringing';
}
else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'inbound') {
$ext_state = 'active';
}
if (!$format_number) {
$call_name = 'System';
$call_number = $ext['dest'];
}
else {
$call_name = $activity[$ext['dest']]['effective_caller_id_name'];
$call_number = format_phone($ext['dest']);
}
$dir_icon = 'outbound';
}
else if ($ext['state'] == 'CS_HIBERNATE') {
if ($ext['callstate'] == 'ACTIVE') {
$ext_state = 'active';
if ($ext['direction'] == 'inbound') {
$call_name = $activity[$ext['dest']]['effective_caller_id_name'];
$call_number = format_phone($ext['dest']);
$dir_icon = 'outbound';
}
else if ($ext['direction'] == 'outbound') {
$call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
$call_number = format_phone($ext['cid_num']);
$dir_icon = 'inbound';
}
}
}
else if ($ext['state'] == 'CS_CONSUME_MEDIA' || $ext['state'] == 'CS_EXCHANGE_MEDIA') {
if ($ext['state'] == 'CS_CONSUME_MEDIA' && $ext['callstate'] == 'RINGING' && $ext['direction'] == 'outbound') {
$ext_state = 'ringing';
}
else if ($ext['state'] == 'CS_EXCHANGE_MEDIA' && $ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') {
$ext_state = 'active';
}
$dir_icon = 'inbound';
$call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
$call_number = format_phone($ext['cid_num']);
}
else {
unset($ext_state, $dir_icon, $call_name, $call_number);
}
//determine block style by state (if any)
$style = ($ext_state != '') ? "op_state_".$ext_state : null;
//determine the call identifier passed on drop
if ($ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') { // transfer an outbound internal call
$call_identifier = $activity[$call_number]['uuid'];
}
else if (($ext['variable_call_direction'] == 'outbound' || $ext['variable_call_direction'] == 'local') && $ext['variable_bridge_uuid'] != '') { // transfer an outbound external call
$call_identifier = $ext['variable_bridge_uuid'];
}
else {
if( $ext['call_uuid'] ) {
$call_identifier = $ext['call_uuid']; // transfer all other call types
}
else {
$call_identifier = $ext['uuid']; // e.g. voice menus
}
}
//determine extension draggable state
if (permission_exists('operator_panel_manage')) {
if (!in_array($extension, $_SESSION['user']['extensions'])) {
//other extension
if ($ext_state == "ringing") {
if ($_GET['vd_ext_from'] == '' && $dir_icon == 'inbound') {
$draggable = true; // selectable - is ringing and not outbound so can transfer away the call (can set as vd_ext_from)
}
else {
$draggable = false; // unselectable - is ringing so can't send a call to the ext (can't set as vd_ext_to)
}
}
else if ($ext_state == 'active') {
$draggable = false; // unselectable - on a call already so can't transfer or send a call to the ext (can't set as vd_ext_from or vd_ext_to)
}
else { // idle
if ($_GET['vd_ext_from'] == '') {
$draggable = false; // unselectable - is idle, but can't initiate a call from the ext as is not assigned to user (can't set as vd_ext_from)
}
else {
$draggable = true; // selectable - is idle, so can transfer a call in to ext (can set as vd_ext_to).
}
}
}
else {
//user extension
if ($ext['uuid'] != '' && $ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') {
$draggable = false;
}
else if ($ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') {
$draggable = false;
}
else if ($ext_state != '' && !$format_number) {
$draggable = false;
}
else {
$draggable = true;
}
}
}
else {
$draggable = false;
}
//determine extension (user) status
$ext_status = (in_array($extension, $_SESSION['user']['extensions'])) ? $ext_user_status[$_SESSION['user_uuid']] : $ext_user_status[$ext['user_uuid']];
switch ($ext_status) {
case "Available" :
$status_icon = "available";
$status_hover = $text['label-status_available'];
break;
case "Available (On Demand)" :
$status_icon = "available_on_demand";
$status_hover = $text['label-status_available_on_demand'];
break;
case "On Break" :
$status_icon = "on_break";
$status_hover = $text['label-status_on_break'];
break;
case "Do Not Disturb" :
$status_icon = "do_not_disturb";
$status_hover = $text['label-status_do_not_disturb'];
break;
default :
$status_icon = "logged_out";
$status_hover = $text['label-status_logged_out_or_unknown'];
}
$block .= "<div id='".$extension."' class='op_ext ".$style."' ".(($_GET['vd_ext_from'] == $extension || $_GET['vd_ext_to'] == $extension) ? "style='border-style: dotted;'" : null)." ".(($ext_state != 'active' && $ext_state != 'ringing') ? "ondrop='drop(event, this.id);' ondragover='allowDrop(event, this.id);' ondragleave='discardDrop(event, this.id);'" : null).">"; // DRAG TO
$block .= "<table class='op_ext ".$style."'>";
$block .= " <tr>";
$block .= " <td class='op_ext_icon'>";
$block .= " <span name='".$extension."'>"; // DRAG FROM
$block .= "<img id='".$call_identifier."' class='op_ext_icon' src='resources/images/status_".$status_icon.".png' title='".$status_hover."' ".(($draggable) ? "draggable='true' ondragstart=\"drag(event, this.parentNode.getAttribute('name'));\" onclick=\"virtual_drag('".$call_identifier."', '".$extension."');\"" : "onfocus='this.blur();' draggable='false' style='cursor: not-allowed;'").">";
$block .= "</span>";
$block .= " </td>";
$block .= " <td class='op_ext_info ".$style."'>";
if ($dir_icon != '') {
$block .= " <img src='resources/images/".$dir_icon.".png' align='right' style='margin-top: 3px; margin-right: 1px; width: 12px; height: 12px; cursor: help;' draggable='false' alt=\"".$text['label-call_direction']."\" title=\"".$text['label-call_direction']."\">";
}
$block .= " <span class='op_user_info'>";
if ($ext['effective_caller_id_name'] != '' && $ext['effective_caller_id_name'] != $extension) {
$block .= " <strong class='strong'>".$ext['effective_caller_id_name']."</strong> (".$extension.")";
}
else {
$block .= " <strong class='strong'>".$extension."</strong>";
}
$block .= " </span><br>";
if ($ext_state != '') {
$block .= " <span class='op_caller_info'>";
$block .= " <table align='right'><tr><td style='text-align: right;'>";
$block .= " <span class='op_call_info'>".$ext['call_length']."</span><br>";
$block .= " <span class='call_control'>";
//record
if (permission_exists('operator_panel_record') && $ext_state == 'active') {
$call_identifier_record = $ext['call_uuid'];
$rec_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$call_identifier_record.".wav";
if (file_exists($rec_file)) {
$block .= "<img src='resources/images/recording.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: help;' title=\"".$text['label-recording']."\" ".$onhover_pause_refresh.">";
}
else {
$block .= "<img src='resources/images/record.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title=\"".$text['label-record']."\" onclick=\"record_call('".$call_identifier_record."');\" ".$onhover_pause_refresh.">";
}
}
//eavesdrop
if (permission_exists('operator_panel_eavesdrop') && $ext_state == 'active' && sizeof($_SESSION['user']['extensions']) > 0 && !in_array($extension, $_SESSION['user']['extensions'])) {
$block .= "<img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-eavesdrop']."' onclick=\"eavesdrop_call('".$ext['destination']."','".$call_identifier."');\" ".$onhover_pause_refresh.">";
}
//kill
if (permission_exists('operator_panel_kill') || in_array($extension, $_SESSION['user']['extensions'])) {
if ($ext['variable_bridge_uuid'] == '' && $ext_state == 'ringing') {
$call_identifier_kill = $ext['uuid'];
}
else if ($dir_icon == 'outbound') {
$call_identifier_kill = $ext['uuid'];
}
else {
$call_identifier_kill = $call_identifier;
}
$block .= "<img src='resources/images/kill.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-kill']."' onclick=\"kill_call('".$call_identifier_kill."');\" ".$onhover_pause_refresh.">";
}
$block .= "</span>";
//transfer
if (in_array($extension, $_SESSION['user']['extensions']) && $ext_state == 'active') {
$block .= "<img id='destination_control_".$extension."_transfer' class='destination_control' src='resources/images/keypad_transfer.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' onclick=\"toggle_destination('".$extension."', 'transfer');\" ".$onhover_pause_refresh.">";
}
$block .= " </td></tr></table>";
$block .= " <span id='op_caller_details_".$extension."'><strong>".$call_name."</strong><br>".$call_number."</span>";
$block .= " </span>";
//transfer
if (in_array($extension, $_SESSION['user']['extensions']) && $ext_state == 'active') {
$call_identifier_transfer = $ext['variable_bridge_uuid'];
$block .= " <form id='frm_destination_".$extension."_transfer' onsubmit=\"go_destination('".$extension."', document.getElementById('destination_".$extension."_transfer').value, 'transfer', '".$call_identifier_transfer."'); return false;\">";
$block .= " <input type='text' class='formfld' id='destination_".$extension."_transfer' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 3px; text-align: center; display: none;' onblur=\"toggle_destination('".$extension."', 'transfer');\">";
$block .= " </form>\n";
}
}
else {
//call
if (in_array($extension, $_SESSION['user']['extensions'])) {
$block .= " <img id='destination_control_".$extension."_call' class='destination_control' src='resources/images/keypad_call.png' style='width: 12px; height: 12px; border: none; margin-top: 26px; margin-right: 1px; cursor: pointer;' align='right' onclick=\"toggle_destination('".$extension."', 'call');\" ".$onhover_pause_refresh.">";
$block .= " <form id='frm_destination_".$extension."_call' onsubmit=\"go_destination('".$extension."', document.getElementById('destination_".$extension."_call').value, 'call'); return false;\">";
$block .= " <input type='text' class='formfld' id='destination_".$extension."_call' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 10px; text-align: center; display: none;' onblur=\"toggle_destination('".$extension."', 'call');\">";
$block .= " </form>\n";
}
}
$block .= " </td>";
$block .= " </tr>";
$block .= "</table>";
if (if_group("superadmin") && isset($_GET['debug'])) {
$block .= "<span style='font-size: 10px;'>";
$block .= "From ID<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: maroon'>".$extension."</strong><br>";
$block .= "uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['uuid'] ? 'blue' : 'black').";'>".$ext['uuid']."</strong><br>";
$block .= "call_uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['call_uuid'] ? 'blue' : 'black').";'>".$ext['call_uuid']."</strong><br>";
$block .= "variable_bridge_uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['variable_bridge_uuid'] ? 'blue' : 'black').";'>".$ext['variable_bridge_uuid']."</strong><br>";
$block .= "direction<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['direction']."</strong><br>";
$block .= "variable_call_direction<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['variable_call_direction']."</strong><br>";
$block .= "state<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['state']."</strong><br>";
$block .= "cid_num<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['cid_num']."</strong><br>";
$block .= "dest<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['dest']."</strong><br>";
$block .= "context<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['context']."</strong><br>";
$block .= "presence_id<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['presence_id']."</strong><br>";
$block .= "callstate<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['callstate']."</strong><br>";
$block .= "</span>";
}
$block .= "</div>";
if (in_array($extension, $_SESSION['user']['extensions'])) {
$user_extensions[] = $block;
}
else {
$other_extensions[] = $block;
}
}
if (sizeof($user_extensions) > 0) {
echo "<table width='100%'><tr><td>";
foreach ($user_extensions as $ext_block) {
echo $ext_block;
}
echo "</td></tr></table>";
}
if ($_REQUEST['group'] != '') {
if (sizeof($user_extensions) > 0) { echo "<br>"; }
echo "<strong style='color: black;'>".ucwords($_REQUEST['group'])."</strong>";
echo "<br><br>";
}
else if (sizeof($user_extensions) > 0) {
echo "<br>";
echo "<strong style='color: black;'>".$text['label-other_extensions']."</strong>";
echo "<br><br>";
}
if (sizeof($other_extensions) > 0) {
echo "<table width='100%'><tr><td>";
foreach ($other_extensions as $ext_block) {
echo $ext_block;
}
echo "</td></tr></table>";
}
else {
echo $text['label-no_extensions_found'];
}
echo "<br><br>";
if (if_group("superadmin") && isset($_GET['debug'])) {
echo '$activity<br>';
echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
print_r($activity);
echo "</textarea>";
echo "<br><br>";
echo '$_SESSION<br>';
echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
print_r($_SESSION);
echo "</textarea>";
}
?>
<?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-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "./resources/functions/get_call_activity.php";
if (permission_exists('operator_panel_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
$activity = get_call_activity();
foreach ($activity as $extension => $fields) {
if (substr_count($fields['call_group'], ',')) {
$tmp = explode(',', $fields['call_group']);
foreach ($tmp as $tmp_index => $tmp_value) {
if (trim($tmp_value) == '') { unset($tmp[$tmp_index]); }
else { $groups[] = $tmp_value; }
}
}
else if ($fields['call_group'] != '') {
$groups[] = $fields['call_group'];
}
}
$groups = array_unique($groups);
sort($groups);
$onhover_pause_refresh = " onmouseover='refresh_stop();' onmouseout='refresh_start();'";
echo "<table width='100%'>";
echo " <tr>";
echo " <td valign='top' align='left' width='50%' nowrap>";
echo " <b>".$text['title-operator_panel']."</b>";
echo " </td>";
echo " <td valign='top' align='center' nowrap>";
if (sizeof($_SESSION['user']['extensions']) > 0) {
$status_options[1]['status'] = "Available";
$status_options[1]['label'] = $text['label-status_available'];
$status_options[1]['style'] = "op_btn_status_available";
if (permission_exists('operator_panel_on_demand')) {
$status_options[2]['status'] = "Available (On Demand)";
$status_options[2]['label'] = $text['label-status_on_demand'];
$status_options[2]['style'] = "op_btn_status_available_on_demand";
}
$status_options[3]['status'] = "On Break";
$status_options[3]['label'] = $text['label-status_on_break'];
$status_options[3]['style'] = "op_btn_status_on_break";
$status_options[4]['status'] = "Do Not Disturb";
$status_options[4]['label'] = $text['label-status_do_not_disturb'];
$status_options[4]['style'] = "op_btn_status_do_not_disturb";
$status_options[5]['status'] = "Logged Out";
$status_options[5]['label'] = $text['label-status_logged_out'];
$status_options[5]['style'] = "op_btn_status_logged_out";
foreach ($status_options as $status_option) {
echo " <input type='button' id='".$status_option['style']."' class='btn' value=\"".$status_option['label']."\" onclick=\"send_cmd('index.php?status='+escape('".$status_option['status']."')); this.disabled='disabled'; refresh_start();\" ".$onhover_pause_refresh.">\n";
}
}
echo " </td>";
echo " <td valign='top' align='right' width='50%' nowrap>";
echo " <table cellpadding='0' cellspacing='0' border='0'>";
echo " <tr>";
echo " <td valign='middle' nowrap='nowrap' style='padding-right: 15px' id='refresh_state'>";
echo " <img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\">";
echo " </td>";
if (permission_exists('operator_panel_eavesdrop')) {
echo " <td valign='top' nowrap='nowrap'>";
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : $_REQUEST['eavesdrop_dest'])."\">";
echo " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 0px 5px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'>";
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";
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".$user_extension."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".$user_extension."</option>\n";
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".$_SESSION['user']['extension'][0]['destination']."\">";
}
echo " </td>";
}
if (sizeof($groups) > 0) {
echo " <td valign='top' nowrap='nowrap'>";
echo " <input type='hidden' id='group' value=\"".$_REQUEST['group']."\">";
if (sizeof($groups) > 5) {
//show select box
echo " <select class='formfld' onchange=\"document.getElementById('group').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
echo " <option value='' ".(($_REQUEST['group'] == '') ? "selected" : null).">".$text['label-call_group']."</option>";
echo " <option value=''>".$text['button-all']."</option>";
foreach ($groups as $group) {
echo " <option value='".$group."' ".(($_REQUEST['group'] == $group) ? "selected" : null).">".$group."</option>\n";
}
echo " </select>\n";
}
else {
//show buttons
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$text['button-all']."\" onclick=\"document.getElementById('group').value = '';\" ".$onhover_pause_refresh.">";
foreach ($groups as $group) {
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\" ".$onhover_pause_refresh.">";
}
}
echo " </td>";
}
echo " </tr>";
echo " </table>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "<br>";
foreach ($activity as $extension => $ext) {
unset($block);
//filter by group, if defined
if ($_REQUEST['group'] != '' && substr_count($ext['call_group'], $_REQUEST['group']) == 0 && !in_array($extension, $_SESSION['user']['extensions'])) { continue; }
//check if feature code being called
$format_number = (substr($ext['dest'], 0, 1) == '*') ? false : true;
//determine extension state, direction icon, and displayed name/number for caller/callee
if ($ext['state'] == 'CS_EXECUTE') {
if (($ext['callstate'] == 'RINGING' || $ext['callstate'] == 'EARLY' || $ext['callstate'] == 'RING_WAIT') && $ext['direction'] == 'inbound') {
$ext_state = 'ringing';
}
else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') {
$ext_state = 'active';
}
else if ($ext['callstate'] == 'RING_WAIT' && $ext['direction'] == 'outbound') {
$ext_state = 'ringing';
}
else if ($ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'inbound') {
$ext_state = 'active';
}
if (!$format_number) {
$call_name = 'System';
$call_number = $ext['dest'];
}
else {
$call_name = $activity[$ext['dest']]['effective_caller_id_name'];
$call_number = format_phone($ext['dest']);
}
$dir_icon = 'outbound';
}
else if ($ext['state'] == 'CS_HIBERNATE') {
if ($ext['callstate'] == 'ACTIVE') {
$ext_state = 'active';
if ($ext['direction'] == 'inbound') {
$call_name = $activity[$ext['dest']]['effective_caller_id_name'];
$call_number = format_phone($ext['dest']);
$dir_icon = 'outbound';
}
else if ($ext['direction'] == 'outbound') {
$call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
$call_number = format_phone($ext['cid_num']);
$dir_icon = 'inbound';
}
}
}
else if ($ext['state'] == 'CS_CONSUME_MEDIA' || $ext['state'] == 'CS_EXCHANGE_MEDIA') {
if ($ext['state'] == 'CS_CONSUME_MEDIA' && $ext['callstate'] == 'RINGING' && $ext['direction'] == 'outbound') {
$ext_state = 'ringing';
}
else if ($ext['state'] == 'CS_EXCHANGE_MEDIA' && $ext['callstate'] == 'ACTIVE' && $ext['direction'] == 'outbound') {
$ext_state = 'active';
}
$dir_icon = 'inbound';
$call_name = $activity[$ext['cid_num']]['effective_caller_id_name'];
$call_number = format_phone($ext['cid_num']);
}
else {
unset($ext_state, $dir_icon, $call_name, $call_number);
}
//determine block style by state (if any)
$style = ($ext_state != '') ? "op_state_".$ext_state : null;
//determine the call identifier passed on drop
if ($ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') { // transfer an outbound internal call
$call_identifier = $activity[$call_number]['uuid'];
}
else if (($ext['variable_call_direction'] == 'outbound' || $ext['variable_call_direction'] == 'local') && $ext['variable_bridge_uuid'] != '') { // transfer an outbound external call
$call_identifier = $ext['variable_bridge_uuid'];
}
else {
if( $ext['call_uuid'] ) {
$call_identifier = $ext['call_uuid']; // transfer all other call types
}
else {
$call_identifier = $ext['uuid']; // e.g. voice menus
}
}
//determine extension draggable state
if (permission_exists('operator_panel_manage')) {
if (!in_array($extension, $_SESSION['user']['extensions'])) {
//other extension
if ($ext_state == "ringing") {
if ($_GET['vd_ext_from'] == '' && $dir_icon == 'inbound') {
$draggable = true; // selectable - is ringing and not outbound so can transfer away the call (can set as vd_ext_from)
}
else {
$draggable = false; // unselectable - is ringing so can't send a call to the ext (can't set as vd_ext_to)
}
}
else if ($ext_state == 'active') {
$draggable = false; // unselectable - on a call already so can't transfer or send a call to the ext (can't set as vd_ext_from or vd_ext_to)
}
else { // idle
if ($_GET['vd_ext_from'] == '') {
$draggable = false; // unselectable - is idle, but can't initiate a call from the ext as is not assigned to user (can't set as vd_ext_from)
}
else {
$draggable = true; // selectable - is idle, so can transfer a call in to ext (can set as vd_ext_to).
}
}
}
else {
//user extension
if ($ext['uuid'] != '' && $ext['uuid'] == $ext['call_uuid'] && $ext['variable_bridge_uuid'] == '') {
$draggable = false;
}
else if ($ext_state == 'ringing' && $ext['variable_call_direction'] == 'local') {
$draggable = false;
}
else if ($ext_state != '' && !$format_number) {
$draggable = false;
}
else {
$draggable = true;
}
}
}
else {
$draggable = false;
}
//determine extension (user) status
$ext_status = (in_array($extension, $_SESSION['user']['extensions'])) ? $ext_user_status[$_SESSION['user_uuid']] : $ext_user_status[$ext['user_uuid']];
switch ($ext_status) {
case "Available" :
$status_icon = "available";
$status_hover = $text['label-status_available'];
break;
case "Available (On Demand)" :
$status_icon = "available_on_demand";
$status_hover = $text['label-status_available_on_demand'];
break;
case "On Break" :
$status_icon = "on_break";
$status_hover = $text['label-status_on_break'];
break;
case "Do Not Disturb" :
$status_icon = "do_not_disturb";
$status_hover = $text['label-status_do_not_disturb'];
break;
default :
$status_icon = "logged_out";
$status_hover = $text['label-status_logged_out_or_unknown'];
}
$block .= "<div id='".$extension."' class='op_ext ".$style."' ".(($_GET['vd_ext_from'] == $extension || $_GET['vd_ext_to'] == $extension) ? "style='border-style: dotted;'" : null)." ".(($ext_state != 'active' && $ext_state != 'ringing') ? "ondrop='drop(event, this.id);' ondragover='allowDrop(event, this.id);' ondragleave='discardDrop(event, this.id);'" : null).">"; // DRAG TO
$block .= "<table class='op_ext ".$style."'>";
$block .= " <tr>";
$block .= " <td class='op_ext_icon'>";
$block .= " <span name='".$extension."'>"; // DRAG FROM
$block .= "<img id='".$call_identifier."' class='op_ext_icon' src='resources/images/status_".$status_icon.".png' title='".$status_hover."' ".(($draggable) ? "draggable='true' ondragstart=\"drag(event, this.parentNode.getAttribute('name'));\" onclick=\"virtual_drag('".$call_identifier."', '".$extension."');\"" : "onfocus='this.blur();' draggable='false' style='cursor: not-allowed;'").">";
$block .= "</span>";
$block .= " </td>";
$block .= " <td class='op_ext_info ".$style."'>";
if ($dir_icon != '') {
$block .= " <img src='resources/images/".$dir_icon.".png' align='right' style='margin-top: 3px; margin-right: 1px; width: 12px; height: 12px; cursor: help;' draggable='false' alt=\"".$text['label-call_direction']."\" title=\"".$text['label-call_direction']."\">";
}
$block .= " <span class='op_user_info'>";
if ($ext['effective_caller_id_name'] != '' && $ext['effective_caller_id_name'] != $extension) {
$block .= " <strong class='strong'>".$ext['effective_caller_id_name']."</strong> (".$extension.")";
}
else {
$block .= " <strong class='strong'>".$extension."</strong>";
}
$block .= " </span><br>";
if ($ext_state != '') {
$block .= " <span class='op_caller_info'>";
$block .= " <table align='right'><tr><td style='text-align: right;'>";
$block .= " <span class='op_call_info'>".$ext['call_length']."</span><br>";
$block .= " <span class='call_control'>";
//record
if (permission_exists('operator_panel_record') && $ext_state == 'active') {
$call_identifier_record = $ext['call_uuid'];
$rec_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$call_identifier_record.".wav";
if (file_exists($rec_file)) {
$block .= "<img src='resources/images/recording.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: help;' title=\"".$text['label-recording']."\" ".$onhover_pause_refresh.">";
}
else {
$block .= "<img src='resources/images/record.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title=\"".$text['label-record']."\" onclick=\"record_call('".$call_identifier_record."');\" ".$onhover_pause_refresh.">";
}
}
//eavesdrop
if (permission_exists('operator_panel_eavesdrop') && $ext_state == 'active' && sizeof($_SESSION['user']['extensions']) > 0 && !in_array($extension, $_SESSION['user']['extensions'])) {
$block .= "<img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-eavesdrop']."' onclick=\"eavesdrop_call('".$ext['destination']."','".$call_identifier."');\" ".$onhover_pause_refresh.">";
}
//kill
if (permission_exists('operator_panel_kill') || in_array($extension, $_SESSION['user']['extensions'])) {
if ($ext['variable_bridge_uuid'] == '' && $ext_state == 'ringing') {
$call_identifier_kill = $ext['uuid'];
}
else if ($dir_icon == 'outbound') {
$call_identifier_kill = $ext['uuid'];
}
else {
$call_identifier_kill = $call_identifier;
}
$block .= "<img src='resources/images/kill.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-kill']."' onclick=\"kill_call('".$call_identifier_kill."');\" ".$onhover_pause_refresh.">";
}
$block .= "</span>";
//transfer
if (in_array($extension, $_SESSION['user']['extensions']) && $ext_state == 'active') {
$block .= "<img id='destination_control_".$extension."_transfer' class='destination_control' src='resources/images/keypad_transfer.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' onclick=\"toggle_destination('".$extension."', 'transfer');\" ".$onhover_pause_refresh.">";
}
$block .= " </td></tr></table>";
$block .= " <span id='op_caller_details_".$extension."'><strong>".$call_name."</strong><br>".$call_number."</span>";
$block .= " </span>";
//transfer
if (in_array($extension, $_SESSION['user']['extensions']) && $ext_state == 'active') {
$call_identifier_transfer = $ext['variable_bridge_uuid'];
$block .= " <form id='frm_destination_".$extension."_transfer' onsubmit=\"go_destination('".$extension."', document.getElementById('destination_".$extension."_transfer').value, 'transfer', '".$call_identifier_transfer."'); return false;\">";
$block .= " <input type='text' class='formfld' id='destination_".$extension."_transfer' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 3px; text-align: center; display: none;' onblur=\"toggle_destination('".$extension."', 'transfer');\">";
$block .= " </form>\n";
}
}
else {
//call
if (in_array($extension, $_SESSION['user']['extensions'])) {
$block .= " <img id='destination_control_".$extension."_call' class='destination_control' src='resources/images/keypad_call.png' style='width: 12px; height: 12px; border: none; margin-top: 26px; margin-right: 1px; cursor: pointer;' align='right' onclick=\"toggle_destination('".$extension."', 'call');\" ".$onhover_pause_refresh.">";
$block .= " <form id='frm_destination_".$extension."_call' onsubmit=\"go_destination('".$extension."', document.getElementById('destination_".$extension."_call').value, 'call'); return false;\">";
$block .= " <input type='text' class='formfld' id='destination_".$extension."_call' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 10px; text-align: center; display: none;' onblur=\"toggle_destination('".$extension."', 'call');\">";
$block .= " </form>\n";
}
}
$block .= " </td>";
$block .= " </tr>";
$block .= "</table>";
if (if_group("superadmin") && isset($_GET['debug'])) {
$block .= "<span style='font-size: 10px;'>";
$block .= "From ID<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: maroon'>".$extension."</strong><br>";
$block .= "uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['uuid'] ? 'blue' : 'black').";'>".$ext['uuid']."</strong><br>";
$block .= "call_uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['call_uuid'] ? 'blue' : 'black').";'>".$ext['call_uuid']."</strong><br>";
$block .= "variable_bridge_uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: ".($call_identifier == $ext['variable_bridge_uuid'] ? 'blue' : 'black').";'>".$ext['variable_bridge_uuid']."</strong><br>";
$block .= "direction<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['direction']."</strong><br>";
$block .= "variable_call_direction<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['variable_call_direction']."</strong><br>";
$block .= "state<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['state']."</strong><br>";
$block .= "cid_num<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['cid_num']."</strong><br>";
$block .= "dest<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['dest']."</strong><br>";
$block .= "context<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['context']."</strong><br>";
$block .= "presence_id<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['presence_id']."</strong><br>";
$block .= "callstate<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong style='color: black;'>".$ext['callstate']."</strong><br>";
$block .= "</span>";
}
$block .= "</div>";
if (in_array($extension, $_SESSION['user']['extensions'])) {
$user_extensions[] = $block;
}
else {
$other_extensions[] = $block;
}
}
if (sizeof($user_extensions) > 0) {
echo "<table width='100%'><tr><td>";
foreach ($user_extensions as $ext_block) {
echo $ext_block;
}
echo "</td></tr></table>";
}
if ($_REQUEST['group'] != '') {
if (sizeof($user_extensions) > 0) { echo "<br>"; }
echo "<strong style='color: black;'>".ucwords($_REQUEST['group'])."</strong>";
echo "<br><br>";
}
else if (sizeof($user_extensions) > 0) {
echo "<br>";
echo "<strong style='color: black;'>".$text['label-other_extensions']."</strong>";
echo "<br><br>";
}
if (sizeof($other_extensions) > 0) {
echo "<table width='100%'><tr><td>";
foreach ($other_extensions as $ext_block) {
echo $ext_block;
}
echo "</td></tr></table>";
}
else {
echo $text['label-no_extensions_found'];
}
echo "<br><br>";
if (if_group("superadmin") && isset($_GET['debug'])) {
echo '$activity<br>';
echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
print_r($activity);
echo "</textarea>";
echo "<br><br>";
echo '$_SESSION<br>';
echo "<textarea style='width: 100%; height: 600px; overflow: scroll;' onfocus='refresh_stop();' onblur='refresh_start();'>";
print_r($_SESSION);
echo "</textarea>";
}
?>

View File

@@ -1,182 +1,182 @@
<?php
function get_call_activity() {
global $db;
global $ext_user_status;
//get the extensions and their user status
$sql = "select ";
$sql .= "e.extension, ";
$sql .= "e.number_alias, ";
$sql .= "e.effective_caller_id_name, ";
$sql .= "e.effective_caller_id_number, ";
$sql .= "e.call_group, ";
$sql .= "e.description, ";
$sql .= "u.user_uuid, ";
$sql .= "u.user_status ";
$sql .= "from ";
$sql .= "v_extensions as e ";
$sql .= "left outer join v_extension_users as eu on ( eu.extension_uuid = e.extension_uuid and eu.domain_uuid = '".$_SESSION['domain_uuid']."' ) ";
$sql .= "left outer join v_users as u on ( u.user_uuid = eu.user_uuid and u.domain_uuid = '".$_SESSION['domain_uuid']."' ) ";
$sql .= "where ";
$sql .= "e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "order by ";
$sql .= "e.extension asc ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//store extension status by user uuid
foreach($extensions as &$row) {
if ($row['user_uuid'] != '') {
$ext_user_status[$row['user_uuid']] = $row['user_status'];
unset($row['user_status']);
}
}
//send the command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = 'show channels as json';
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$json_array = json_decode($switch_result, true);
}
//build the response
$x = 0;
foreach($extensions as &$row) {
$user = $row['extension'];
if (strlen($row['number_alias']) >0 ) {
$user = $row['number_alias'];
}
//add the extension details
$array[$x] = $row;
//set the call detail defaults
$array[$x]["uuid"] = null;
$array[$x]["direction"] = null;
$array[$x]["created"] = null;
$array[$x]["created_epoch"] = null;
$array[$x]["name"] = null;
$array[$x]["state"] = null;
$array[$x]["cid_name"] = null;
$array[$x]["cid_num"] = null;
$array[$x]["ip_addr"] = null;
$array[$x]["dest"] = null;
$array[$x]["application"] = null;
$array[$x]["application_data"] = null;
$array[$x]["dialplan"] = null;
$array[$x]["context"] = null;
$array[$x]["read_codec"] = null;
$array[$x]["read_rate"] = null;
$array[$x]["read_bit_rate"] = null;
$array[$x]["write_codec"] = null;
$array[$x]["write_rate"] = null;
$array[$x]["write_bit_rate"] = null;
$array[$x]["secure"] = null;
$array[$x]["hostname"] = null;
$array[$x]["presence_id"] = null;
$array[$x]["presence_data"] = null;
$array[$x]["callstate"] = null;
$array[$x]["callee_name"] = null;
$array[$x]["callee_num"] = null;
$array[$x]["callee_direction"] = null;
$array[$x]["call_uuid"] = null;
$array[$x]["sent_callee_name"] = null;
$array[$x]["sent_callee_num"] = null;
$array[$x]["destination"] = null;
//add the active call details
$found = false;
foreach($json_array['rows'] as &$field) {
$presence_id = $field['presence_id'];
$presence = explode("@", $presence_id);
$presence_id = $presence[0];
$presence_domain = $presence[1];
if ($user == $presence_id) {
if ($presence_domain == $_SESSION['domain_name']) {
$found = true;
break;
}
}
}
//normalize the array
if ($found) {
$array[$x]["uuid"] = $field['uuid'];
$array[$x]["direction"] = $field['direction'];
$array[$x]["created"] = $field['created'];
$array[$x]["created_epoch"] = $field['created_epoch'];
$array[$x]["name"] = $field['name'];
$array[$x]["state"] = $field['state'];
$array[$x]["cid_name"] = $field['cid_name'];
$array[$x]["cid_num"] = $field['cid_num'];
$array[$x]["ip_addr"] = $field['ip_addr'];
$array[$x]["dest"] = $field['dest'];
$array[$x]["application"] = $field['application'];
$array[$x]["application_data"] = $field['application_data'];
$array[$x]["dialplan"] = $field['dialplan'];
$array[$x]["context"] = $field['context'];
$array[$x]["read_codec"] = $field['read_codec'];
$array[$x]["read_rate"] = $field['read_rate'];
$array[$x]["read_bit_rate"] = $field['read_bit_rate'];
$array[$x]["write_codec"] = $field['write_codec'];
$array[$x]["write_rate"] = $field['write_rate'];
$array[$x]["write_bit_rate"] = $field['write_bit_rate'];
$array[$x]["secure"] = $field['secure'];
$array[$x]["hostname"] = $field['hostname'];
$array[$x]["presence_id"] = $field['presence_id'];
$array[$x]["presence_data"] = $field['presence_data'];
$array[$x]["callstate"] = $field['callstate'];
$array[$x]["callee_name"] = $field['callee_name'];
$array[$x]["callee_num"] = $field['callee_num'];
$array[$x]["callee_direction"] = $field['callee_direction'];
$array[$x]["call_uuid"] = $field['call_uuid'];
$array[$x]["sent_callee_name"] = $field['sent_callee_name'];
$array[$x]["sent_callee_num"] = $field['sent_callee_num'];
$array[$x]["destination"] = $user;
//calculate and set the call length
$call_length_seconds = time() - $array[$x]["created_epoch"];
$call_length_hour = floor($call_length_seconds/3600);
$call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
$call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
$call_length_min = sprintf("%02d", $call_length_min);
$call_length_sec = sprintf("%02d", $call_length_sec);
$call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
$array[$x]['call_length'] = $call_length;
//send the command
if ($field['state'] != '') {
if ($fp) {
$switch_cmd = 'uuid_dump '.$field['uuid'].' json';
$dump_result = event_socket_request($fp, 'api '.$switch_cmd);
$dump_array = json_decode($dump_result, true);
foreach ($dump_array as $dump_var_name => $dump_var_value) {
$array[$x][$dump_var_name] = trim($dump_var_value);
}
}
}
}
//increment the row
$x++;
}
//reindex array using extension instead of auto-incremented value
$result = array();
foreach ($array as $index => $subarray) {
$extension = $subarray['extension'];
foreach ($subarray as $field => $value) {
$result[$extension][$field] = $array[$index][$field];
unset($array[$index][$field]);
}
unset($array[$subarray['extension']]['extension']);
unset($array[$index]);
}
//return array
return $result;
}
<?php
function get_call_activity() {
global $db;
global $ext_user_status;
//get the extensions and their user status
$sql = "select ";
$sql .= "e.extension, ";
$sql .= "e.number_alias, ";
$sql .= "e.effective_caller_id_name, ";
$sql .= "e.effective_caller_id_number, ";
$sql .= "e.call_group, ";
$sql .= "e.description, ";
$sql .= "u.user_uuid, ";
$sql .= "u.user_status ";
$sql .= "from ";
$sql .= "v_extensions as e ";
$sql .= "left outer join v_extension_users as eu on ( eu.extension_uuid = e.extension_uuid and eu.domain_uuid = '".$_SESSION['domain_uuid']."' ) ";
$sql .= "left outer join v_users as u on ( u.user_uuid = eu.user_uuid and u.domain_uuid = '".$_SESSION['domain_uuid']."' ) ";
$sql .= "where ";
$sql .= "e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "order by ";
$sql .= "e.extension asc ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//store extension status by user uuid
foreach($extensions as &$row) {
if ($row['user_uuid'] != '') {
$ext_user_status[$row['user_uuid']] = $row['user_status'];
unset($row['user_status']);
}
}
//send the command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = 'show channels as json';
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$json_array = json_decode($switch_result, true);
}
//build the response
$x = 0;
foreach($extensions as &$row) {
$user = $row['extension'];
if (strlen($row['number_alias']) >0 ) {
$user = $row['number_alias'];
}
//add the extension details
$array[$x] = $row;
//set the call detail defaults
$array[$x]["uuid"] = null;
$array[$x]["direction"] = null;
$array[$x]["created"] = null;
$array[$x]["created_epoch"] = null;
$array[$x]["name"] = null;
$array[$x]["state"] = null;
$array[$x]["cid_name"] = null;
$array[$x]["cid_num"] = null;
$array[$x]["ip_addr"] = null;
$array[$x]["dest"] = null;
$array[$x]["application"] = null;
$array[$x]["application_data"] = null;
$array[$x]["dialplan"] = null;
$array[$x]["context"] = null;
$array[$x]["read_codec"] = null;
$array[$x]["read_rate"] = null;
$array[$x]["read_bit_rate"] = null;
$array[$x]["write_codec"] = null;
$array[$x]["write_rate"] = null;
$array[$x]["write_bit_rate"] = null;
$array[$x]["secure"] = null;
$array[$x]["hostname"] = null;
$array[$x]["presence_id"] = null;
$array[$x]["presence_data"] = null;
$array[$x]["callstate"] = null;
$array[$x]["callee_name"] = null;
$array[$x]["callee_num"] = null;
$array[$x]["callee_direction"] = null;
$array[$x]["call_uuid"] = null;
$array[$x]["sent_callee_name"] = null;
$array[$x]["sent_callee_num"] = null;
$array[$x]["destination"] = null;
//add the active call details
$found = false;
foreach($json_array['rows'] as &$field) {
$presence_id = $field['presence_id'];
$presence = explode("@", $presence_id);
$presence_id = $presence[0];
$presence_domain = $presence[1];
if ($user == $presence_id) {
if ($presence_domain == $_SESSION['domain_name']) {
$found = true;
break;
}
}
}
//normalize the array
if ($found) {
$array[$x]["uuid"] = $field['uuid'];
$array[$x]["direction"] = $field['direction'];
$array[$x]["created"] = $field['created'];
$array[$x]["created_epoch"] = $field['created_epoch'];
$array[$x]["name"] = $field['name'];
$array[$x]["state"] = $field['state'];
$array[$x]["cid_name"] = $field['cid_name'];
$array[$x]["cid_num"] = $field['cid_num'];
$array[$x]["ip_addr"] = $field['ip_addr'];
$array[$x]["dest"] = $field['dest'];
$array[$x]["application"] = $field['application'];
$array[$x]["application_data"] = $field['application_data'];
$array[$x]["dialplan"] = $field['dialplan'];
$array[$x]["context"] = $field['context'];
$array[$x]["read_codec"] = $field['read_codec'];
$array[$x]["read_rate"] = $field['read_rate'];
$array[$x]["read_bit_rate"] = $field['read_bit_rate'];
$array[$x]["write_codec"] = $field['write_codec'];
$array[$x]["write_rate"] = $field['write_rate'];
$array[$x]["write_bit_rate"] = $field['write_bit_rate'];
$array[$x]["secure"] = $field['secure'];
$array[$x]["hostname"] = $field['hostname'];
$array[$x]["presence_id"] = $field['presence_id'];
$array[$x]["presence_data"] = $field['presence_data'];
$array[$x]["callstate"] = $field['callstate'];
$array[$x]["callee_name"] = $field['callee_name'];
$array[$x]["callee_num"] = $field['callee_num'];
$array[$x]["callee_direction"] = $field['callee_direction'];
$array[$x]["call_uuid"] = $field['call_uuid'];
$array[$x]["sent_callee_name"] = $field['sent_callee_name'];
$array[$x]["sent_callee_num"] = $field['sent_callee_num'];
$array[$x]["destination"] = $user;
//calculate and set the call length
$call_length_seconds = time() - $array[$x]["created_epoch"];
$call_length_hour = floor($call_length_seconds/3600);
$call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
$call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
$call_length_min = sprintf("%02d", $call_length_min);
$call_length_sec = sprintf("%02d", $call_length_sec);
$call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
$array[$x]['call_length'] = $call_length;
//send the command
if ($field['state'] != '') {
if ($fp) {
$switch_cmd = 'uuid_dump '.$field['uuid'].' json';
$dump_result = event_socket_request($fp, 'api '.$switch_cmd);
$dump_array = json_decode($dump_result, true);
foreach ($dump_array as $dump_var_name => $dump_var_value) {
$array[$x][$dump_var_name] = trim($dump_var_value);
}
}
}
}
//increment the row
$x++;
}
//reindex array using extension instead of auto-incremented value
$result = array();
foreach ($array as $index => $subarray) {
$extension = $subarray['extension'];
foreach ($subarray as $field => $value) {
$result[$extension][$field] = $array[$index][$field];
unset($array[$index][$field]);
}
unset($array[$subarray['extension']]['extension']);
unset($array[$index]);
}
//return array
return $result;
}

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

View File

@@ -1,12 +1,12 @@
<?php
//$apps[$x]['menu'][0]['title']['en-us'] = "Provision";
//$apps[$x]['menu'][0]['title']['fr-fr'] = "Provision";
//$apps[$x]['menu'][0]['uuid'] = "";
//$apps[$x]['menu'][0]['parent_uuid'] = "";
//$apps[$x]['menu'][0]['category'] = "internal";
//$apps[$x]['menu'][0]['path'] = "";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
<?php
//$apps[$x]['menu'][0]['title']['en-us'] = "Provision";
//$apps[$x]['menu'][0]['title']['fr-fr'] = "Provision";
//$apps[$x]['menu'][0]['uuid'] = "";
//$apps[$x]['menu'][0]['parent_uuid'] = "";
//$apps[$x]['menu'][0]['category'] = "internal";
//$apps[$x]['menu'][0]['path'] = "";
//$apps[$x]['menu'][0]['groups'][] = "admin";
//$apps[$x]['menu'][0]['groups'][] = "superadmin";
?>

View File

@@ -80,7 +80,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
}
//get the domain_name and domain_uuid
if ($_SESSION['provision']['http_domain_filter']['text'] == "false") {
if ((!isset($_SESSION['provision']['http_domain_filter'])) or $_SESSION['provision']['http_domain_filter']['text'] == "false") {
//get the domain_uuid
$sql = "SELECT domain_uuid FROM v_devices ";
$sql .= "WHERE device_mac_address = '".$mac."' ";

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
@@ -33,10 +34,12 @@
}
}
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($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
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')) {

Some files were not shown because too many files have changed in this diff Show More