mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Refactor PHP code (#7574)
* Use settings-get method - get default, domain and user settings - Replace _SESSION * Simplify get domain paging * Change isset using empty * Fix token name and hash * Add new default settings category: contact, name: default_sort_column, and default_sort_order * Update app_config.php * Update footer.php * Fix require.php and core/dashboard/index.php (#7563) * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Fix require.php and core/dashboard/index.php * Update destinations.php * Update permission.php * Update require.php --------- Co-authored-by: FusionPBX <markjcrane@gmail.com> Co-authored-by: FusionPBX <mark@fusionpbx.com> * Update header.php * Use settings get classes (#7567) * access_control * azure * azure * basic_operator_panel * bridges * call_block * call_broadcast * call_center * call_flows * call_forward * call_recordings * do_not_disturb * feature_event_notify * follow_me * remove unused object properties * fix esl command * fix esl command * conference_centers * conference_centers - remove whitespace * conference_controls * conference_profiles * conference_profiles * Delete core/websockets/resources/classes/socket_exception.php.original~ * Delete core/websockets/resources/classes/websocket_server.php.original~ * conferences * destinations * device * dialplan * email_queue * event_guard * extension_settings * extension * fax * fax_queue * fifo * gateways * ivr_menu * modules * switch_music_on_hold * number_translations * phrases * pin_numbers * provision * switch_recordings * registrations * ring_groups * sip_profiles * sofia_global_settings * streams * presence * switch_files * time_conditions * vars * voicemail_greetings * voicemail * ringbacks * contacts * xml_cdr * authentication * dashboard * default_settings * domain_settings * email_templates * permission * user_logs * user_settings * users * button * cache * captcha * remove cli_option * remove directory.php for switch_directory class * email * file * groups * event_socket use config object * Use intval to give an integer port * switch_settings * tones * fix object used before initialization * menu * fix copy paste error for switch_files.php * always include require.php for framework files * Fix missing properties * set the action * Use the $database object * Add missing class properties * Fix the domain_name * Use public scope for domain_uuid and domain_name * Add missing parameters * Correct the user_uuid parameter * Add json_validate and use it in the dashboard update indentation on functions.php * Intialize the active_registrations variable * Define the $parameters * Set a default value for user_setting_enabled * Add condition domain_uuid not empty * Add not empty condition for domain_uuid * Declare the global variables * Update how the defaults are set use ?? * Use ?? to set the default values * Update call_center_queue_edit.php * Prevent an error * Add domain_name property * Fix the null coalescing operator * Removed domain_uuid from the URL * Change condition to check sip_profile_domain_name * Refactor domain_uuid declaration and comments Removed redundant domain_uuid declaration and updated comments. * Account for an empty value * Refactor constructor to use settings array Updated constructor to accept settings array for domain UUID and database initialization. * Refactor xml_cdr.php to improve variable organization Removed duplicate domain_uuid declaration and reorganized private variables for better structure. * Enhance transcription button logic and icon display Updated transcription button visibility conditions and improved application icon handling in the call flow summary. * Refactor settings initialization in domains.php Updated settings initialization to include domain_uuid and user_uuid. * Modify domain change condition in require.php Updated condition to check if 'domain_change' is not empty before proceeding. * Set default_setting_enabled to true by default * Enhance domain UUID check in access controls * Enhance domain UUID check in settings list * Refactor category display logic in vars.php * Simplify list row URL generation Removed domain UUID check from list row URL construction. * Refactor module category display logic * Fix SQL query by removing parameters variable * Initialize result_count variable for call recordings * Refactor leg variable usage in xml_cdr_details.php * Update conference_room_edit.php * Change GET to REQUEST for order and search variables * Set timezone and SQL time format in recordings.php Added timezone and SQL time format settings. * Set default for ring group greeting * Improve domain UUID check in stream listing * Handle null voicemail_option_param safely * Add file existence check for greeting files Check if greeting file exists before getting size and date. * Improve domain UUID check in email templates * Update FIFO strategy dropdown and description text * Add multilingual agent descriptions Added multilingual descriptions for agents in the app_languages.php file. * Add music on hold descriptions * Add the chime list description Updated copyright year from 2024 to 2025. * Fix domain UUID check and handle email subject decoding * Add null coalescing for $value in email_test.php Ensure $value is not null by providing a default empty string. * Handle undefined dialplan_uuid in input field * Add translations for 'Status' label in multiple languages * Fix typo in config instance check --------- Co-authored-by: frytimo <tim@fusionpbx.com>
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/access_control_nodes-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/access_control_nodes-".$_SESSION['domain_name'].".csv";
|
||||
if (file_put_contents($file, $_POST['data'])) {
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('access_control_node_add')) {
|
||||
if (!empty($_POST['type']) &&$_POST['type'] == 'csv') {
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$file = $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name'];
|
||||
if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) {
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
$list_row_url = '';
|
||||
if (permission_exists('access_control_view')) {
|
||||
$list_row_url = "access_control_edit.php?id=".urlencode($row['access_control_uuid']);
|
||||
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,32 @@
|
||||
const app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -23,15 +46,17 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$config = $setting_array['config'] ?? config::load();
|
||||
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
|
||||
|
||||
//assign private variables
|
||||
$this->list_page = 'access_controls.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ $row_style["1"] = "row_style1";
|
||||
$widget_icon = 'fa-solid fa-phone';
|
||||
|
||||
//add multi-lingual support
|
||||
$text = (new text)->get($_SESSION['domain']['language']['code'], 'app/active_calls');
|
||||
$text = (new text)->get($settings->get('domain', 'language', 'en-us'), 'app/active_calls');
|
||||
|
||||
//show the widget
|
||||
echo "<div class='hud_box'>\n";
|
||||
|
||||
@@ -3,115 +3,115 @@
|
||||
class azure{
|
||||
|
||||
public static $formats = array (
|
||||
'English-Zira' =>
|
||||
'English-Zira' =>
|
||||
array (
|
||||
'lang' => 'en-US',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)'
|
||||
),
|
||||
'English-Jessa' =>
|
||||
'English-Jessa' =>
|
||||
array (
|
||||
'lang' => 'en-US',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
|
||||
),
|
||||
'English-Benjamin' =>
|
||||
'English-Benjamin' =>
|
||||
array (
|
||||
'lang' => 'en-US',
|
||||
'gender' => 'Male',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-US, BenjaminRUS)'
|
||||
),
|
||||
'British-Susan' =>
|
||||
'British-Susan' =>
|
||||
array (
|
||||
'lang' => 'en-GB',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-GB, Susan, Apollo)'
|
||||
),
|
||||
'British-Hazel' =>
|
||||
'British-Hazel' =>
|
||||
array (
|
||||
'lang' => 'en-GB',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-GB, HazelRUS)'
|
||||
),
|
||||
'British-George' =>
|
||||
'British-George' =>
|
||||
array (
|
||||
'lang' => 'en-GB',
|
||||
'gender' => 'Male',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-GB, George, Apollo)'
|
||||
),
|
||||
'Australian-Catherine' =>
|
||||
'Australian-Catherine' =>
|
||||
array (
|
||||
'lang' => 'en-AU',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (en-AU, Catherine)'
|
||||
),
|
||||
'Spanish-Helena' =>
|
||||
'Spanish-Helena' =>
|
||||
array (
|
||||
'lang' => 'es-ES',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (es-ES, HelenaRUS)'
|
||||
),
|
||||
'Spanish-Laura' =>
|
||||
'Spanish-Laura' =>
|
||||
array (
|
||||
'lang' => 'es-ES',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (es-ES, Laura, Apollo)'
|
||||
),
|
||||
'Spanish-Pablo' =>
|
||||
'Spanish-Pablo' =>
|
||||
array (
|
||||
'lang' => 'es-ES',
|
||||
'gender' => 'Male',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (es-ES, Pablo, Apollo)'
|
||||
),
|
||||
'French-Julie' =>
|
||||
'French-Julie' =>
|
||||
array (
|
||||
'lang' => 'fr-FR',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (fr-FR, Julie, Apollo)'
|
||||
),
|
||||
'French-Hortense' =>
|
||||
'French-Hortense' =>
|
||||
array (
|
||||
'lang' => 'fr-FR',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (fr-FR, HortenseRUS)'
|
||||
),
|
||||
'French-Paul' =>
|
||||
'French-Paul' =>
|
||||
array (
|
||||
'lang' => 'fr-FR',
|
||||
'gender' => 'Male',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (fr-FR, Paul, Apollo)'
|
||||
),
|
||||
'German-Hedda' =>
|
||||
'German-Hedda' =>
|
||||
array (
|
||||
'lang' => 'de-DE',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (de-DE, Hedda)'
|
||||
),
|
||||
'Russian-Irina' =>
|
||||
'Russian-Irina' =>
|
||||
array (
|
||||
'lang' => 'ru-RU',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (ru-RU, Irina, Apollo)'
|
||||
),
|
||||
'Russian-Pavel' =>
|
||||
'Russian-Pavel' =>
|
||||
array (
|
||||
'lang' => 'ru-RU',
|
||||
'gender' => 'Male',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (ru-RU, Pavel, Apollo)'
|
||||
),
|
||||
'Chinese-Huihui' =>
|
||||
'Chinese-Huihui' =>
|
||||
array (
|
||||
'lang' => 'zh-CN',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (zh-CN, HuihuiRUS)'
|
||||
),
|
||||
'Chinese-Yaoyao' =>
|
||||
'Chinese-Yaoyao' =>
|
||||
array (
|
||||
'lang' => 'zh-CN',
|
||||
'gender' => 'Female',
|
||||
'name' => 'Microsoft Server Speech Text to Speech Voice (zh-CN, Yaoyao, Apollo)'
|
||||
),
|
||||
'Chinese-Kangkang' =>
|
||||
'Chinese-Kangkang' =>
|
||||
array (
|
||||
'lang' => 'zh-CN',
|
||||
'gender' => 'Male',
|
||||
@@ -119,6 +119,17 @@ class azure{
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$config = $setting_array['config'] ?? config::load();
|
||||
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $domain_uuid, 'user_uuid' => $user_uuid]);
|
||||
}
|
||||
|
||||
private static function getTokenUrl(){
|
||||
return "https://api.cognitive.microsoft.com/sts/v1.0/issueToken";
|
||||
}
|
||||
@@ -127,13 +138,13 @@ class azure{
|
||||
return "https://speech.platform.bing.com/synthesize";
|
||||
}
|
||||
|
||||
private static function getSubscriptionKey(){
|
||||
return $_SESSION['azure']['key']['text'];
|
||||
private static function getSubscriptionKey(settings $settings){
|
||||
return $settings->get('azure', 'key');
|
||||
}
|
||||
|
||||
private static function _getToken(){
|
||||
private static function _getToken(settings $settings){
|
||||
$url = self::getTokenUrl();
|
||||
$subscriptionKey = self::getSubscriptionKey();
|
||||
$subscriptionKey = self::getSubscriptionKey($settings);
|
||||
|
||||
$headers = array();
|
||||
$headers[] = 'Ocp-Apim-Subscription-Key: '. $subscriptionKey;
|
||||
@@ -149,22 +160,22 @@ class azure{
|
||||
curl_setopt ( $ch, CURLOPT_VERBOSE, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
//curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
||||
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public static function synthesize($data,$formate_key){
|
||||
public static function synthesize(settings $settings, $data, $format_key){
|
||||
|
||||
$lang = self::$formats[$formate_key]['lang'];
|
||||
$gender = self::$formats[$formate_key]['gender'];
|
||||
$name = self::$formats[$formate_key]['name'];
|
||||
$token = self::_getToken();
|
||||
$lang = self::$formats[$format_key]['lang'];
|
||||
$gender = self::$formats[$format_key]['gender'];
|
||||
$name = self::$formats[$format_key]['name'];
|
||||
$token = self::_getToken($settings);
|
||||
|
||||
$url = self::getApiUrl();
|
||||
|
||||
|
||||
$headers = array();
|
||||
$headers[] = 'Authorization: Bearer '. $token;
|
||||
$headers[] = 'Content-Type: application/ssml+xml';
|
||||
@@ -187,12 +198,12 @@ class azure{
|
||||
curl_setopt ( $ch, CURLOPT_VERBOSE, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
|
||||
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$filename = "tts_".time().".wav";
|
||||
file_put_contents("/var/www/html/fusionpbx/app/voiplyrecording/tts_record/".$filename, $response);
|
||||
|
||||
curl_close($ch);
|
||||
return $filename;
|
||||
return $filename;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ if (count($_GET) > 0) {
|
||||
}
|
||||
else if ($switch_cmd == 'uuid_record') {
|
||||
$uuid = preg_replace($uuid_pattern,'',$_GET['uuid']);
|
||||
$api_cmd = 'uuid_record ' . $uuid . ' start ' . $_SESSION['switch']['recordings']['dir'] . '/' . $_SESSION['domain_name'] . '/archive/' . date('Y/M/d') . '/' . $uuid . '.wav';
|
||||
$api_cmd = 'uuid_record ' . $uuid . ' start ' . $settings->get('switch', 'recordings') . '/' . $_SESSION['domain_name'] . '/archive/' . date('Y/M/d') . '/' . $uuid . '.wav';
|
||||
}
|
||||
else if ($switch_cmd == 'uuid_transfer') {
|
||||
$uuid = preg_replace($uuid_pattern,'',$_GET['uuid']);
|
||||
@@ -108,13 +108,13 @@ if (count($_GET) > 0) {
|
||||
$x=0;
|
||||
while (true) {
|
||||
if ($x > 0) {
|
||||
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
|
||||
$dest_file = $settings->get('switch', 'recordings')."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"]."_".$x.".wav";
|
||||
}
|
||||
else {
|
||||
$dest_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
|
||||
$dest_file = $settings->get('switch', 'recordings')."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav";
|
||||
}
|
||||
if (!file_exists($dest_file)) {
|
||||
rename($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
|
||||
rename($settings->get('switch', 'recordings')."/archive/".date("Y")."/".date("M")."/".date("d")."/".$_GET["uuid"].".wav", $dest_file);
|
||||
break;
|
||||
}
|
||||
$x++;
|
||||
|
||||
@@ -162,10 +162,10 @@
|
||||
//delete extension from the cache
|
||||
$cache = new cache;
|
||||
if (!empty($extension)) {
|
||||
$cache->delete("directory:".$extension."@".$this->domain_name);
|
||||
$cache->delete("directory:".$extension."@".$domain_name);
|
||||
}
|
||||
if (!empty($number_alias)) {
|
||||
$cache->delete("directory:".$number_alias."@".$this->domain_name);
|
||||
$cache->delete("directory:".$number_alias."@".$domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
<?php
|
||||
//determine refresh rate
|
||||
$refresh_default = 1500; //milliseconds
|
||||
$refresh = is_numeric($_SESSION['operator_panel']['refresh']['numeric']) ? $_SESSION['operator_panel']['refresh']['numeric'] : $refresh_default;
|
||||
$refresh = is_numeric($settings->get('operator_panel', 'refresh')) ? $settings->get('operator_panel', 'refresh') : $refresh_default;
|
||||
if ($refresh >= 0.5 && $refresh <= 120) { //convert seconds to milliseconds
|
||||
$refresh = $refresh * 1000;
|
||||
}
|
||||
|
||||
@@ -36,28 +36,50 @@
|
||||
const app_uuid = 'dd3d173a-5d51-4231-ab22-b18c5b712bb2';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//assign public variables
|
||||
if (!isset($this->domain_uuid)) {
|
||||
$this->domain_uuid = $_SESSION['domain_uuid'];
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
//set domain_name
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
|
||||
//set objects
|
||||
$config = $setting_array['config'] ?? config::load();
|
||||
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +109,7 @@
|
||||
$sql .= "e.domain_uuid = :domain_uuid ";
|
||||
$sql .= "order by ";
|
||||
$sql .= "e.extension asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$extensions = $this->database->select($sql, $parameters);
|
||||
|
||||
//store extension status by user uuid
|
||||
@@ -164,7 +186,7 @@
|
||||
$presence_id = $presence[0];
|
||||
$presence_domain = $presence[1] ?? '';
|
||||
if ($user == $presence_id) {
|
||||
if ($presence_domain == $_SESSION['domain_name']) {
|
||||
if ($presence_domain == $this->domain_name) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -74,29 +74,29 @@ if ($valet_info !== false) {
|
||||
}
|
||||
//view_array($valet_matches, false);
|
||||
|
||||
//unset($_SESSION['valet']);
|
||||
//unset($valet);
|
||||
foreach($valet_matches as $row) {
|
||||
if (!isset($_SESSION['valet']['uuid']['caller_id_name'])) {
|
||||
$_SESSION['valet'][$row[1]]['caller_id_name'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_name');
|
||||
if (!isset($valet['uuid']['caller_id_name'])) {
|
||||
$valet[$row[1]]['caller_id_name'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_name');
|
||||
}
|
||||
if (!isset($_SESSION['valet']['uuid']['caller_id_number'])) {
|
||||
$_SESSION['valet'][$row[1]]['caller_id_number'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_number');
|
||||
if (!isset($valet['uuid']['caller_id_number'])) {
|
||||
$valet[$row[1]]['caller_id_number'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_number');
|
||||
}
|
||||
}
|
||||
|
||||
//unset the array
|
||||
//view_array($_SESSION['valet']);
|
||||
//view_array($valet);
|
||||
|
||||
//reformat the array and add the caller ID name and numbers
|
||||
$x = 0;
|
||||
foreach($valet_matches as $row) {
|
||||
$valet_array[$x]['uuid'] = $row[1];
|
||||
$valet_array[$x]['extension'] = $row[2];
|
||||
if (isset($_SESSION['valet'][$row[1]]['caller_id_name'])) {
|
||||
$valet_array[$x]['caller_id_name'] = $_SESSION['valet'][$row[1]]['caller_id_name'];
|
||||
if (isset($valet[$row[1]]['caller_id_name'])) {
|
||||
$valet_array[$x]['caller_id_name'] = $valet[$row[1]]['caller_id_name'];
|
||||
}
|
||||
if (isset($_SESSION['valet'][$row[1]]['caller_id_number'])) {
|
||||
$valet_array[$x]['caller_id_number'] = $_SESSION['valet'][$row[1]]['caller_id_number'];
|
||||
if (isset($valet[$row[1]]['caller_id_number'])) {
|
||||
$valet_array[$x]['caller_id_number'] = $valet[$row[1]]['caller_id_number'];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -475,7 +475,7 @@ if (is_array($activity)) {
|
||||
//record
|
||||
if (permission_exists('operator_panel_record') && $ext_state == 'active') {
|
||||
$call_identifier_record = $ext['call_uuid'];
|
||||
$rec_file = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".escape($call_identifier_record).".wav";
|
||||
$rec_file = $settings->get('switch', 'recordings')."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/".escape($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.">\n";
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/bridges-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/bridges-".$_SESSION['domain_name'].".csv";
|
||||
file_put_contents($file, $_POST['data']);
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
@@ -72,11 +72,11 @@
|
||||
//copy the csv file
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('bridge_import')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*');
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$settings->get('server', 'temp')."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$settings->get('server', 'temp').'*');
|
||||
unset($_POST['txtCommand']);
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$file = $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name'];
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,32 @@
|
||||
const app_uuid = 'a6a7c4c5-340a-43ce-bcbc-2ed9bab8659d';
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -47,7 +70,15 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$config = $setting_array['config'] ?? config::load();
|
||||
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign private variables
|
||||
|
||||
@@ -58,11 +89,6 @@
|
||||
$this->toggle_field = 'bridge_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +116,7 @@
|
||||
foreach ($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +171,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -218,7 +244,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
unset($parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".$search;
|
||||
if ($show == "all" && permission_exists('call_block_all')) {
|
||||
$param .= "&show=all";
|
||||
@@ -151,7 +151,7 @@
|
||||
$sql .= " call_block_country_code, call_block_number, extension, number_alias, call_block_count, ";
|
||||
$sql .= " call_block_app, call_block_data, ";
|
||||
$sql .= " to_char(timezone(:time_zone, insert_date), 'DD Mon YYYY') as date_formatted, \n";
|
||||
if (date(!empty($_SESSION['domain']['time_format']['text']) == '12h')) {
|
||||
if (date(!empty($settings->get('domain', 'time_format')) == '12h')) {
|
||||
$sql .= " to_char(timezone(:time_zone, insert_date), 'HH12:MI:SS am') as time_formatted, \n";
|
||||
}
|
||||
else {
|
||||
@@ -336,8 +336,8 @@
|
||||
}
|
||||
echo " <td class='center'>";
|
||||
switch ($row['call_block_direction']) {
|
||||
case "inbound": echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png' style='border: none;' title='".$text['label-inbound']."'>\n"; break;
|
||||
case "outbound": echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_answered.png' style='border: none;' title='".$text['label-outbound']."'>\n"; break;
|
||||
case "inbound": echo "<img src='/themes/".$settings->get('domain', 'template')."/images/icon_cdr_inbound_answered.png' style='border: none;' title='".$text['label-inbound']."'>\n"; break;
|
||||
case "outbound": echo "<img src='/themes/".$settings->get('domain', 'template')."/images/icon_cdr_outbound_answered.png' style='border: none;' title='".$text['label-outbound']."'>\n"; break;
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='center'>";
|
||||
|
||||
@@ -618,7 +618,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
|
||||
$sql .= "and direction <> 'local' ";
|
||||
$sql .= $sql_where ?? null;
|
||||
$sql .= "order by start_stamp desc ";
|
||||
$sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']);
|
||||
$sql .= limit_offset($settings->get('call_block', 'recent_call_limit'));
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$recent_calls = $database->select($sql, $parameters);
|
||||
unset($sql, $parameters);
|
||||
@@ -685,7 +685,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
|
||||
$list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all_".$direction."').checked = false; }";
|
||||
$list_row_onclick_toggle = "onclick=\"document.getElementById('checkbox_".$x."').checked = document.getElementById('checkbox_".$x."').checked ? false : true; ".$list_row_onclick_uncheck."\"";
|
||||
if (strlen($row['caller_id_number']) >= 7) {
|
||||
if (!empty($_SESSION['domain']['time_format']['text']) && $_SESSION['domain']['time_format']['text'] == '24h') {
|
||||
if (!empty($settings->get('domain', 'time_format')) && $settings->get('domain', 'time_format') == '24h') {
|
||||
$tmp_start_epoch = date('j M Y', $row['start_epoch'])." <span class='hide-sm-dn'>".date('H:i:s', $row['start_epoch']).'</span>';
|
||||
}
|
||||
else {
|
||||
@@ -697,10 +697,10 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
|
||||
echo " <input type='hidden' name='xml_cdrs[$x][uuid]' value='".escape($row['xml_cdr_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
if (
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_answered.png")
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template')."/images/icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template')."/images/icon_cdr_inbound_answered.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template')."/images/icon_cdr_outbound_failed.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template')."/images/icon_cdr_outbound_answered.png")
|
||||
) {
|
||||
$title_mod = null;
|
||||
echo " <td class='center' ".$list_row_onclick_toggle.">";
|
||||
@@ -713,7 +713,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
|
||||
else {
|
||||
$file_mod = "_answered";
|
||||
}
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound".$file_mod.".png' style='border: none;' title='".$text['label-inbound'].$title_mod."'>\n";
|
||||
echo "<img src='/themes/".$settings->get('domain', 'template')."/images/icon_cdr_inbound".$file_mod.".png' style='border: none;' title='".$text['label-inbound'].$title_mod."'>\n";
|
||||
break;
|
||||
case "outbound":
|
||||
if ($row['billsec'] == 0) {
|
||||
@@ -723,7 +723,7 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
|
||||
else {
|
||||
$file_mod = "_answered";
|
||||
}
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound".$file_mod.".png' style='border: none;' title='".$text['label-outbound'].$title_mod."'>\n";
|
||||
echo "<img src='/themes/".$settings->get('domain', 'template')."/images/icon_cdr_outbound".$file_mod.".png' style='border: none;' title='".$text['label-outbound'].$title_mod."'>\n";
|
||||
break;
|
||||
}
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -12,9 +12,38 @@
|
||||
const app_uuid = '9ed63276-e085-4897-839c-4f2e36d92d6c';
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -33,7 +62,16 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$config = $setting_array['config'] ?? config::load();
|
||||
$this->database = $setting_array['database'] ?? database::new(['config' => $config]);
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'call_block_';
|
||||
@@ -42,12 +80,6 @@
|
||||
$this->uuid_prefix = 'call_block_';
|
||||
$this->toggle_field = 'call_block_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +120,7 @@
|
||||
}
|
||||
$sql .= ") ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -103,7 +135,7 @@
|
||||
foreach ($call_block_numbers as $call_block_uuid => $call_block_number) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $call_block_uuid;
|
||||
if (!permission_exists('call_block_domain')) {
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -118,7 +150,7 @@
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
foreach ($call_block_numbers as $call_block_number) {
|
||||
$cache->delete("app:call_block:".$_SESSION['domain_name'].":".$call_block_number);
|
||||
$cache->delete("app:call_block:".$this->domain_name.":".$call_block_number);
|
||||
}
|
||||
|
||||
//set message
|
||||
@@ -160,7 +192,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, call_block_number from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -190,7 +222,7 @@
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
foreach ($call_block_numbers as $call_block_number) {
|
||||
$cache->delete("app:call_block:".$_SESSION['domain_name'].":".$call_block_number);
|
||||
$cache->delete("app:call_block:".$this->domain_name.":".$call_block_number);
|
||||
}
|
||||
|
||||
//set message
|
||||
@@ -235,7 +267,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
@@ -307,7 +339,7 @@
|
||||
}
|
||||
|
||||
//get the caller id info from call detail records
|
||||
if (isset($_SESSION['domain_uuid']) && is_uuid($_SESSION['domain_uuid'])) {
|
||||
if (is_uuid($this->domain_uuid)) {
|
||||
//get the destination country code
|
||||
$sql = "select distinct(destination_prefix), ";
|
||||
$sql .= "(select count(destination_prefix) from v_destinations where domain_uuid = :domain_uuid and destination_prefix = d.destination_prefix) as count ";
|
||||
@@ -316,7 +348,7 @@
|
||||
$sql .= "and destination_prefix <> '' ";
|
||||
$sql .= "and destination_enabled = true ";
|
||||
$sql .= "order by count desc limit 1; ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$destination_country_code = $this->database->select($sql, $parameters ?? null, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
@@ -331,14 +363,14 @@
|
||||
if (!permission_exists('call_block_extension')) {
|
||||
$sql = "select extension_uuid from v_extension_users ";
|
||||
$sql .= "where user_uuid = :user_uuid ";
|
||||
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
||||
$parameters['user_uuid'] = $this->user_uuid;
|
||||
$user_extensions = $this->database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
//get the country code from default settings
|
||||
if (!empty($_SESSION['domain']['country_code']['numeric'])) {
|
||||
$country_code = $_SESSION['domain']['country_code']['numeric'];
|
||||
if ($this->settings->get('domain', 'country_code', null) !== null) {
|
||||
$country_code = $this->settings->get('domain', 'country_code');
|
||||
}
|
||||
|
||||
//loop through records
|
||||
@@ -361,7 +393,7 @@
|
||||
//build insert array
|
||||
if (permission_exists('call_block_extension')) {
|
||||
$array['call_block'][$x]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['call_block'][$x]['call_block_direction'] = $this->call_block_direction;
|
||||
if (is_uuid($this->extension_uuid)) {
|
||||
$array['call_block'][$x]['extension_uuid'] = $this->extension_uuid;
|
||||
@@ -387,7 +419,7 @@
|
||||
foreach ($user_extensions as $field) {
|
||||
if (is_uuid($field['extension_uuid'])) {
|
||||
$array['call_block'][$x]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['call_block'][$x]['call_block_direction'] = $this->call_block_direction;
|
||||
$array['call_block'][$x]['extension_uuid'] = $field['extension_uuid'];
|
||||
if ($this->call_block_direction == 'inbound') {
|
||||
@@ -421,7 +453,7 @@
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and app_uuid = '".self::app_uuid."' ";
|
||||
$sql .= "and dialplan_enabled <> true ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters);
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
//prepare the paging
|
||||
$param = '';
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
if (!empty($search)) {
|
||||
$param .= "&search=".urlencode($search);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
$response = event_socket::command($cmd);
|
||||
|
||||
//method 2
|
||||
//cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";");
|
||||
//cmd_async($settings->get('switch', 'bin')."/fs_cli -x \"".$cmd."\";");
|
||||
|
||||
//spread the calls out so that they are scheduled with different times
|
||||
if (strlen($broadcast_concurrent_limit) > 0 && !empty($broadcast_timeout)) {
|
||||
|
||||
@@ -36,11 +36,27 @@
|
||||
const app_name = 'call_broadcast';
|
||||
const app_uuid = 'efc11f6b-ed73-9955-4d4d-3a1bed75a056';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -49,19 +65,19 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'call_broadcast_';
|
||||
$this->list_page = 'call_broadcast.php';
|
||||
$this->table = 'call_broadcasts';
|
||||
$this->uuid_prefix = 'call_broadcast_';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +105,7 @@
|
||||
foreach($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +157,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
//determine refresh rate
|
||||
$refresh_default = 1500; //milliseconds
|
||||
$refresh = is_numeric($_SESSION['call_center']['refresh']['numeric']) ? $_SESSION['call_center']['refresh']['numeric'] : $refresh_default;
|
||||
$refresh = is_numeric($settings->get('call_center', 'refresh')) ? $settings->get('call_center', 'refresh') : $refresh_default;
|
||||
if ($refresh >= 0.5 && $refresh <= 120) { //convert seconds to milliseconds
|
||||
$refresh = $refresh * 1000;
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@
|
||||
}
|
||||
|
||||
//set default values
|
||||
if (empty($agent_call_timeout)) { $agent_call_timeout = "20"; }
|
||||
if (empty($agent_max_no_answer)) { $agent_max_no_answer = "0"; }
|
||||
if (empty($agent_wrap_up_time)) { $agent_wrap_up_time = "10"; }
|
||||
if (empty($agent_no_answer_delay_time)) { $agent_no_answer_delay_time = "30"; }
|
||||
if (empty($agent_reject_delay_time)) { $agent_reject_delay_time = "90"; }
|
||||
if (empty($agent_busy_delay_time)) { $agent_busy_delay_time = "90"; }
|
||||
if ($agent_record === null) { $agent_record = false; }
|
||||
$agent_call_timeout = $agent_call_timeout ?? "20";
|
||||
$agent_max_no_answer = $agent_max_no_answer ?? "0";
|
||||
$agent_wrap_up_time = $agent_wrap_up_time ?? "10";
|
||||
$agent_no_answer_delay_time = $agent_no_answer_delay_time ?? "30";
|
||||
$agent_reject_delay_time = $agent_reject_delay_time ?? "90";
|
||||
$agent_busy_delay_time = $agent_busy_delay_time ?? "90";
|
||||
$agent_record = $agent_record ?? false;
|
||||
|
||||
//add the call_center_agent_uuid
|
||||
if (empty($call_center_agent_uuid)) {
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
|
||||
//change the contact string to loopback - Not recommended added for backwards comptability causes multiple problems
|
||||
if ($_SESSION['call_center']['agent_contact_method']['text'] == 'loopback') {
|
||||
if ($settings->get('call_center', 'agent_contact_method') == 'loopback') {
|
||||
$agent_contact = str_replace("user/", "loopback/", $agent_contact);
|
||||
$agent_contact = str_replace("@", "/", $agent_contact);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$tiers = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($_SESSION['call_center']['queue_login']['text']) && $_SESSION['call_center']['queue_login']['text'] == 'dynamic') {
|
||||
if (!empty($settings->get('call_center', 'queue_login')) && $settings->get('call_center', 'queue_login') == 'dynamic') {
|
||||
$per_queue_login = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('call_center_all')) {
|
||||
$param .= "&show=all";
|
||||
|
||||
@@ -685,21 +685,21 @@
|
||||
unset($sounds);
|
||||
}
|
||||
|
||||
//set default values
|
||||
if (empty($queue_strategy)) { $queue_strategy = "longest-idle-agent"; }
|
||||
if (empty($queue_moh_sound)) { $queue_moh_sound = "\$\${hold_music}"; }
|
||||
if (empty($queue_time_base_score)) { $queue_time_base_score = "system"; }
|
||||
if (empty($queue_max_wait_time)) { $queue_max_wait_time = "0"; }
|
||||
if (empty($queue_max_wait_time_with_no_agent)) { $queue_max_wait_time_with_no_agent = "90"; }
|
||||
if (empty($queue_max_wait_time_with_no_agent_time_reached)) { $queue_max_wait_time_with_no_agent_time_reached = "30"; }
|
||||
if (empty($queue_tier_rule_wait_second)) { $queue_tier_rule_wait_second = "30"; }
|
||||
if (empty($queue_discard_abandoned_after)) { $queue_discard_abandoned_after = "900"; }
|
||||
if (empty($queue_context)) { $queue_context = $domain_name; }
|
||||
if ($queue_record_template === null) { $queue_record_template = 'false'; }
|
||||
if ($queue_tier_rules_apply === null) { $queue_tier_rules_apply = false; }
|
||||
if ($queue_tier_rule_wait_multiply_level === null) { $queue_tier_rule_wait_multiply_level = true; }
|
||||
if ($queue_tier_rule_no_agent_no_wait === null) { $queue_tier_rule_no_agent_no_wait = true; }
|
||||
if ($queue_abandoned_resume_allowed === null) { $queue_abandoned_resume_allowed = false; }
|
||||
//set the default values
|
||||
$queue_strategy = $queue_strategy ?? "longest-idle-agent";
|
||||
$queue_moh_sound = $queue_moh_sound ?? "\$\${hold_music}";
|
||||
$queue_time_base_score = $queue_time_base_score ?? "system";
|
||||
$queue_max_wait_time = $queue_max_wait_time ?? "0";
|
||||
$queue_max_wait_time_with_no_agent = $queue_max_wait_time_with_no_agent ?? "90";
|
||||
$queue_max_wait_time_with_no_agent_time_reached = $queue_max_wait_time_with_no_agent_time_reached ?? "30";
|
||||
$queue_tier_rule_wait_second = $queue_tier_rule_wait_second ?? "30";
|
||||
$queue_discard_abandoned_after = $queue_discard_abandoned_after ?? "900";
|
||||
$queue_context = $queue_context ?? $domain_name;
|
||||
$queue_record_template = $queue_record_template ?? 'false';
|
||||
$queue_tier_rules_apply = $queue_tier_rules_apply ?? false;
|
||||
$queue_tier_rule_wait_multiply_level = $queue_tier_rule_wait_multiply_level ?? true;
|
||||
$queue_tier_rule_no_agent_no_wait = $queue_tier_rule_no_agent_no_wait ?? true;
|
||||
$queue_abandoned_resume_allowed = $queue_abandoned_resume_allowed ?? false;
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -144,11 +144,11 @@
|
||||
echo button::create(['type'=>'button','label'=>$text['button-wallboard'],'icon'=>'th','link'=>PROJECT_PATH.'/app/call_center_wallboard/call_center_wallboard.php']);
|
||||
}
|
||||
$margin_left = permission_exists('call_center_agent_view') || permission_exists('call_center_wallboard') ? 'margin-left: 15px;' : null;
|
||||
if (permission_exists('call_center_queue_add') && (!is_numeric($_SESSION['limit']['call_center_queues']['numeric'] ?? '') || $num_rows <= $_SESSION['limit']['call_center_queues']['numeric'])) {
|
||||
if (permission_exists('call_center_queue_add') && (!is_numeric($settings->get('limit', 'call_center_queues') ?? '') || $num_rows <= $settings->get('limit', 'call_center_queues'))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','style'=>$margin_left,'link'=>'call_center_queue_edit.php']);
|
||||
unset($margin_left);
|
||||
}
|
||||
if (permission_exists('call_center_queue_add') && $result && (!is_numeric($_SESSION['limit']['call_center_queues']['numeric'] ?? '') || $num_rows <= $_SESSION['limit']['call_center_queues']['numeric'])) {
|
||||
if (permission_exists('call_center_queue_add') && $result && (!is_numeric($settings->get('limit', 'call_center_queues') ?? '') || $num_rows <= $settings->get('limit', 'call_center_queues'))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none; '.!empty($margin_left),'onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
unset($margin_left);
|
||||
}
|
||||
@@ -176,7 +176,7 @@
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('call_center_queue_add') && $result && (!is_numeric($_SESSION['limit']['call_center_queues']['numeric'] ?? '') || $num_rows <= $_SESSION['limit']['call_center_queues']['numeric'])) {
|
||||
if (permission_exists('call_center_queue_add') && $result && (!is_numeric($settings->get('limit', 'call_center_queues') ?? '') || $num_rows <= $settings->get('limit', 'call_center_queues'))) {
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('call_center_queue_delete') && $result) {
|
||||
|
||||
@@ -37,9 +37,14 @@
|
||||
const app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||
|
||||
/**
|
||||
* define public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* define public variables
|
||||
*/
|
||||
public $call_center_queue_uuid;
|
||||
public $dialplan_uuid;
|
||||
public $queue_name;
|
||||
@@ -47,10 +52,27 @@
|
||||
public $destination_number;
|
||||
public $queue_cc_exit_keys;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -59,11 +81,14 @@
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +125,7 @@
|
||||
$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['domain_name'];
|
||||
$dialplan["dialplan_context"] = $this->domain_name;
|
||||
$dialplan["dialplan_continue"] = false;
|
||||
$dialplan["dialplan_order"] = "210";
|
||||
$dialplan["dialplan_enabled"] = true;
|
||||
@@ -190,7 +215,7 @@
|
||||
$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_data"] = $this->queue_name.'@'.$this->domain_name;
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
|
||||
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
|
||||
$y++;
|
||||
@@ -252,7 +277,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION['domain_name']);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//return the dialplan_uuid
|
||||
return $dialplan_response;
|
||||
@@ -299,7 +324,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid, queue_name, queue_extension from v_".$this->table." ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in ('".implode("','", $uuids)."') ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -315,16 +340,16 @@
|
||||
$x = 0;
|
||||
foreach ($call_center_queues as $call_center_queue_uuid => $call_center_queue) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $call_center_queue_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $call_center_queue['dialplan_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $call_center_queue['dialplan_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['call_center_tiers'][$x][$this->uuid_prefix.'uuid'] = $call_center_queue_uuid;
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$x++;
|
||||
$array['call_center_tiers'][$x]['queue_name'] = $call_center_queue['queue_extension']."@".$_SESSION['domain_name'];
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_center_tiers'][$x]['queue_name'] = $call_center_queue['queue_extension']."@".$this->domain_name;
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$x++;
|
||||
}
|
||||
|
||||
@@ -337,7 +362,7 @@
|
||||
//delete the queue in the switch
|
||||
if ($esl->is_connected()) {
|
||||
foreach ($uuids as $uuid) {
|
||||
$cmd = "callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$_SESSION['domain_name'];
|
||||
$cmd = "callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$this->domain_name;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
}
|
||||
@@ -359,7 +384,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
remove_config_from_cache('configuration:callcenter.conf');
|
||||
|
||||
//clear the destinations session array
|
||||
@@ -417,9 +442,9 @@
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
foreach ($uuids as $x => $uuid) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['call_center_tiers'][$x]['call_center_agent_uuid'] = $uuid;
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_center_tiers'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,7 +605,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_centers');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'app/call_centers');
|
||||
|
||||
//get http variables and set as php variables
|
||||
$order_by = $_GET["order_by"] ?? null;
|
||||
|
||||
@@ -46,20 +46,20 @@
|
||||
if ($_GET['type'] == 'recordings') {
|
||||
|
||||
$slash = substr($_GET['data'],0,1) != '/' ? '/' : null;
|
||||
$full_file_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].$slash.str_replace($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
$full_file_path = $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].$slash.str_replace($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
|
||||
}
|
||||
else if ($_GET['type'] == 'sounds') {
|
||||
|
||||
//get first installed language (like en/us/callie)
|
||||
$language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*");
|
||||
$language_paths = glob($settings->get('switch', 'sounds')."/*/*/*");
|
||||
foreach ($language_paths as $key => $path) {
|
||||
$path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path);
|
||||
$path = str_replace($settings->get('switch', 'sounds').'/', "", $path);
|
||||
$path_array = explode('/', $path);
|
||||
if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
$language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? '');
|
||||
$language_paths[$key] = str_replace($settings->get('switch', 'sounds')."/","",$language_paths[$key] ?? '');
|
||||
if (empty($language_paths[$key])) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
//determine the path for sound file
|
||||
$filename_parts = explode('/', str_replace('..', '', $_GET['data']));
|
||||
if (!is_array($filename_parts) || @sizeof($filename_parts) != 2) { exit; }
|
||||
$path = $_SESSION['switch']['sounds']['dir'].'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
$path = $settings->get('switch', 'sounds').'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
|
||||
//build full path to sound file
|
||||
$full_file_path = $path.$filename_parts[1];
|
||||
@@ -91,13 +91,13 @@
|
||||
$waveform = new Waveform($full_file_path);
|
||||
Waveform::$linesPerPixel = 1; // default: 8
|
||||
Waveform::$samplesPerLine = 512; // default: 512
|
||||
Waveform::$colorA = !empty($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
|
||||
Waveform::$colorA = !empty($settings->get('theme', 'audio_player_waveform_color_a_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_a_leg')) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($settings->get('theme', 'audio_player_waveform_color_b_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_b_leg')) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($settings->get('theme', 'audio_player_waveform_color_background')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_background')) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($settings->get('theme', 'audio_player_waveform_color_axis')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_axis')) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($settings->get('theme', 'audio_player_waveform_single_phase') ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($settings->get('theme', 'audio_player_waveform_single_axis') ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($settings->get('theme', 'audio_player_waveform_height')) && is_numeric(str_replace('px','',$settings->get('theme', 'audio_player_waveform_height'))) ? 2.2 * (int) str_replace('px','',$settings->get('theme', 'audio_player_waveform_height')) : null;
|
||||
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +470,7 @@
|
||||
echo " ".$text['label-call_flow_extension']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"".escape($call_flow_extension)."\" required='required' placeholder=\"".($_SESSION['call_flow']['extension_range']['text'] ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='text' name='call_flow_extension' maxlength='255' value=\"".escape($call_flow_extension)."\" required='required' placeholder=\"".($settings->get('call_flow', 'extension_range') ?? '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-call_flow_extension']."\n";
|
||||
echo "</td>\n";
|
||||
@@ -575,8 +575,8 @@
|
||||
if ($key == 'recordings') {
|
||||
if (
|
||||
!empty($instance_value) &&
|
||||
($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
($instance_value == $row["value"] || $instance_value == $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
|
||||
@@ -677,8 +677,8 @@
|
||||
if ($key == 'recordings') {
|
||||
if (
|
||||
!empty($instance_value) &&
|
||||
($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
($instance_value == $row["value"] || $instance_value == $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('call_flow_all')) {
|
||||
$param .= "&show=all";
|
||||
|
||||
@@ -38,11 +38,39 @@
|
||||
const app_name = 'call_flows';
|
||||
const app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -52,7 +80,14 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'call_flow_';
|
||||
@@ -60,12 +95,6 @@
|
||||
$this->table = 'call_flows';
|
||||
$this->uuid_prefix = 'call_flow_';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +130,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid, call_flow_context from v_".$this->table." ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -116,11 +145,11 @@
|
||||
$x = 0;
|
||||
foreach ($call_flows as $call_flow_uuid => $call_flow) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $call_flow_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $call_flow['dialplan_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $call_flow['dialplan_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$x++;
|
||||
}
|
||||
|
||||
@@ -197,7 +226,7 @@
|
||||
$sql .= "dialplan_uuid, call_flow_feature_code, call_flow_context from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -265,8 +294,8 @@
|
||||
//prepare the event
|
||||
$cmd = "sendevent PRESENCE_IN\n";
|
||||
$cmd .= "proto: flow\n";
|
||||
$cmd .= "login: ".$row['call_flow_feature_code']."@".$_SESSION['domain_name']."\n";
|
||||
$cmd .= "from: ".$row['call_flow_feature_code']."@".$_SESSION['domain_name']."\n";
|
||||
$cmd .= "login: ".$row['call_flow_feature_code']."@".$this->domain_name."\n";
|
||||
$cmd .= "from: ".$row['call_flow_feature_code']."@".$this->domain_name."\n";
|
||||
$cmd .= "status: Active (1 waiting)\n";
|
||||
$cmd .= "rpid: unknown\n";
|
||||
$cmd .= "event_type: presence\n";
|
||||
@@ -327,7 +356,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
@@ -46,20 +46,20 @@
|
||||
if ($_GET['type'] == 'recordings') {
|
||||
|
||||
$slash = substr($_GET['data'],0,1) != '/' ? '/' : null;
|
||||
$full_file_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].$slash.str_replace($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
$full_file_path = $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].$slash.str_replace($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
|
||||
}
|
||||
else if ($_GET['type'] == 'sounds') {
|
||||
|
||||
//get first installed language (like en/us/callie)
|
||||
$language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*");
|
||||
$language_paths = glob($settings->get('switch', 'sounds')."/*/*/*");
|
||||
foreach ($language_paths as $key => $path) {
|
||||
$path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path);
|
||||
$path = str_replace($settings->get('switch', 'sounds').'/', "", $path);
|
||||
$path_array = explode('/', $path);
|
||||
if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
$language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? '');
|
||||
$language_paths[$key] = str_replace($settings->get('switch', 'sounds')."/","",$language_paths[$key] ?? '');
|
||||
if (empty($language_paths[$key])) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
//determine the path for sound file
|
||||
$filename_parts = explode('/', str_replace('..', '', $_GET['data']));
|
||||
if (!is_array($filename_parts) || @sizeof($filename_parts) != 2) { exit; }
|
||||
$path = $_SESSION['switch']['sounds']['dir'].'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
$path = $settings->get('switch', 'sounds').'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
|
||||
//build full path to sound file
|
||||
$full_file_path = $path.$filename_parts[1];
|
||||
@@ -91,13 +91,13 @@
|
||||
$waveform = new Waveform($full_file_path);
|
||||
Waveform::$linesPerPixel = 1; // default: 8
|
||||
Waveform::$samplesPerLine = 512; // default: 512
|
||||
Waveform::$colorA = !empty($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
|
||||
Waveform::$colorA = !empty($settings->get('theme', 'audio_player_waveform_color_a_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_a_leg')) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($settings->get('theme', 'audio_player_waveform_color_b_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_b_leg')) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($settings->get('theme', 'audio_player_waveform_color_background')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_background')) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($settings->get('theme', 'audio_player_waveform_color_axis')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_axis')) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($settings->get('theme', 'audio_player_waveform_single_phase') ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($settings->get('theme', 'audio_player_waveform_single_axis') ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($settings->get('theme', 'audio_player_waveform_height')) && is_numeric(str_replace('px','',$settings->get('theme', 'audio_player_waveform_height'))) ? 2.2 * (int) str_replace('px','',$settings->get('theme', 'audio_player_waveform_height')) : null;
|
||||
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'app/call_forward');
|
||||
|
||||
//get posted data and set defaults
|
||||
$action = $_POST['action'] ?? '';
|
||||
@@ -127,7 +127,7 @@
|
||||
unset($parameters);
|
||||
|
||||
//prepare the paging
|
||||
$rows_per_page = !empty($_SESSION['domain']['paging']['numeric']) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = !empty($settings->get('domain', 'paging')) ? $settings->get('domain', 'paging') : 50;
|
||||
|
||||
if ($search) {
|
||||
$params[] = "search=" . $search;
|
||||
|
||||
@@ -37,12 +37,22 @@
|
||||
const app_name = 'call_forward';
|
||||
const app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d';
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_name;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $debug;
|
||||
public $domain_uuid;
|
||||
public $domain_name;
|
||||
public $extension_uuid;
|
||||
public $forward_all_destination;
|
||||
public $forward_all_enabled;
|
||||
@@ -50,11 +60,27 @@
|
||||
public $outbound_caller_id_name;
|
||||
public $outbound_caller_id_number;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $extension;
|
||||
private $number_alias;
|
||||
private $toll_allow;
|
||||
@@ -62,15 +88,19 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign private variables
|
||||
$this->toggle_field = 'forward_all_enabled';
|
||||
$this->toggle_values = ['true', 'false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
public function set() {
|
||||
@@ -166,7 +196,7 @@
|
||||
$sql .= "from v_extensions ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and extension_uuid in (" . implode(', ', $uuids) . ") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -235,7 +265,7 @@
|
||||
if ($settings->get('device', 'feature_sync', false)) {
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$feature_event_notify = new feature_event_notify;
|
||||
$feature_event_notify->domain_name = $_SESSION['domain_name'];
|
||||
$feature_event_notify->domain_name = $this->domain_name;
|
||||
$feature_event_notify->extension = $extension['extension'];
|
||||
$feature_event_notify->do_not_disturb = $extension['do_not_disturb'];
|
||||
$feature_event_notify->ring_count = ceil($extension['call_timeout'] / 6);
|
||||
@@ -252,7 +282,7 @@
|
||||
}
|
||||
|
||||
//synchronize configuration
|
||||
if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions')) && is_readable($this->settings->get('switch', 'extensions'))) {
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
@@ -261,9 +291,9 @@
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$cache->delete("directory:" . $extension['extension'] . "@" . $_SESSION['domain_name']);
|
||||
$cache->delete("directory:" . $extension['extension'] . "@" . $this->domain_name);
|
||||
if ($extension['number_alias'] != '') {
|
||||
$cache->delete("directory:" . $extension['number_alias'] . "@" . $_SESSION['domain_name']);
|
||||
$cache->delete("directory:" . $extension['number_alias'] . "@" . $this->domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,32 +33,73 @@
|
||||
const app_name = 'call_forward';
|
||||
const app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d';
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_name;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $debug;
|
||||
public $domain_uuid;
|
||||
public $domain_name;
|
||||
public $extension_uuid;
|
||||
public $extension;
|
||||
public $enabled;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Username set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $permission;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
$this->username = $setting_array['username'] ?? $_SESSION['username'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
//update the user_status
|
||||
@@ -69,8 +110,8 @@
|
||||
$user_status = "Logged Out";
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['username']."@".$this->domain_name." '".$user_status."'";
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$switch_cmd .= "callcenter_config agent set status ".$this->username."@".$this->domain_name." '".$user_status."'";
|
||||
$esl->request('api '.$switch_cmd);
|
||||
}
|
||||
|
||||
//update the database user_status
|
||||
@@ -81,7 +122,7 @@
|
||||
$sql .= "and username = :username ";
|
||||
$parameters['user_status'] = "Do Not Disturb";
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$parameters['username'] = $_SESSION['username'];
|
||||
$parameters['username'] = $this->username;
|
||||
$this->database->execute($sql);
|
||||
}
|
||||
}
|
||||
@@ -140,18 +181,7 @@
|
||||
|
||||
} //function
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $permission;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
/**
|
||||
* toggle records
|
||||
*/
|
||||
public function toggle($records) {
|
||||
@@ -197,7 +227,7 @@
|
||||
$sql .= "from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -257,10 +287,10 @@
|
||||
$p->delete('extension_edit', 'temp');
|
||||
|
||||
//send feature event notify to the phone
|
||||
if ($settings->get('device', 'feature_sync', false)) {
|
||||
if ($this->settings->get('device', 'feature_sync', false)) {
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$feature_event_notify = new feature_event_notify;
|
||||
$feature_event_notify->domain_name = $_SESSION['domain_name'];
|
||||
$feature_event_notify->domain_name = $this->domain_name;
|
||||
$feature_event_notify->extension = $extension['extension'];
|
||||
$feature_event_notify->do_not_disturb = $extension['do_not_disturb'] == "true" ? "false" : "true";
|
||||
$feature_event_notify->ring_count = ceil($extension['call_timeout'] / 6);
|
||||
@@ -277,7 +307,7 @@
|
||||
}
|
||||
|
||||
//synchronize configuration
|
||||
if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions')) && is_readable($this->settings->get('switch', 'extensions'))) {
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
@@ -286,9 +316,9 @@
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$cache->delete("directory:".$extension['extension']."@".$_SESSION['domain_name']);
|
||||
$cache->delete("directory:".$extension['extension']."@".$this->domain_name);
|
||||
if ($extension['number_alias'] != '') {
|
||||
$cache->delete("directory:".$extension['number_alias']."@".$_SESSION['domain_name']);
|
||||
$cache->delete("directory:".$extension['number_alias']."@".$this->domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
public $do_not_disturb;
|
||||
public $ring_count;
|
||||
|
||||
//feature_event method
|
||||
//feature_event method
|
||||
public function send_notify() {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
|
||||
@@ -38,9 +38,14 @@
|
||||
const app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $db_type;
|
||||
public $follow_me_uuid;
|
||||
public $cid_name_prefix;
|
||||
@@ -85,23 +90,52 @@
|
||||
public $destination_order = 1;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
private $toll_allow;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $extension;
|
||||
private $number_alias;
|
||||
private $permission;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
public function add() {
|
||||
@@ -270,18 +304,7 @@
|
||||
|
||||
} //function
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $permission;
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
/**
|
||||
* toggle records
|
||||
*/
|
||||
public function toggle($records) {
|
||||
@@ -327,7 +350,7 @@
|
||||
$sql .= "from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -410,7 +433,7 @@
|
||||
if ($settings->get('device', 'feature_sync', false)) {
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$feature_event_notify = new feature_event_notify;
|
||||
$feature_event_notify->domain_name = $_SESSION['domain_name'];
|
||||
$feature_event_notify->domain_name = $this->domain_name;
|
||||
$feature_event_notify->extension = $extension['extension'];
|
||||
$feature_event_notify->do_not_disturb = $extension['do_not_disturb'];
|
||||
$feature_event_notify->ring_count = ceil($extension['call_timeout'] / 6);
|
||||
@@ -427,7 +450,7 @@
|
||||
}
|
||||
|
||||
//synchronize configuration
|
||||
if (!empty($_SESSION['switch']['extensions']['dir']) && is_readable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions')) && is_readable($this->settings->get('switch', 'extensions'))) {
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
@@ -436,9 +459,9 @@
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
foreach ($extensions as $uuid => $extension) {
|
||||
$cache->delete("directory:".$extension['extension']."@".$_SESSION['domain_name']);
|
||||
$cache->delete("directory:".$extension['extension']."@".$this->domain_name);
|
||||
if ($extension['number_alias'] != '') {
|
||||
$cache->delete("directory:".$extension['number_alias']."@".$_SESSION['domain_name']);
|
||||
$cache->delete("directory:".$extension['number_alias']."@".$this->domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'app/call_forward');
|
||||
|
||||
//extensions link
|
||||
$extension_link = '#';
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
//set additional variables
|
||||
$search = $_GET["search"] ?? '';
|
||||
$show = $_GET["show"] ?? '';
|
||||
$result_count = 0;
|
||||
|
||||
//get the http post data
|
||||
if (!empty($_POST['call_recordings']) && is_array($_POST['call_recordings'])) {
|
||||
@@ -100,7 +101,7 @@
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//prepare some of the paging values
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$page = $_GET['page'] ?? '';
|
||||
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
|
||||
$offset = $rows_per_page * $page;
|
||||
@@ -145,8 +146,8 @@
|
||||
}
|
||||
|
||||
//limit the number of results
|
||||
if (!empty($_SESSION['cdr']['limit']['numeric']) && $_SESSION['cdr']['limit']['numeric'] > 0) {
|
||||
$num_rows = $_SESSION['cdr']['limit']['numeric'];
|
||||
if (!empty($settings->get('cdr', 'limit')) && $settings->get('cdr', 'limit') > 0) {
|
||||
$num_rows = $settings->get('cdr', 'limit');
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
|
||||
@@ -35,11 +35,45 @@
|
||||
const app_name = 'follow_me';
|
||||
const app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Username set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $settings;
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $description_field;
|
||||
@@ -50,18 +84,21 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign the variables
|
||||
$this->name = 'call_recording';
|
||||
$this->table = 'call_recordings';
|
||||
$this->description_field = 'call_recording_description';
|
||||
$this->location = 'call_recordings.php';
|
||||
|
||||
//allow global
|
||||
$this->database = database::new();
|
||||
|
||||
//initialize the settings object
|
||||
$this->settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
//get call recording details from database
|
||||
$sql = "select call_recording_name, call_recording_path ";
|
||||
if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
if (!empty($settings->get('call_recordings', 'storage_type')) && $settings->get('call_recordings', 'storage_type') == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
$sql = ", call_recording_base64 ";
|
||||
}
|
||||
$sql .= "from view_call_recordings ";
|
||||
@@ -54,7 +54,7 @@
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$call_recording_name = $row['call_recording_name'];
|
||||
$call_recording_path = $row['call_recording_path'];
|
||||
if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
if (!empty($settings->get('call_recordings', 'storage_type')) && $settings->get('call_recordings', 'storage_type') == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
file_put_contents($call_recording_path.'/'.$call_recording_name, base64_decode($row['call_recording_base64']));
|
||||
}
|
||||
}
|
||||
@@ -78,13 +78,13 @@
|
||||
$waveform = new Waveform($full_recording_path);
|
||||
Waveform::$linesPerPixel = 1; // default: 8
|
||||
Waveform::$samplesPerLine = 512; // default: 512
|
||||
Waveform::$colorA = !empty($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
|
||||
Waveform::$colorA = !empty($settings->get('theme', 'audio_player_waveform_color_a_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_a_leg')) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($settings->get('theme', 'audio_player_waveform_color_b_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_b_leg')) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($settings->get('theme', 'audio_player_waveform_color_background')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_background')) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($settings->get('theme', 'audio_player_waveform_color_axis')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_axis')) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($settings->get('theme', 'audio_player_waveform_single_phase') ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($settings->get('theme', 'audio_player_waveform_single_axis') ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($settings->get('theme', 'audio_player_waveform_height')) && is_numeric(str_replace('px','',$settings->get('theme', 'audio_player_waveform_height'))) ? 2.2 * (int) str_replace('px','',$settings->get('theme', 'audio_player_waveform_height')) : null;
|
||||
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
//if base64, remove temp recording file
|
||||
if (!empty($_SESSION['call_recordings']['storage_type']['text']) && $_SESSION['call_recordings']['storage_type']['text'] == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
if (!empty($settings->get('call_recordings', 'storage_type')) && $settings->get('call_recordings', 'storage_type') == 'base64' && !empty($row['call_recording_base64'])) {
|
||||
@unlink($full_recording_path);
|
||||
}
|
||||
unset($row);
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
}
|
||||
|
||||
function get_record_cmd(uuid, prefix, name) {
|
||||
cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";
|
||||
cmd = \"uuid_record \"+uuid+\" start ".$settings->get('switch', 'recordings')."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";
|
||||
return escape(cmd);
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
|
||||
echo " </table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<input type='hidden' name='".$_SESSION['app']['calls_active']['token']['name']."' value='".$_SESSION['app']['calls_active']['token']['hash']."'>\n";
|
||||
echo "<input type='hidden' name='".$settings->get('app', 'calls_active')['name']."' value='".$settings->get('app', 'calls_active')['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
?>
|
||||
|
||||
@@ -101,16 +101,16 @@
|
||||
|
||||
//add record path and name
|
||||
if ($rec == "true") {
|
||||
$record_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
|
||||
if (isset($_SESSION['recordings']['extension']['text'])) {
|
||||
$record_extension = $_SESSION['recordings']['extension']['text'];
|
||||
$record_path = $settings->get('switch', 'recordings')."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
|
||||
if (!empty($settings->get('recordings', 'extension'))) {
|
||||
$record_extension = $settings->get('recordings', 'extension');
|
||||
}
|
||||
else {
|
||||
$record_extension = 'wav';
|
||||
}
|
||||
if (isset($_SESSION['recordings']['template']['text'])) {
|
||||
if (!empty($settings->get('recordings', 'template'))) {
|
||||
//${year}${month}${day}-${caller_id_number}-${caller_destination}-${uuid}.${record_extension}
|
||||
$record_name = $_SESSION['recordings']['template']['text'];
|
||||
$record_name = $settings->get('recordings', 'template');
|
||||
$record_name = str_replace('${year}', date("Y"), $record_name);
|
||||
$record_name = str_replace('${month}', date("M"), $record_name);
|
||||
$record_name = str_replace('${day}', date("d"), $record_name);
|
||||
|
||||
@@ -352,7 +352,7 @@
|
||||
echo " ".$text['label-conference_center_extension']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='conference_center_extension' maxlength='255' value=\"".escape($conference_center_extension)."\" required='required' placeholder=\"".($_SESSION['conference_center']['extension_range']['text'] ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='text' name='conference_center_extension' maxlength='255' value=\"".escape($conference_center_extension)."\" required='required' placeholder=\"".($settings->get('conference_center', 'extension_range') ?? '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-conference_center_extension']."\n";
|
||||
echo "</td>\n";
|
||||
@@ -379,8 +379,8 @@
|
||||
if ($key == 'recordings') {
|
||||
if (
|
||||
!empty($instance_value) &&
|
||||
($instance_value == $row["value"] || $instance_value == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
($instance_value == $row["value"] || $instance_value == $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.$row["value"]) &&
|
||||
file_exists($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].'/'.pathinfo($row["value"], PATHINFO_BASENAME))
|
||||
) {
|
||||
$selected = "selected='selected'";
|
||||
$playable = '../recordings/recordings.php?action=download&type=rec&filename='.pathinfo($row["value"], PATHINFO_BASENAME);
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('conference_center_all')) {
|
||||
$param .= "&show=all";
|
||||
|
||||
@@ -90,6 +90,10 @@
|
||||
$participant_pin = preg_replace('{\D}', '', $participant_pin);
|
||||
}
|
||||
|
||||
//set the default values
|
||||
$profile = $profile ?? 'default';
|
||||
$max_members = $max_members ?? 0;
|
||||
|
||||
//get the conference centers array and set a default conference center
|
||||
$sql = "select * from v_conference_centers ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
@@ -141,7 +145,7 @@
|
||||
$default_language = 'en';
|
||||
$default_dialect = 'us';
|
||||
$default_voice = 'callie';
|
||||
$switch_cmd = "conference ".$conference_room_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
$switch_cmd = "conference ".$conference_room_uuid."@".$_SESSION['domain_name']." play ".$settings->get('switch', 'sounds')."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
|
||||
//connect to event socket
|
||||
$esl = event_socket::create();
|
||||
@@ -296,10 +300,6 @@
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
if ($action == "add" && permission_exists('conference_room_add')) {
|
||||
//set default values
|
||||
if (empty($profile)) { $profile = 'default'; }
|
||||
if (empty($max_members)) { $max_members = 0; }
|
||||
|
||||
//add a conference room
|
||||
$conference_room_uuid = uuid();
|
||||
$array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid;
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
$default_language = 'en';
|
||||
$default_dialect = 'us';
|
||||
$default_voice = 'callie';
|
||||
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$settings->get('switch', 'sounds')."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
//connect to event socket
|
||||
$esl = event_socket::create();
|
||||
if ($esl) {
|
||||
@@ -178,7 +178,7 @@
|
||||
$num_rows = $conference_center->room_count();
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = !empty($search) ? "&search=".$search : null;
|
||||
if (isset($_GET['page'])) {
|
||||
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = '';
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
||||
@@ -111,7 +111,7 @@
|
||||
echo " <div class='heading'><b>".$text['title-conference_session_details']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','link'=>'conference_sessions.php']);
|
||||
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
|
||||
$tmp_dir = $settings->get('switch', 'recordings').'/'.$_SESSION['domain_name'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
|
||||
$tmp_name = '';
|
||||
if (!empty($row['conference_session_uuid']) && file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) {
|
||||
$tmp_name = $row['conference_session_uuid'].".mp3";
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = '';
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
$event .= "login: agent+".$this->agent_name."@".$this->domain_name."\n";
|
||||
$event .= "unique-id: ".$this->agent_uuid."\n";
|
||||
$event .= "answer-state: ".$this->answer_state."\n";
|
||||
event_socket::command($event);
|
||||
$esl->request('api ' . $event);
|
||||
//echo $event."<br />";
|
||||
}
|
||||
} //function
|
||||
|
||||
@@ -35,9 +35,14 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
const app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $conference_room_uuid;
|
||||
public $order_by;
|
||||
public $order;
|
||||
@@ -48,11 +53,39 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
public $created_by;
|
||||
public $toggle_field;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Username set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -63,13 +96,15 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +182,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
if ($not_admin) {
|
||||
$sql .= "and r.conference_room_uuid = u.conference_room_uuid ";
|
||||
$sql .= "and u.user_uuid = :user_uuid ";
|
||||
$parameters['user_uuid'] = $_SESSION["user_uuid"];
|
||||
$parameters['user_uuid'] = $this->user_uuid;
|
||||
}
|
||||
if (!empty($this->search)) {
|
||||
$sql .= "and (";
|
||||
@@ -240,8 +275,8 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
}
|
||||
|
||||
//set the path for the directory
|
||||
$default_path = $_SESSION['switch']['call_recordings']['dir']."/".$_SESSION['domain_name'];
|
||||
|
||||
$default_path = $this->settings->get('switch', 'call_recordings')."/".$this->domain_name;
|
||||
|
||||
//get the file path and name
|
||||
$record_path = dirname($recording);
|
||||
$record_name = basename($recording);
|
||||
@@ -288,7 +323,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
}
|
||||
|
||||
//if base64, remove temp recording file
|
||||
//if ($_SESSION['conference']['storage_type']['text'] == 'base64' && $row['conference_recording_base64'] != '') {
|
||||
//if ($this->settings->get('conference', 'storage_type') == 'base64' && $row['conference_recording_base64'] != '') {
|
||||
// @unlink($record_path.'/'.$record_name);
|
||||
//}
|
||||
}
|
||||
@@ -330,18 +365,18 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
$sql = "select dialplan_uuid from v_conference_centers ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and conference_center_uuid = :conference_center_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$parameters['conference_center_uuid'] = $record['uuid'];
|
||||
$dialplan_uuid = $this->database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +398,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
@@ -412,9 +447,9 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
|
||||
//create array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['conference_room_users'][$x]['conference_room_uuid'] = $record['uuid'];
|
||||
$array['conference_room_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['conference_room_users'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,9 +508,9 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
|
||||
//create array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['conference_session_details'][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array['conference_session_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['conference_session_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +578,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -584,7 +619,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
@@ -646,7 +681,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -669,9 +704,9 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
$default_language = 'en';
|
||||
$default_dialect = 'us';
|
||||
$default_voice = 'callie';
|
||||
// $recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
// $switch_cmd_record = "conference ".$meeting_uuid[$uuid]."@".$_SESSION['domain_name']." record ".$recording_dir.'/'.$meeting_uuid[$uuid].'.wav';
|
||||
$switch_cmd_notice = "conference ".$meeting_uuid[$uuid]."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
// $recording_dir = $this->settings->get('switch', 'recordings').'/'.$this->domain_name.'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
// $switch_cmd_record = "conference ".$meeting_uuid[$uuid]."@".$this->domain_name." record ".$recording_dir.'/'.$meeting_uuid[$uuid].'.wav';
|
||||
$switch_cmd_notice = "conference ".$meeting_uuid[$uuid]."@".$this->domain_name." play ".$this->settings->get('switch', 'sounds')."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
//execute api commands
|
||||
// if (!file_exists($recording_dir.'/'.$meeting_uuid[$uuid].'.wav')) {
|
||||
$esl = event_socket::create();
|
||||
@@ -744,7 +779,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (!empty($rows)) {
|
||||
foreach ($rows as $x => $row) {
|
||||
@@ -787,7 +822,7 @@ Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
//example conference center
|
||||
/*
|
||||
$conference_center = new conference_centers;
|
||||
$conference_center->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$conference_center->domain_uuid = $this->domain_uuid;
|
||||
$conference_center->rows_per_page = 150;
|
||||
$conference_center->offset = 0;
|
||||
$conference_center->created_by = uuid;
|
||||
|
||||
@@ -46,20 +46,20 @@
|
||||
if ($_GET['type'] == 'recordings') {
|
||||
|
||||
$slash = substr($_GET['data'],0,1) != '/' ? '/' : null;
|
||||
$full_file_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'].$slash.str_replace($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
$full_file_path = $settings->get('switch', 'recordings')."/".$_SESSION['domain_name'].$slash.str_replace($settings->get('switch', 'recordings')."/".$_SESSION['domain_name'], '', $_GET['data']);
|
||||
|
||||
}
|
||||
else if ($_GET['type'] == 'sounds') {
|
||||
|
||||
//get first installed language (like en/us/callie)
|
||||
$language_paths = glob($_SESSION["switch"]['sounds']['dir']."/*/*/*");
|
||||
$language_paths = glob($settings->get('switch', 'sounds')."/*/*/*");
|
||||
foreach ($language_paths as $key => $path) {
|
||||
$path = str_replace($_SESSION["switch"]['sounds']['dir'].'/', "", $path);
|
||||
$path = str_replace($settings->get('switch', 'sounds').'/', "", $path);
|
||||
$path_array = explode('/', $path);
|
||||
if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
$language_paths[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$language_paths[$key] ?? '');
|
||||
$language_paths[$key] = str_replace($settings->get('switch', 'sounds')."/","",$language_paths[$key] ?? '');
|
||||
if (empty($language_paths[$key])) {
|
||||
unset($language_paths[$key]);
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
//determine the path for sound file
|
||||
$filename_parts = explode('/', str_replace('..', '', $_GET['data']));
|
||||
if (!is_array($filename_parts) || @sizeof($filename_parts) != 2) { exit; }
|
||||
$path = $_SESSION['switch']['sounds']['dir'].'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
$path = $settings->get('switch', 'sounds').'/'.$language_path.'/'.$filename_parts[0].'/8000/';
|
||||
|
||||
//build full path to sound file
|
||||
$full_file_path = $path.$filename_parts[1];
|
||||
@@ -91,13 +91,13 @@
|
||||
$waveform = new Waveform($full_file_path);
|
||||
Waveform::$linesPerPixel = 1; // default: 8
|
||||
Waveform::$samplesPerLine = 512; // default: 512
|
||||
Waveform::$colorA = !empty($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_a_leg']['text']) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_b_leg']['text']) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($_SESSION['theme']['audio_player_waveform_color_background']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_background']['text']) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($_SESSION['theme']['audio_player_waveform_color_axis']['text']) ? color_to_rgba_array($_SESSION['theme']['audio_player_waveform_color_axis']['text']) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($_SESSION['theme']['audio_player_waveform_single_phase']['boolean'] ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($_SESSION['theme']['audio_player_waveform_single_axis']['boolean'] ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($_SESSION['theme']['audio_player_waveform_height']['text']) && is_numeric(str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text'])) ? 2.2 * (int) str_replace('px','',$_SESSION['theme']['audio_player_waveform_height']['text']) : null;
|
||||
Waveform::$colorA = !empty($settings->get('theme', 'audio_player_waveform_color_a_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_a_leg')) : [32,134,37,0.6]; // array rgba, left (a-leg) wave color
|
||||
Waveform::$colorB = !empty($settings->get('theme', 'audio_player_waveform_color_b_leg')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_b_leg')) : [0,125,232,0.6]; // array rgba, right (b-leg) wave color
|
||||
Waveform::$backgroundColor = !empty($settings->get('theme', 'audio_player_waveform_color_background')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_background')) : [0,0,0,0]; // array rgba, default: transparent
|
||||
Waveform::$axisColor = !empty($settings->get('theme', 'audio_player_waveform_color_axis')) ? color_to_rgba_array($settings->get('theme', 'audio_player_waveform_color_axis')) : [0,0,0,0.3]; // array rgba
|
||||
Waveform::$singlePhase = filter_var($settings->get('theme', 'audio_player_waveform_single_phase') ?? false, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // positive phase only - left (a-leg) top, right (b-leg) bottom
|
||||
Waveform::$singleAxis = filter_var($settings->get('theme', 'audio_player_waveform_single_axis') ?? true, FILTER_VALIDATE_BOOL) ? 'true': 'false'; // combine channels into single axis
|
||||
$height = !empty($settings->get('theme', 'audio_player_waveform_height')) && is_numeric(str_replace('px','',$settings->get('theme', 'audio_player_waveform_height'))) ? 2.2 * (int) str_replace('px','',$settings->get('theme', 'audio_player_waveform_height')) : null;
|
||||
$wf = $waveform->getWaveform($temp_filename, 1600, $height ?? 180); // input: png filename returns boolean true/false, or 'base64' returns base64 string
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&id=".!empty($conference_control_uuid);
|
||||
if (isset($_GET['page'])) {
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
unset($sql);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = $search ? "&search=".$search : null;
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
||||
|
||||
@@ -55,11 +55,9 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&id=".$conference_profile_uuid;
|
||||
if (isset($_GET['page'])) {
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
private $toggle_values;
|
||||
private $description_field;
|
||||
private $location;
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
@@ -54,11 +55,9 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
echo " ".$text['label-extension']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='conference_extension' maxlength='255' value=\"".escape($conference_extension)."\" required='required' placeholder=\"".($_SESSION['conference']['extension_range']['text'] ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='text' name='conference_extension' maxlength='255' value=\"".escape($conference_extension)."\" required='required' placeholder=\"".($settings->get('conference', 'extension_range') ?? '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "".$text['description-extension']."\n";
|
||||
echo "</td>\n";
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('conference_all')) {
|
||||
$param .= "&show=all";
|
||||
|
||||
@@ -33,11 +33,33 @@
|
||||
const app_name = 'conferences';
|
||||
const app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -48,7 +70,15 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'conference_';
|
||||
$this->list_page = 'conferences.php';
|
||||
@@ -56,11 +86,6 @@
|
||||
$this->uuid_prefix = 'conference_';
|
||||
$this->toggle_field = 'conference_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,20 +117,20 @@
|
||||
$sql = "select dialplan_uuid from v_conferences ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and conference_uuid = :conference_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$parameters['conference_uuid'] = $record['uuid'];
|
||||
$dialplan_uuid = $this->database->select($sql, $parameters, 'column');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//build array
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['conference_users'][$x]['conference_uuid'] = $record['uuid'];
|
||||
$array['conference_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['conference_users'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -133,7 +158,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
@@ -180,7 +205,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, dialplan_uuid from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -221,7 +246,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
@@ -270,7 +295,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$y = 0;
|
||||
@@ -291,7 +316,7 @@
|
||||
$sql_2 .= "where conference_uuid = :conference_uuid ";
|
||||
$sql_2 .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters_2['conference_uuid'] = $row['conference_uuid'];
|
||||
$parameters_2['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters_2['domain_uuid'] = $this->domain_uuid;
|
||||
$conference_users = $this->database->select($sql_2, $parameters_2, 'all');
|
||||
if (is_array($conference_users) && @sizeof($conference_users) != 0) {
|
||||
foreach ($conference_users as $conference_user) {
|
||||
@@ -356,7 +381,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
elseif ($data == "record") {
|
||||
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$recording_dir = $settings->get('switch', 'recordings').'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$switch_cmd .= $recording_dir."/{$uuid}.wav";
|
||||
if (!file_exists($switch_cmd)) {
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
@@ -226,7 +226,7 @@
|
||||
}
|
||||
elseif ($data == "norecord") {
|
||||
//stop recording and rename the file
|
||||
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$recording_dir = $settings->get('switch', 'recordings').'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$switch_cmd .= $recording_dir."/".$uuid.".wav";
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
echo "<div style='float: right;'>\n";
|
||||
|
||||
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$recording_dir = $settings->get('switch', 'recordings').'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$recording_name = '';
|
||||
if (!empty($recording_dir) && !empty($row['uuid'])) {
|
||||
if (file_exists($recording_dir.'/'.$row['uuid'].'.wav')) {
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
unset($parameters);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "search=".$search;
|
||||
$page = empty($_GET['page']) ? $page = 0 : $page = $_GET['page'];
|
||||
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/destinations-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/destinations-".$_SESSION['domain_name'].".csv";
|
||||
file_put_contents($file, $_POST['data']);
|
||||
$_SESSION['file'] = $file;
|
||||
$_SESSION['file_name'] = $_FILES['ulfile']['name'];
|
||||
@@ -82,11 +82,11 @@
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('destination_upload')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*');
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$settings->get('server', 'temp')."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$settings->get('server', 'temp').'*');
|
||||
unset($_POST['txtCommand']);
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$file = $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name'];
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
}
|
||||
@@ -277,8 +277,8 @@
|
||||
$dialplan_detail_order = $dialplan_detail_order + 10;
|
||||
|
||||
//set the dialplan detail type
|
||||
if (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
|
||||
if (!empty($settings->get('dialplan', 'destination'))) {
|
||||
$dialplan_detail_type = $settings->get('dialplan', 'destination');
|
||||
}
|
||||
else {
|
||||
$dialplan_detail_type = "destination_number";
|
||||
@@ -339,8 +339,8 @@
|
||||
//check the destination number
|
||||
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
|
||||
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
|
||||
if (!empty($_SESSION['dialplan']['destination']['text'])) {
|
||||
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
|
||||
if (!empty($settings->get('dialplan', 'destination'))) {
|
||||
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $settings->get('dialplan', 'destination');
|
||||
}
|
||||
else {
|
||||
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
|
||||
//function to return the action names in the order defined
|
||||
function action_name($destination_array, $destination_actions) {
|
||||
global $settings;
|
||||
$actions = [];
|
||||
if (!empty($destination_array) && is_array($destination_array)) {
|
||||
if (!empty($destination_actions) && is_array($destination_actions)) {
|
||||
@@ -102,7 +103,7 @@
|
||||
if (!isset($language2) && !isset($text2)) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_languages.php")) {
|
||||
$language2 = new text;
|
||||
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/dialplans');
|
||||
$text2 = $language2->get($settings->get('domain', 'language', 'en-us'), 'app/dialplans');
|
||||
}
|
||||
}
|
||||
$actions[] = trim($text2['title-other'].' › '.$text2['option-'.str_replace('_','_',$key)]);
|
||||
@@ -110,7 +111,7 @@
|
||||
else {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$group."/app_languages.php")) {
|
||||
$language3 = new text;
|
||||
$text3 = $language3->get($_SESSION['domain']['language']['code'], 'app/'.$group);
|
||||
$text3 = $language3->get($settings->get('domain', 'language', 'en-us'), 'app/'.$group);
|
||||
$actions[] = trim($text3['title-'.$group].' › '.$key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,16 +35,44 @@
|
||||
const app_name = 'destinations';
|
||||
const app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_name;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $destinations;
|
||||
public $domain_uuid;
|
||||
public $domain_name;
|
||||
public $start_stamp_begin;
|
||||
public $start_stamp_end;
|
||||
public $quick_select;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
@@ -54,31 +82,19 @@
|
||||
private $list_page;
|
||||
private $table;
|
||||
private $uuid_prefix;
|
||||
private $database;
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct($setting_array = []) {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//open a database connection
|
||||
if (empty($setting_array['database'])) {
|
||||
$this->database = database::new();
|
||||
} else {
|
||||
$this->database = $setting_array['database'];
|
||||
}
|
||||
|
||||
//set the domain details
|
||||
$this->domain_uuid = $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//get the settings object
|
||||
if (empty($setting_array['settings'])) {
|
||||
$this->settings = new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
} else {
|
||||
$this->settings = $setting_array['settings'];
|
||||
}
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'destination_';
|
||||
@@ -553,7 +569,7 @@
|
||||
public function all($destination_type) {
|
||||
|
||||
//set the global variables
|
||||
global $db_type;
|
||||
global $db_type, $settings;
|
||||
|
||||
//set default values
|
||||
$destination_name = '';
|
||||
@@ -575,7 +591,7 @@
|
||||
try {
|
||||
include($config_path);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
catch (Throwable $e) {
|
||||
//echo 'Caught exception: ', $e->getMessage(), "\n";
|
||||
}
|
||||
$x++;
|
||||
@@ -764,7 +780,7 @@
|
||||
public function get($destination_type) {
|
||||
|
||||
//set the global variables
|
||||
global $db_type;
|
||||
global $db_type, $settings;
|
||||
|
||||
//get the domain_name
|
||||
$sql = "select domain_name from v_domains ";
|
||||
|
||||
@@ -540,7 +540,7 @@
|
||||
unset($sql, $parameters);
|
||||
|
||||
//set the defaults
|
||||
if ($device_enabled === null) { $device_enabled = true; }
|
||||
$device_enabled = $device_enabled ?? true;
|
||||
|
||||
//use the device address to get the vendor
|
||||
if (empty($device_vendor)) {
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/devices-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/devices-".$_SESSION['domain_name'].".csv";
|
||||
if (file_put_contents($file, $_POST['data'])) {
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('device_import')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
$file = $_SESSION['server']['temp']['dir']."/devices-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/devices-".$_SESSION['domain_name'].".csv";
|
||||
if (move_uploaded_file($_FILES['ulfile']['tmp_name'], $file)) {
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
@@ -443,7 +443,7 @@
|
||||
//view_array($message);
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['provision']['path']['text'])) {
|
||||
if (!empty($settings->get('provision', 'path'))) {
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $domain_uuid;
|
||||
$response = $prov->write();
|
||||
|
||||
@@ -313,11 +313,11 @@
|
||||
|
||||
//add an empty row
|
||||
if (empty($device_profile_keys) || !is_array($device_profile_keys) || count($device_profile_keys) == 0) {
|
||||
$rows = $_SESSION['devices']['profile_key_add_rows']['numeric'];
|
||||
$rows = $settings->get('devices', 'profile_key_add_rows');
|
||||
$id = 0;
|
||||
}
|
||||
if (!empty($device_profile_keys) && is_array($device_profile_keys) && count($device_profile_keys) > 0) {
|
||||
$rows = $_SESSION['devices']['profile_key_edit_rows']['numeric'];
|
||||
$rows = $settings->get('devices', 'profile_key_edit_rows');
|
||||
$id = count($device_profile_keys)+1;
|
||||
}
|
||||
for ($x = 0; $x < $rows; $x++) {
|
||||
@@ -371,7 +371,7 @@
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if ($device_profile_enabled === null) { $device_profile_enabled = true; }
|
||||
$device_profile_enabled = $device_profile_enabled ?? true;
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
}
|
||||
|
||||
//set the defaults
|
||||
if ($enabled === null) { $enabled = true; }
|
||||
$enabled = $enabled ?? true;
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
unset($sql, $parameters, $sql_where, $index);
|
||||
|
||||
//set the defaults
|
||||
if ($enabled === null) { $enabled = true; }
|
||||
$enabled = $enabled ?? true;
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
$list_row_url = '';
|
||||
if (permission_exists('device_vendor_function_edit')) {
|
||||
$list_row_url = "device_vendor_function_edit.php?device_vendor_uuid=".urlencode($row['device_vendor_uuid'])."&id=".urlencode($row['device_vendor_function_uuid']);
|
||||
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
$list_row_url = '';
|
||||
if (permission_exists('device_vendor_edit')) {
|
||||
$list_row_url = "device_vendor_edit.php?id=".urlencode($row['device_vendor_uuid']);
|
||||
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
//get the devices profiles
|
||||
$sql = "select * from v_device_profiles ";
|
||||
$sql .= "where true ";
|
||||
$parameters = [];
|
||||
if (!permission_exists('device_profile_all')) {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
@@ -321,7 +322,7 @@
|
||||
echo button::create(['type'=>'button','label'=>$text['button-profiles'],'icon'=>'clone','link'=>'device_profiles.php']);
|
||||
}
|
||||
$margin_left = permission_exists('device_import') || permission_exists('device_export') || permission_exists('device_vendor_view') || permission_exists('device_profile_view') ? "margin-left: 15px;" : null;
|
||||
if (permission_exists('device_add') && (empty($_SESSION['limit']['devices']['numeric']) || ($total_devices < $_SESSION['limit']['devices']['numeric']))) {
|
||||
if (permission_exists('device_add') && (empty($settings->get('limit', 'devices')) || ($total_devices < $settings->get('limit', 'devices')))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','style'=>$margin_left,'link'=>'device_edit.php']);
|
||||
unset($margin_left);
|
||||
}
|
||||
|
||||
@@ -34,14 +34,49 @@
|
||||
const app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $template_dir;
|
||||
public $device_uuid;
|
||||
public $device_vendor_uuid;
|
||||
public $device_profile_uuid;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Username set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $username;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
@@ -52,12 +87,6 @@
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Create a settings object using key/value pairs in the $setting_array.
|
||||
*
|
||||
@@ -66,16 +95,15 @@
|
||||
* @depends database::new()
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($setting_array = []) {
|
||||
|
||||
//open a database connection
|
||||
if (empty($setting_array['database'])) {
|
||||
$this->database = database::new();
|
||||
} else {
|
||||
$this->database = $setting_array['database'];
|
||||
}
|
||||
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
public function get_domain_uuid() {
|
||||
@@ -471,8 +499,8 @@
|
||||
}
|
||||
|
||||
//check to see if the domain name sub directory exists
|
||||
if (is_dir($this->template_dir."/".$_SESSION["domain_name"])) {
|
||||
$this->template_dir = $this->template_dir."/".$_SESSION["domain_name"];
|
||||
if (is_dir($this->template_dir."/".$this->domain_name)) {
|
||||
$this->template_dir = $this->template_dir."/".$this->domain_name;
|
||||
}
|
||||
|
||||
//return the template directory
|
||||
@@ -541,9 +569,9 @@
|
||||
$p->delete('device_key_delete', 'temp');
|
||||
|
||||
//write the provision files
|
||||
if (!empty($_SESSION['provision']['path']['text'])) {
|
||||
if (!empty($this->settings->get('provision', 'path'))) {
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$prov->domain_uuid = $this->domain_uuid;
|
||||
$response = $prov->write();
|
||||
}
|
||||
|
||||
@@ -994,7 +1022,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -1021,9 +1049,9 @@
|
||||
unset($array);
|
||||
|
||||
//write the provision files
|
||||
if (!empty($_SESSION['provision']['path']['text'])) {
|
||||
if (!empty($this->settings->get('provision', 'path'))) {
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$prov->domain_uuid = $this->domain_uuid;
|
||||
$response = $prov->write();
|
||||
}
|
||||
|
||||
@@ -1288,7 +1316,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$y = $z = 0;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/devices');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'app/devices');
|
||||
|
||||
//get the vendor functions
|
||||
$sql = "select v.name as vendor_name, f.type, f.value ";
|
||||
@@ -270,7 +270,7 @@
|
||||
}
|
||||
|
||||
//write the provision files
|
||||
if (!empty($_SESSION['provision']['path']['text'])) {
|
||||
if (!empty($settings->get('provision', 'path'))) {
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $domain_uuid;
|
||||
$response = $prov->write();
|
||||
|
||||
@@ -174,11 +174,11 @@
|
||||
$text = $language->get();
|
||||
|
||||
// load editor preferences/defaults
|
||||
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
|
||||
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
|
||||
$setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false';
|
||||
$setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false';
|
||||
$setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true';
|
||||
$setting_size = !empty($settings->get('editor', 'font_size')) ? $settings->get('editor', 'font_size') : '12px';
|
||||
$setting_theme = !empty($settings->get('editor', 'theme')) ? $settings->get('editor', 'theme') : 'cobalt';
|
||||
$setting_invisibles = $settings->get('editor', 'invisibles', 'false');
|
||||
$setting_indenting = $settings->get('editor', 'indent_guides', 'false');
|
||||
$setting_numbering = $settings->get('editor', 'line_numbers', 'true');
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -574,7 +574,7 @@
|
||||
) {
|
||||
$list_row_url = "dialplan_edit.php?id=".urlencode($row['dialplan_uuid']).(is_uuid($app_uuid) ? "&app_uuid=".urlencode($app_uuid) : null);
|
||||
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid'] ?? '').'&domain_change=true';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -34,9 +34,14 @@
|
||||
const app_uuid = '742714e5-8cdf-32fd-462c-cbe7e3d655db';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $dialplan_uuid;
|
||||
public $dialplan_detail_uuid;
|
||||
public $xml;
|
||||
@@ -73,6 +78,24 @@
|
||||
public $array;
|
||||
public $list_page;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
@@ -82,14 +105,16 @@
|
||||
private $toggle_field;
|
||||
private $toggle_values;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
//class constructor
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//class constructor
|
||||
public function __construct() {
|
||||
//set the default value
|
||||
$this->dialplan_global = false;
|
||||
|
||||
@@ -100,13 +125,6 @@
|
||||
$this->uuid_prefix = 'dialplan_';
|
||||
$this->toggle_field = 'dialplan_enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//open a database connection
|
||||
if (empty($setting_array['database'])) {
|
||||
$this->database = database::new();
|
||||
} else {
|
||||
$this->database = $setting_array['database'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +156,7 @@
|
||||
//prepare the xml
|
||||
if (!empty($xml_string)) {
|
||||
//replace the variables
|
||||
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
|
||||
$length = (is_numeric($this->settings->get('security', 'pin_length'))) ? $this->settings->get('security', 'pin_length') : 8;
|
||||
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
|
||||
$xml_string = str_replace("{v_pin_number}", generate_password($length, 1), $xml_string);
|
||||
//convert the xml string to an xml object
|
||||
@@ -179,7 +197,7 @@
|
||||
//prepare the xml
|
||||
if (!empty($xml_string)) {
|
||||
//replace the variables
|
||||
$length = (!empty($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
|
||||
$length = (!empty($this->settings->get('security', 'pin_length'))) ? $this->settings->get('security', 'pin_length') : 8;
|
||||
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
|
||||
$xml_string = str_replace("{v_pin_number}", generate_password($length, 1), $xml_string);
|
||||
|
||||
@@ -418,7 +436,7 @@
|
||||
$destination_number = trim($destination_number);
|
||||
|
||||
//check the session array if it doesn't exist then build the array
|
||||
if (empty($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
|
||||
if (empty($_SESSION[$this->domain_uuid]['outbound_routes'])) {
|
||||
//get the outbound routes from the database
|
||||
$sql = "select * ";
|
||||
$sql .= "from v_dialplans as d, ";
|
||||
@@ -479,12 +497,12 @@
|
||||
}
|
||||
|
||||
//set the session array
|
||||
$_SESSION[$_SESSION['domain_uuid']]['outbound_routes'] = $array;
|
||||
$_SESSION[$this->domain_uuid]['outbound_routes'] = $array;
|
||||
}
|
||||
|
||||
//find the matching outbound routes
|
||||
if (isset($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'])) {
|
||||
foreach ($_SESSION[$_SESSION['domain_uuid']]['outbound_routes'] as $row) {
|
||||
if (isset($_SESSION[$this->domain_uuid]['outbound_routes'])) {
|
||||
foreach ($_SESSION[$this->domain_uuid]['outbound_routes'] as $row) {
|
||||
if (isset($row['dialplan_details'])) {
|
||||
foreach ($row['dialplan_details'] as $field) {
|
||||
if ($field['dialplan_detail_tag'] == "condition") {
|
||||
@@ -1232,7 +1250,7 @@
|
||||
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
if (!permission_exists('dialplan_all')) {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
$rows = $this->database->select($sql, $parameters ?? null, 'all');
|
||||
if (!empty($rows)) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'core/user_settings');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'core/user_settings');
|
||||
|
||||
//clear initial stat
|
||||
unset($hud_stat);
|
||||
@@ -52,10 +52,6 @@
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//set default values
|
||||
if (!isset($_SESSION['limit']['extensions']['numeric'])) { $_SESSION['limit']['extensions']['numeric'] = 0; }
|
||||
if (!isset($_SESSION['limit']['destinations']['numeric'])) { $_SESSION['limit']['destinations']['numeric'] = 0; }
|
||||
|
||||
//caller id
|
||||
echo "<div class='hud_box'>\n";
|
||||
|
||||
@@ -95,13 +91,13 @@
|
||||
if (permission_exists('extension_view')) {
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
|
||||
$hud_stat_used = $usage['extensions'];
|
||||
$hud_stat_remaining = $_SESSION['limit']['extensions']['numeric'] - $usage['extensions'];
|
||||
$hud_stat_remaining = $settings->get('limit', 'extensions', 0) - $usage['extensions'];
|
||||
$hud_stat_title = $text['label-extensions'];
|
||||
}
|
||||
else if (permission_exists('destination_view')) {
|
||||
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/destinations/destinations.php'\"";
|
||||
$hud_stat_used = $usage['destinations'];
|
||||
$hud_stat_remaining = $_SESSION['limit']['destinations']['numeric'] - $usage['destinations'];
|
||||
$hud_stat_remaining = $settings->get('limit', 'destinations', 0) - $usage['destinations'];
|
||||
$hud_stat_title = $text['label-destinations'];
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
$list_row_url = '';
|
||||
if (permission_exists('email_queue_edit')) {
|
||||
$list_row_url = "email_queue_edit.php?id=".urlencode($row['email_queue_uuid']);
|
||||
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
if (!empty($row['domain_uuid']) && $row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
|
||||
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
|
||||
}
|
||||
}
|
||||
@@ -348,7 +348,7 @@
|
||||
echo " <td class='hide-md-dn'>".escape($row['hostname'])."</td>\n";
|
||||
echo " <td class='shrink hide-md-dn'>".escape($row['email_from'])."</td>\n";
|
||||
echo " <td class='overflow' style='width: 20%; max-width: 200px;'>".escape($row['email_to'])."</td>\n";
|
||||
echo " <td class='overflow' style='width: 30%; max-width: 200px;'>".iconv_mime_decode($row['email_subject'])."</td>\n";
|
||||
echo " <td class='overflow' style='width: 30%; max-width: 200px;'>".iconv_mime_decode($row['email_subject'] ?? '')."</td>\n";
|
||||
// echo " <td class='hide-md-dn'>".escape($row['email_body'])."</td>\n";
|
||||
echo " <td>".ucwords($text['label-'.$row['email_status']])."</td>\n";
|
||||
echo " <td>".escape($row['email_retry_count'])."</td>\n";
|
||||
@@ -398,4 +398,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -227,11 +227,11 @@
|
||||
}
|
||||
|
||||
//load editor preferences/defaults
|
||||
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
|
||||
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
|
||||
$setting_invisibles = isset($_SESSION['editor']['invisibles']['text']) ? $_SESSION['editor']['invisibles']["text"] : 'false';
|
||||
$setting_indenting = isset($_SESSION['editor']['indent_guides']['text']) ? $_SESSION['editor']['indent_guides']["text"]: 'false';
|
||||
$setting_numbering = isset($_SESSION['editor']['line_numbers']['text']) ? $_SESSION['editor']['line_numbers']["text"] : 'true';
|
||||
$setting_size = !empty($settings->get('editor', 'font_size')) ? $settings->get('editor', 'font_size') : '12px';
|
||||
$setting_theme = !empty($settings->get('editor', 'theme')) ? $settings->get('editor', 'theme') : 'cobalt';
|
||||
$setting_invisibles = $settings->get('editor', 'invisibles', 'false');
|
||||
$setting_indenting = $settings->get('editor', 'indent_guides', 'false');
|
||||
$setting_numbering = $settings->get('editor', 'line_numbers', 'true');
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
$email_body .= "If you received this message, your current SMTP settings are valid.<br /><br />\n";
|
||||
}
|
||||
|
||||
$email_from_address = $_SESSION['email']['smtp_from']['text'];
|
||||
$email_from_name = $_SESSION['email']['smtp_from_name']['text'];
|
||||
$email_from_address = $settings->get('email', 'smtp_from');
|
||||
$email_from_name = $settings->get('email', 'smtp_from_name');
|
||||
|
||||
//send email
|
||||
$sent = 0;
|
||||
@@ -118,6 +118,7 @@
|
||||
echo "<table>\n";
|
||||
foreach ($_SESSION['email'] as $name => $setting) {
|
||||
foreach ($setting as $type => $value) {
|
||||
$value = $value ?? '';
|
||||
echo "<tr>\n";
|
||||
if ($type == 'uuid') { $uuid = $value; continue; }
|
||||
if ($name == 'smtp_password') { $value = str_repeat('*', strlen($value)); }
|
||||
@@ -138,7 +139,7 @@
|
||||
echo "<b>".$text['header-connection']."</b>\n";
|
||||
echo "<br><br>\n";
|
||||
|
||||
echo "<div style='width: 100%; max-height: 250px; overflow: auto; border: 1px solid ".($_SESSION['theme']['table_row_border_color']['text'] ?? '#c5d1e5')."; padding: 12px 15px; background-color: ".($_SESSION['theme']['table_row_background_color_light']['text'] ?? '#fff')."; font-family: monospace; font-size: 85%;'>\n";
|
||||
echo "<div style='width: 100%; max-height: 250px; overflow: auto; border: 1px solid ".($settings->get('theme', 'table_row_border_color') ?? '#c5d1e5')."; padding: 12px 15px; background-color: ".($settings->get('theme', 'table_row_background_color_light') ?? '#fff')."; font-family: monospace; font-size: 85%;'>\n";
|
||||
|
||||
if (!empty($email_response) && is_array($email_response) && @sizeof($email_response) != 0) {
|
||||
echo implode("<br>\n<hr style='margin: 3px 0;'>\n", $email_response);
|
||||
@@ -155,4 +156,4 @@
|
||||
echo " <input type='button' class='btn' style='margin-top: 15px;' value='".$text['button-close']."' onclick=\"$('#test_result_layer').fadeOut(200);\">\n";
|
||||
echo "</center>\n";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -11,10 +11,33 @@
|
||||
const app_name = 'email_queue';
|
||||
const app_uuid = '5befdf60-a242-445f-91b3-2e9ee3e0ddf7';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
@@ -24,18 +47,21 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign the variables
|
||||
$this->name = 'email_queue';
|
||||
$this->table = 'email_queue';
|
||||
$this->toggle_field = '';
|
||||
$this->toggle_values = ['true','false'];
|
||||
$this->location = 'email_queue.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +91,7 @@
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
|
||||
$array['email_queue_attachments'][$x][$this->name.'_uuid'] = $record['uuid'];
|
||||
//$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
|
||||
//increment the id
|
||||
@@ -165,7 +191,7 @@
|
||||
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -234,7 +260,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$x = 0;
|
||||
|
||||
@@ -35,10 +35,33 @@
|
||||
const app_name = 'event_guard';
|
||||
const app_uuid = 'c5b86612-1514-40cb-8e2c-3f01a8f6f637';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
@@ -48,18 +71,20 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign the variables
|
||||
$this->name = 'event_guard_log';
|
||||
$this->table = 'event_guard_logs';
|
||||
$this->toggle_field = '';
|
||||
$this->toggle_values = ['block','pending'];
|
||||
$this->location = 'event_guard_logs.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,10 +35,33 @@
|
||||
const app_name = 'extension_settings';
|
||||
const app_uuid = '1416a250-f6e1-4edc-91a6-5c9b883638fd';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare the variables
|
||||
*/
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
@@ -49,7 +72,14 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign the variables
|
||||
$this->name = 'extension_setting';
|
||||
$this->table = 'extension_settings';
|
||||
@@ -58,10 +88,6 @@
|
||||
$this->description_field = 'extension_setting_description';
|
||||
$this->location = 'extension_settings.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +116,7 @@
|
||||
//add to the array
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
|
||||
//increment the id
|
||||
@@ -150,7 +176,7 @@
|
||||
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle, extension_uuid from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$extension_uuid = $rows[0]['extension_uuid'];
|
||||
@@ -229,7 +255,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $x => $row) {
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
$array['extensions'][0]['extension_uuid'] = uuid();
|
||||
$array['extensions'][0]['extension'] = $extension_new;
|
||||
$array['extensions'][0]['number_alias'] = $number_alias_new;
|
||||
$array['extensions'][0]['password'] = generate_password($_SESSION["extension"]["password_length"]["numeric"], $_SESSION["extension"]["password_strength"]["numeric"]);
|
||||
$array['extensions'][0]['password'] = generate_password($settings->get('extension', 'password_length'), $settings->get('extension', 'password_strength'));
|
||||
$array['extensions'][0]['accountcode'] = $password;
|
||||
$array['extensions'][0]['effective_caller_id_name'] = $effective_caller_id_name;
|
||||
$array['extensions'][0]['effective_caller_id_number'] = $effective_caller_id_number;
|
||||
@@ -187,7 +187,7 @@
|
||||
}
|
||||
|
||||
//synchronize configuration
|
||||
if (is_writable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (is_writable($settings->get('switch', 'extensions'))) {
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
$file = $_SESSION['server']['temp']['dir']."/extensions-".$_SESSION['domain_name'].".csv";
|
||||
$file = $settings->get('server', 'temp')."/extensions-".$_SESSION['domain_name'].".csv";
|
||||
file_put_contents($file, $_POST['data']);
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
@@ -70,11 +70,11 @@
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('extension_import')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$_SESSION['server']['temp']['dir'].'*');
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$settings->get('server', 'temp')."/". htmlentities($_FILES['ulfile']['name']);
|
||||
//system('chmod -R 744 '.$settings->get('server', 'temp').'*');
|
||||
unset($_POST['txtCommand']);
|
||||
$file = $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name'];
|
||||
$file = $settings->get('server', 'temp').'/'.$_FILES['ulfile']['name'];
|
||||
$_SESSION['file'] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
//get total extension count for domain
|
||||
if (isset($_SESSION['limit']['extensions']['numeric'])) {
|
||||
if (!empty($settings->get('limit', 'extensions'))) {
|
||||
$sql = "select count(*) from v_extensions ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
@@ -288,14 +288,14 @@
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-extensions']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('extension_import') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
||||
if (permission_exists('extension_import') && (empty($settings->get('limit', 'extensions', 0)) || $total_extensions < $settings->get('limit', 'extensions'))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$settings->get('theme', 'button_icon_import'),'link'=>'extension_imports.php']);
|
||||
}
|
||||
if (permission_exists('extension_export')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$settings->get('theme', 'button_icon_export'),'link'=>'extension_download.php']);
|
||||
}
|
||||
$margin_left = permission_exists('extension_import') || permission_exists('extension_export') ? "margin-left: 15px;" : null;
|
||||
if (permission_exists('extension_add') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
||||
if (permission_exists('extension_add') && (empty($settings->get('limit', 'extensions', 0)) || $total_extensions < $settings->get('limit', 'extensions'))) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$settings->get('theme', 'button_icon_add'),'id'=>'btn_add','style'=>($margin_left ?? ''),'link'=>'extension_edit.php']);
|
||||
unset($margin_left);
|
||||
}
|
||||
@@ -435,8 +435,8 @@
|
||||
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||
}
|
||||
if (permission_exists('extension_registered')) {
|
||||
$icon_registered_color = $_SESSION['extension']['icon_registered_color']['text'] ?? '#12d600';
|
||||
$icon_unregistered_color = $_SESSION['extension']['icon_unregistered_color']['text'] ?? '#e21b1b';
|
||||
$icon_registered_color = $settings->get('extension', 'icon_registered_color') ?? '#12d600';
|
||||
$icon_unregistered_color = $settings->get('extension', 'icon_unregistered_color') ?? '#e21b1b';
|
||||
|
||||
$extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
||||
$extension_number_alias = $row['number_alias'];
|
||||
|
||||
@@ -34,10 +34,20 @@
|
||||
const app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_name;
|
||||
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $extension_uuid;
|
||||
public $extension;
|
||||
public $voicemail_id;
|
||||
@@ -80,9 +90,26 @@
|
||||
public $delete_voicemail;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -93,7 +120,15 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
|
||||
//assign private variables
|
||||
$this->permission_prefix = 'extension_';
|
||||
@@ -102,12 +137,6 @@
|
||||
$this->uuid_prefix = 'extension_';
|
||||
$this->toggle_field = 'enabled';
|
||||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function exists($domain_uuid, $extension) {
|
||||
@@ -188,7 +217,7 @@
|
||||
}
|
||||
|
||||
public function xml() {
|
||||
if (isset($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions'))) {
|
||||
//declare global variables
|
||||
global $config, $domain_uuid;
|
||||
|
||||
@@ -197,7 +226,7 @@
|
||||
$user_context = $domain_name;
|
||||
|
||||
//delete all old extensions to prepare for new ones
|
||||
$dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml");
|
||||
$dialplan_list = glob($this->settings->get('switch', 'extensions')."/".$user_context."/v_*.xml");
|
||||
foreach($dialplan_list as $name => $value) {
|
||||
unlink($value);
|
||||
}
|
||||
@@ -243,8 +272,8 @@
|
||||
$extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension);
|
||||
$dial_string = $row['dial_string'];
|
||||
if (empty($dial_string)) {
|
||||
if (!empty($_SESSION['domain']['dial_string']['text'])) {
|
||||
$dial_string = $_SESSION['domain']['dial_string']['text'];
|
||||
if (!empty($this->settings->get('domain', 'dial_string'))) {
|
||||
$dial_string = $this->settings->get('domain', 'dial_string');
|
||||
}
|
||||
else {
|
||||
$dial_string = "{sip_invite_domain=\${domain_name},leg_timeout=".$call_timeout.",presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}";
|
||||
@@ -318,8 +347,8 @@
|
||||
$xml .= " <param name=\"dial-string\" value=\"" . $dial_string . "\"/>\n";
|
||||
$xml .= " </params>\n";
|
||||
$xml .= " <variables>\n";
|
||||
$xml .= " <variable name=\"domain_name\" value=\"" . $_SESSION['domain_name'] . "\"/>\n";
|
||||
$xml .= " <variable name=\"domain_uuid\" value=\"" . $_SESSION['domain_uuid'] . "\"/>\n";
|
||||
$xml .= " <variable name=\"domain_name\" value=\"" . $this->domain_name . "\"/>\n";
|
||||
$xml .= " <variable name=\"domain_uuid\" value=\"" . $this->domain_uuid . "\"/>\n";
|
||||
$xml .= " <variable name=\"extension_uuid\" value=\"" . $extension_uuid . "\"/>\n";
|
||||
if (!empty($row['call_group'])) {
|
||||
$xml .= " <variable name=\"call_group\" value=\"" . $row['call_group'] . "\"/>\n";
|
||||
@@ -428,11 +457,11 @@
|
||||
$xml .= " </variables>\n";
|
||||
$xml .= " </user>\n";
|
||||
|
||||
if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) {
|
||||
mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'], 0770, false);
|
||||
if (!is_readable($this->settings->get('switch', 'extensions')."/".$row['user_context'])) {
|
||||
mkdir($this->settings->get('switch', 'extensions')."/".$row['user_context'], 0770, false);
|
||||
}
|
||||
if (!empty($extension)) {
|
||||
$fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w");
|
||||
$fout = fopen($this->settings->get('switch', 'extensions')."/".$row['user_context']."/v_".$extension.".xml","w");
|
||||
}
|
||||
$xml .= "</include>\n";
|
||||
fwrite($fout, $xml);
|
||||
@@ -444,7 +473,7 @@
|
||||
unset($rows, $row);
|
||||
|
||||
//prepare extension
|
||||
$extension_dir = realpath($_SESSION['switch']['extensions']['dir']);
|
||||
$extension_dir = realpath($this->settings->get('switch', 'extensions'));
|
||||
$user_context = str_replace(" ", "_", $user_context);
|
||||
$user_context = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $user_context);
|
||||
|
||||
@@ -568,7 +597,7 @@
|
||||
$sql = "select extension, number_alias, user_context, follow_me_uuid from v_extensions ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and extension_uuid = :extension_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$parameters['extension_uuid'] = $record['uuid'];
|
||||
$row = $this->database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
@@ -589,10 +618,10 @@
|
||||
//include ring group destinations, if exists
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")) {
|
||||
$array['ring_group_destinations'][$x]['destination_number'] = $extensions[$x]['extension'];
|
||||
$array['ring_group_destinations'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['ring_group_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
if (is_numeric($extensions[$x]['number_alias'])) {
|
||||
$array['ring_group_destinations'][$y]['destination_number'] = $extensions[$x]['number_alias'];
|
||||
$array['ring_group_destinations'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['ring_group_destinations'][$y]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
$y++;
|
||||
}
|
||||
@@ -600,7 +629,7 @@
|
||||
//include extension settings, if exists
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extension_settings/app_config.php")) {
|
||||
$array['extension_settings'][$x]['extension_uuid'] = $record['uuid'];
|
||||
$array['extension_settings'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['extension_settings'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
|
||||
//create array of voicemail ids
|
||||
@@ -629,7 +658,7 @@
|
||||
$sql = "select voicemail_uuid as uuid from v_voicemails ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and voicemail_id in ('".implode("','", $voicemail_ids)."') ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $r => $row) {
|
||||
@@ -675,7 +704,7 @@
|
||||
unset($extensions);
|
||||
|
||||
//synchronize configuration
|
||||
if (!empty($_SESSION['switch']['extensions']['dir']) && is_writable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions')) && is_writable($this->settings->get('switch', 'extensions'))) {
|
||||
$this->xml();
|
||||
}
|
||||
|
||||
@@ -724,7 +753,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, ".$this->toggle_field." as toggle, extension, number_alias, user_context from v_".$this->table." ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -762,15 +791,15 @@
|
||||
$p->delete('extension_edit', 'temp');
|
||||
|
||||
//synchronize configuration
|
||||
if (!empty($_SESSION['switch']['extensions']['dir']) && is_writable($_SESSION['switch']['extensions']['dir'])) {
|
||||
if (!empty($this->settings->get('switch', 'extensions')) && is_writable($this->settings->get('switch', 'extensions'))) {
|
||||
$this->xml();
|
||||
}
|
||||
|
||||
//write the provision files
|
||||
if (!empty($_SESSION['provision']['path']['text'])) {
|
||||
if (!empty($this->settings->get('provision', 'path'))) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) {
|
||||
$prov = new provision;
|
||||
$prov->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$prov->domain_uuid = $this->domain_uuid;
|
||||
$response = $prov->write();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/extensions');
|
||||
$text = $language->get($settings->get('domain', 'language', 'en-us'), 'app/extensions');
|
||||
|
||||
//add or update the database
|
||||
if (isset($_POST['extensions']) && is_array($_POST['extensions']) && @sizeof($_POST['extensions']) != 0) {
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
||||
|
||||
//prepare paging
|
||||
$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$rows_per_page = $settings->get('domain', 'paging', 50);
|
||||
$param = "&search=".urlencode($search);
|
||||
if ($show == "all" && permission_exists('fax_extension_view_all')) {
|
||||
$param .= "&show=all";
|
||||
@@ -294,7 +294,7 @@
|
||||
if (permission_exists('fax_log_view')) {
|
||||
echo " <a href='fax_logs.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-log']."</a> ";
|
||||
}
|
||||
if (file_exists(__DIR__ . '/fax_active.php') && permission_exists('fax_active_view') && isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') {
|
||||
if (file_exists(__DIR__ . '/fax_active.php') && permission_exists('fax_active_view') && !empty($settings->get('fax', 'send_mode')) && $settings->get('fax', 'send_mode') == 'queue') {
|
||||
echo " <a href='fax_active.php?id=".urlencode($row['fax_uuid'])."'>".$text['label-active']."</a> ";
|
||||
}
|
||||
if (permission_exists('fax_queue_view')) {
|
||||
|
||||
@@ -424,7 +424,7 @@
|
||||
echo " <br>";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='fax_uuid' value='".escape($fax_uuid)."'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid ?? '')."'>\n";
|
||||
}
|
||||
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
|
||||
//set the fax directory
|
||||
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
|
||||
$fax_dir = $settings->get('switch', 'storage').'/fax/'.$_SESSION['domain_name'];
|
||||
|
||||
//get the fax extension
|
||||
if (!empty($fax_extension) && is_numeric($fax_extension)) {
|
||||
@@ -57,8 +57,8 @@
|
||||
$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'], 0770, true);
|
||||
if (!is_dir($settings->get('switch', 'storage'))) {
|
||||
mkdir($settings->get('switch', 'storage'), 0770, true);
|
||||
}
|
||||
if (!is_dir($fax_dir.'/'.$fax_extension)) {
|
||||
mkdir($fax_dir.'/'.$fax_extension, 0770, true);
|
||||
@@ -549,7 +549,7 @@
|
||||
echo " ".$text['label-extension']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='fax_extension' maxlength='15' value=\"".escape($fax_extension ?? '')."\" required='required' placeholder=\"".($_SESSION['fax']['extension_range']['text'] ?? '')."\">\n";
|
||||
echo " <input class='formfld' type='text' name='fax_extension' maxlength='15' value=\"".escape($fax_extension ?? '')."\" required='required' placeholder=\"".($settings->get('fax', 'extension_range') ?? '')."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "".$text['description-extension']."\n";
|
||||
echo "</td>\n";
|
||||
|
||||
@@ -123,8 +123,8 @@
|
||||
}
|
||||
|
||||
//set the fax directory
|
||||
if (!empty($_SESSION['switch']['storage']['dir'])) {
|
||||
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
|
||||
if (!empty($settings->get('switch', 'storage'))) {
|
||||
$fax_dir = $settings->get('switch', 'storage').'/fax/'.$_SESSION['domain_name'];
|
||||
}
|
||||
|
||||
//download the fax
|
||||
@@ -204,8 +204,8 @@
|
||||
$dir_fax_temp = $fax_dir.'/'.$fax_extension.'/temp';
|
||||
|
||||
//make sure the directories exist
|
||||
if (!empty($_SESSION['switch']['storage']['dir']) && !is_dir($_SESSION['switch']['storage']['dir'])) {
|
||||
mkdir($_SESSION['switch']['storage']['dir'], 0770, false);
|
||||
if (!empty($settings->get('switch', 'storage')) && !is_dir($settings->get('switch', 'storage'))) {
|
||||
mkdir($settings->get('switch', 'storage'), 0770, false);
|
||||
}
|
||||
if (!is_dir($fax_dir.'/'.$fax_extension)) {
|
||||
mkdir($fax_dir.'/'.$fax_extension, 0770, false);
|
||||
@@ -250,11 +250,11 @@
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//set the time format options: 12h, 24h
|
||||
if (isset($_SESSION['domain']['time_format']['text'])) {
|
||||
if ($_SESSION['domain']['time_format']['text'] == '12h') {
|
||||
if (!empty($settings->get('domain', 'time_format'))) {
|
||||
if ($settings->get('domain', 'time_format') == '12h') {
|
||||
$time_format = 'HH12:MI:SS am';
|
||||
}
|
||||
elseif ($_SESSION['domain']['time_format']['text'] == '24h') {
|
||||
elseif ($settings->get('domain', 'time_format') == '24h') {
|
||||
$time_format = 'HH24:MI:SS';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
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'];
|
||||
$fax_dir = $settings->get('switch', 'storage').'/fax/'.$_SESSION['domain_name'];
|
||||
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment['name']);
|
||||
//redirect user
|
||||
message::add($text['message-delete']);
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
echo " <input type='hidden' name='fax_logs[$x][uuid]' value='".escape($row['fax_log_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td><a href='".$list_row_url."'>".(!empty($_SESSION['domain']['time_format']['text']) && $_SESSION['domain']['time_format']['text'] == '12h' ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']))."</a> </td>\n";
|
||||
echo " <td><a href='".$list_row_url."'>".(!empty($settings->get('domain', 'time_format')) && $settings->get('domain', 'time_format') == '12h' ? date("j M Y g:i:sa", $row['fax_epoch']) : date("j M Y H:i:s", $row['fax_epoch']))."</a> </td>\n";
|
||||
echo " <td>".$row['fax_success']." </td>\n";
|
||||
echo " <td>".$row['fax_result_code']." </td>\n";
|
||||
echo " <td>".$row['fax_result_text']." </td>\n";
|
||||
|
||||
@@ -33,10 +33,15 @@
|
||||
const app_name = 'fax';
|
||||
const app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
public $domain_uuid;
|
||||
|
||||
/**
|
||||
* define the variables
|
||||
*/
|
||||
public $domain_uuid;
|
||||
public $fax_uuid;
|
||||
public $dialplan_uuid;
|
||||
public $fax_name;
|
||||
@@ -49,10 +54,33 @@
|
||||
public $order;
|
||||
public $download;
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Settings object set in the constructor. Must be a settings object and cannot be null.
|
||||
* @var settings Settings Object
|
||||
*/
|
||||
private $settings;
|
||||
|
||||
/**
|
||||
* User UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $user_uuid;
|
||||
|
||||
/**
|
||||
* Domain name set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_name;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $database;
|
||||
private $permission_prefix;
|
||||
private $list_page;
|
||||
private $table;
|
||||
@@ -64,13 +92,15 @@
|
||||
/**
|
||||
* Called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
$this->domain_name = $setting_array['domain_name'] ?? $_SESSION['domain_name'] ?? '';
|
||||
$this->user_uuid = $setting_array['user_uuid'] ?? $_SESSION['user_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
$this->settings = $setting_array['settings'] ?? new settings(['database' => $this->database, 'domain_uuid' => $this->domain_uuid, 'user_uuid' => $this->user_uuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,15 +161,15 @@
|
||||
$fax_name = ($this->fax_name != '') ? $this->fax_name : format_phone($this->destination_number);
|
||||
|
||||
//set the last fax
|
||||
if (!empty($_SESSION['fax']['last_fax']['text'])) {
|
||||
$last_fax = "last_fax=".xml::sanitize($_SESSION['fax']['last_fax']['text']);
|
||||
if (!empty($this->settings->get('fax', 'last_fax'))) {
|
||||
$last_fax = "last_fax=".xml::sanitize($this->settings->get('fax', 'last_fax'));
|
||||
}
|
||||
else {
|
||||
$last_fax = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
|
||||
}
|
||||
|
||||
//set the rx_fax
|
||||
$rxfax_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'].'/'.xml::sanitize($this->fax_extension).'/inbox/'.xml::sanitize($this->forward_prefix).'${last_fax}.tif';
|
||||
$rxfax_data = $this->settings->get('switch', 'storage').'/fax/'.$this->domain_name.'/'.xml::sanitize($this->fax_extension).'/inbox/'.xml::sanitize($this->forward_prefix).'${last_fax}.tif';
|
||||
|
||||
//build the xml dialplan
|
||||
$dialplan_xml = "<extension name=\"".xml::sanitize($fax_name)."\" continue=\"false\" uuid=\"".xml::sanitize($this->dialplan_uuid)."\">\n";
|
||||
@@ -168,7 +198,7 @@
|
||||
$dialplan["dialplan_uuid"] = $this->dialplan_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['domain_name'];
|
||||
$dialplan["dialplan_context"] = $this->domain_name;
|
||||
$dialplan["dialplan_continue"] = false;
|
||||
$dialplan["dialplan_xml"] = $dialplan_xml;
|
||||
$dialplan["dialplan_order"] = "40";
|
||||
@@ -200,7 +230,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION['domain_name']);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//return the dialplan_uuid
|
||||
return $dialplan_response ?? null;
|
||||
@@ -247,7 +277,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid from v_".$this->table." ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -262,7 +292,7 @@
|
||||
$sql = "select fax_file_uuid as uuid, fax_mode, fax_file_path, fax_file_type from v_fax_files ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -304,17 +334,17 @@
|
||||
if (!empty($faxes) && is_array($faxes) && @sizeof($faxes) != 0) {
|
||||
foreach ($faxes as $fax_uuid => $fax) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $fax_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['fax_users'][$x][$this->uuid_prefix.'uuid'] = $fax_uuid;
|
||||
$array['fax_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['fax_users'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['fax_files'][$x][$this->uuid_prefix.'uuid'] = $fax_uuid;
|
||||
$array['fax_files'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['fax_files'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['fax_logs'][$x][$this->uuid_prefix.'uuid'] = $fax_uuid;
|
||||
$array['fax_logs'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['fax_logs'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplans'][$x]['dialplan_uuid'] = $fax['dialplan_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplans'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['dialplan_details'][$x]['dialplan_uuid'] = $fax['dialplan_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['dialplan_details'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +378,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//clear the destinations session array
|
||||
if (isset($_SESSION['destinations']['array'])) {
|
||||
@@ -400,7 +430,7 @@
|
||||
$sql = "select ".$this->uuid_prefix."uuid as uuid, fax_mode, fax_file_path, fax_file_type from v_".$this->table." ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -441,7 +471,7 @@
|
||||
$x = 0;
|
||||
foreach ($fax_files as $fax_file_uuid => $fax_file) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $fax_file_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$x++;
|
||||
}
|
||||
|
||||
@@ -489,7 +519,7 @@
|
||||
foreach ($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +580,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$y = 0;
|
||||
@@ -574,7 +604,7 @@
|
||||
$sql_2 .= "where e.user_uuid = u.user_uuid ";
|
||||
$sql_2 .= "and e.domain_uuid = :domain_uuid ";
|
||||
$sql_2 .= "and e.fax_uuid = :fax_uuid ";
|
||||
$parameters_2['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters_2['domain_uuid'] = $this->domain_uuid;
|
||||
$parameters_2['fax_uuid'] = $row['fax_uuid'];
|
||||
$rows_2 = $this->database->select($sql_2, $parameters_2, 'all');
|
||||
if (is_array($rows_2) && @sizeof($rows_2) != 0) {
|
||||
@@ -641,7 +671,7 @@
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["domain_name"]);
|
||||
$cache->delete("dialplan:".$this->domain_name);
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
@@ -689,7 +719,7 @@
|
||||
|
||||
//toggle read state
|
||||
$array['fax_files'][$x]['fax_file_uuid'] = $record['uuid'];
|
||||
$array['fax_files'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['fax_files'][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
$array['fax_files'][$x]['read_date'] = empty($read_date) ? 'now()' : null;
|
||||
$fax_files_toggled++;
|
||||
}
|
||||
|
||||
@@ -35,10 +35,21 @@
|
||||
const app_name = 'fax_queue';
|
||||
const app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
|
||||
|
||||
/**
|
||||
* Set in the constructor. Must be a database object and cannot be null.
|
||||
* @var database Database Object
|
||||
*/
|
||||
private $database;
|
||||
|
||||
/**
|
||||
* Domain UUID set in the constructor. This can be passed in through the $settings_array associative array or set in the session global array
|
||||
* @var string
|
||||
*/
|
||||
private $domain_uuid;
|
||||
|
||||
/**
|
||||
* declare private variables
|
||||
*/
|
||||
private $database;
|
||||
private $name;
|
||||
private $table;
|
||||
private $toggle_field;
|
||||
@@ -48,18 +59,19 @@
|
||||
/**
|
||||
* called when the object is created
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(array $setting_array = []) {
|
||||
//set domain and user UUIDs
|
||||
$this->domain_uuid = $setting_array['domain_uuid'] ?? $_SESSION['domain_uuid'] ?? '';
|
||||
|
||||
//set objects
|
||||
$this->database = $setting_array['database'] ?? database::new();
|
||||
|
||||
//assign the variables
|
||||
$this->name = 'fax_queue';
|
||||
$this->table = 'fax_queue';
|
||||
$this->toggle_field = '';
|
||||
$this->toggle_values = ['true','false'];
|
||||
$this->location = 'fax_queue.php';
|
||||
|
||||
//connect to the database
|
||||
if (empty($this->database)) {
|
||||
$this->database = database::new();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +100,7 @@
|
||||
//add to the array
|
||||
if ($record['checked'] == 'true' && is_uuid($record['fax_queue_uuid'])) {
|
||||
$array[$this->table][$x]['fax_queue_uuid'] = $record['fax_queue_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array[$this->table][$x]['domain_uuid'] = $this->domain_uuid;
|
||||
}
|
||||
|
||||
//increment the id
|
||||
@@ -191,7 +203,7 @@
|
||||
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
|
||||
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
foreach ($rows as $row) {
|
||||
@@ -260,7 +272,7 @@
|
||||
$sql = "select * from v_".$this->table." ";
|
||||
$sql .= "where fax_queue_uuid in (".implode(', ', $uuids).") ";
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['domain_uuid'] = $this->domain_uuid;
|
||||
$rows = $this->database->select($sql, $parameters, 'all');
|
||||
if (is_array($rows) && @sizeof($rows) != 0) {
|
||||
$x = 0;
|
||||
|
||||
@@ -1127,4 +1127,31 @@ $text['label-member_enabled']['zh-cn'] = "已启用";
|
||||
$text['label-member_enabled']['ja-jp'] = "有効";
|
||||
$text['label-member_enabled']['ko-kr'] = "활성화됨";
|
||||
|
||||
?>
|
||||
$text['description-agents']['en-us'] = "Select the agent, set the call timeout, wrap up time, and enabled.";
|
||||
$text['description-agents']['en-gb'] = "Select the agent, set the call timeout, wrap up time, and enabled.";
|
||||
$text['description-agents']['ar-eg'] = "حدد وكيل التحول، و 설정 الدخول، و الزمن المحدد، و التفعيل.";
|
||||
$text['description-agents']['de-at'] = "Wählen Sie den Agenten, stellen Sie die Anruferwartungszeit, die Abschlusszeit und den Status ein.";
|
||||
$text['description-agents']['de-ch'] = "Wählen Sie den Agenten, stellen Sie die Anruferwartungszeit, die Abschlusszeit und den Status ein.";
|
||||
$text['description-agents']['de-de'] = "Wählen Sie den Agenten, stellen Sie die Anruferwartungszeit, die Abschlusszeit und den Status ein.";
|
||||
$text['description-agents']['el-gr'] = "Επιλέξτε τον αρχικό, θετείτε το χρόνο αναμονής, το χρόνο ολοκλήρωσης και την ενεργοποίηση.";
|
||||
$text['description-agents']['es-cl'] = "Seleccione el agente, establezca el tiempo de espera, el tiempo de cierre y el estado.";
|
||||
$text['description-agents']['es-mx'] = "Seleccione el agente, establezca el tiempo de espera, el tiempo de cierre y el estado.";
|
||||
$text['description-agents']['fr-ca'] = "Sélectionnez l'agent, définissez le délai d'attente, le temps de clôture et l'état.";
|
||||
$text['description-agents']['fr-fr'] = "Sélectionnez l'agent, définissez le délai d'attente, le temps de clôture et l'état.";
|
||||
$text['description-agents']['he-il'] = "בחר את המנהל,設置 הwartime, זמן סיום ופעולה.";
|
||||
$text['description-agents']['it-it'] = "Seleziona l'agente, impostare il tempo di attesa, il tempo di chiusura e lo stato.";
|
||||
$text['description-agents']['ka-ge'] = "დაირჩეთ აგენტს, დადგენით გამომავლენი დრო, დამთავრების დრო და აქტიურობა.";
|
||||
$text['description-agents']['nl-nl'] = "Selecteer de agent, stel de wachtduur, afsluitduur en status in.";
|
||||
$text['description-agents']['pl-pl'] = "Wybierz agenta, ustaw czas oczekiwania, czas zakończenia i status.";
|
||||
$text['description-agents']['pt-br'] = "Selecione o agente, configure o tempo de espera, o tempo de encerramento e o status.";
|
||||
$text['description-agents']['pt-pt'] = "Selecione o agente, configure o tempo de espera, o tempo de encerramento e o status.";
|
||||
$text['description-agents']['ro-ro'] = "Selectați agentul, setați timpul de așteptare, timpul de închidere și starea.";
|
||||
$text['description-agents']['ru-ru'] = "Выберите агента, установите время ожидания, время завершения и включите.";
|
||||
$text['description-agents']['sv-se'] = "Välj agenten, ställ in väntetid, avslutningstid och status.";
|
||||
$text['description-agents']['uk-ua'] = "Оберіть агента, встановіть час очікування, час закінчення та включіть.";
|
||||
$text['description-agents']['tr-tr'] = "Ağcın seçin, bekletme süresini, sona erme süresini ve durumunu ayarlayın.";
|
||||
$text['description-agents']['zh-cn'] = "选择代理,设置等待时间,结束时间,并启用。";
|
||||
$text['description-agents']['ja-jp'] = "アーカイブを選択し、待ち時間、終了時間、有効化を設定します。";
|
||||
$text['description-agents']['ko-kr'] = "대리자를 선택하고 대기 시간, 종료 시간, 활성화를 설정하세요.";
|
||||
|
||||
?>
|
||||
|
||||
@@ -577,7 +577,7 @@
|
||||
echo " ".$text['label-strategy']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='fifo_strategy' onchange=\"getElementById('destination_delayorder').innerHTML = (this.selectedIndex == 1 || this.selectedIndex == 3) ? '".$text['label-destination_order']."' : '".$text['label-destination_delay']."';\">\n";
|
||||
echo " <select class='formfld' name='fifo_strategy' onchange=\"\">\n";
|
||||
echo " <option value='longest_idle_agent' ".(($fifo_strategy == "'option-longest_idle_agent") ? "selected='selected'" : null).">".$text['option-longest_idle_agent']."</option>\n";
|
||||
echo " <option value='simultaneous' ".(($fifo_strategy == "simultaneous") ? "selected='selected'" : null).">".$text['option-simultaneous']."</option>\n";
|
||||
echo " </select>\n";
|
||||
@@ -659,7 +659,7 @@
|
||||
}
|
||||
echo " </table>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-member_enabled']."\n";
|
||||
echo $text['description-agents']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
@@ -805,4 +805,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user