Frytimo pr patches for php8.1 (#6630)

* Passing null to parameter #2 ($string) of type string is deprecated

* Passing null to parameter #1 ($string) of type string is deprecated

* php 8.1 fixes

* php 8.1 fixes - replace strlen($var) > 0 with !empty($var)

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - replace ${var} with {$var}

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

* php 8.1 fixes - check for false and check for null on $this->dir

* php 8.1 fixes - remove assignment of $db variable to modules object

* php 8.1 fixes - avoid sending null to substr

* php 8.1 fixes - change ${var} to {$var}

* php 8.1 fixes - check for null before preg_replace

* php 8.1 fixes - remove setting db variable on domains object

* php 8.1 fixes - set empty string if $row['domain_setting_subcategory'] is null

* php 8.1 fixes - set empty string if $_REQUEST['show'] is not available

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
frytimo 2023-05-05 13:46:37 -03:00 committed by GitHub
parent ebbb2f1a72
commit fef8165be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
230 changed files with 1948 additions and 1937 deletions

View File

@ -61,7 +61,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//enforce valid data //enforce valid data
if ($access_control_name == 'providers' || $access_control_name == 'domains') { if ($access_control_name == 'providers' || $access_control_name == 'domains') {
@ -80,7 +80,7 @@
} }
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) { if (!empty($_POST['action'])) {
//prepare the array(s) //prepare the array(s)
$x = 0; $x = 0;
@ -134,11 +134,11 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($access_control_name) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_name']."<br>\n"; } if (empty($access_control_name)) { $msg .= $text['message-required']." ".$text['label-access_control_name']."<br>\n"; }
if (strlen($access_control_default) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_default']."<br>\n"; } if (empty($access_control_default)) { $msg .= $text['message-required']." ".$text['label-access_control_default']."<br>\n"; }
//if (strlen($access_control_nodes) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_nodes']."<br>\n"; } //if (empty($access_control_nodes)) { $msg .= $text['message-required']." ".$text['label-access_control_nodes']."<br>\n"; }
//if (strlen($access_control_description) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_description']."<br>\n"; } //if (empty($access_control_description)) { $msg .= $text['message-required']." ".$text['label-access_control_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -51,7 +51,7 @@
$fp = fopen("php://memory", 'r+'); $fp = fopen("php://memory", 'r+');
fputs($fp, $input); fputs($fp, $input);
rewind($fp); rewind($fp);
$data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0 $data = fgetcsv($fp, null, $delimiter, $enclosure, $escape);
fclose($fp); fclose($fp);
return $data; return $data;
} }
@ -86,7 +86,7 @@
} }
//get the schema //get the schema
if (strlen($delimiter) > 0) { if (!empty($delimiter)) {
//get the first line //get the first line
$line = fgets(fopen($_SESSION['file'], 'r')); $line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line); $line_fields = explode($delimiter, $line);
@ -128,7 +128,7 @@
} }
//match the column names to the field names //match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && $action != 'import') { if (!empty($delimiter) && file_exists($_SESSION['file']) && $action != 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -294,7 +294,7 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
$array[$table_name][$row_id]['access_control_node_uuid'] = uuid(); $array[$table_name][$row_id]['access_control_node_uuid'] = uuid();
$array[$table_name][$row_id]['access_control_uuid'] = $_GET['id']; $array[$table_name][$row_id]['access_control_uuid'] = $_GET['id'];
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];

View File

@ -88,7 +88,7 @@
$p->delete('access_control_add', 'temp'); $p->delete('access_control_add', 'temp');
//normalize the array - needed because the array is inconsistent when there is only one row vs multiple //normalize the array - needed because the array is inconsistent when there is only one row vs multiple
if (strlen($list['node']['@attributes']['type']) > 0) { if (!empty($list['node']['@attributes']['type'])) {
$list['node'][]['@attributes'] = $list['node']['@attributes']; $list['node'][]['@attributes'] = $list['node']['@attributes'];
unset($list['node']['@attributes']); unset($list['node']['@attributes']);
} }

View File

@ -64,7 +64,7 @@ if (count($_GET) > 0) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//allow specific commands //allow specific commands
if (strlen($switch_cmd) > 0) { if (!empty($switch_cmd)) {
$api_cmd = ''; $api_cmd = '';
$uuid_pattern = '/[^-A-Fa-f0-9]/'; $uuid_pattern = '/[^-A-Fa-f0-9]/';
$num_pattern = '/[^-A-Za-z0-9()*#]/'; $num_pattern = '/[^-A-Za-z0-9()*#]/';

View File

@ -124,7 +124,7 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
if(strlen($number_alias) > 0){ if(!empty($number_alias)){
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
} }
@ -143,7 +143,7 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['extension']."@".$_SESSION['user']['domain_name']);
if(strlen($number_alias) > 0){ if(!empty($number_alias)){
$cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']); $cache->delete("directory:".$row['number_alias']."@".$_SESSION['user']['domain_name']);
} }
@ -169,7 +169,7 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$extension."@".$this->domain_name); $cache->delete("directory:".$extension."@".$this->domain_name);
if(strlen($number_alias) > 0){ if(!empty($number_alias)){
$cache->delete("directory:".$number_alias."@".$this->domain_name); $cache->delete("directory:".$number_alias."@".$this->domain_name);
} }
} }

View File

@ -59,7 +59,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//delete the bridge //delete the bridge
if (permission_exists('bridge_delete')) { if (permission_exists('bridge_delete')) {
@ -91,10 +91,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($bridge_name) == 0) { $msg .= $text['message-required']." ".$text['label-bridge_name']."<br>\n"; } if (empty($bridge_name)) { $msg .= $text['message-required']." ".$text['label-bridge_name']."<br>\n"; }
if (strlen($bridge_destination) == 0) { $msg .= $text['message-required']." ".$text['label-bridge_destination']."<br>\n"; } if (empty($bridge_destination)) { $msg .= $text['message-required']." ".$text['label-bridge_destination']."<br>\n"; }
if (strlen($bridge_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-bridge_enabled']."<br>\n"; } if (empty($bridge_enabled)) { $msg .= $text['message-required']." ".$text['label-bridge_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -108,7 +108,7 @@
} }
//add the bridge_uuid //add the bridge_uuid
if (strlen($bridge_uuid) == 0) { if (empty($bridge_uuid)) {
$bridge_uuid = uuid(); $bridge_uuid = uuid();
} }
@ -163,7 +163,7 @@
} }
//set the defaults //set the defaults
if (strlen($bridge_enabled) == 0) { $bridge_enabled = 'true'; } if (empty($bridge_enabled)) { $bridge_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -132,7 +132,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -206,7 +206,7 @@
echo " <input type='hidden' name='show' value='all'>"; echo " <input type='hidden' name='show' value='all'>";
} }
else { else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type).'&show=all'.($search != '' ? "&search=".urlencode($search) : null)]); echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.($search != '' ? "&search=".urlencode($search ?? '') : null)]);
} }
} }
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>"; echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
@ -285,7 +285,7 @@
} }
echo " </td>\n"; echo " </td>\n";
echo " <td class='center'>"; echo " <td class='center'>";
if (strlen($row['extension']) == 0) { if (empty($row['extension'])) {
echo $text['label-all']; echo $text['label-all'];
} }
else { else {

View File

@ -76,7 +76,7 @@
} }
//handle the http post //handle the http post
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//handle action //handle action
if ($_POST['action'] != '') { if ($_POST['action'] != '') {
@ -118,10 +118,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($call_block_name) == 0) { $msg .= $text['label-provide-name']."<br>\n"; } //if (empty($call_block_name)) { $msg .= $text['label-provide-name']."<br>\n"; }
//if (strlen($call_block_number) == 0) { $msg .= $text['label-provide-number']."<br>\n"; } //if (empty($call_block_number)) { $msg .= $text['label-provide-number']."<br>\n"; }
if (strlen($call_block_enabled) == 0) { $msg .= $text['label-provide-enabled']."<br>\n"; } if (empty($call_block_enabled)) { $msg .= $text['label-provide-enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -272,7 +272,7 @@
} }
//set the defaults //set the defaults
if (strlen($call_block_enabled) == 0) { $call_block_enabled = 'true'; } if (empty($call_block_enabled)) { $call_block_enabled = 'true'; }
//get the extensions //get the extensions
if (permission_exists('call_block_all') || permission_exists('call_block_extension')) { if (permission_exists('call_block_all') || permission_exists('call_block_extension')) {

View File

@ -80,7 +80,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " ("; $sql_search = " (";
$sql_search .= " lower(broadcast_name) like :search "; $sql_search .= " lower(broadcast_name) like :search ";
$sql_search .= " or lower(broadcast_description) like :search "; $sql_search .= " or lower(broadcast_description) like :search ";
@ -111,7 +111,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -151,7 +151,7 @@
echo " <input type='hidden' name='show' value='all'>"; echo " <input type='hidden' name='show' value='all'>";
} }
else { else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type).'&show=all'.($search != '' ? "&search=".urlencode($search) : null)]); echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type ?? '').'&show=all'.($search != '' ? "&search=".urlencode($search ?? '') : null)]);
} }
} }
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>"; echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
@ -212,7 +212,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('call_broadcast_all')) { if ($_GET['show'] == "all" && permission_exists('call_broadcast_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -128,7 +128,7 @@
} }
} }
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//delete the call broadcast //delete the call broadcast
if (permission_exists('call_broadcast_delete')) { if (permission_exists('call_broadcast_delete')) {
@ -159,18 +159,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
//check for all required data //check for all required data
if (strlen($broadcast_name) == 0) { $msg .= "".$text['confirm-name']."<br>\n"; } if (empty($broadcast_name)) { $msg .= "".$text['confirm-name']."<br>\n"; }
//if (strlen($broadcast_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($broadcast_description)) { $msg .= "Please provide: Description<br>\n"; }
//if (strlen($broadcast_timeout) == 0) { $msg .= "Please provide: Timeout<br>\n"; } //if (empty($broadcast_timeout)) { $msg .= "Please provide: Timeout<br>\n"; }
//if (strlen($broadcast_concurrent_limit) == 0) { $msg .= "Please provide: Concurrent Limit<br>\n"; } //if (empty($broadcast_concurrent_limit)) { $msg .= "Please provide: Concurrent Limit<br>\n"; }
//if (strlen($recording_uuid) == 0) { $msg .= "Please provide: Recording<br>\n"; } //if (empty($recording_uuid)) { $msg .= "Please provide: Recording<br>\n"; }
//if (strlen($broadcast_caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name<br>\n"; } //if (empty($broadcast_caller_id_name)) { $msg .= "Please provide: Caller ID Name<br>\n"; }
//if (strlen($broadcast_caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number<br>\n"; } //if (empty($broadcast_caller_id_number)) { $msg .= "Please provide: Caller ID Number<br>\n"; }
//if (strlen($broadcast_destination_type) == 0) { $msg .= "Please provide: Type<br>\n"; } //if (empty($broadcast_destination_type)) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($broadcast_phone_numbers) == 0) { $msg .= "Please provide: Phone Number List<br>\n"; } //if (empty($broadcast_phone_numbers)) { $msg .= "Please provide: Phone Number List<br>\n"; }
//if (strlen($broadcast_avmd) == 0) { $msg .= "Please provide: Voicemail Detection<br>\n"; } //if (empty($broadcast_avmd)) { $msg .= "Please provide: Voicemail Detection<br>\n"; }
//if (strlen($broadcast_destination_data) == 0) { $msg .= "Please provide: Destination<br>\n"; } //if (empty($broadcast_destination_data)) { $msg .= "Please provide: Destination<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -510,7 +510,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' style='width: 300px; height: 200px;' type='text' name='broadcast_phone_numbers' placeholder=\"".$text['label-list_example']."\">".str_replace('\n', "\n", $broadcast_phone_numbers)."</textarea>"; echo " <textarea class='formfld' style='width: 300px; height: 200px;' type='text' name='broadcast_phone_numbers' placeholder=\"".$text['label-list_example']."\">".str_replace('\n', "\n", $broadcast_phone_numbers ?? '')."</textarea>";
echo "<br><br>"; echo "<br><br>";
echo " <input type='file' name='broadcast_phone_numbers_file' accept='.csv,.txt' style=\"display:inline-block;\"><a href='sample.csv' download><i class='fas fa-cloud-download-alt' style='margin-right: 5px;'></i>".$text['label-sample_file']."</a>"; echo " <input type='file' name='broadcast_phone_numbers_file' accept='.csv,.txt' style=\"display:inline-block;\"><a href='sample.csv' download><i class='fas fa-cloud-download-alt' style='margin-right: 5px;'></i>".$text['label-sample_file']."</a>";
echo "<br /><br />"; echo "<br /><br />";

View File

@ -97,7 +97,7 @@
$broadcast_avmd = $row["broadcast_avmd"]; $broadcast_avmd = $row["broadcast_avmd"];
$broadcast_accountcode = $row["broadcast_accountcode"]; $broadcast_accountcode = $row["broadcast_accountcode"];
$broadcast_description = $row["broadcast_description"]; $broadcast_description = $row["broadcast_description"];
//if (strlen($row["broadcast_destination_data"]) == 0) { //if (empty($row["broadcast_destination_data"])) {
// $broadcast_destination_application = ''; // $broadcast_destination_application = '';
// $broadcast_destination_data = ''; // $broadcast_destination_data = '';
//} //}
@ -110,13 +110,13 @@
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
//set the defaults //set the defaults
if (strlen($broadcast_caller_id_name) == 0) { if (empty($broadcast_caller_id_name)) {
$broadcast_caller_id_name = "anonymous"; $broadcast_caller_id_name = "anonymous";
} }
if (strlen($broadcast_caller_id_number) == 0) { if (empty($broadcast_caller_id_number)) {
$broadcast_caller_id_number = "0000000000"; $broadcast_caller_id_number = "0000000000";
} }
if (strlen($broadcast_accountcode) == 0) { if (empty($broadcast_accountcode)) {
$broadcast_accountcode = $_SESSION['domain_name'];; $broadcast_accountcode = $_SESSION['domain_name'];;
} }
if (isset($broadcast_start_time) && is_numeric($broadcast_start_time)) { if (isset($broadcast_start_time) && is_numeric($broadcast_start_time)) {
@ -157,7 +157,7 @@
require_once "resources/header.php"; require_once "resources/header.php";
//send the call broadcast //send the call broadcast
if (strlen($broadcast_phone_numbers) > 0) { if (!empty($broadcast_phone_numbers)) {
$broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers); $broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers);
$count = 1; $count = 1;
foreach ($broadcast_phone_number_array as $tmp_value) { foreach ($broadcast_phone_number_array as $tmp_value) {
@ -210,7 +210,7 @@
//cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";"); //cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";");
//spread the calls out so that they are scheduled with different times //spread the calls out so that they are scheduled with different times
if (strlen($broadcast_concurrent_limit) > 0 && strlen($broadcast_timeout) > 0) { if (strlen($broadcast_concurrent_limit) > 0 && !empty($broadcast_timeout)) {
if ($broadcast_concurrent_limit == $count) { if ($broadcast_concurrent_limit == $count) {
$sched_seconds = $sched_seconds + $broadcast_timeout; $sched_seconds = $sched_seconds + $broadcast_timeout;
$count=0; $count=0;

View File

@ -117,7 +117,7 @@
var url = 'call_center_active_inc.php?queue_name=<?php echo escape($queue_name); ?>&name=<?php echo urlencode(escape($name)); ?>'; var url = 'call_center_active_inc.php?queue_name=<?php echo escape($queue_name); ?>&name=<?php echo urlencode(escape($name)); ?>';
new loadXmlHttp(url, 'ajax_response'); new loadXmlHttp(url, 'ajax_response');
<?php <?php
if (strlen($_SESSION["ajax_refresh_rate"]) == 0) { $_SESSION["ajax_refresh_rate"] = "1777"; } if (empty($_SESSION["ajax_refresh_rate"])) { $_SESSION["ajax_refresh_rate"] = "1777"; }
echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");"; echo "setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, ".$_SESSION["ajax_refresh_rate"].");";
?> ?>
} }

View File

@ -136,7 +136,7 @@
} }
//fs cmd //fs cmd
if (strlen($switch_cmd) > 0) { if (!empty($switch_cmd)) {
//setup the event socket connection //setup the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//ensure the connection exists //ensure the connection exists

View File

@ -51,7 +51,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " ("; $sql_search = " (";
$sql_search .= "lower(queue_name) like :search "; $sql_search .= "lower(queue_name) like :search ";
$sql_search .= "or lower(queue_description) like :search "; $sql_search .= "or lower(queue_description) like :search ";

View File

@ -122,10 +122,10 @@ if ($domains_processed == 1) {
} }
} }
} }
if (strlen($row['queue_cid_prefix']) > 0) { if (!empty($row['queue_cid_prefix'])) {
$dialplan_xml .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($row['queue_cid_prefix'])."#\${caller_id_name}\"/>\n"; $dialplan_xml .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($row['queue_cid_prefix'])."#\${caller_id_name}\"/>\n";
} }
if (strlen($row['queue_cc_exit_keys']) > 0) { if (!empty($row['queue_cc_exit_keys'])) {
$dialplan_xml .= " <action application=\"set\" data=\"cc_exit_keys=".xml::sanitize($row['queue_cc_exit_keys'])."\"/>\n"; $dialplan_xml .= " <action application=\"set\" data=\"cc_exit_keys=".xml::sanitize($row['queue_cc_exit_keys'])."\"/>\n";
} }
$dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($row['queue_extension'])."@".xml::sanitize($row['domain_name'])."\"/>\n"; $dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($row['queue_extension'])."@".xml::sanitize($row['domain_name'])."\"/>\n";

View File

@ -101,7 +101,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -113,23 +113,23 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($call_center_agent_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-call_center_agent_uuid']."<br>\n"; } //if (empty($call_center_agent_uuid)) { $msg .= $text['message-required']." ".$text['label-call_center_agent_uuid']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; } //if (empty($user_uuid)) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
if (strlen($agent_name) == 0) { $msg .= $text['message-required']." ".$text['label-agent_name']."<br>\n"; } if (empty($agent_name)) { $msg .= $text['message-required']." ".$text['label-agent_name']."<br>\n"; }
if (strlen($agent_type) == 0) { $msg .= $text['message-required']." ".$text['label-agent_type']."<br>\n"; } if (empty($agent_type)) { $msg .= $text['message-required']." ".$text['label-agent_type']."<br>\n"; }
if (strlen($agent_call_timeout) == 0) { $msg .= $text['message-required']." ".$text['label-agent_call_timeout']."<br>\n"; } if (empty($agent_call_timeout)) { $msg .= $text['message-required']." ".$text['label-agent_call_timeout']."<br>\n"; }
//if (strlen($agent_id) == 0) { $msg .= $text['message-required']." ".$text['label-agent_id']."<br>\n"; } //if (empty($agent_id)) { $msg .= $text['message-required']." ".$text['label-agent_id']."<br>\n"; }
//if (strlen($agent_password) == 0) { $msg .= $text['message-required']." ".$text['label-agent_password']."<br>\n"; } //if (empty($agent_password)) { $msg .= $text['message-required']." ".$text['label-agent_password']."<br>\n"; }
//if (strlen($agent_status) == 0) { $msg .= $text['message-required']." ".$text['label-agent_status']."<br>\n"; } //if (empty($agent_status)) { $msg .= $text['message-required']." ".$text['label-agent_status']."<br>\n"; }
if (strlen($agent_contact) == 0) { $msg .= $text['message-required']." ".$text['label-agent_contact']."<br>\n"; } if (empty($agent_contact)) { $msg .= $text['message-required']." ".$text['label-agent_contact']."<br>\n"; }
if (strlen($agent_no_answer_delay_time) == 0) { $msg .= $text['message-required']." ".$text['label-agent_no_answer_delay_time']."<br>\n"; } if (empty($agent_no_answer_delay_time)) { $msg .= $text['message-required']." ".$text['label-agent_no_answer_delay_time']."<br>\n"; }
if (strlen($agent_max_no_answer) == 0) { $msg .= $text['message-required']." ".$text['label-agent_max_no_answer']."<br>\n"; } if (empty($agent_max_no_answer)) { $msg .= $text['message-required']." ".$text['label-agent_max_no_answer']."<br>\n"; }
if (strlen($agent_wrap_up_time) == 0) { $msg .= $text['message-required']." ".$text['label-agent_wrap_up_time']."<br>\n"; } if (empty($agent_wrap_up_time)) { $msg .= $text['message-required']." ".$text['label-agent_wrap_up_time']."<br>\n"; }
if (strlen($agent_reject_delay_time) == 0) { $msg .= $text['message-required']." ".$text['label-agent_reject_delay_time']."<br>\n"; } if (empty($agent_reject_delay_time)) { $msg .= $text['message-required']." ".$text['label-agent_reject_delay_time']."<br>\n"; }
if (strlen($agent_busy_delay_time) == 0) { $msg .= $text['message-required']." ".$text['label-agent_busy_delay_time']."<br>\n"; } if (empty($agent_busy_delay_time)) { $msg .= $text['message-required']." ".$text['label-agent_busy_delay_time']."<br>\n"; }
//if (strlen($agent_logout) == 0) { $msg .= $text['message-required']." ".$text['label-agent_logout']."<br>\n"; } //if (empty($agent_logout)) { $msg .= $text['message-required']." ".$text['label-agent_logout']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -143,7 +143,7 @@
} }
//add the call_center_agent_uuid //add the call_center_agent_uuid
if (strlen($call_center_agent_uuid) == 0) { if (empty($call_center_agent_uuid)) {
$call_center_agent_uuid = uuid(); $call_center_agent_uuid = uuid();
} }
@ -278,7 +278,7 @@
header("Location: call_center_agents.php"); header("Location: call_center_agents.php");
return; return;
} }
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) } //(is_array($_POST) && empty($_POST["persistformvar"]))
//initialize the destinations object //initialize the destinations object
$destination = new destinations; $destination = new destinations;
@ -315,13 +315,13 @@
} }
//set default values //set default values
if (strlen($agent_type) == 0) { $agent_type = "callback"; } if (empty($agent_type)) { $agent_type = "callback"; }
if (strlen($agent_call_timeout) == 0) { $agent_call_timeout = "20"; } if (empty($agent_call_timeout)) { $agent_call_timeout = "20"; }
if (strlen($agent_max_no_answer) == 0) { $agent_max_no_answer = "0"; } if (empty($agent_max_no_answer)) { $agent_max_no_answer = "0"; }
if (strlen($agent_wrap_up_time) == 0) { $agent_wrap_up_time = "10"; } if (empty($agent_wrap_up_time)) { $agent_wrap_up_time = "10"; }
if (strlen($agent_no_answer_delay_time) == 0) { $agent_no_answer_delay_time = "30"; } if (empty($agent_no_answer_delay_time)) { $agent_no_answer_delay_time = "30"; }
if (strlen($agent_reject_delay_time) == 0) { $agent_reject_delay_time = "90"; } if (empty($agent_reject_delay_time)) { $agent_reject_delay_time = "90"; }
if (strlen($agent_busy_delay_time) == 0) { $agent_busy_delay_time = "90"; } if (empty($agent_busy_delay_time)) { $agent_busy_delay_time = "90"; }
//create token //create token
$object = new token; $object = new token;

View File

@ -74,7 +74,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " ("; $sql_search = " (";
$sql_search .= "lower(agent_name) like :search "; $sql_search .= "lower(agent_name) like :search ";
$sql_search .= "or lower(agent_id) like :search "; $sql_search .= "or lower(agent_id) like :search ";
@ -102,13 +102,13 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
//get the list //get the list
$sql = str_replace('count(*)', '*', $sql); $sql = str_replace('count(*)', '*', $sql ?? '');
$sql .= order_by($order_by, $order, 'agent_name', 'asc'); $sql .= order_by($order_by, $order, 'agent_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset); $sql .= limit_offset($rows_per_page, $offset);
$database = new database; $database = new database;
@ -211,7 +211,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('call_center_all')) { if ($_GET['show'] == "all" && permission_exists('call_center_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -157,7 +157,7 @@
} }
//delete the tier from the database //delete the tier from the database
if (strlen($call_center_tier_uuid) > 0) { if (!empty($call_center_tier_uuid)) {
$array['call_center_tiers'][0]['call_center_tier_uuid'] = $call_center_tier_uuid; $array['call_center_tiers'][0]['call_center_tier_uuid'] = $call_center_tier_uuid;
$array['call_center_tiers'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['call_center_tiers'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -175,7 +175,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid from the POST //get the uuid from the POST
if ($action == "update") { if ($action == "update") {
@ -192,27 +192,27 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
if (strlen($queue_name) == 0) { $msg .= $text['message-required'].$text['label-queue_name']."<br>\n"; } if (empty($queue_name)) { $msg .= $text['message-required'].$text['label-queue_name']."<br>\n"; }
if (strlen($queue_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; } if (empty($queue_extension)) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; }
if (strlen($queue_strategy) == 0) { $msg .= $text['message-required'].$text['label-strategy']."<br>\n"; } if (empty($queue_strategy)) { $msg .= $text['message-required'].$text['label-strategy']."<br>\n"; }
//if (strlen($queue_moh_sound) == 0) { $msg .= $text['message-required'].$text['label-music_on_hold']."<br>\n"; } //if (empty($queue_moh_sound)) { $msg .= $text['message-required'].$text['label-music_on_hold']."<br>\n"; }
//if (strlen($queue_record_template) == 0) { $msg .= $text['message-required'].$text['label-record_template']."<br>\n"; } //if (empty($queue_record_template)) { $msg .= $text['message-required'].$text['label-record_template']."<br>\n"; }
//if (strlen($queue_time_base_score) == 0) { $msg .= $text['message-required'].$text['label-time_base_score']."<br>\n"; } //if (empty($queue_time_base_score)) { $msg .= $text['message-required'].$text['label-time_base_score']."<br>\n"; }
//if (strlen($queue_time_base_score_sec) == 0) { $msg .= $text['message-required'].$text['label-time_base_score_sec']."<br>\n"; } //if (empty($queue_time_base_score_sec)) { $msg .= $text['message-required'].$text['label-time_base_score_sec']."<br>\n"; }
//if (strlen($queue_max_wait_time) == 0) { $msg .= $text['message-required'].$text['label-max_wait_time']."<br>\n"; } //if (empty($queue_max_wait_time)) { $msg .= $text['message-required'].$text['label-max_wait_time']."<br>\n"; }
//if (strlen($queue_max_wait_time_with_no_agent) == 0) { $msg .= $text['message-required'].$text['label-max_wait_time_with_no_agent']."<br>\n"; } //if (empty($queue_max_wait_time_with_no_agent)) { $msg .= $text['message-required'].$text['label-max_wait_time_with_no_agent']."<br>\n"; }
//if (strlen($queue_max_wait_time_with_no_agent_time_reached) == 0) { $msg .= $text['message-required'].$text['label-max_wait_time_with_no_agent_time_reached']."<br>\n"; } //if (empty($queue_max_wait_time_with_no_agent_time_reached)) { $msg .= $text['message-required'].$text['label-max_wait_time_with_no_agent_time_reached']."<br>\n"; }
//if (strlen($queue_tier_rules_apply) == 0) { $msg .= $text['message-required'].$text['label-tier_rules_apply']."<br>\n"; } //if (empty($queue_tier_rules_apply)) { $msg .= $text['message-required'].$text['label-tier_rules_apply']."<br>\n"; }
//if (strlen($queue_tier_rule_wait_second) == 0) { $msg .= $text['message-required'].$text['label-tier_rule_wait_second']."<br>\n"; } //if (empty($queue_tier_rule_wait_second)) { $msg .= $text['message-required'].$text['label-tier_rule_wait_second']."<br>\n"; }
//if (strlen($queue_tier_rule_wait_multiply_level) == 0) { $msg .= $text['message-required'].$text['label-tier_rule_wait_multiply_level']."<br>\n"; } //if (empty($queue_tier_rule_wait_multiply_level)) { $msg .= $text['message-required'].$text['label-tier_rule_wait_multiply_level']."<br>\n"; }
//if (strlen($queue_tier_rule_no_agent_no_wait) == 0) { $msg .= $text['message-required'].$text['label-tier_rule_no_agent_no_wait']."<br>\n"; } //if (empty($queue_tier_rule_no_agent_no_wait)) { $msg .= $text['message-required'].$text['label-tier_rule_no_agent_no_wait']."<br>\n"; }
//if (strlen($queue_timeout_action) == 0) { $msg .= $text['message-required'].$text['label-timeout_action']."<br>\n"; } //if (empty($queue_timeout_action)) { $msg .= $text['message-required'].$text['label-timeout_action']."<br>\n"; }
//if (strlen($queue_discard_abandoned_after) == 0) { $msg .= $text['message-required'].$text['label-discard_abandoned_after']."<br>\n"; } //if (empty($queue_discard_abandoned_after)) { $msg .= $text['message-required'].$text['label-discard_abandoned_after']."<br>\n"; }
//if (strlen($queue_abandoned_resume_allowed) == 0) { $msg .= $text['message-required'].$text['label-abandoned_resume_allowed']."<br>\n"; } //if (empty($queue_abandoned_resume_allowed)) { $msg .= $text['message-required'].$text['label-abandoned_resume_allowed']."<br>\n"; }
//if (strlen($queue_cid_prefix) == 0) { $msg .= $text['message-required'].$text['label-caller_id_name_prefix']."<br>\n"; } //if (empty($queue_cid_prefix)) { $msg .= $text['message-required'].$text['label-caller_id_name_prefix']."<br>\n"; }
//if (strlen($queue_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } //if (empty($queue_description)) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -229,13 +229,13 @@
$_POST["domain_uuid"] = $_SESSION["domain_uuid"]; $_POST["domain_uuid"] = $_SESSION["domain_uuid"];
//add the call_center_queue_uuid //add the call_center_queue_uuid
if (strlen($_POST["call_center_queue_uuid"]) == 0) { if (empty($_POST["call_center_queue_uuid"])) {
$call_center_queue_uuid = uuid(); $call_center_queue_uuid = uuid();
$_POST["call_center_queue_uuid"] = $call_center_queue_uuid; $_POST["call_center_queue_uuid"] = $call_center_queue_uuid;
} }
//add the dialplan_uuid //add the dialplan_uuid
if (strlen($_POST["dialplan_uuid"]) == 0) { if (empty($_POST["dialplan_uuid"])) {
$dialplan_uuid = uuid(); $dialplan_uuid = uuid();
$_POST["dialplan_uuid"] = $dialplan_uuid; $_POST["dialplan_uuid"] = $dialplan_uuid;
} }
@ -245,11 +245,11 @@
if (is_array($_POST["call_center_tiers"]) && @sizeof($_POST["call_center_tiers"]) != 0) { if (is_array($_POST["call_center_tiers"]) && @sizeof($_POST["call_center_tiers"]) != 0) {
foreach ($_POST["call_center_tiers"] as $row) { foreach ($_POST["call_center_tiers"] as $row) {
//add the domain_uuid //add the domain_uuid
if (strlen($row["domain_uuid"]) == 0) { if (empty($row["domain_uuid"])) {
$_POST["call_center_tiers"][$x]["domain_uuid"] = $_SESSION['domain_uuid']; $_POST["call_center_tiers"][$x]["domain_uuid"] = $_SESSION['domain_uuid'];
} }
//unset ring_group_destination_uuid if the field has no value //unset ring_group_destination_uuid if the field has no value
if (strlen($row["call_center_agent_uuid"]) == 0) { if (empty($row["call_center_agent_uuid"])) {
unset($_POST["call_center_tiers"][$x]); unset($_POST["call_center_tiers"][$x]);
} }
//increment the row //increment the row
@ -324,7 +324,7 @@
else { else {
$call_center_tier_uuid = uuid(); $call_center_tier_uuid = uuid();
} }
if (strlen($row['call_center_agent_uuid']) > 0) { if (!empty($row['call_center_agent_uuid'])) {
$array["call_center_queues"][0]["call_center_tiers"][$y]["call_center_tier_uuid"] = $call_center_tier_uuid; $array["call_center_queues"][0]["call_center_tiers"][$y]["call_center_tier_uuid"] = $call_center_tier_uuid;
$array['call_center_queues'][0]["call_center_tiers"][$y]["call_center_agent_uuid"] = $row['call_center_agent_uuid']; $array['call_center_queues'][0]["call_center_tiers"][$y]["call_center_agent_uuid"] = $row['call_center_agent_uuid'];
$array['call_center_queues'][0]["call_center_tiers"][$y]["tier_level"] = $row['tier_level']; $array['call_center_queues'][0]["call_center_tiers"][$y]["tier_level"] = $row['tier_level'];
@ -365,10 +365,10 @@
} }
} }
} }
if (strlen($queue_cid_prefix) > 0) { if (!empty($queue_cid_prefix)) {
$dialplan_xml .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($queue_cid_prefix)."#\${caller_id_name}\"/>\n"; $dialplan_xml .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($queue_cid_prefix)."#\${caller_id_name}\"/>\n";
} }
if (strlen($queue_cc_exit_keys) > 0) { if (!empty($queue_cc_exit_keys)) {
$dialplan_xml .= " <action application=\"set\" data=\"cc_exit_keys=".xml::sanitize($queue_cc_exit_keys)."\"/>\n"; $dialplan_xml .= " <action application=\"set\" data=\"cc_exit_keys=".xml::sanitize($queue_cc_exit_keys)."\"/>\n";
} }
$dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($queue_extension)."@".$_SESSION["domain_name"]."\"/>\n"; $dialplan_xml .= " <action application=\"callcenter\" data=\"".xml::sanitize($queue_extension)."@".$_SESSION["domain_name"]."\"/>\n";
@ -486,7 +486,7 @@
} }
return; return;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && empty($_POST["persistformvar"]))
//pre-populate the form //pre-populate the form
if (is_array($_GET) && is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") { if (is_array($_GET) && is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") {
@ -581,19 +581,19 @@
$sounds = $sounds->get(); $sounds = $sounds->get();
//set default values //set default values
if (strlen($queue_strategy) == 0) { $queue_strategy = "longest-idle-agent"; } if (empty($queue_strategy)) { $queue_strategy = "longest-idle-agent"; }
if (strlen($queue_moh_sound) == 0) { $queue_moh_sound = "\$\${hold_music}"; } if (empty($queue_moh_sound)) { $queue_moh_sound = "\$\${hold_music}"; }
if (strlen($queue_time_base_score) == 0) { $queue_time_base_score = "system"; } if (empty($queue_time_base_score)) { $queue_time_base_score = "system"; }
if (strlen($queue_time_base_score) == 0) { $queue_time_base_score = ""; } if (empty($queue_time_base_score)) { $queue_time_base_score = ""; }
if (strlen($queue_max_wait_time) == 0) { $queue_max_wait_time = "0"; } if (empty($queue_max_wait_time)) { $queue_max_wait_time = "0"; }
if (strlen($queue_max_wait_time_with_no_agent) == 0) { $queue_max_wait_time_with_no_agent = "90"; } if (empty($queue_max_wait_time_with_no_agent)) { $queue_max_wait_time_with_no_agent = "90"; }
if (strlen($queue_max_wait_time_with_no_agent_time_reached) == 0) { $queue_max_wait_time_with_no_agent_time_reached = "30"; } if (empty($queue_max_wait_time_with_no_agent_time_reached)) { $queue_max_wait_time_with_no_agent_time_reached = "30"; }
if (strlen($queue_tier_rules_apply) == 0) { $queue_tier_rules_apply = "false"; } if (empty($queue_tier_rules_apply)) { $queue_tier_rules_apply = "false"; }
if (strlen($queue_tier_rule_wait_second) == 0) { $queue_tier_rule_wait_second = "30"; } if (empty($queue_tier_rule_wait_second)) { $queue_tier_rule_wait_second = "30"; }
if (strlen($queue_tier_rule_wait_multiply_level) == 0) { $queue_tier_rule_wait_multiply_level = "true"; } if (empty($queue_tier_rule_wait_multiply_level)) { $queue_tier_rule_wait_multiply_level = "true"; }
if (strlen($queue_tier_rule_no_agent_no_wait) == 0) { $queue_tier_rule_no_agent_no_wait = "true"; } if (empty($queue_tier_rule_no_agent_no_wait)) { $queue_tier_rule_no_agent_no_wait = "true"; }
if (strlen($queue_discard_abandoned_after) == 0) { $queue_discard_abandoned_after = "900"; } if (empty($queue_discard_abandoned_after)) { $queue_discard_abandoned_after = "900"; }
if (strlen($queue_abandoned_resume_allowed) == 0) { $queue_abandoned_resume_allowed = "false"; } if (empty($queue_abandoned_resume_allowed)) { $queue_abandoned_resume_allowed = "false"; }
//create token //create token
$object = new token; $object = new token;
@ -825,7 +825,7 @@
foreach($tiers as $field) { foreach($tiers as $field) {
echo " <tr>\n"; echo " <tr>\n";
echo " <td class=''>"; echo " <td class=''>";
if (strlen($field['call_center_tier_uuid']) > 0) { if (!empty($field['call_center_tier_uuid'])) {
echo " <input name='call_center_tiers[".$x."][call_center_tier_uuid]' type='hidden' value=\"".escape($field['call_center_tier_uuid'])."\">\n"; echo " <input name='call_center_tiers[".$x."][call_center_tier_uuid]' type='hidden' value=\"".escape($field['call_center_tier_uuid'])."\">\n";
} }
echo " <select name=\"call_center_tiers[$x][call_center_agent_uuid]\" class=\"formfld\" style=\"width: 200px\">\n"; echo " <select name=\"call_center_tiers[$x][call_center_agent_uuid]\" class=\"formfld\" style=\"width: 200px\">\n";
@ -901,13 +901,13 @@
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}"; $record_template = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}/\${uuid}.\${record_ext}";
echo " <select class='formfld' name='queue_record_template'>\n"; echo " <select class='formfld' name='queue_record_template'>\n";
if (strlen($queue_record_template) > 0) { if (!empty($queue_record_template)) {
echo " <option value='".escape($queue_record_template)."' selected='selected' >".$text['option-true']."</option>\n"; echo " <option value='".escape($queue_record_template)."' selected='selected' >".$text['option-true']."</option>\n";
} }
else { else {
echo " <option value='".escape($record_template)."'>".$text['option-true']."</option>\n"; echo " <option value='".escape($record_template)."'>".$text['option-true']."</option>\n";
} }
if (strlen($queue_record_template) == 0) { if (empty($queue_record_template)) {
echo " <option value='' selected='selected' >".$text['option-false']."</option>\n"; echo " <option value='' selected='selected' >".$text['option-false']."</option>\n";
} }
else { else {
@ -1239,11 +1239,11 @@
foreach ($recordings as &$row) { foreach ($recordings as &$row) {
$recording_name = $row["recording_name"]; $recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"]; $recording_filename = $row["recording_filename"];
if ($queue_announce_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($queue_announce_sound) > 0) { if ($queue_announce_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && !empty($queue_announce_sound)) {
$tmp_selected = true; $tmp_selected = true;
echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n"; echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
} }
else if ($queue_announce_sound == $recording_filename && strlen($queue_announce_sound) > 0) { else if ($queue_announce_sound == $recording_filename && !empty($queue_announce_sound)) {
$tmp_selected = true; $tmp_selected = true;
echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n"; echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
} }
@ -1254,7 +1254,7 @@
echo "</optgroup>\n"; echo "</optgroup>\n";
} }
if (!$tmp_selected && strlen($queue_announce_sound) > 0) { if (!$tmp_selected && !empty($queue_announce_sound)) {
echo "<optgroup label='Selected'>\n"; echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$queue_announce_sound)) { if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$queue_announce_sound)) {
echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($queue_announce_sound)."' selected='selected'>".escape($queue_announce_sound)."</option>\n"; echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($queue_announce_sound)."' selected='selected'>".escape($queue_announce_sound)."</option>\n";

View File

@ -80,7 +80,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " ("; $sql_search = " (";
$sql_search .= "lower(queue_name) like :search "; $sql_search .= "lower(queue_name) like :search ";
$sql_search .= "or lower(queue_description) like :search "; $sql_search .= "or lower(queue_description) like :search ";
@ -108,13 +108,13 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
//get the list //get the list
$sql = str_replace('count(*)', '*', $sql); $sql = str_replace('count(*)', '*', $sql ?? '');
$sql .= order_by($order_by, $order, 'queue_name', 'asc'); $sql .= order_by($order_by, $order, 'queue_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset); $sql .= limit_offset($rows_per_page, $offset);
$database = new database; $database = new database;
@ -234,7 +234,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('call_center_all')) { if ($_GET['show'] == "all" && permission_exists('call_center_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -146,7 +146,7 @@
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++; $y++;
if (strlen($this->queue_cid_prefix) > 0) { if (!empty($this->queue_cid_prefix)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@ -156,7 +156,7 @@
$y++; $y++;
} }
if (strlen($this->queue_greeting) > 0) { if (!empty($this->queue_greeting)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "sleep"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "sleep";
@ -166,7 +166,7 @@
$y++; $y++;
} }
if (strlen($this->queue_greeting) > 0) { if (!empty($this->queue_greeting)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
@ -176,7 +176,7 @@
$y++; $y++;
} }
if (strlen($this->queue_cc_exit_keys) > 0) { if (!empty($this->queue_cc_exit_keys)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@ -194,7 +194,7 @@
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++; $y++;
if (strlen($this->queue_timeout_action) > 0) { if (!empty($this->queue_timeout_action)) {
$action_array = explode(":",$this->queue_timeout_action); $action_array = explode(":",$this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";

View File

@ -60,7 +60,7 @@
//get the http post values and set them as php variables //get the http post values and set them as php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
foreach ($_POST['agents'] as $row) { foreach ($_POST['agents'] as $row) {
if (strlen($row['agent_status']) > 0) { if (!empty($row['agent_status'])) {
//agent set status //agent set status
if ($fp) { if ($fp) {
// update the database // update the database

View File

@ -91,7 +91,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid from the POST //get the uuid from the POST
if ($action == "update") { if ($action == "update") {
@ -108,25 +108,25 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($call_flow_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_uuid']."<br>\n"; } //if (empty($call_flow_uuid)) { $msg .= $text['message-required']." ".$text['label-call_flow_uuid']."<br>\n"; }
//if (strlen($dialplan_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-dialplan_uuid']."<br>\n"; } //if (empty($dialplan_uuid)) { $msg .= $text['message-required']." ".$text['label-dialplan_uuid']."<br>\n"; }
//if (strlen($call_flow_name) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_name']."<br>\n"; } //if (empty($call_flow_name)) { $msg .= $text['message-required']." ".$text['label-call_flow_name']."<br>\n"; }
if (strlen($call_flow_extension) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_extension']."<br>\n"; } if (empty($call_flow_extension)) { $msg .= $text['message-required']." ".$text['label-call_flow_extension']."<br>\n"; }
if (strlen($call_flow_feature_code) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_feature_code']."<br>\n"; } if (empty($call_flow_feature_code)) { $msg .= $text['message-required']." ".$text['label-call_flow_feature_code']."<br>\n"; }
//if (strlen($call_flow_context) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_context']."<br>\n"; } //if (empty($call_flow_context)) { $msg .= $text['message-required']." ".$text['label-call_flow_context']."<br>\n"; }
//if (strlen($call_flow_status) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_status']."<br>\n"; } //if (empty($call_flow_status)) { $msg .= $text['message-required']." ".$text['label-call_flow_status']."<br>\n"; }
//if (strlen($call_flow_pin_number) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_pin_number']."<br>\n"; } //if (empty($call_flow_pin_number)) { $msg .= $text['message-required']." ".$text['label-call_flow_pin_number']."<br>\n"; }
//if (strlen($call_flow_label) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_label']."<br>\n"; } //if (empty($call_flow_label)) { $msg .= $text['message-required']." ".$text['label-call_flow_label']."<br>\n"; }
//if (strlen($call_flow_sound) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_sound']."<br>\n"; } //if (empty($call_flow_sound)) { $msg .= $text['message-required']." ".$text['label-call_flow_sound']."<br>\n"; }
if (strlen($call_flow_app) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_app']."<br>\n"; } if (empty($call_flow_app)) { $msg .= $text['message-required']." ".$text['label-call_flow_app']."<br>\n"; }
if (strlen($call_flow_data) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_data']."<br>\n"; } if (empty($call_flow_data)) { $msg .= $text['message-required']." ".$text['label-call_flow_data']."<br>\n"; }
//if (strlen($call_flow_alternate_label) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_label']."<br>\n"; } //if (empty($call_flow_alternate_label)) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_label']."<br>\n"; }
//if (strlen($call_flow_alternate_sound) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_sound']."<br>\n"; } //if (empty($call_flow_alternate_sound)) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_sound']."<br>\n"; }
//if (strlen($call_flow_alternate_app) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_app']."<br>\n"; } //if (empty($call_flow_alternate_app)) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_app']."<br>\n"; }
//if (strlen($call_flow_alternate_data) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_data']."<br>\n"; } //if (empty($call_flow_alternate_data)) { $msg .= $text['message-required']." ".$text['label-call_flow_alternate_data']."<br>\n"; }
//if (strlen($call_flow_description) == 0) { $msg .= $text['message-required']." ".$text['label-call_flow_description']."<br>\n"; } //if (empty($call_flow_description)) { $msg .= $text['message-required']." ".$text['label-call_flow_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -235,7 +235,7 @@
$database = new database; $database = new database;
$database->app_name = 'call_flows'; $database->app_name = 'call_flows';
$database->app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14'; $database->app_uuid = 'b1b70f85-6b42-429b-8c5a-60c8b02b7d14';
if (strlen($call_flow_uuid) > 0) { if (!empty($call_flow_uuid)) {
$database->uuid($call_flow_uuid); $database->uuid($call_flow_uuid);
} }
$database->save($array); $database->save($array);
@ -299,7 +299,7 @@
header("Location: call_flows.php"); header("Location: call_flows.php");
return; return;
} }
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) } //(is_array($_POST) && empty($_POST["persistformvar"]))
//pre-populate the form //pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") { if (is_array($_GET) && $_POST["persistformvar"] != "true") {
@ -352,12 +352,12 @@
} }
//set the context for users that are not in the superadmin group //set the context for users that are not in the superadmin group
if (strlen($call_flow_context) == 0) { if (empty($call_flow_context)) {
$call_flow_context = $_SESSION['domain_name']; $call_flow_context = $_SESSION['domain_name'];
} }
//set the defaults //set the defaults
if (strlen($call_flow_enabled) == 0) { $call_flow_enabled = 'true'; } if (empty($call_flow_enabled)) { $call_flow_enabled = 'true'; }
//get the recordings //get the recordings
$sql = "select recording_name, recording_filename from v_recordings "; $sql = "select recording_name, recording_filename from v_recordings ";
@ -425,11 +425,11 @@
foreach ($recordings as &$row) { foreach ($recordings as &$row) {
$recording_name = $row["recording_name"]; $recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"]; $recording_filename = $row["recording_filename"];
if ($var == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($var) > 0) { if ($var == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && !empty($var)) {
$tmp_selected = true; $tmp_selected = true;
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n"; echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
} }
else if ($var == $recording_filename && strlen($var) > 0) { else if ($var == $recording_filename && !empty($var)) {
$tmp_selected = true; $tmp_selected = true;
echo " <option value='".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n"; echo " <option value='".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
} }
@ -465,7 +465,7 @@
if (is_array($sound_files)) { if (is_array($sound_files)) {
echo "<optgroup label=".$text["sounds"].">\n"; echo "<optgroup label=".$text["sounds"].">\n";
foreach ($sound_files as $value) { foreach ($sound_files as $value) {
if (strlen($value) > 0) { if (!empty($value)) {
if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { if (substr($var, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
$var = substr($var, 71); $var = substr($var, 71);
} }
@ -483,7 +483,7 @@
} }
//select //select
if (if_group("superadmin")) { if (if_group("superadmin")) {
if (!$tmp_selected && strlen($var) > 0) { if (!$tmp_selected && !empty($var)) {
echo "<optgroup label='Selected'>\n"; echo "<optgroup label='Selected'>\n";
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$var)) { if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$var)) {
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".escape($var)."' selected='selected'>".escape($var)."</option>\n"; echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".escape($var)."' selected='selected'>".escape($var)."</option>\n";
@ -568,7 +568,7 @@
echo " <select class='formfld' name='call_flow_status'>\n"; echo " <select class='formfld' name='call_flow_status'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if ($call_flow_status == "true") { if ($call_flow_status == "true") {
if (strlen($call_flow_label) > 0) { if (!empty($call_flow_label)) {
echo " <option value='true' selected='selected'>".escape($call_flow_label)."</option>\n"; echo " <option value='true' selected='selected'>".escape($call_flow_label)."</option>\n";
} }
else { else {
@ -576,7 +576,7 @@
} }
} }
else { else {
if (strlen($call_flow_label) > 0) { if (!empty($call_flow_label)) {
echo " <option value='true'>".escape($call_flow_label)."</option>\n"; echo " <option value='true'>".escape($call_flow_label)."</option>\n";
} }
else { else {
@ -584,7 +584,7 @@
} }
} }
if ($call_flow_status == "false") { if ($call_flow_status == "false") {
if (strlen($call_flow_alternate_label) > 0) { if (!empty($call_flow_alternate_label)) {
echo " <option value='false' selected='selected'>".escape($call_flow_alternate_label)."</option>\n"; echo " <option value='false' selected='selected'>".escape($call_flow_alternate_label)."</option>\n";
} }
else { else {
@ -592,7 +592,7 @@
} }
} }
else { else {
if (strlen($call_flow_alternate_label) > 0) { if (!empty($call_flow_alternate_label)) {
echo " <option value='false'>".escape($call_flow_alternate_label)."</option>\n"; echo " <option value='false'>".escape($call_flow_alternate_label)."</option>\n";
} }
else { else {
@ -649,7 +649,7 @@
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$select_value = ''; $select_value = '';
//set the selected value //set the selected value
if (strlen($call_flow_app.$call_flow_data) > 0) { if (!empty($call_flow_app.$call_flow_data)) {
$select_value = $call_flow_app.':'.$call_flow_data; $select_value = $call_flow_app.':'.$call_flow_data;
} }
//show the destination list //show the destination list
@ -692,7 +692,7 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
$select_value = ''; $select_value = '';
if (strlen($call_flow_alternate_app.$call_flow_alternate_data) > 0) { if (!empty($call_flow_alternate_app.$call_flow_alternate_data)) {
$select_value = $call_flow_alternate_app.':'.$call_flow_alternate_data; $select_value = $call_flow_alternate_app.':'.$call_flow_alternate_data;
} }
echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value); echo $destination->select('dialplan', 'call_flow_alternate_destination', $select_value);

View File

@ -88,7 +88,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "and ("; $sql_search = "and (";
$sql_search .= "lower(call_flow_name) like :search "; $sql_search .= "lower(call_flow_name) like :search ";
$sql_search .= "or lower(call_flow_extension) like :search "; $sql_search .= "or lower(call_flow_extension) like :search ";
@ -120,13 +120,13 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
//get the list //get the list
$sql = str_replace('count(*)', '*', $sql); $sql = str_replace('count(*)', '*', $sql ?? '');
$sql .= order_by($order_by, $order, 'call_flow_name', 'asc'); $sql .= order_by($order_by, $order, 'call_flow_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset); $sql .= limit_offset($rows_per_page, $offset);
$database = new database; $database = new database;
@ -248,7 +248,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('call_flow_all')) { if ($_GET['show'] == "all" && permission_exists('call_flow_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -96,7 +96,7 @@
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and ( "; $sql .= "and ( ";
$sql .= "extension like :search "; $sql .= "extension like :search ";
$sql .= "or lower(description) like :search "; $sql .= "or lower(description) like :search ";
@ -142,7 +142,7 @@
$param = $params ? implode('&', $params) : null; $param = $params ? implode('&', $params) : null;
unset($params); unset($params);
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -156,7 +156,7 @@
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and ( "; $sql .= "and ( ";
$sql .= "extension like :search "; $sql .= "extension like :search ";
$sql .= "or lower(description) like :search "; $sql .= "or lower(description) like :search ";
@ -296,7 +296,7 @@
echo " </td>\n"; echo " </td>\n";
if ($_GET['show'] == "all" && permission_exists('call_forward_all')) { if ($_GET['show'] == "all" && permission_exists('call_forward_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -48,7 +48,7 @@
//define the destination_select function //define the destination_select function
function destination_select($select_name, $select_value, $select_default) { function destination_select($select_name, $select_value, $select_default) {
if (strlen($select_value) == 0) { $select_value = $select_default; } if (empty($select_value)) { $select_value = $select_default; }
echo " <select class='formfld' style='width: 55px;' name='$select_name'>\n"; echo " <select class='formfld' style='width: 55px;' name='$select_name'>\n";
$i = 0; $i = 0;
while($i <= 100) { while($i <= 100) {
@ -112,7 +112,7 @@
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
//process post vars //process post vars
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
@ -155,7 +155,7 @@
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-call_forward']; $document['title'] = $text['title-call_forward'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -444,7 +444,7 @@
//clear the cache //clear the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$extension."@".$_SESSION['domain_name']); $cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
if (strlen($number_alias) > 0) { if (!empty($number_alias)) {
$cache->delete("directory:".$number_alias."@".$_SESSION['domain_name']); $cache->delete("directory:".$number_alias."@".$_SESSION['domain_name']);
} }
@ -517,7 +517,7 @@
echo "\$(function() {\n"; echo "\$(function() {\n";
echo " var extensions = [\n"; echo " var extensions = [\n";
foreach ($extensions as &$row) { foreach ($extensions as &$row) {
if (strlen($number_alias) == 0) { if (empty($number_alias)) {
echo " \"".escape($row["extension"])."\",\n"; echo " \"".escape($row["extension"])."\",\n";
} }
else { else {

View File

@ -67,7 +67,7 @@
//build extension update array //build extension update array
$array['extensions'][0]['extension_uuid'] = $this->extension_uuid; $array['extensions'][0]['extension_uuid'] = $this->extension_uuid;
$array['extensions'][0]['forward_all_destination'] = strlen($this->forward_all_destination) != 0 ? $this->forward_all_destination : null; $array['extensions'][0]['forward_all_destination'] = strlen($this->forward_all_destination) != 0 ? $this->forward_all_destination : null;
if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") { if (empty($this->forward_all_destination) || $this->forward_all_enabled == "false") {
$array['extensions'][0]['forward_all_enabled'] = 'false'; $array['extensions'][0]['forward_all_enabled'] = 'false';
} }
else { else {
@ -90,7 +90,7 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$this->extension."@".$this->domain_name); $cache->delete("directory:".$this->extension."@".$this->domain_name);
if(strlen($this->number_alias) > 0){ if(!empty($this->number_alias)){
$cache->delete("directory:".$this->number_alias."@".$this->domain_name); $cache->delete("directory:".$this->number_alias."@".$this->domain_name);
} }

View File

@ -79,8 +79,8 @@
if (is_uuid($this->extension_uuid)) { if (is_uuid($this->extension_uuid)) {
$this->extension_uuid = $row["extension_uuid"]; $this->extension_uuid = $row["extension_uuid"];
} }
if (strlen($this->extension) == 0) { if (empty($this->extension)) {
if (strlen($row["number_alias"]) == 0) { if (empty($row["number_alias"])) {
$this->extension = $row["extension"]; $this->extension = $row["extension"];
} }
else { else {
@ -111,7 +111,7 @@
//delete extension from the cache //delete extension from the cache
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$this->extension."@".$this->domain_name); $cache->delete("directory:".$this->extension."@".$this->domain_name);
if(strlen($this->number_alias) > 0){ if(!empty($this->number_alias)){
$cache->delete("directory:".$this->number_alias."@".$this->domain_name); $cache->delete("directory:".$this->number_alias."@".$this->domain_name);
} }

View File

@ -84,7 +84,7 @@
$array['follow_me'][0]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me'][0]['follow_me_uuid'] = $this->follow_me_uuid;
$array['follow_me'][0]['domain_uuid'] = $this->domain_uuid; $array['follow_me'][0]['domain_uuid'] = $this->domain_uuid;
$array['follow_me'][0]['cid_name_prefix'] = $this->cid_name_prefix; $array['follow_me'][0]['cid_name_prefix'] = $this->cid_name_prefix;
if (strlen($this->cid_number_prefix) > 0) { if (!empty($this->cid_number_prefix)) {
$array['follow_me'][0]['cid_number_prefix'] = $this->cid_number_prefix; $array['follow_me'][0]['cid_number_prefix'] = $this->cid_number_prefix;
} }
@ -148,7 +148,7 @@
//build follow me destinations insert array //build follow me destinations insert array
$x = 0; $x = 0;
if (strlen($this->destination_data_1) > 0) { if (!empty($this->destination_data_1)) {
$array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid(); $array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid();
$array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid; $array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid;
@ -160,7 +160,7 @@
$this->destination_order++; $this->destination_order++;
$x++; $x++;
} }
if (strlen($this->destination_data_2) > 0) { if (!empty($this->destination_data_2)) {
$array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid(); $array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid();
$array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid; $array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid;
@ -172,7 +172,7 @@
$this->destination_order++; $this->destination_order++;
$x++; $x++;
} }
if (strlen($this->destination_data_3) > 0) { if (!empty($this->destination_data_3)) {
$array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid(); $array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid();
$array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid; $array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid;
@ -184,7 +184,7 @@
$this->destination_order++; $this->destination_order++;
$x++; $x++;
} }
if (strlen($this->destination_data_4) > 0) { if (!empty($this->destination_data_4)) {
$array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid(); $array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid();
$array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid; $array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid;
@ -196,7 +196,7 @@
$this->destination_order++; $this->destination_order++;
$x++; $x++;
} }
if (strlen($this->destination_data_5) > 0) { if (!empty($this->destination_data_5)) {
$array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid(); $array['follow_me_destinations'][$x]['follow_me_destination_uuid'] = uuid();
$array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid; $array['follow_me_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
$array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid; $array['follow_me_destinations'][$x]['follow_me_uuid'] = $this->follow_me_uuid;

View File

@ -108,7 +108,7 @@
//prepare some of the paging values //prepare some of the paging values
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
//get the list //get the list

View File

@ -46,7 +46,7 @@
$text = $language->get(); $text = $language->get();
//get the HTTP values and set as variables //get the HTTP values and set as variables
$show = trim($_REQUEST["show"]); $show = trim($_REQUEST["show"] ?? '');
if ($show != "all") { $show = ''; } if ($show != "all") { $show = ''; }
//include theme config for button images //include theme config for button images
@ -69,7 +69,7 @@
if (isset($results["rows"])) { if (isset($results["rows"])) {
foreach ($results["rows"] as &$row) { foreach ($results["rows"] as &$row) {
//get the domain //get the domain
if (strlen($row['context']) > 0 && $row['context'] != "public" && $row['context'] != "default") { if (!empty($row['context']) && $row['context'] != "public" && $row['context'] != "default") {
if (substr_count($row['context'], '@') > 0) { if (substr_count($row['context'], '@') > 0) {
$context_array = explode('@', $row['context']); $context_array = explode('@', $row['context']);
$row['domain_name'] = $context_array[1]; $row['domain_name'] = $context_array[1];
@ -227,7 +227,7 @@
echo " <td>".escape($cid_name)."&nbsp;</td>\n"; echo " <td>".escape($cid_name)."&nbsp;</td>\n";
echo " <td>".escape($cid_num)."&nbsp;</td>\n"; echo " <td>".escape($cid_num)."&nbsp;</td>\n";
echo " <td>".escape($dest)."&nbsp;</td>\n"; echo " <td>".escape($dest)."&nbsp;</td>\n";
echo " <td>".(strlen($application) > 0 ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n"; echo " <td>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n"; echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo " <td>".escape($secure)."&nbsp;</td>\n"; echo " <td>".escape($secure)."&nbsp;</td>\n";
if (permission_exists('call_active_hangup')) { if (permission_exists('call_active_hangup')) {

View File

@ -177,7 +177,7 @@
} }
else { else {
//local extension (source) > external number (destination) //local extension (source) > external number (destination)
if (user_exists($src) && strlen($dest_cid_number) == 0) { if (user_exists($src) && empty($dest_cid_number)) {
//retrieve outbound caller id from the (source) extension //retrieve outbound caller id from the (source) extension
$sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = :domain_uuid and extension = :src "; $sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = :domain_uuid and extension = :src ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];

View File

@ -55,7 +55,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//delete the conference center //delete the conference center
if ($_POST['action'] == 'delete' && permission_exists('conference_center_delete') && is_uuid($conference_center_uuid)) { if ($_POST['action'] == 'delete' && permission_exists('conference_center_delete') && is_uuid($conference_center_uuid)) {
@ -90,14 +90,14 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID<br>\n"; } //if (empty($dialplan_uuid)) { $msg .= "Please provide: Dialplan UUID<br>\n"; }
if (strlen($conference_center_name) == 0) { $msg .= "Please provide: Name<br>\n"; } if (empty($conference_center_name)) { $msg .= "Please provide: Name<br>\n"; }
if (strlen($conference_center_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; } if (empty($conference_center_extension)) { $msg .= "Please provide: Extension<br>\n"; }
if (strlen($conference_center_pin_length) == 0) { $msg .= "Please provide: PIN Length<br>\n"; } if (empty($conference_center_pin_length)) { $msg .= "Please provide: PIN Length<br>\n"; }
//if (strlen($conference_center_order) == 0) { $msg .= "Please provide: Order<br>\n"; } //if (empty($conference_center_order)) { $msg .= "Please provide: Order<br>\n"; }
//if (strlen($conference_center_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($conference_center_description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($conference_center_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; } if (empty($conference_center_enabled)) { $msg .= "Please provide: Enabled<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -204,7 +204,7 @@
header("Location: conference_centers.php"); header("Location: conference_centers.php");
return; return;
} }
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) } //(is_array($_POST) && empty($_POST["persistformvar"]))
//pre-populate the form //pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") { if (is_array($_GET) && $_POST["persistformvar"] != "true") {
@ -230,8 +230,8 @@
} }
//set defaults //set defaults
if (strlen($conference_center_enabled) == 0) { $conference_center_enabled = "true"; } if (empty($conference_center_enabled)) { $conference_center_enabled = "true"; }
if (strlen($conference_center_pin_length) == 0) { $conference_center_pin_length = 9; } if (empty($conference_center_pin_length)) { $conference_center_pin_length = 9; }
//get the recordings //get the recordings
$sql = "select recording_name, recording_filename from v_recordings "; $sql = "select recording_name, recording_filename from v_recordings ";
@ -383,7 +383,7 @@
if (is_array($sound_files)) { if (is_array($sound_files)) {
echo "<optgroup label='".$text['label-sounds']."'>\n"; echo "<optgroup label='".$text['label-sounds']."'>\n";
foreach ($sound_files as $key => $value) { foreach ($sound_files as $key => $value) {
if (strlen($value) > 0) { if (!empty($value)) {
if (substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { if (substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
$conference_center_greeting = substr($conference_center_greeting, 71); $conference_center_greeting = substr($conference_center_greeting, 71);
} }
@ -395,7 +395,7 @@
echo "</optgroup>\n"; echo "</optgroup>\n";
} }
//select //select
if (strlen($conference_center_greeting) > 0) { if (!empty($conference_center_greeting)) {
if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) { if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) {
if (!$tmp_selected) { if (!$tmp_selected) {
echo "<optgroup label='selected'>\n"; echo "<optgroup label='selected'>\n";

View File

@ -88,7 +88,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "and ( "; $sql_search = "and ( ";
$sql_search .= "lower(conference_center_name) like :search "; $sql_search .= "lower(conference_center_name) like :search ";
$sql_search .= "or lower(conference_center_extension) like :search "; $sql_search .= "or lower(conference_center_extension) like :search ";
@ -116,7 +116,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -223,7 +223,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('conference_center_all')) { if ($_GET['show'] == "all" && permission_exists('conference_center_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -158,10 +158,10 @@
$pin_length = $row['conference_center_pin_length']; $pin_length = $row['conference_center_pin_length'];
} }
unset($sql, $parameters); unset($sql, $parameters);
if (strlen($moderator_pin) == 0) { if (empty($moderator_pin)) {
$moderator_pin = get_conference_pin($pin_length, $conference_room_uuid); $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
if (strlen($participant_pin) == 0) { if (empty($participant_pin)) {
$participant_pin = get_conference_pin($pin_length, $conference_room_uuid); $participant_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
} }
@ -196,7 +196,7 @@
} }
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
$msg = ''; $msg = '';
if ($action == "update") { if ($action == "update") {
@ -212,7 +212,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
//check for a unique pin number and length //check for a unique pin number and length
if (strlen($moderator_pin) > 0 || strlen($participant_pin) > 0) { if (strlen($moderator_pin) > 0 || !empty($participant_pin)) {
//make sure the moderator pin number is unique //make sure the moderator pin number is unique
$sql = "select count(*) from v_conference_rooms "; $sql = "select count(*) from v_conference_rooms ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
@ -258,21 +258,21 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
//check for all required data //check for all required data
//if (strlen($conference_center_uuid) == 0) { $msg .= "Please provide: Conference UUID<br>\n"; } //if (empty($conference_center_uuid)) { $msg .= "Please provide: Conference UUID<br>\n"; }
//if (strlen($max_members) == 0) { $msg .= "Please provide: Max Members<br>\n"; } //if (empty($max_members)) { $msg .= "Please provide: Max Members<br>\n"; }
//if (strlen($start_datetime) == 0) { $msg .= "Please provide: Start Date/Time<br>\n"; } //if (empty($start_datetime)) { $msg .= "Please provide: Start Date/Time<br>\n"; }
//if (strlen($stop_datetime) == 0) { $msg .= "Please provide: Stop Date/Time<br>\n"; } //if (empty($stop_datetime)) { $msg .= "Please provide: Stop Date/Time<br>\n"; }
//if (strlen($wait_mod) == 0) { $msg .= "Please provide: Wait for the Moderator<br>\n"; } //if (empty($wait_mod)) { $msg .= "Please provide: Wait for the Moderator<br>\n"; }
//if (strlen($profile) == 0) { $msg .= "Please provide: Conference Profile<br>\n"; } //if (empty($profile)) { $msg .= "Please provide: Conference Profile<br>\n"; }
//if (strlen($announce) == 0) { $msg .= "Please provide: Announce<br>\n"; } //if (empty($announce)) { $msg .= "Please provide: Announce<br>\n"; }
//if (strlen($enter_sound) == 0) { $msg .= "Please provide: Enter Sound<br>\n"; } //if (empty($enter_sound)) { $msg .= "Please provide: Enter Sound<br>\n"; }
//if (strlen($mute) == 0) { $msg .= "Please provide: Mute<br>\n"; } //if (empty($mute)) { $msg .= "Please provide: Mute<br>\n"; }
//if (strlen($sounds) == 0) { $msg .= "Please provide: Sounds<br>\n"; } //if (empty($sounds)) { $msg .= "Please provide: Sounds<br>\n"; }
//if (strlen($created) == 0) { $msg .= "Please provide: Created<br>\n"; } //if (empty($created)) { $msg .= "Please provide: Created<br>\n"; }
//if (strlen($created_by) == 0) { $msg .= "Please provide: Created By<br>\n"; } //if (empty($created_by)) { $msg .= "Please provide: Created By<br>\n"; }
//if (strlen($enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; } //if (empty($enabled)) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-conference_room']; $document['title'] = $text['title-conference_room'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -291,17 +291,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "add" && permission_exists('conference_room_add')) { if ($action == "add" && permission_exists('conference_room_add')) {
//set default values //set default values
if (strlen($profile) == 0) { $profile = 'default'; } if (empty($profile)) { $profile = 'default'; }
if (strlen($record) == 0) { $record = 'false'; } if (empty($record)) { $record = 'false'; }
if (strlen($max_members) == 0) { $max_members = 0; } if (empty($max_members)) { $max_members = 0; }
if (strlen($wait_mod) == 0) { $wait_mod = 'true'; } if (empty($wait_mod)) { $wait_mod = 'true'; }
if (strlen($moderator_endconf) == 0) { $moderator_endconf = 'false'; } if (empty($moderator_endconf)) { $moderator_endconf = 'false'; }
if (strlen($announce_name) == 0) { $announce_name = 'true'; } if (empty($announce_name)) { $announce_name = 'true'; }
if (strlen($announce_recording) == 0) { $announce_recording = 'true'; } if (empty($announce_recording)) { $announce_recording = 'true'; }
if (strlen($announce_count) == 0) { $announce_count = 'true'; } if (empty($announce_count)) { $announce_count = 'true'; }
if (strlen($mute) == 0) { $mute = 'false'; } if (empty($mute)) { $mute = 'false'; }
if (strlen($enabled) == 0) { $enabled = 'true'; } if (empty($enabled)) { $enabled = 'true'; }
if (strlen($sounds) == 0) { $sounds = 'false'; } if (empty($sounds)) { $sounds = 'false'; }
//add a conference room //add a conference room
$conference_room_uuid = uuid(); $conference_room_uuid = uuid();
@ -371,35 +371,35 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$array['conference_rooms'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['conference_rooms'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['conference_rooms'][0]['conference_center_uuid'] = $conference_center_uuid; $array['conference_rooms'][0]['conference_center_uuid'] = $conference_center_uuid;
$array['conference_rooms'][0]['conference_room_name'] = $conference_room_name; $array['conference_rooms'][0]['conference_room_name'] = $conference_room_name;
if (strlen($profile) > 0) { if (!empty($profile)) {
$array['conference_rooms'][0]['profile'] = $profile; $array['conference_rooms'][0]['profile'] = $profile;
} }
if (strlen($record) > 0) { if (!empty($record)) {
$array['conference_rooms'][0]['record'] = $record; $array['conference_rooms'][0]['record'] = $record;
} }
$array['conference_rooms'][0]['moderator_pin'] = $moderator_pin; $array['conference_rooms'][0]['moderator_pin'] = $moderator_pin;
$array['conference_rooms'][0]['participant_pin'] = $participant_pin; $array['conference_rooms'][0]['participant_pin'] = $participant_pin;
if (strlen($max_members) > 0) { if (!empty($max_members)) {
$array['conference_rooms'][0]['max_members'] = $max_members; $array['conference_rooms'][0]['max_members'] = $max_members;
} }
$array['conference_rooms'][0]['start_datetime'] = $start_datetime; $array['conference_rooms'][0]['start_datetime'] = $start_datetime;
$array['conference_rooms'][0]['stop_datetime'] = $stop_datetime; $array['conference_rooms'][0]['stop_datetime'] = $stop_datetime;
if (strlen($wait_mod) > 0) { if (!empty($wait_mod)) {
$array['conference_rooms'][0]['wait_mod'] = $wait_mod; $array['conference_rooms'][0]['wait_mod'] = $wait_mod;
} }
if (strlen($moderator_endconf) > 0) { if (!empty($moderator_endconf)) {
$array['conference_rooms'][0]['moderator_endconf'] = $moderator_endconf; $array['conference_rooms'][0]['moderator_endconf'] = $moderator_endconf;
} }
if (strlen($announce_name) > 0) { if (!empty($announce_name)) {
$array['conference_rooms'][0]['announce_name'] = $announce_name; $array['conference_rooms'][0]['announce_name'] = $announce_name;
} }
if (strlen($announce_name) > 0) { if (!empty($announce_name)) {
$array['conference_rooms'][0]['announce_recording'] = $announce_recording; $array['conference_rooms'][0]['announce_recording'] = $announce_recording;
} }
if (strlen($announce_name) > 0) { if (!empty($announce_name)) {
$array['conference_rooms'][0]['announce_count'] = $announce_count; $array['conference_rooms'][0]['announce_count'] = $announce_count;
} }
if (strlen($mute) > 0) { if (!empty($mute)) {
$array['conference_rooms'][0]['mute'] = $mute; $array['conference_rooms'][0]['mute'] = $mute;
} }
$array['conference_rooms'][0]['sounds'] = $sounds; $array['conference_rooms'][0]['sounds'] = $sounds;
@ -409,7 +409,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('conference_room_account_code')) { if (permission_exists('conference_room_account_code')) {
$array['conference_rooms'][0]['account_code'] = $account_code; $array['conference_rooms'][0]['account_code'] = $account_code;
} }
if (strlen($enabled) > 0) { if (!empty($enabled)) {
$array['conference_rooms'][0]['enabled'] = $enabled; $array['conference_rooms'][0]['enabled'] = $enabled;
} }
$array['conference_rooms'][0]['description'] = $description; $array['conference_rooms'][0]['description'] = $description;
@ -523,13 +523,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql, $parameters); unset($sql, $parameters);
//set default profile //set default profile
if (strlen($profile) == 0) { $profile = 'default'; } if (empty($profile)) { $profile = 'default'; }
//get default pins //get default pins
if (strlen($moderator_pin) == 0) { if (empty($moderator_pin)) {
$moderator_pin = get_conference_pin($pin_length, $conference_room_uuid); $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
if (strlen($participant_pin) == 0) { if (empty($participant_pin)) {
$participant_pin = get_conference_pin($pin_length, $conference_room_uuid); $participant_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
@ -542,16 +542,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} }
//set default values //set default values
if (strlen($record) == 0) { $record = 'false'; } if (empty($record)) { $record = 'false'; }
if (strlen($max_members) == 0) { $max_members = 0; } if (empty($max_members)) { $max_members = 0; }
if (strlen($wait_mod) == 0) { $wait_mod = 'true'; } if (empty($wait_mod)) { $wait_mod = 'true'; }
if (strlen($moderator_endconf) == 0) { $moderator_endconf = 'false'; } if (empty($moderator_endconf)) { $moderator_endconf = 'false'; }
if (strlen($announce_name) == 0) { $announce_name = 'true'; } if (empty($announce_name)) { $announce_name = 'true'; }
if (strlen($announce_recording) == 0) { $announce_recording = 'true'; } if (empty($announce_recording)) { $announce_recording = 'true'; }
if (strlen($announce_count) == 0) { $announce_count = 'true'; } if (empty($announce_count)) { $announce_count = 'true'; }
if (strlen($mute) == 0) { $mute = 'false'; } if (empty($mute)) { $mute = 'false'; }
if (strlen($sounds) == 0) { $sounds = 'false'; } if (empty($sounds)) { $sounds = 'false'; }
if (strlen($enabled) == 0) { $enabled = 'true'; } if (empty($enabled)) { $enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -78,7 +78,7 @@
/* /*
//if the $_GET array exists then process it //if the $_GET array exists then process it
if (count($_GET) > 0 && strlen($_GET["search"]) == 0) { if (count($_GET) > 0 && empty($_GET["search"])) {
//get http GET variables and set them as php variables //get http GET variables and set them as php variables
$conference_room_uuid = $_GET["conference_room_uuid"]; $conference_room_uuid = $_GET["conference_room_uuid"];
$record = $_GET["record"]; $record = $_GET["record"];
@ -104,22 +104,22 @@
//build the array //build the array
$array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid; $array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid;
if (strlen($record) > 0) { if (!empty($record)) {
$array['conference_rooms'][0]['record'] = $record; $array['conference_rooms'][0]['record'] = $record;
} }
if (strlen($wait_mod) > 0) { if (!empty($wait_mod)) {
$array['conference_rooms'][0]['wait_mod'] = $wait_mod; $array['conference_rooms'][0]['wait_mod'] = $wait_mod;
} }
if (strlen($announce) > 0) { if (!empty($announce)) {
$array['conference_rooms'][0]['announce'] = $announce; $array['conference_rooms'][0]['announce'] = $announce;
} }
if (strlen($mute) > 0) { if (!empty($mute)) {
$array['conference_rooms'][0]['mute'] = $mute; $array['conference_rooms'][0]['mute'] = $mute;
} }
if (strlen($sounds) > 0) { if (!empty($sounds)) {
$array['conference_rooms'][0]['sounds'] = $sounds; $array['conference_rooms'][0]['sounds'] = $sounds;
} }
if (strlen($enabled) > 0) { if (!empty($enabled)) {
$array['conference_rooms'][0]['enabled'] = $enabled; $array['conference_rooms'][0]['enabled'] = $enabled;
} }
@ -174,7 +174,7 @@
$conference_center = new conference_centers; $conference_center = new conference_centers;
$conference_center->db = $db; $conference_center->db = $db;
$conference_center->domain_uuid = $_SESSION['domain_uuid']; $conference_center->domain_uuid = $_SESSION['domain_uuid'];
if (strlen($search) > 0) { if (!empty($search)) {
$conference_center->search = $search; $conference_center->search = $search;
} }
$num_rows = $conference_center->room_count(); $num_rows = $conference_center->room_count();
@ -194,7 +194,7 @@
$conference_center->offset = $offset; $conference_center->offset = $offset;
$conference_center->order_by = $order_by; $conference_center->order_by = $order_by;
$conference_center->order = $order; $conference_center->order = $order;
if (strlen($search) > 0) { if (!empty($search)) {
$conference_center->search = $search; $conference_center->search = $search;
} }
$result = $conference_center->rooms(); $result = $conference_center->rooms();

View File

@ -121,7 +121,7 @@
elseif (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.wav')) { elseif (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.wav')) {
$tmp_name = $row['conference_session_uuid'].".wav"; $tmp_name = $row['conference_session_uuid'].".wav";
} }
if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name)) { if (!empty($tmp_name) && file_exists($tmp_dir.'/'.$tmp_name)) {
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'style'=>'margin-left: 15px;','link'=>'../recordings/recordings.php?a=download&type=rec&t=bin&filename='.base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)]); echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'style'=>'margin-left: 15px;','link'=>'../recordings/recordings.php?a=download&type=rec&t=bin&filename='.base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)]);
if (permission_exists('conference_session_play')) { if (permission_exists('conference_session_play')) {
echo button::create(['type'=>'button','label'=>$text['button-play'],'icon'=>$_SESSION['theme']['button_icon_play'],'onclick'=>"window.open('".PROJECT_PATH."/app/recordings/recording_play.php?a=download&type=moh&filename=".urlencode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no');"]); echo button::create(['type'=>'button','label'=>$text['button-play'],'icon'=>$_SESSION['theme']['button_icon_play'],'onclick'=>"window.open('".PROJECT_PATH."/app/recordings/recording_play.php?a=download&type=moh&filename=".urlencode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no');"]);
@ -165,7 +165,7 @@
$end_date = date("j M Y h:i:sa", $row['end_epoch']); $end_date = date("j M Y h:i:sa", $row['end_epoch']);
} }
$time_difference = ''; $time_difference = '';
if (strlen($row['end_epoch']) > 0) { if (!empty($row['end_epoch'])) {
$time_difference = $row['end_epoch'] - $row['start_epoch']; $time_difference = $row['end_epoch'] - $row['start_epoch'];
$time_difference = gmdate("G:i:s", $time_difference); $time_difference = gmdate("G:i:s", $time_difference);
} }

View File

@ -192,12 +192,12 @@
$end_date = date("j M Y h:i:sa", $row['end_epoch']); $end_date = date("j M Y h:i:sa", $row['end_epoch']);
} }
$time_difference = ''; $time_difference = '';
if (strlen($row['end_epoch']) > 0) { if (!empty($row['end_epoch'])) {
$time_difference = $row['end_epoch'] - $row['start_epoch']; $time_difference = $row['end_epoch'] - $row['start_epoch'];
$time_difference = gmdate("G:i:s", $time_difference); $time_difference = gmdate("G:i:s", $time_difference);
} }
if (strlen($row['start_epoch']) > 0) { if (!empty($row['start_epoch'])) {
$list_row_url = "conference_session_details.php?uuid=".urlencode($row['conference_session_uuid']); $list_row_url = "conference_session_details.php?uuid=".urlencode($row['conference_session_uuid']);
echo "<tr class='list-row' href='".$list_row_url."'>\n"; echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('conference_session_delete')) { if (permission_exists('conference_session_delete')) {
@ -212,7 +212,7 @@
echo " <td>".escape($row['profile'])."&nbsp;</td>\n"; echo " <td>".escape($row['profile'])."&nbsp;</td>\n";
$recording_name = $row['recording']; $recording_name = $row['recording'];
echo " <td class='button no-link'>\n"; echo " <td class='button no-link'>\n";
if (strlen($recording_name) > 0 && file_exists($recording_name)) { if (!empty($recording_name) && file_exists($recording_name)) {
echo "<table border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td>\n"; echo "<td>\n";

View File

@ -110,7 +110,7 @@ if (!class_exists('conference_centers')) {
$order = $this->order; $order = $this->order;
//validate order by //validate order by
if (strlen($order_by) > 0) { if (!empty($order_by)) {
$order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', $order_by); $order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', $order_by);
} }
@ -154,7 +154,7 @@ if (!class_exists('conference_centers')) {
$sql .= "and r.created_by = :created_by "; $sql .= "and r.created_by = :created_by ";
$parameters['created_by'] = $this->created_by; $parameters['created_by'] = $this->created_by;
} }
if (strlen($this->order_by) == 0) { if (empty($this->order_by)) {
$sql .= "order by r.description, r.conference_room_uuid asc "; $sql .= "order by r.description, r.conference_room_uuid asc ";
} }
else { else {

View File

@ -93,7 +93,7 @@
$array['conference_control_details'][0]['conference_control_detail_uuid'] = $conference_control_detail_uuid; $array['conference_control_details'][0]['conference_control_detail_uuid'] = $conference_control_detail_uuid;
$array['conference_control_details'][0]['control_digits'] = $control_digits; $array['conference_control_details'][0]['control_digits'] = $control_digits;
$array['conference_control_details'][0]['control_action'] = $control_action; $array['conference_control_details'][0]['control_action'] = $control_action;
if (strlen($control_data) > 0) { if (!empty($control_data)) {
$array['conference_control_details'][0]['control_data'] = $control_data; $array['conference_control_details'][0]['control_data'] = $control_data;
} }
$array['conference_control_details'][0]['control_enabled'] = $control_enabled; $array['conference_control_details'][0]['control_enabled'] = $control_enabled;

View File

@ -44,7 +44,7 @@
} }
//process the http post //process the http post
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid //get the uuid
if ($action == "update") { if ($action == "update") {
@ -61,11 +61,11 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; } //if (empty($control_digits)) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; }
if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; } if (empty($control_action)) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; }
//if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; } //if (empty($control_data)) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; } if (empty($control_enabled)) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -131,7 +131,7 @@
} }
//set the defaults //set the defaults
if (strlen($control_enabled) == 0) { $control_enabled = 'true'; } if (empty($control_enabled)) { $control_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -82,7 +82,7 @@
//add the search term //add the search term
$search = $_GET["search"]; $search = $_GET["search"];
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "and ("; $sql_search = "and (";
$sql_search .= "control_digits like :search"; $sql_search .= "control_digits like :search";
$sql_search .= "or control_action like :search"; $sql_search .= "or control_action like :search";

View File

@ -38,7 +38,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid from the POST //get the uuid from the POST
if ($action == "update") { if ($action == "update") {
@ -55,10 +55,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($control_name) == 0) { $msg .= $text['message-required']." ".$text['label-control_name']."<br>\n"; } if (empty($control_name)) { $msg .= $text['message-required']." ".$text['label-control_name']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; } if (empty($control_enabled)) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
//if (strlen($control_description) == 0) { $msg .= $text['message-required']." ".$text['label-control_description']."<br>\n"; } //if (empty($control_description)) { $msg .= $text['message-required']." ".$text['label-control_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-conference_control']; $document['title'] = $text['title-conference_control'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -87,7 +87,7 @@
$database = new database; $database = new database;
$database->app_name = 'conference_controls'; $database->app_name = 'conference_controls';
$database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048'; $database->app_uuid = 'e1ad84a2-79e1-450c-a5b1-7507a043e048';
if (strlen($conference_control_uuid) > 0) { if (!empty($conference_control_uuid)) {
$database->uuid($conference_control_uuid); $database->uuid($conference_control_uuid);
} }
$database->save($array); $database->save($array);
@ -104,7 +104,7 @@
header("Location: conference_controls.php"); header("Location: conference_controls.php");
return; return;
} }
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) } //(is_array($_POST) && empty($_POST["persistformvar"]))
//pre-populate the form //pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") { if (is_array($_GET) && $_POST["persistformvar"] != "true") {
@ -124,7 +124,7 @@
} }
//set the defaults //set the defaults
if (strlen($control_enabled) == 0) { $control_enabled = 'true'; } if (empty($control_enabled)) { $control_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -86,7 +86,7 @@
//add the search string //add the search string
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "where ("; $sql_search = "where (";
$sql_search .= " lower(control_name) like :search "; $sql_search .= " lower(control_name) like :search ";
$sql_search .= " or lower(control_description) like :search "; $sql_search .= " or lower(control_description) like :search ";

View File

@ -37,7 +37,7 @@
$profile_description = $_POST["profile_description"]; $profile_description = $_POST["profile_description"];
} }
//check to see if the http post exists //check to see if the http post exists
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid //get the uuid
if ($action == "update") { if ($action == "update") {
@ -54,10 +54,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-profile_name']."<br>\n"; } if (empty($profile_name)) { $msg .= $text['message-required']." ".$text['label-profile_name']."<br>\n"; }
if (strlen($profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-profile_enabled']."<br>\n"; } if (empty($profile_enabled)) { $msg .= $text['message-required']." ".$text['label-profile_enabled']."<br>\n"; }
//if (strlen($profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-profile_description']."<br>\n"; } //if (empty($profile_description)) { $msg .= $text['message-required']." ".$text['label-profile_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-conference_profile']; $document['title'] = $text['title-conference_profile'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -121,7 +121,7 @@
} }
//set the defaults //set the defaults
if (strlen($profile_enabled) == 0) { $profile_enabled = 'true'; } if (empty($profile_enabled)) { $profile_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -44,7 +44,7 @@
} }
//process the http post if it exists //process the http post if it exists
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid //get the uuid
if ($action == "update") { if ($action == "update") {
@ -61,10 +61,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($profile_param_name) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_name']."<br>\n"; } if (empty($profile_param_name)) { $msg .= $text['message-required']." ".$text['label-profile_param_name']."<br>\n"; }
if (strlen($profile_param_value) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_value']."<br>\n"; } if (empty($profile_param_value)) { $msg .= $text['message-required']." ".$text['label-profile_param_value']."<br>\n"; }
if (strlen($profile_param_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_enabled']."<br>\n"; } if (empty($profile_param_enabled)) { $msg .= $text['message-required']." ".$text['label-profile_param_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-conference_profile_param']; $document['title'] = $text['title-conference_profile_param'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -129,7 +129,7 @@
} }
//set the defaults //set the defaults
if (strlen($profile_param_enabled) == 0) { $profile_param_enabled = 'true'; } if (empty($profile_param_enabled)) { $profile_param_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;

View File

@ -131,7 +131,7 @@
} }
//process http post variables //process http post variables
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the conference id //get the conference id
if ($action == "add") { if ($action == "add") {
@ -152,16 +152,16 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID<br>\n"; } //if (empty($dialplan_uuid)) { $msg .= "Please provide: Dialplan UUID<br>\n"; }
if (strlen($conference_name) == 0) { $msg .= "".$text['confirm-name']."<br>\n"; } if (empty($conference_name)) { $msg .= "".$text['confirm-name']."<br>\n"; }
if (strlen($conference_extension) == 0) { $msg .= "".$text['confirm-extension']."<br>\n"; } if (empty($conference_extension)) { $msg .= "".$text['confirm-extension']."<br>\n"; }
//if (strlen($conference_pin_number) == 0) { $msg .= "Please provide: Pin Number<br>\n"; } //if (empty($conference_pin_number)) { $msg .= "Please provide: Pin Number<br>\n"; }
if (strlen($conference_profile) == 0) { $msg .= "".$text['confirm-profile']."<br>\n"; } if (empty($conference_profile)) { $msg .= "".$text['confirm-profile']."<br>\n"; }
//if (strlen($conference_flags) == 0) { $msg .= "Please provide: Flags<br>\n"; } //if (empty($conference_flags)) { $msg .= "Please provide: Flags<br>\n"; }
//if (strlen($conference_order) == 0) { $msg .= "Please provide: Order<br>\n"; } //if (empty($conference_order)) { $msg .= "Please provide: Order<br>\n"; }
//if (strlen($conference_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($conference_description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($conference_enabled) == 0) { $msg .= "".$text['confirm-enabled']."<br>\n"; } if (empty($conference_enabled)) { $msg .= "".$text['confirm-enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
$document['title'] = $text['title-conference']; $document['title'] = $text['title-conference'];
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
@ -198,7 +198,7 @@
$array['conferences'][0]['conference_enabled'] = $conference_enabled; $array['conferences'][0]['conference_enabled'] = $conference_enabled;
//conference pin number //conference pin number
$pin_number = (strlen($conference_pin_number) > 0) ? '+'.$conference_pin_number : ''; $pin_number = (!empty($conference_pin_number)) ? '+'.$conference_pin_number : '';
//build the xml //build the xml
$dialplan_xml = "<extension name=\"".xml::sanitize($conference_name)."\" continue=\"\" uuid=\"".xml::sanitize($dialplan_uuid)."\">\n"; $dialplan_xml = "<extension name=\"".xml::sanitize($conference_name)."\" continue=\"\" uuid=\"".xml::sanitize($dialplan_uuid)."\">\n";
@ -297,7 +297,7 @@
} }
//set the defaults //set the defaults
if (strlen($conference_enabled) == 0) { $conference_enabled = 'true'; } if (empty($conference_enabled)) { $conference_enabled = 'true'; }
//get the conference profiles //get the conference profiles
$sql = "select * "; $sql = "select * ";

View File

@ -86,7 +86,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "and ("; $sql_search = "and (";
$sql_search .= "lower(conference_name) like :search "; $sql_search .= "lower(conference_name) like :search ";
$sql_search .= "or lower(conference_extension) like :search "; $sql_search .= "or lower(conference_extension) like :search ";
@ -125,7 +125,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -238,7 +238,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('conference_all')) { if ($_GET['show'] == "all" && permission_exists('conference_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -73,7 +73,7 @@
} }
//get the conference name //get the conference name
if (isset($name) && strlen($name) > 0) { if (isset($name) && !empty($name)) {
$name_array = explode('@', $name); $name_array = explode('@', $name);
$name = $name_array[0]; $name = $name_array[0];
} }
@ -182,12 +182,12 @@
//execute the command //execute the command
if (count($_GET) > 0) { if (count($_GET) > 0) {
if (strlen($cmd) > 0) { if (!empty($cmd)) {
//prepare the switch cmd //prepare the switch cmd
$switch_cmd = $cmd . " "; $switch_cmd = $cmd . " ";
$switch_cmd .= $name . " "; $switch_cmd .= $name . " ";
$switch_cmd .= $data . " "; $switch_cmd .= $data . " ";
if ($id && strlen($id) > 0) { if ($id && !empty($id)) {
$switch_cmd .= " ".$id; $switch_cmd .= " ".$id;
} }

View File

@ -96,7 +96,7 @@
$member_count = $xml->conference['member-count']; $member_count = $xml->conference['member-count'];
$locked = $xml->conference['locked']; $locked = $xml->conference['locked'];
$recording = $xml->conference['recording']; $recording = $xml->conference['recording'];
if (strlen($member_count) == 0) { if (empty($member_count)) {
$member_count = 0; $member_count = 0;
} }
@ -191,7 +191,7 @@
$join_time_formatted = sprintf('%02d:%02d:%02d', ($join_time/3600), ($join_time/60%60), $join_time%60); $join_time_formatted = sprintf('%02d:%02d:%02d', ($join_time/3600), ($join_time/60%60), $join_time%60);
$last_talking_formatted = sprintf('%02d:%02d:%02d', ($last_talking/3600), ($last_talking/60%60), $last_talking%60); $last_talking_formatted = sprintf('%02d:%02d:%02d', ($last_talking/3600), ($last_talking/60%60), $last_talking%60);
if (strlen($record_path) == 0) { if (empty($record_path)) {
if (permission_exists('conference_interactive_mute')) { if (permission_exists('conference_interactive_mute')) {
$action_mute = ($flag_can_speak == "true") ? 'mute' : 'unmute'; $action_mute = ($flag_can_speak == "true") ? 'mute' : 'unmute';
$list_row_onclick = "onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".urlencode($conference_name)."&data=".$action_mute."&id=".urlencode($id)."');\""; $list_row_onclick = "onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".urlencode($conference_name)."&data=".$action_mute."&id=".urlencode($id)."');\"";

View File

@ -82,7 +82,7 @@
} }
//process the form data //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -99,7 +99,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -89,7 +89,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//debug info //debug info
//view_array($_POST, true); //view_array($_POST, true);
@ -103,7 +103,7 @@
} }
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) { if ($_POST['action'] != '' && !empty($_POST['action'])) {
//prepare the array(s) //prepare the array(s)
$x = 0; $x = 0;
@ -236,29 +236,29 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($contact_type) == 0) { $msg .= $text['message-required']." ".$text['label-contact_type']."<br>\n"; } //if (empty($contact_type)) { $msg .= $text['message-required']." ".$text['label-contact_type']."<br>\n"; }
//if (strlen($contact_title) == 0) { $msg .= $text['message-required']." ".$text['label-contact_title']."<br>\n"; } //if (empty($contact_title)) { $msg .= $text['message-required']." ".$text['label-contact_title']."<br>\n"; }
//if (strlen($contact_role) == 0) { $msg .= $text['message-required']." ".$text['label-contact_role']."<br>\n"; } //if (empty($contact_role)) { $msg .= $text['message-required']." ".$text['label-contact_role']."<br>\n"; }
//if (strlen($contact_category) == 0) { $msg .= $text['message-required']." ".$text['label-contact_category']."<br>\n"; } //if (empty($contact_category)) { $msg .= $text['message-required']." ".$text['label-contact_category']."<br>\n"; }
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required']." ".$text['label-contact_organization']."<br>\n"; } //if (empty($contact_organization)) { $msg .= $text['message-required']." ".$text['label-contact_organization']."<br>\n"; }
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required']." ".$text['label-contact_name_prefix']."<br>\n"; } //if (empty($contact_name_prefix)) { $msg .= $text['message-required']." ".$text['label-contact_name_prefix']."<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required']." ".$text['label-contact_name_given']."<br>\n"; } //if (empty($contact_name_given)) { $msg .= $text['message-required']." ".$text['label-contact_name_given']."<br>\n"; }
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required']." ".$text['label-contact_name_middle']."<br>\n"; } //if (empty($contact_name_middle)) { $msg .= $text['message-required']." ".$text['label-contact_name_middle']."<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required']." ".$text['label-contact_name_family']."<br>\n"; } //if (empty($contact_name_family)) { $msg .= $text['message-required']." ".$text['label-contact_name_family']."<br>\n"; }
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required']." ".$text['label-contact_name_suffix']."<br>\n"; } //if (empty($contact_name_suffix)) { $msg .= $text['message-required']." ".$text['label-contact_name_suffix']."<br>\n"; }
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required']." ".$text['label-contact_nickname']."<br>\n"; } //if (empty($contact_nickname)) { $msg .= $text['message-required']." ".$text['label-contact_nickname']."<br>\n"; }
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required']." ".$text['label-contact_time_zone']."<br>\n"; } //if (empty($contact_time_zone)) { $msg .= $text['message-required']." ".$text['label-contact_time_zone']."<br>\n"; }
//if (strlen($last_mod_date) == 0) { $msg .= $text['message-required']." ".$text['label-last_mod_date']."<br>\n"; } //if (empty($last_mod_date)) { $msg .= $text['message-required']." ".$text['label-last_mod_date']."<br>\n"; }
//if (strlen($last_mod_user) == 0) { $msg .= $text['message-required']." ".$text['label-last_mod_user']."<br>\n"; } //if (empty($last_mod_user)) { $msg .= $text['message-required']." ".$text['label-last_mod_user']."<br>\n"; }
//if (strlen($contact_phones) == 0) { $msg .= $text['message-required']." ".$text['label-contact_phones']."<br>\n"; } //if (empty($contact_phones)) { $msg .= $text['message-required']." ".$text['label-contact_phones']."<br>\n"; }
//if (strlen($contact_addresses) == 0) { $msg .= $text['message-required']." ".$text['label-contact_addresses']."<br>\n"; } //if (empty($contact_addresses)) { $msg .= $text['message-required']." ".$text['label-contact_addresses']."<br>\n"; }
//if (strlen($contact_emails) == 0) { $msg .= $text['message-required']." ".$text['label-contact_emails']."<br>\n"; } //if (empty($contact_emails)) { $msg .= $text['message-required']." ".$text['label-contact_emails']."<br>\n"; }
//if (strlen($contact_urls) == 0) { $msg .= $text['message-required']." ".$text['label-contact_urls']."<br>\n"; } //if (empty($contact_urls)) { $msg .= $text['message-required']." ".$text['label-contact_urls']."<br>\n"; }
//if (strlen($contact_settings) == 0) { $msg .= $text['message-required']." ".$text['label-contact_settings']."<br>\n"; } //if (empty($contact_settings)) { $msg .= $text['message-required']." ".$text['label-contact_settings']."<br>\n"; }
//if (strlen($contact_user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-contact_user_uuid']."<br>\n"; } //if (empty($contact_user_uuid)) { $msg .= $text['message-required']." ".$text['label-contact_user_uuid']."<br>\n"; }
//if (strlen($contact_group_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-contact_group_uuid']."<br>\n"; } //if (empty($contact_group_uuid)) { $msg .= $text['message-required']." ".$text['label-contact_group_uuid']."<br>\n"; }
//if (strlen($contact_note) == 0) { $msg .= $text['message-required']." ".$text['label-contact_note']."<br>\n"; } //if (empty($contact_note)) { $msg .= $text['message-required']." ".$text['label-contact_note']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -316,7 +316,7 @@
$y = 0; $y = 0;
if (is_array($contact_phones)) { if (is_array($contact_phones)) {
foreach ($contact_phones as $row) { foreach ($contact_phones as $row) {
if (strlen($row['phone_number']) > 0) { if (!empty($row['phone_number'])) {
//add the speed dial //add the speed dial
$array['contacts'][0]['contact_phones'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_phones'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_phones'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_phones'][$y]['contact_uuid'] = $contact_uuid;
@ -348,7 +348,7 @@
$y = 0; $y = 0;
if (is_array($contact_addresses)) { if (is_array($contact_addresses)) {
foreach ($contact_addresses as $row) { foreach ($contact_addresses as $row) {
if (strlen($row['address_street']) > 0) { if (!empty($row['address_street'])) {
$array['contacts'][0]['contact_addresses'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_addresses'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_addresses'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_addresses'][$y]['contact_uuid'] = $contact_uuid;
$array['contacts'][0]['contact_addresses'][$y]['contact_address_uuid'] = $row["contact_address_uuid"]; $array['contacts'][0]['contact_addresses'][$y]['contact_address_uuid'] = $row["contact_address_uuid"];
@ -379,7 +379,7 @@
$y = 0; $y = 0;
if (is_array($contact_emails)) { if (is_array($contact_emails)) {
foreach ($contact_emails as $row) { foreach ($contact_emails as $row) {
if (strlen($row['email_address']) > 0) { if (!empty($row['email_address'])) {
$array['contacts'][0]['contact_emails'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_emails'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_emails'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_emails'][$y]['contact_uuid'] = $contact_uuid;
$array['contacts'][0]['contact_emails'][$y]['contact_email_uuid'] = $row["contact_email_uuid"]; $array['contacts'][0]['contact_emails'][$y]['contact_email_uuid'] = $row["contact_email_uuid"];
@ -396,7 +396,7 @@
$y = 0; $y = 0;
if (is_array($contact_urls)) { if (is_array($contact_urls)) {
foreach ($contact_urls as $row) { foreach ($contact_urls as $row) {
if (strlen($row['url_address']) > 0) { if (!empty($row['url_address'])) {
$array['contacts'][0]['contact_urls'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_urls'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_urls'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_urls'][$y]['contact_uuid'] = $contact_uuid;
$array['contacts'][0]['contact_urls'][$y]['contact_url_uuid'] = $row["contact_url_uuid"]; $array['contacts'][0]['contact_urls'][$y]['contact_url_uuid'] = $row["contact_url_uuid"];
@ -413,7 +413,7 @@
$y = 0; $y = 0;
if (is_array($contact_relations)) { if (is_array($contact_relations)) {
foreach ($contact_relations as $row) { foreach ($contact_relations as $row) {
if (strlen($row['contact_relation_uuid']) > 0) { if (!empty($row['contact_relation_uuid'])) {
$array['contacts'][0]['contact_relations'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_relations'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_relations'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_relations'][$y]['contact_uuid'] = $contact_uuid;
$array['contacts'][0]['contact_relations'][$y]['contact_relation_uuid'] = $row["contact_relation_uuid"]; $array['contacts'][0]['contact_relations'][$y]['contact_relation_uuid'] = $row["contact_relation_uuid"];
@ -427,7 +427,7 @@
$y = 0; $y = 0;
if (is_array($contact_settings)) { if (is_array($contact_settings)) {
foreach ($contact_settings as $row) { foreach ($contact_settings as $row) {
if (strlen($row['contact_setting_category']) > 0 && strlen($row['contact_setting_subcategory']) > 0 && strlen($row['contact_setting_name']) > 0) { if (strlen($row['contact_setting_category']) > 0 && strlen($row['contact_setting_subcategory']) > 0 && !empty($row['contact_setting_name'])) {
$array['contacts'][0]['contact_settings'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['contacts'][0]['contact_settings'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['contacts'][0]['contact_settings'][$y]['contact_uuid'] = $contact_uuid; $array['contacts'][0]['contact_settings'][$y]['contact_uuid'] = $contact_uuid;
$array['contacts'][0]['contact_settings'][$y]['contact_setting_uuid'] = $row["contact_setting_uuid"]; $array['contacts'][0]['contact_settings'][$y]['contact_setting_uuid'] = $row["contact_setting_uuid"];
@ -446,7 +446,7 @@
$y = 0; $y = 0;
if (is_array($contact_attachments)) { if (is_array($contact_attachments)) {
foreach ($contact_attachments as $row) { foreach ($contact_attachments as $row) {
if (strlen($row['attachment_description']) > 0) { if (!empty($row['attachment_description'])) {
$array['contacts'][0]['contact_attachments'][$y]['contact_attachment_uuid'] = $row["contact_attachment_uuid"]; $array['contacts'][0]['contact_attachments'][$y]['contact_attachment_uuid'] = $row["contact_attachment_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['domain_uuid'] = $row["domain_uuid"]; $array['contacts'][0]['contact_attachments'][$y]['domain_uuid'] = $row["domain_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['contact_uuid'] = $row["contact_uuid"]; $array['contacts'][0]['contact_attachments'][$y]['contact_uuid'] = $row["contact_uuid"];
@ -465,7 +465,7 @@
$y = 0; $y = 0;
if (is_array($contact_times)) { if (is_array($contact_times)) {
foreach ($contact_times as $row) { foreach ($contact_times as $row) {
if (strlen($row['time_start']) > 0) { if (!empty($row['time_start'])) {
$array['contacts'][0]['contact_times'][$y]['contact_time_uuid'] = $row["contact_time_uuid"]; $array['contacts'][0]['contact_times'][$y]['contact_time_uuid'] = $row["contact_time_uuid"];
$array['contacts'][0]['contact_times'][$y]['domain_uuid'] = $row["domain_uuid"]; $array['contacts'][0]['contact_times'][$y]['domain_uuid'] = $row["domain_uuid"];
$array['contacts'][0]['contact_times'][$y]['contact_uuid'] = $row["contact_uuid"]; $array['contacts'][0]['contact_times'][$y]['contact_uuid'] = $row["contact_uuid"];
@ -480,7 +480,7 @@
$y = 0; $y = 0;
if (is_array($contact_notes)) { if (is_array($contact_notes)) {
foreach ($contact_notes as $row) { foreach ($contact_notes as $row) {
if (strlen($row['contact_note']) > 0) { if (!empty($row['contact_note'])) {
$array['contacts'][0]['contact_notes'][$y]['contact_note_uuid'] = $row["contact_note_uuid"]; $array['contacts'][0]['contact_notes'][$y]['contact_note_uuid'] = $row["contact_note_uuid"];
$array['contacts'][0]['contact_notes'][$y]['domain_uuid'] = $row["domain_uuid"]; $array['contacts'][0]['contact_notes'][$y]['domain_uuid'] = $row["domain_uuid"];
$array['contacts'][0]['contact_notes'][$y]['contact_uuid'] = $row["contact_uuid"]; $array['contacts'][0]['contact_notes'][$y]['contact_uuid'] = $row["contact_uuid"];
@ -529,7 +529,7 @@
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];
} }
//header('Location: contacts.php'); //header('Location: contacts.php');
header('Location: contact_edit.php?id='.urlencode($contact_uuid)); header('Location: contact_edit.php?id='.urlencode($contact_uuid ?? ''));
return; return;
} }
} }
@ -1057,7 +1057,7 @@
} }
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','collapse'=>'hide-sm-dn','onclick'=>"$('#qr_code_container').fadeIn(400);"]); echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','collapse'=>'hide-sm-dn','onclick'=>"$('#qr_code_container').fadeIn(400);"]);
echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid).'&type=download']); echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid ?? '').'&type=download']);
} }
//add edit //add edit
//if (isset($id)) { //if (isset($id)) {
@ -1066,7 +1066,7 @@
//add user //add user
if (isset($id) && permission_exists('user_edit')) { if (isset($id) && permission_exists('user_edit')) {
echo button::create(['type'=>'button','label'=>$text['button-user'],'icon'=>'user','collapse'=>'hide-sm-dn','link'=>'../../core/users/user_edit.php?id='.urlencode($contact_user_uuid)]); echo button::create(['type'=>'button','label'=>$text['button-user'],'icon'=>'user','collapse'=>'hide-sm-dn','link'=>'../../core/users/user_edit.php?id='.urlencode($contact_user_uuid ?? '')]);
} }
if ( if (
$action == "update" && ( $action == "update" && (
@ -1080,7 +1080,7 @@
permission_exists('contact_setting_add') || permission_exists('contact_setting_add') ||
permission_exists('contact_attachment_add') permission_exists('contact_attachment_add')
)) { )) {
echo "<select class='formfld' style='width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid)."';\">\n"; echo "<select class='formfld' style='width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid ?? '')."';\">\n";
echo " <option value=''>".$text['button-add']."...</option>\n"; echo " <option value=''>".$text['button-add']."...</option>\n";
if (permission_exists('contact_phone_add')) { echo "<option value='phone'>".$text['label-phone_number']."</option>\n"; } if (permission_exists('contact_phone_add')) { echo "<option value='phone'>".$text['label-phone_number']."</option>\n"; }
if (permission_exists('contact_address_add')) { echo "<option value='address'>".$text['label-address_address']."</option>\n"; } if (permission_exists('contact_address_add')) { echo "<option value='address'>".$text['label-address_address']."</option>\n"; }
@ -1386,7 +1386,7 @@ foreach ($time_zone_identifiers as $key => $val) {
} }
echo " <optgroup label='".$category."'>\n"; echo " <optgroup label='".$category."'>\n";
} }
if (strlen($val) > 0) { if (!empty($val)) {
$time_zone_offset = get_time_zone_offset($val)/3600; $time_zone_offset = get_time_zone_offset($val)/3600;
$time_zone_offset_hours = floor($time_zone_offset); $time_zone_offset_hours = floor($time_zone_offset);
$time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60; $time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60;
@ -1505,7 +1505,7 @@ if ($_SESSION['contact']['permissions']['boolean'] == "true") {
} }
echo " </div>\n"; echo " </div>\n";
foreach ($contact_groups_assigned as $x => $field) { foreach ($contact_groups_assigned as $x => $field) {
if (strlen($field['group_name']) > 0) { if (!empty($field['group_name'])) {
echo " <div class='vtable'>".escape($field['group_name'])."\n"; echo " <div class='vtable'>".escape($field['group_name'])."\n";
if (permission_exists('contact_group_delete')) { if (permission_exists('contact_group_delete')) {
if (is_uuid($field['contact_group_uuid'])) { if (is_uuid($field['contact_group_uuid'])) {
@ -1596,18 +1596,18 @@ if (permission_exists('contact_phone_view')) {
$call = "send_cmd('"; $call = "send_cmd('";
$call .= PROJECT_PATH."/app/click_to_call/click_to_call.php"; $call .= PROJECT_PATH."/app/click_to_call/click_to_call.php";
$call .= "?src_cid_name=".urlencode($row['phone_number']); $call .= "?src_cid_name=".urlencode($row['phone_number'] ?? '');
$call .= "&src_cid_number=".urlencode($row['phone_number']); $call .= "&src_cid_number=".urlencode($row['phone_number'] ?? '');
$call .= "&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name']); $call .= "&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'] ?? '');
$call .= "&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number']); $call .= "&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'] ?? '');
$call .= "&src=".urlencode($_SESSION['user']['extension'][0]['user']); $call .= "&src=".urlencode($_SESSION['user']['extension'][0]['user'] ?? '');
$call .= "&dest=".urlencode($row['phone_number']); $call .= "&dest=".urlencode($row['phone_number'] ?? '');
$call .= "&rec=false"; $call .= "&rec=false";
$call .= "&ringback=us-ring"; $call .= "&ringback=us-ring";
$call .= "&auto_answer=true"; $call .= "&auto_answer=true";
$call .= "');"; $call .= "');";
echo " <a href='' onclick=\"".$call."\">\n"; echo " <a href='' onclick=\"".$call."\">\n";
echo " <i class='fas fa-phone fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 7px;' title=\"".urlencode($row['phone_number'])."\"></i>\n"; echo " <i class='fas fa-phone fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 7px;' title=\"".urlencode($row['phone_number'] ?? '')."\"></i>\n";
echo " </a>\n"; echo " </a>\n";
echo " </div>\n"; echo " </div>\n";
@ -2180,7 +2180,7 @@ if (permission_exists('contact_url_view')) {
echo (is_array($url_label_options)) ? implode("\n", $url_label_options) : null; echo (is_array($url_label_options)) ? implode("\n", $url_label_options) : null;
echo " </select>\n"; echo " </select>\n";
echo " <input type='text' class='formfld' ".(($url_label_found || $url_label == '') ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label) : null)."\">\n"; echo " <input type='text' class='formfld' ".(($url_label_found || $url_label == '') ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label ?? '') : null)."\">\n";
//echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('url_label');\">\n"; //echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle_custom('url_label');\">\n";
echo " </div>\n"; echo " </div>\n";

View File

@ -72,7 +72,7 @@ if (is_uuid($_GET["contact_uuid"])) {
} }
//process the form data //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -89,7 +89,7 @@ if (is_uuid($_GET["contact_uuid"])) {
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -86,7 +86,7 @@
} }
//get the schema //get the schema
if (strlen($delimiter) > 0) { if (!empty($delimiter)) {
//get the first line //get the first line
$line = fgets(fopen($_SESSION['file'], 'r')); $line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line); $line_fields = explode($delimiter, $line);
@ -139,7 +139,7 @@
} }
//match the column names to the field names //match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && $action != 'import') { if (!empty($delimiter) && file_exists($_SESSION['file']) && $action != 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -341,8 +341,8 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
if (strlen($parent) == 0) { if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];
} }

View File

@ -67,7 +67,7 @@
} }
//process the form data //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the primary id for the contact note //get the primary id for the contact note
if ($action == "update") { if ($action == "update") {
@ -84,7 +84,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -83,7 +83,7 @@
} }
//process the form data //process the form data
if (is_array($_POST) && @sizeof($_POST) != 0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
//set thge uuid //set thge uuid
if ($action == "update") { if ($action == "update") {
@ -100,7 +100,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -75,7 +75,7 @@
} }
//process the form data //process the form data
if (is_array($_POST) && @sizeof($_POST) != 0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -92,7 +92,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -75,7 +75,7 @@
} }
//process the form data //process the form data
if (is_array($_POST) && sizeof($_POST) != 0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_POST) && sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -92,14 +92,14 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; } //if (empty($domain_setting_category)) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; } //if (empty($domain_setting_subcategory)) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; } //if (empty($domain_setting_name)) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; } //if (empty($domain_setting_value)) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; } //if (empty($domain_setting_order)) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; } //if (empty($domain_setting_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } //if (empty($domain_setting_description)) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -67,7 +67,7 @@
} }
//process the form data //process the form data
if (is_array($_POST) && @sizeof($_POST) != 0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -84,7 +84,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -73,7 +73,7 @@
} }
//process the form data //process the form data
if (is_array($_POST) && @sizeof($_POST) != 0 && strlen($_POST["persistformvar"]) == 0) { if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
//set the uuid //set the uuid
if ($action == "update") { if ($action == "update") {
@ -90,7 +90,7 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -129,7 +129,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
if (is_numeric($search)) { if (is_numeric($search)) {
$sql_search .= "and contact_uuid in ( "; $sql_search .= "and contact_uuid in ( ";
$sql_search .= " select contact_uuid from v_contact_phones "; $sql_search .= " select contact_uuid from v_contact_phones ";
@ -229,7 +229,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -394,7 +394,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('contact_all')) { if ($_GET['show'] == "all" && permission_exists('contact_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -103,7 +103,7 @@
} }
//get the type if not provided //get the type if not provided
if (strlen($transaction_type) == 0) { if (empty($transaction_type)) {
if ($transaction_old == null || $transaction_old == "null") { if ($transaction_old == null || $transaction_old == "null") {
$transaction_type = 'add'; $transaction_type = 'add';
} }

View File

@ -88,7 +88,7 @@
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "search=".$search; $param = "search=".$search;
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;

View File

@ -129,7 +129,7 @@
if (is_array($destination_conditions)) { if (is_array($destination_conditions)) {
$i=0; $i=0;
foreach($destination_conditions as $row) { foreach($destination_conditions as $row) {
if (isset($row['condition_expression']) && strlen($row['condition_expression']) > 0) { if (isset($row['condition_expression']) && !empty($row['condition_expression'])) {
if ($row['condition_field'] == 'caller_id_number') { if ($row['condition_field'] == 'caller_id_number') {
$row['condition_expression'] = preg_replace('#[^\+0-9\*]#', '', $row['condition_expression']); $row['condition_expression'] = preg_replace('#[^\+0-9\*]#', '', $row['condition_expression']);
$conditions[$i]['condition_field'] = $row['condition_field']; $conditions[$i]['condition_field'] = $row['condition_field'];
@ -142,7 +142,7 @@
} }
//process the http post //process the http post
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//initialize the destinations object //initialize the destinations object
$destination = new destinations; $destination = new destinations;
@ -151,10 +151,10 @@
} }
//set the default context //set the default context
if ($destination_type =="inbound" && strlen($destination_context) == 0) { if ($destination_type =="inbound" && empty($destination_context)) {
$destination_context = 'public'; $destination_context = 'public';
} }
if ($destination_type =="outbound" && strlen($destination_context) == 0) { if ($destination_type =="outbound" && empty($destination_context)) {
$destination_context = $_SESSION['domain_name']; $destination_context = $_SESSION['domain_name'];
} }
@ -183,11 +183,11 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($destination_type) == 0) { $msg .= $text['message-required']." ".$text['label-destination_type']."<br>\n"; } if (empty($destination_type)) { $msg .= $text['message-required']." ".$text['label-destination_type']."<br>\n"; }
//if (strlen($destination_prefix) == 0 && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."<br>\n"; } //if (empty($destination_prefix) && permission_exists('destination_prefix')) { $msg .= $text['message-required']." ".$text['label-destination_country_code']."<br>\n"; }
if (strlen($destination_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; } if (empty($destination_number)) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; }
if (strlen($destination_context) == 0) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; } if (empty($destination_context)) { $msg .= $text['message-required']." ".$text['label-destination_context']."<br>\n"; }
if (strlen($destination_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; } if (empty($destination_enabled)) { $msg .= $text['message-required']." ".$text['label-destination_enabled']."<br>\n"; }
//check for duplicates //check for duplicates
if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $_SESSION['destinations']['unique']['boolean'] == 'true') { if ($destination_type == 'inbound' && $destination_number != $db_destination_number && $_SESSION['destinations']['unique']['boolean'] == 'true') {
@ -204,7 +204,7 @@
} }
//show the message //show the message
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -345,7 +345,7 @@
if (is_array($dialplan_details)) { if (is_array($dialplan_details)) {
foreach ($dialplan_details as $index => $row) { foreach ($dialplan_details as $index => $row) {
//unset the empty row //unset the empty row
if (strlen($row["dialplan_detail_data"]) == 0) { if (empty($row["dialplan_detail_data"])) {
unset($dialplan_details[$index]); unset($dialplan_details[$index]);
} }
} }
@ -381,16 +381,16 @@
foreach($destination_numbers as $destination_number) { foreach($destination_numbers as $destination_number) {
//convert the number to a regular expression //convert the number to a regular expression
if (isset($destination_prefix) && strlen($destination_prefix) > 0) { if (isset($destination_prefix) && !empty($destination_prefix)) {
$destination_numbers['destination_prefix'] = $destination_prefix; $destination_numbers['destination_prefix'] = $destination_prefix;
} }
if (isset($destination_trunk_prefix) && strlen($destination_trunk_prefix) > 0) { if (isset($destination_trunk_prefix) && !empty($destination_trunk_prefix)) {
$destination_numbers['destination_trunk_prefix'] = $destination_trunk_prefix; $destination_numbers['destination_trunk_prefix'] = $destination_trunk_prefix;
} }
if (isset($destination_area_code) && strlen($destination_area_code) > 0) { if (isset($destination_area_code) && !empty($destination_area_code)) {
$destination_numbers['destination_area_code'] = $destination_area_code; $destination_numbers['destination_area_code'] = $destination_area_code;
} }
if (isset($destination_number) && strlen($destination_number) > 0) { if (isset($destination_number) && !empty($destination_number)) {
$destination_numbers['destination_number'] = $destination_number; $destination_numbers['destination_number'] = $destination_number;
} }
$destination = new destinations; $destination = new destinations;
@ -433,10 +433,10 @@
$dialplan_detail_order = 10; $dialplan_detail_order = 10;
//set the dialplan detail type //set the dialplan detail type
if (strlen($destination_condition_field) > 0) { if (!empty($destination_condition_field)) {
$dialplan_detail_type = $destination_condition_field; $dialplan_detail_type = $destination_condition_field;
} }
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) { elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text']; $dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
} }
else { else {
@ -471,7 +471,7 @@
//add the dialplan xml destination conditions //add the dialplan xml destination conditions
if (is_array($conditions)) { if (is_array($conditions)) {
foreach($conditions as $row) { foreach($conditions as $row) {
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && strlen($destination_prefix) > 0) { if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
$condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression']; $condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression'];
} }
else { else {
@ -492,10 +492,10 @@
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"continue_on_fail=true\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"continue_on_fail=true\" inline=\"true\"/>\n";
} }
if (strlen($destination_cid_name_prefix) > 0) { if (!empty($destination_cid_name_prefix)) {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"false\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"false\"/>\n";
} }
if (strlen($destination_record) > 0 && $destination_record == 'true') { if (!empty($destination_record) && $destination_record == 'true') {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n";
@ -503,19 +503,19 @@
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n";
} }
if (strlen($destination_hold_music) > 0) { if (!empty($destination_hold_music)) {
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"hold_music=".xml::sanitize($destination_hold_music)."\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"hold_music=".xml::sanitize($destination_hold_music)."\" inline=\"true\"/>\n";
} }
if (strlen($destination_distinctive_ring) > 0) { if (!empty($destination_distinctive_ring)) {
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"sip_h_Alert-Info=".xml::sanitize($destination_distinctive_ring)."\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"sip_h_Alert-Info=".xml::sanitize($destination_distinctive_ring)."\" inline=\"true\"/>\n";
} }
if (strlen($destination_accountcode) > 0) { if (!empty($destination_accountcode)) {
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n";
} }
if (strlen($destination_carrier) > 0) { if (!empty($destination_carrier)) {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n";
} }
if (strlen($fax_uuid) > 0) { if (!empty($fax_uuid)) {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +3000\"/>\n"; $dialplan["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +3000\"/>\n";
@ -547,7 +547,7 @@
if (is_array($conditions)) { if (is_array($conditions)) {
foreach($conditions as $row) { foreach($conditions as $row) {
//prepare the expression //prepare the expression
if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && strlen($destination_prefix) > 0) { if (is_numeric($row['condition_expression']) && strlen($destination_number) == strlen($row['condition_expression']) && !empty($destination_prefix)) {
$condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression']; $condition_expression = '\+?'.$destination_prefix.'?'.$row['condition_expression'];
} }
else { else {
@ -572,10 +572,10 @@
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
if (strlen($destination_condition_field) > 0) { if (!empty($destination_condition_field)) {
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $destination_condition_field;
} }
elseif (strlen($_SESSION['dialplan']['destination']['text']) > 0) { elseif (!empty($_SESSION['dialplan']['destination']['text'])) {
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text']; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
} }
else { else {
@ -618,7 +618,7 @@
$dialplan_detail_order = $dialplan_detail_order + 10; $dialplan_detail_order = $dialplan_detail_order + 10;
//set the caller id name prefix //set the caller id name prefix
if (strlen($destination_cid_name_prefix) > 0) { if (!empty($destination_cid_name_prefix)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -633,7 +633,7 @@
} }
//set the call accountcode //set the call accountcode
if (strlen($destination_accountcode) > 0) { if (!empty($destination_accountcode)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -648,7 +648,7 @@
} }
//set the call carrier //set the call carrier
if (strlen($destination_carrier) > 0) { if (!empty($destination_carrier)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -663,7 +663,7 @@
} }
//set the hold music //set the hold music
if (strlen($destination_hold_music) > 0) { if (!empty($destination_hold_music)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -675,7 +675,7 @@
} }
//set the distinctive ring //set the distinctive ring
if (strlen($destination_distinctive_ring) > 0) { if (!empty($destination_distinctive_ring)) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid; $dialplan["dialplan_details"][$y]["dialplan_uuid"] = $dialplan_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
@ -1084,7 +1084,7 @@
//decode the json to an array //decode the json to an array
$destination_conditions = json_decode($destination_conditions, true); $destination_conditions = json_decode($destination_conditions, true);
$destination_actions = json_decode($destination_actions, true); $destination_actions = json_decode($destination_actions ?? '', true);
//prepare the conditions array, add an empty row //prepare the conditions array, add an empty row
if (is_array($destination_conditions)) { if (is_array($destination_conditions)) {
@ -1131,7 +1131,7 @@
if ($row['dialplan_detail_type'] == "tone_detect") { if ($row['dialplan_detail_type'] == "tone_detect") {
unset($dialplan_details[$x]); unset($dialplan_details[$x]);
} }
if (substr($dialplan_detail_data,0,22) == "execute_on_tone_detect") { if (substr($dialplan_detail_data ?? '',0,22) == "execute_on_tone_detect") {
unset($dialplan_details[$x]); unset($dialplan_details[$x]);
} }
if ($row['dialplan_detail_type'] == "answer") { if ($row['dialplan_detail_type'] == "answer") {
@ -1148,10 +1148,10 @@
} }
//set the defaults //set the defaults
if (strlen($destination_order) == 0) { $destination_order = '100'; } if (empty($destination_order)) { $destination_order = '100'; }
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; } if (empty($destination_type)) { $destination_type = 'inbound'; }
if (strlen($destination_context) == 0) { $destination_context = 'public'; } if (empty($destination_context)) { $destination_context = 'public'; }
if (strlen($destination_enabled) == 0) { $destination_enabled = 'true'; } if (empty($destination_enabled)) { $destination_enabled = 'true'; }
if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; } if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; }
if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; } if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; }
@ -1703,7 +1703,7 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n"; echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n";
if (strlen($domain_uuid) == 0) { if (empty($domain_uuid)) {
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n"; echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
} }
else { else {

View File

@ -68,11 +68,11 @@
$destination_record = $_POST["destination_record"]; $destination_record = $_POST["destination_record"];
//set the defaults //set the defaults
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; } if (empty($destination_type)) { $destination_type = 'inbound'; }
if (strlen($destination_context) == 0) { $destination_context = 'public'; } if (empty($destination_context)) { $destination_context = 'public'; }
if ($destination_type =="outbound" && $destination_context == "public") { $destination_context = $_SESSION['domain_name']; } if ($destination_type =="outbound" && $destination_context == "public") { $destination_context = $_SESSION['domain_name']; }
if ($destination_type =="outbound" && strlen($destination_context) == 0) { $destination_context = $_SESSION['domain_name']; } if ($destination_type =="outbound" && empty($destination_context)) { $destination_context = $_SESSION['domain_name']; }
if (strlen($from_row) == 0) { $from_row = '2'; } if (empty($from_row)) { $from_row = '2'; }
//save the data to the csv file //save the data to the csv file
if (isset($_POST['data'])) { if (isset($_POST['data'])) {
@ -96,7 +96,7 @@
} }
//get the schema //get the schema
if (strlen($delimiter) > 0) { if (!empty($delimiter)) {
//get the first line //get the first line
$line = fgets(fopen($_SESSION['file'], 'r')); $line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line); $line_fields = explode($delimiter, $line);
@ -148,7 +148,7 @@
} }
//upload the destination csv //upload the destination csv
if (file_exists($_SESSION['file']) && $action == 'add') { if (file_exists($_SESSION['file'] ?? '') && $action == 'add') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -199,8 +199,8 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
if (strlen($parent) == 0) { if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];
} }
@ -235,7 +235,7 @@
$destination_description = $row['destination_description']; $destination_description = $row['destination_description'];
//convert the number to a regular expression //convert the number to a regular expression
if (isset($destination_prefix) && strlen($destination_prefix) > 0) { if (isset($destination_prefix) && !empty($destination_prefix)) {
$destination_number_regex = string_to_regex($destination_number, $destination_prefix); $destination_number_regex = string_to_regex($destination_number, $destination_prefix);
} }
else { else {
@ -269,7 +269,7 @@
$dialplan_detail_order = $dialplan_detail_order + 10; $dialplan_detail_order = $dialplan_detail_order + 10;
//set the dialplan detail type //set the dialplan detail type
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) { if (!empty($_SESSION['dialplan']['destination']['text'])) {
$dialplan_detail_type = $_SESSION['dialplan']['destination']['text']; $dialplan_detail_type = $_SESSION['dialplan']['destination']['text'];
} }
else { else {
@ -294,10 +294,10 @@
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_uuid=".$_SESSION['domain_uuid']."\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_uuid=".$_SESSION['domain_uuid']."\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_name=".$_SESSION['domain_name']."\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"domain_name=".$_SESSION['domain_name']."\" inline=\"true\"/>\n";
if (strlen($destination_cid_name_prefix) > 0) { if (!empty($destination_cid_name_prefix)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"effective_caller_id_name=".xml::sanitize($destination_cid_name_prefix)."#\${caller_id_name}\" inline=\"true\"/>\n";
} }
if (strlen($destination_record) > 0) { if (!empty($destination_record)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_path=\${recordings_dir}/\${domain_name}/archive/\${strftime(%Y)}/\${strftime(%b)}/\${strftime(%d)}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_name=\${uuid}.\${record_ext}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"record_append=true\" inline=\"true\"/>\n";
@ -305,13 +305,13 @@
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"recording_follow_transfer=true\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"record_session\" data=\"\${record_path}/\${record_name}\" inline=\"false\"/>\n";
} }
if (strlen($destination_accountcode) > 0) { if (!empty($destination_accountcode)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"accountcode=".xml::sanitize($destination_accountcode)."\" inline=\"true\"/>\n";
} }
if (strlen($destination_carrier) > 0) { if (!empty($destination_carrier)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"carrier=".xml::sanitize($destination_carrier)."\" inline=\"true\"/>\n";
} }
if (strlen($fax_uuid) > 0) { if (!empty($fax_uuid)) {
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"tone_detect_hits=1\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"set\" data=\"execute_on_tone_detect=transfer ".xml::sanitize($fax_extension)." XML \${domain_name}\" inline=\"true\"/>\n";
$array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +5000\"/>\n"; $array["dialplans"][$row_id]["dialplan_xml"] .= " <action application=\"tone_detect\" data=\"fax 1100 r +5000\"/>\n";
@ -327,7 +327,7 @@
//check the destination number //check the destination number
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "condition"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
if (strlen($_SESSION['dialplan']['destination']['text']) > 0) { if (!empty($_SESSION['dialplan']['destination']['text'])) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text']; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $_SESSION['dialplan']['destination']['text'];
} }
else { else {
@ -341,7 +341,7 @@
$dialplan_detail_order = $dialplan_detail_order + 10; $dialplan_detail_order = $dialplan_detail_order + 10;
//set the caller id name prefix //set the caller id name prefix
if (strlen($destination_cid_name_prefix) > 0) { if (!empty($destination_cid_name_prefix)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@ -414,7 +414,7 @@
} }
//set the call accountcode //set the call accountcode
if (strlen($destination_accountcode) > 0) { if (!empty($destination_accountcode)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = "set";
@ -427,7 +427,7 @@
} }
//set the destination app and data //set the destination app and data
if (strlen($destination_app) > 0 && strlen($destination_data) > 0) { if (strlen($destination_app) > 0 && !empty($destination_data)) {
$array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; $array["dialplans"][$row_id]["dialplan_details"][$y]["domain_uuid"] = $domain_uuid;
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $destination_app; $array["dialplans"][$row_id]["dialplan_details"][$y]["dialplan_detail_type"] = $destination_app;
@ -491,7 +491,7 @@
} }
//upload the destination csv //upload the destination csv
if (file_exists($_SESSION['file']) && $action == 'delete') { if (file_exists($_SESSION['file'] ?? '') && $action == 'delete') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -543,8 +543,8 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
if (strlen($parent) == 0) { if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];
} }
@ -567,7 +567,7 @@
$destination_number = $row['destination_number']; $destination_number = $row['destination_number'];
//get the dialplan uuid //get the dialplan uuid
if (strlen($row['destination_number']) == 0 || !is_uuid($row['dialplan_uuid'])) { if (empty($row['destination_number']) || !is_uuid($row['dialplan_uuid'])) {
$sql = "select * from v_destinations "; $sql = "select * from v_destinations ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and destination_number = :destination_number; "; $sql .= "and destination_number = :destination_number; ";
@ -581,7 +581,7 @@
//add to the array //add to the array
//$array['destinations'][$row_id] = $destinations[0]; //$array['destinations'][$row_id] = $destinations[0];
$array['destinations'][$row_id]['destination_uuid'] = $destinations[0]['destination_uuid']; $array['destinations'][$row_id]['destination_uuid'] = $destinations[0]['destination_uuid'];
if (strlen($row['dialplan_uuid']) > 0) { if (!empty($row['dialplan_uuid'])) {
$array['destinations'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid']; $array['destinations'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid'];
//$array['dialplans'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid']; //$array['dialplans'][$row_id]['dialplan_uuid'] = $destinations[0]['dialplan_uuid'];
} }
@ -678,7 +678,7 @@
} }
//match the column names to the field names //match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && ($action !== 'add' or $action !== 'delete')) { if (!empty($delimiter) && file_exists($_SESSION['file']) && ($action !== 'add' or $action !== 'delete')) {
//create token //create token
$object = new token; $object = new token;
@ -705,7 +705,7 @@
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
if (isset($_SESSION['file_name']) && strlen($_SESSION['file_name']) > 0) { if (isset($_SESSION['file_name']) && !empty($_SESSION['file_name'])) {
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-file_name']."\n"; echo " ".$text['label-file_name']."\n";
@ -825,7 +825,7 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n"; echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n";
if (strlen($domain_uuid) == 0) { if (empty($domain_uuid)) {
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n"; echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
} }
else { else {

View File

@ -112,7 +112,7 @@
$order = $_GET["order"]; $order = $_GET["order"];
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"] ?? '');
//prepare to page the results //prepare to page the results
$sql = "select count(*) from v_destinations "; $sql = "select count(*) from v_destinations ";
@ -121,7 +121,7 @@
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and ("; $sql .= "and (";
$sql .= "lower(destination_type) like :search "; $sql .= "lower(destination_type) like :search ";
$sql .= "or lower(destination_number) like :search "; $sql .= "or lower(destination_number) like :search ";
@ -149,7 +149,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -161,7 +161,7 @@
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and ("; $sql .= "and (";
$sql .= "lower(destination_type) like :search "; $sql .= "lower(destination_type) like :search ";
$sql .= "or lower(destination_number) like :search "; $sql .= "or lower(destination_number) like :search ";
@ -306,7 +306,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('destination_all')) { if ($_GET['show'] == "all" && permission_exists('destination_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -103,7 +103,7 @@ if (!class_exists('destinations')) {
} }
//add prefix //add prefix
if (strlen($destination_prefix) > 0) { if (!empty($destination_prefix)) {
$destination_prefix = str_replace("+", "", $destination_prefix); $destination_prefix = str_replace("+", "", $destination_prefix);
$plus = '\+?'; $plus = '\+?';
if (strlen($destination_prefix) == 1) { if (strlen($destination_prefix) == 1) {
@ -345,7 +345,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name); $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
} }
if (is_array($row['result']['data']) && count($row['result']['data']) > 0 and strlen($row['select_value'][$destination_type]) > 0) { if (is_array($row['result']['data']) && count($row['result']['data']) > 0 and !empty($row['select_value'][$destination_type])) {
$response .= " <optgroup label='".$text2['title-'.$label]."'>\n"; $response .= " <optgroup label='".$text2['title-'.$label]."'>\n";
$label2 = $label; $label2 = $label;
foreach ($row['result']['data'] as $data) { foreach ($row['result']['data'] as $data) {
@ -363,9 +363,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) { if (strpos($value,',') !== false) {
$keys = explode(",", $value); $keys = explode(",", $value);
foreach ($keys as $k) { foreach ($keys as $k) {
if (strlen($data[$k]) > 0) { if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value); $select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label); $select_label = str_replace("\${".$key."}", $data[$k], $select_label);
} }
else { else {
@ -376,9 +376,9 @@ if (!class_exists('destinations')) {
} }
} }
else { else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value); $select_value = str_replace("\${".$key."}", $data[$key] ?? '', $select_value ?? '');
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label); $select_label = str_replace("\${".$key."}", $data[$key] ?? '', $select_label ?? '');
} }
else { else {
$label = $data['label']; $label = $data['label'];
@ -386,7 +386,7 @@ if (!class_exists('destinations')) {
} }
} }
//application: hangup //application: hangup
if (strlen($data['application']) > 0) { if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value); $select_value = str_replace("transfer", $data['application'], $select_value);
} }
} }
@ -408,7 +408,7 @@ if (!class_exists('destinations')) {
} }
} }
if (!$select_found) { if (!$select_found) {
$destination_label = str_replace(":", " ", $destination_value); $destination_label = str_replace(":", " ", $destination_value ?? '');
$destination_label = str_replace("menu-exec-app", "", $destination_label); $destination_label = str_replace("menu-exec-app", "", $destination_label);
$destination_label = str_replace("transfer", "", $destination_label); $destination_label = str_replace("transfer", "", $destination_label);
$destination_label = str_replace("XML ".$this->domain_name, "", $destination_label); $destination_label = str_replace("XML ".$this->domain_name, "", $destination_label);
@ -661,7 +661,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name); $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
} }
if (is_array($row['result']['data']) && strlen($row['select_value'][$destination_type]) > 0) { if (is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
$label2 = $label; $label2 = $label;
foreach ($row['result']['data'] as $data) { foreach ($row['result']['data'] as $data) {
$select_value = $row['select_value'][$destination_type]; $select_value = $row['select_value'][$destination_type];
@ -678,9 +678,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) { if (strpos($value,',') !== false) {
$keys = explode(",", $value); $keys = explode(",", $value);
foreach ($keys as $k) { foreach ($keys as $k) {
if (strlen($data[$k]) > 0) { if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value); $select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label); $select_label = str_replace("\${".$key."}", $data[$k], $select_label);
} }
else { else {
@ -691,9 +691,9 @@ if (!class_exists('destinations')) {
} }
} }
else { else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value); $select_value = str_replace("\${".$key."}", $data[$key] ?? '', $select_value);
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label); $select_label = str_replace("\${".$key."}", $data[$key] ?? '', $select_label);
} }
else { else {
$label = $data['label']; $label = $data['label'];
@ -701,7 +701,7 @@ if (!class_exists('destinations')) {
} }
} }
//application: hangup //application: hangup
if (strlen($data['application']) > 0) { if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value); $select_value = str_replace("transfer", $data['application'], $select_value);
} }
} }
@ -722,8 +722,9 @@ if (!class_exists('destinations')) {
} }
} }
if (!$select_found) { if (!$select_found) {
$destination_label = str_replace(":", " ", $destination_value); if(!empty($destination_value))
$destination_label = str_replace("menu-exec-app", "", $destination_label); $destination_label = str_replace(":", " ", $destination_value);
$destination_label = str_replace("menu-exec-app", "", $destination_label ?? '');
$destination_label = str_replace("transfer", "", $destination_label); $destination_label = str_replace("transfer", "", $destination_label);
$destination_label = str_replace("XML ".$this->domain_name, "", $destination_label); $destination_label = str_replace("XML ".$this->domain_name, "", $destination_label);
$array[$label][$destination_label] = $destination_value; $array[$label][$destination_label] = $destination_value;
@ -874,7 +875,7 @@ if (!class_exists('destinations')) {
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name); $text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
} }
if (is_array($row['result']['data']) && strlen($row['select_value'][$destination_type]) > 0) { if (is_array($row['result']['data']) && !empty($row['select_value'][$destination_type])) {
$label2 = $label; $label2 = $label;
foreach ($row['result']['data'] as $data) { foreach ($row['result']['data'] as $data) {
$select_value = $row['select_value'][$destination_type]; $select_value = $row['select_value'][$destination_type];
@ -892,9 +893,9 @@ if (!class_exists('destinations')) {
if (strpos($value,',') !== false) { if (strpos($value,',') !== false) {
$keys = explode(",", $value); $keys = explode(",", $value);
foreach ($keys as $k) { foreach ($keys as $k) {
if (strlen($data[$k]) > 0) { if (!empty($data[$k])) {
$select_value = str_replace("\${".$key."}", $data[$k], $select_value); $select_value = str_replace("\${".$key."}", $data[$k], $select_value);
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$k], $select_label); $select_label = str_replace("\${".$key."}", $data[$k], $select_label);
} }
else { else {
@ -906,7 +907,7 @@ if (!class_exists('destinations')) {
} }
else { else {
$select_value = str_replace("\${".$key."}", $data[$key], $select_value); $select_value = str_replace("\${".$key."}", $data[$key], $select_value);
if (strlen($data['label']) == 0) { if (empty($data['label'])) {
$select_label = str_replace("\${".$key."}", $data[$key], $select_label); $select_label = str_replace("\${".$key."}", $data[$key], $select_label);
} }
else { else {
@ -915,7 +916,7 @@ if (!class_exists('destinations')) {
} }
} }
//application: hangup //application: hangup
if (strlen($data['application']) > 0) { if (!empty($data['application'])) {
$select_value = str_replace("transfer", $data['application'], $select_value); $select_value = str_replace("transfer", $data['application'], $select_value);
} }
} }

View File

@ -156,7 +156,7 @@
} }
//normalize the mac address //normalize the mac address
if (isset($device_mac_address) && strlen($device_mac_address) > 0) { if (isset($device_mac_address) && !empty($device_mac_address)) {
$device_mac_address = strtolower($device_mac_address); $device_mac_address = strtolower($device_mac_address);
$device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address); $device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address);
} }

View File

@ -162,19 +162,19 @@
//$device_setting_description = $_POST["device_setting_description"]; //$device_setting_description = $_POST["device_setting_description"];
//normalize the mac address //normalize the mac address
if (isset($device_mac_address) && strlen($device_mac_address) > 0) { if (!empty($device_mac_address)) {
$device_mac_address = strtolower($device_mac_address); $device_mac_address = strtolower($device_mac_address);
$device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address); $device_mac_address = preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address);
} }
} }
//use the mac address to get the vendor //use the mac address to get the vendor
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
$device_vendor = device::get_vendor($device_mac_address); $device_vendor = device::get_vendor($device_mac_address);
} }
//add or update the database //add or update the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($_POST) && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -186,17 +186,17 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($device_mac_address) == 0) { $msg .= $text['message-required'].$text['label-device_mac_address']."<br>\n"; } if (empty($device_mac_address)) { $msg .= $text['message-required'].$text['label-device_mac_address']."<br>\n"; }
//if (strlen($device_label) == 0) { $msg .= "Please provide: Label<br>\n"; } //if (empty($device_label)) { $msg .= "Please provide: Label<br>\n"; }
//if (strlen($device_vendor) == 0) { $msg .= "Please provide: Vendor<br>\n"; } //if (empty($device_vendor)) { $msg .= "Please provide: Vendor<br>\n"; }
//if (strlen($device_model) == 0) { $msg .= "Please provide: Model<br>\n"; } //if (empty($device_model)) { $msg .= "Please provide: Model<br>\n"; }
//if (strlen($device_firmware_version) == 0) { $msg .= "Please provide: Firmware Version<br>\n"; } //if (empty($device_firmware_version)) { $msg .= "Please provide: Firmware Version<br>\n"; }
//if (strlen($device_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; } //if (empty($device_enabled)) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($device_template) == 0) { $msg .= "Please provide: Template<br>\n"; } //if (empty($device_template)) { $msg .= "Please provide: Template<br>\n"; }
//if (strlen($device_username) == 0) { $msg .= "Please provide: Username<br>\n"; } //if (empty($device_username)) { $msg .= "Please provide: Username<br>\n"; }
//if (strlen($device_password) == 0) { $msg .= "Please provide: Password<br>\n"; } //if (empty($device_password)) { $msg .= "Please provide: Password<br>\n"; }
//if (strlen($device_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($device_description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0) { if (!empty($msg)) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -291,7 +291,7 @@
if (permission_exists('device_line_edit')) { if (permission_exists('device_line_edit')) {
$y = 0; $y = 0;
foreach ($device_lines as $row) { foreach ($device_lines as $row) {
if (strlen($row['line_number']) > 0) { if (!empty($row['line_number'])) {
$new_line = false; $new_line = false;
if (is_uuid($row["device_line_uuid"])) { if (is_uuid($row["device_line_uuid"])) {
$device_line_uuid = $row["device_line_uuid"]; $device_line_uuid = $row["device_line_uuid"];
@ -374,7 +374,7 @@
if (permission_exists('device_key_edit')) { if (permission_exists('device_key_edit')) {
$y = 0; $y = 0;
foreach ($device_keys as $row) { foreach ($device_keys as $row) {
if (strlen($row['device_key_category']) > 0) { if (!empty($row['device_key_category'])) {
if (is_uuid($row["device_key_uuid"])) { if (is_uuid($row["device_key_uuid"])) {
$device_key_uuid = $row["device_key_uuid"]; $device_key_uuid = $row["device_key_uuid"];
} }
@ -413,7 +413,7 @@
if (permission_exists('device_setting_edit')) { if (permission_exists('device_setting_edit')) {
$y = 0; $y = 0;
foreach ($device_settings as $row) { foreach ($device_settings as $row) {
if (strlen($row['device_setting_subcategory']) > 0) { if (!empty($row['device_setting_subcategory'])) {
if (is_uuid($row["device_setting_uuid"])) { if (is_uuid($row["device_setting_uuid"])) {
$device_setting_uuid = $row["device_setting_uuid"]; $device_setting_uuid = $row["device_setting_uuid"];
} }
@ -477,7 +477,7 @@
} }
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $domain_uuid; $prov->domain_uuid = $domain_uuid;
$response = $prov->write(); $response = $prov->write();
@ -502,7 +502,7 @@
} }
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (!empty($_GET) && $_POST["persistformvar"] != "true") {
$sql = "select * from v_devices "; $sql = "select * from v_devices ";
$sql .= "where device_uuid = :device_uuid "; $sql .= "where device_uuid = :device_uuid ";
$parameters['device_uuid'] = $device_uuid; $parameters['device_uuid'] = $device_uuid;
@ -532,17 +532,17 @@
} }
//set the defaults //set the defaults
if (strlen($device_enabled) == 0) { $device_enabled = 'true'; } if (empty($device_enabled)) { $device_enabled = 'true'; }
//use the mac address to get the vendor //use the mac address to get the vendor
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
//get the device vendor using the mac address //get the device vendor using the mac address
$device_vendor = device::get_vendor($device_mac_address); $device_vendor = device::get_vendor($device_mac_address);
//if the vendor was not found using the mac address use an alternative method //if the vendor was not found using the mac address use an alternative method
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
$template_array = explode("/", $device_template); $template_array = explode("/", $device_template ?? '');
$device_vendor = $template_array[0]; $device_vendor = $template_array[0] ?? '';
} }
} }
@ -665,16 +665,16 @@
unset($sql, $parameters); unset($sql, $parameters);
//use the mac address to get the vendor //use the mac address to get the vendor
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
$device_vendor = device::get_vendor($device_mac_address); $device_vendor = device::get_vendor($device_mac_address);
} }
//get the device line info for provision button //get the device line info for provision button
foreach($device_lines as $row) { foreach($device_lines as $row) {
if (strlen($row['user_id']) > 0) { if (!empty($row['user_id'])) {
$user_id = $row['user_id']; $user_id = $row['user_id'];
} }
if (strlen($row['server_address']) > 0) { if (!empty($row['server_address'])) {
$server_address = $row['server_address']; $server_address = $row['server_address'];
} }
} }
@ -747,7 +747,7 @@
if (permission_exists("device_line_password") && $device_template == "grandstream/wave") { if (permission_exists("device_line_password") && $device_template == "grandstream/wave") {
//set the mode //set the mode
if (isset($_SESSION['theme']['qr_image'])) { if (isset($_SESSION['theme']['qr_image'])) {
if (strlen($_SESSION['theme']['qr_image']) > 0) { if (!empty($_SESSION['theme']['qr_image'])) {
$mode = '4'; $mode = '4';
} }
else { else {
@ -762,7 +762,7 @@
$row = $device_lines[0]; $row = $device_lines[0];
//set the outbound proxy settings //set the outbound proxy settings
if (strlen($row['outbound_proxy_primary']) == 0) { if (empty($row['outbound_proxy_primary'])) {
$outbound_proxy_primary = $row['server_address']; $outbound_proxy_primary = $row['server_address'];
} }
else { else {
@ -908,7 +908,7 @@
'id'=>'btn_copy', 'id'=>'btn_copy',
'style'=>'float: right; margin-left: 15px;', 'style'=>'float: right; margin-left: 15px;',
'collapse'=>'never', 'collapse'=>'never',
'onclick'=>"modal_close(); if (document.getElementById('new_mac_address').value != '') { window.location='device_copy.php?id=".urlencode($device_uuid)."&mac=' + document.getElementById('new_mac_address').value; }" 'onclick'=>"modal_close(); if (document.getElementById('new_mac_address').value != '') { window.location='device_copy.php?id=".urlencode($device_uuid ?? '')."&mac=' + document.getElementById('new_mac_address').value; }"
]), ]),
'onclose'=>"document.getElementById('new_mac_address').value = '';", 'onclose'=>"document.getElementById('new_mac_address').value = '';",
]); ]);
@ -933,15 +933,15 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' width='70%' align='left'>\n"; echo "<td class='vtable' width='70%' align='left'>\n";
if (permission_exists('device_mac_address')) { if (permission_exists('device_mac_address')) {
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"".escape($device_mac_address)."\"/>\n"; echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"".escape($device_mac_address ?? '')."\"/>\n";
echo "<br />\n"; echo "<br />\n";
echo $text['description-device_mac_address']."\n"; echo $text['description-device_mac_address']."\n";
} }
else { else {
echo escape($device_mac_address); echo escape($device_mac_address ?? '');
} }
echo " <div style='display: none;' id='duplicate_mac_response'></div>\n"; echo " <div style='display: none;' id='duplicate_mac_response'></div>\n";
echo " ".escape($device_provisioned_ip)."(<a href='http://".escape($device_provisioned_ip)."' target='_blank'>http</a>|<a href='https://".escape($device_provisioned_ip)."' target='_blank'>https</a>)\n"; echo " ".escape($device_provisioned_ip ?? '')."(<a href='http://".escape($device_provisioned_ip ?? '')."' target='_blank'>http</a>|<a href='https://".escape($device_provisioned_ip ?? '')."' target='_blank'>https</a>)\n";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
@ -1111,11 +1111,11 @@
//set the defaults //set the defaults
if (!permission_exists('device_line_server_address')) { if (!permission_exists('device_line_server_address')) {
if (strlen($row['server_address']) == 0) { $row['server_address'] = $_SESSION['domain_name']; } if (empty($row['server_address'])) { $row['server_address'] = $_SESSION['domain_name']; }
} }
if (strlen($row['sip_transport']) == 0) { $row['sip_transport'] = $_SESSION['provision']['line_sip_transport']['text']; } if (empty($row['sip_transport'])) { $row['sip_transport'] = $_SESSION['provision']['line_sip_transport']['text']; }
if (strlen($row['sip_port']) == 0) { $row['sip_port'] = $_SESSION['provision']['line_sip_port']['numeric']; } if (empty($row['sip_port'])) { $row['sip_port'] = $_SESSION['provision']['line_sip_port']['numeric']; }
if (strlen($row['register_expires']) == 0) { $row['register_expires'] = $_SESSION['provision']['line_register_expires']['numeric']; } if (empty($row['register_expires'])) { $row['register_expires'] = $_SESSION['provision']['line_register_expires']['numeric']; }
//determine whether to hide the element //determine whether to hide the element
if (!is_uuid($device_line_uuid)) { if (!is_uuid($device_line_uuid)) {
@ -1302,7 +1302,7 @@
$x++; $x++;
} }
echo " </table>\n"; echo " </table>\n";
if (strlen($text['description-lines']) > 0) { if (!empty($text['description-lines'])) {
echo " <br>".$text['description-lines']."\n"; echo " <br>".$text['description-lines']."\n";
} }
echo " </td>"; echo " </td>";
@ -1397,7 +1397,7 @@
if (permission_exists('device_key_id')) { if (permission_exists('device_key_id')) {
echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n"; echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n";
} }
if ($vendor_count > 1 && strlen($row['device_key_vendor']) > 0) { if ($vendor_count > 1 && !empty($row['device_key_vendor'])) {
echo " <td class='vtable'>".ucwords($row['device_key_vendor'])."</td>\n"; echo " <td class='vtable'>".ucwords($row['device_key_vendor'])."</td>\n";
if ($show_key_subtype) { if ($show_key_subtype) {
echo " <td class='vtable'>".$text['label-device_key_subtype']."</td>\n"; echo " <td class='vtable'>".$text['label-device_key_subtype']."</td>\n";
@ -1467,7 +1467,7 @@
echo " <option value='programmable'>".$text['label-programmable']."</option>\n"; echo " <option value='programmable'>".$text['label-programmable']."</option>\n";
} }
if ($row['device_key_vendor'] !== "polycom") { if ($row['device_key_vendor'] !== "polycom") {
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
if ($row['device_key_category'] == "expansion") { if ($row['device_key_category'] == "expansion") {
echo " <option value='expansion' selected='selected'>".$text['label-expansion']." 1</option>\n"; echo " <option value='expansion' selected='selected'>".$text['label-expansion']." 1</option>\n";
} }
@ -1571,7 +1571,7 @@
echo "<td align='left' nowrap='nowrap'>\n"; echo "<td align='left' nowrap='nowrap'>\n";
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n"; //echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
if (strlen($row['device_key_vendor']) > 0) { if (!empty($row['device_key_vendor'])) {
$device_key_vendor = $row['device_key_vendor']; $device_key_vendor = $row['device_key_vendor'];
} }
else { else {
@ -1585,7 +1585,7 @@
$previous_vendor = ''; $previous_vendor = '';
$i=0; $i=0;
foreach ($vendor_functions as $function) { foreach ($vendor_functions as $function) {
if (strlen($row['device_key_vendor']) == 0 && $function['vendor_name'] != $previous_vendor) { if (empty($row['device_key_vendor']) && $function['vendor_name'] != $previous_vendor) {
if ($i > 0) { echo " </optgroup>\n"; } if ($i > 0) { echo " </optgroup>\n"; }
echo " <optgroup label='".ucwords($function['vendor_name'])."'>\n"; echo " <optgroup label='".ucwords($function['vendor_name'])."'>\n";
} }
@ -1593,16 +1593,16 @@
if (strtolower($row['device_key_vendor']) == $function['vendor_name'] && $row['device_key_type'] == $function['value']) { if (strtolower($row['device_key_vendor']) == $function['vendor_name'] && $row['device_key_type'] == $function['value']) {
$selected = "selected='selected'"; $selected = "selected='selected'";
} }
if (strlen($row['device_key_vendor']) == 0) { if (empty($row['device_key_vendor'])) {
echo " <option value='".$function['value']."' vendor='".$function['vendor_name']."' $selected >".$text['label-'.$function['type']]."</option>\n"; echo " <option value='".$function['value']."' vendor='".$function['vendor_name']."' $selected >".$text['label-'.$function['type']]."</option>\n";
} }
if (strlen($row['device_key_vendor']) > 0 && strtolower($row['device_key_vendor']) == $function['vendor_name']) { if (!empty($row['device_key_vendor']) && strtolower($row['device_key_vendor']) == $function['vendor_name']) {
echo " <option value='".$function['value']."' vendor='".$function['vendor_name']."' $selected >".$text['label-'.$function['type']]."</option>\n"; echo " <option value='".$function['value']."' vendor='".$function['vendor_name']."' $selected >".$text['label-'.$function['type']]."</option>\n";
} }
$previous_vendor = $function['vendor_name']; $previous_vendor = $function['vendor_name'];
$i++; $i++;
} }
if (strlen($row['device_key_vendor']) == 0) { if (empty($row['device_key_vendor'])) {
echo " </optgroup>\n"; echo " </optgroup>\n";
} }
echo "</select>\n"; echo "</select>\n";
@ -1663,7 +1663,7 @@
$x++; $x++;
} }
echo " </table>\n"; echo " </table>\n";
if (strlen($text['description-keys']) > 0) { if (!empty($text['description-keys'])) {
echo " <br>".$text['description-keys']."\n"; echo " <br>".$text['description-keys']."\n";
} }
echo " </td>"; echo " </td>";
@ -1745,7 +1745,7 @@
echo "</table>\n"; echo "</table>\n";
if (strlen($text['description-settings']) > 0) { if (!empty($text['description-settings'])) {
echo "<br>".$text['description-settings']."\n"; echo "<br>".$text['description-settings']."\n";
} }
@ -1793,8 +1793,8 @@
echo "</td>\n"; echo "</td>\n";
echo "<td class='vtable' align='left' nowrap='nowrap'>\n"; echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
$label = $device_alternate[0]['device_label']; $label = $device_alternate[0]['device_label'];
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; } if (empty($label)) { $label = $device_alternate[0]['device_description']; }
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; } if (empty($label)) { $label = $device_alternate[0]['device_mac_address']; }
echo " <table>\n"; echo " <table>\n";
echo " <tr>\n"; echo " <tr>\n";
echo " <td><a href='?id=".escape($device_uuid_alternate)."' id='device_uuid_alternate_link'>".escape($label)."</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"".escape($device_uuid_alternate)."\" />&nbsp;</td>"; echo " <td><a href='?id=".escape($device_uuid_alternate)."' id='device_uuid_alternate_link'>".escape($label)."</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"".escape($device_uuid_alternate)."\" />&nbsp;</td>";

View File

@ -51,7 +51,7 @@
$fp = fopen("php://memory", 'r+'); $fp = fopen("php://memory", 'r+');
fputs($fp, $input); fputs($fp, $input);
rewind($fp); rewind($fp);
$data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0 $data = fgetcsv($fp, null, $delimiter, $enclosure, $escape);
fclose($fp); fclose($fp);
return $data; return $data;
} }
@ -86,7 +86,7 @@
} }
//get the schema //get the schema
if (strlen($delimiter) > 0 && file_exists($_SESSION['file'])) { if (!empty($delimiter) && file_exists($_SESSION['file'] ?? '')) {
//get the first line //get the first line
$line = fgets(fopen($_SESSION['file'], 'r')); $line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line); $line_fields = explode($delimiter, $line);
@ -135,7 +135,7 @@
} }
//match the column names to the field names //match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && $action != 'import') { if (!empty($delimiter) && file_exists($_SESSION['file'] ?? '') && $action != 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -239,7 +239,7 @@
} }
//upload the csv //upload the csv
if (file_exists($_SESSION['file']) && $action == 'import') { if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -316,8 +316,8 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
if (strlen($parent) == 0) { if (empty($parent)) {
if ($field_name != "username") { if ($field_name != "username") {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];
@ -450,7 +450,7 @@
//view_array($message); //view_array($message);
} }
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $domain_uuid; $prov->domain_uuid = $domain_uuid;
$response = $prov->write(); $response = $prov->write();

View File

@ -55,7 +55,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && is_uuid($_POST['device_profile_uuid'])) { if ($_POST['action'] != '' && is_uuid($_POST['device_profile_uuid'])) {
@ -115,13 +115,13 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($device_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."<br>\n"; } if (empty($device_profile_name)) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."<br>\n"; }
//if (strlen($device_profile_keys) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."<br>\n"; } //if (empty($device_profile_keys)) { $msg .= $text['message-required']." ".$text['label-device_profile_keys']."<br>\n"; }
//if (strlen($device_profile_settings) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."<br>\n"; } //if (empty($device_profile_settings)) { $msg .= $text['message-required']." ".$text['label-device_profile_settings']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($device_profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."<br>\n"; } if (empty($device_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-device_profile_enabled']."<br>\n"; }
//if (strlen($device_profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."<br>\n"; } //if (empty($device_profile_description)) { $msg .= $text['message-required']." ".$text['label-device_profile_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -135,7 +135,7 @@
} }
//add the device_profile_uuid //add the device_profile_uuid
if (strlen($_POST["device_profile_uuid"]) == 0) { if (empty($_POST["device_profile_uuid"])) {
$device_profile_uuid = uuid(); $device_profile_uuid = uuid();
} }
@ -147,7 +147,7 @@
$array['device_profiles'][0]["device_profile_description"] = $device_profile_description; $array['device_profiles'][0]["device_profile_description"] = $device_profile_description;
$y = 0; $y = 0;
foreach ($device_profile_keys as $row) { foreach ($device_profile_keys as $row) {
if (strlen($row['profile_key_vendor']) > 0 && strlen($row['profile_key_id']) > 0) { if (strlen($row['profile_key_vendor']) > 0 && !empty($row['profile_key_id'])) {
$array['device_profiles'][0]['device_profile_keys'][$y]["domain_uuid"] = $domain_uuid; $array['device_profiles'][0]['device_profile_keys'][$y]["domain_uuid"] = $domain_uuid;
$array['device_profiles'][0]['device_profile_keys'][$y]["device_profile_key_uuid"] = $row["device_profile_key_uuid"]; $array['device_profiles'][0]['device_profile_keys'][$y]["device_profile_key_uuid"] = $row["device_profile_key_uuid"];
$array['device_profiles'][0]['device_profile_keys'][$y]["profile_key_category"] = $row["profile_key_category"]; $array['device_profiles'][0]['device_profile_keys'][$y]["profile_key_category"] = $row["profile_key_category"];
@ -169,7 +169,7 @@
$y = 0; $y = 0;
if (permission_exists("device_profile_setting_edit")) { if (permission_exists("device_profile_setting_edit")) {
foreach ($device_profile_settings as $row) { foreach ($device_profile_settings as $row) {
if (strlen($row['profile_setting_name']) > 0 && strlen($row['profile_setting_enabled']) > 0) { if (strlen($row['profile_setting_name']) > 0 && !empty($row['profile_setting_enabled'])) {
$array['device_profiles'][0]['device_profile_settings'][$y]["domain_uuid"] = $domain_uuid; $array['device_profiles'][0]['device_profile_settings'][$y]["domain_uuid"] = $domain_uuid;
$array['device_profiles'][0]['device_profile_settings'][$y]["device_profile_setting_uuid"] = $row["device_profile_setting_uuid"]; $array['device_profiles'][0]['device_profile_settings'][$y]["device_profile_setting_uuid"] = $row["device_profile_setting_uuid"];
$array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_name"] = $row["profile_setting_name"]; $array['device_profiles'][0]['device_profile_settings'][$y]["profile_setting_name"] = $row["profile_setting_name"];
@ -246,10 +246,10 @@
} }
//set the defaults //set the defaults
if (strlen($device_profile_enabled) == 0) { $device_profile_enabled = 'true'; } if (empty($device_profile_enabled)) { $device_profile_enabled = 'true'; }
//get the child data //get the child data
if (strlen($device_profile_uuid) > 0) { if (!empty($device_profile_uuid)) {
$sql = "select * from v_device_profile_keys "; $sql = "select * from v_device_profile_keys ";
$sql .= "where device_profile_uuid = :device_profile_uuid "; $sql .= "where device_profile_uuid = :device_profile_uuid ";
//$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; //$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
@ -316,7 +316,7 @@
unset($sql); unset($sql);
//add the $device_profile_key_uuid //add the $device_profile_key_uuid
if (strlen($device_profile_key_uuid) == 0) { if (empty($device_profile_key_uuid)) {
$device_profile_key_uuid = uuid(); $device_profile_key_uuid = uuid();
} }
@ -348,7 +348,7 @@
} }
//get the child data //get the child data
if (strlen($device_profile_uuid) > 0) { if (!empty($device_profile_uuid)) {
$sql = "select * from v_device_profile_settings "; $sql = "select * from v_device_profile_settings ";
$sql .= "where device_profile_uuid = :device_profile_uuid "; $sql .= "where device_profile_uuid = :device_profile_uuid ";
//$sql .= "and domain_uuid = '".$domain_uuid."' "; //$sql .= "and domain_uuid = '".$domain_uuid."' ";
@ -361,7 +361,7 @@
} }
//add the $device_profile_setting_uuid //add the $device_profile_setting_uuid
if (strlen($device_profile_setting_uuid) == 0) { if (empty($device_profile_setting_uuid)) {
$device_profile_setting_uuid = uuid(); $device_profile_setting_uuid = uuid();
} }
@ -536,7 +536,7 @@
} }
echo " <option value='programmable' ".($row['profile_key_category'] == "programmable" ? "selected='selected'" : null).">".$text['label-programmable']."</option>\n"; echo " <option value='programmable' ".($row['profile_key_category'] == "programmable" ? "selected='selected'" : null).">".$text['label-programmable']."</option>\n";
if ($row['profile_key_vendor'] !== "polycom") { if ($row['profile_key_vendor'] !== "polycom") {
if (strlen($row['profile_key_vendor']) == 0) { if (empty($row['profile_key_vendor'])) {
echo " <option value='expansion' ".($row['profile_key_category'] == "expansion" ? "selected='selected'" : null).">".$text['label-expansion']."</option>\n"; echo " <option value='expansion' ".($row['profile_key_category'] == "expansion" ? "selected='selected'" : null).">".$text['label-expansion']."</option>\n";
echo " <option value='expansion-1' ".($row['profile_key_category'] == "expansion-1" ? "selected='selected'" : null).">".$text['label-expansion']." 1</option>\n"; echo " <option value='expansion-1' ".($row['profile_key_category'] == "expansion-1" ? "selected='selected'" : null).">".$text['label-expansion']." 1</option>\n";
echo " <option value='expansion-2' ".($row['profile_key_category'] == "expansion-2" ? "selected='selected'" : null).">".$text['label-expansion']." 2</option>\n"; echo " <option value='expansion-2' ".($row['profile_key_category'] == "expansion-2" ? "selected='selected'" : null).">".$text['label-expansion']." 2</option>\n";
@ -577,7 +577,7 @@
if ($row['profile_key_vendor'] == $vendor['name']) { if ($row['profile_key_vendor'] == $vendor['name']) {
$selected = "selected='selected'"; $selected = "selected='selected'";
} }
if (strlen($vendor['name']) > 0) { if (!empty($vendor['name'])) {
echo " <option value='".escape($vendor['name'])."' $selected >".escape(ucwords($vendor['name']))."</option>\n"; echo " <option value='".escape($vendor['name'])."' $selected >".escape(ucwords($vendor['name']))."</option>\n";
} }
} }
@ -591,7 +591,7 @@
$previous_vendor = ''; $previous_vendor = '';
$i = 0; $i = 0;
foreach ($vendor_functions as $function) { foreach ($vendor_functions as $function) {
if (strlen($row['profile_key_vendor']) == 0 && $function['vendor_name'] != $previous_vendor) { if (empty($row['profile_key_vendor']) && $function['vendor_name'] != $previous_vendor) {
if ($i > 0) { echo " </optgroup>\n"; } if ($i > 0) { echo " </optgroup>\n"; }
echo " <optgroup label='".escape(ucwords($function['vendor_name']))."'>\n"; echo " <optgroup label='".escape(ucwords($function['vendor_name']))."'>\n";
} }
@ -599,16 +599,16 @@
if ($row['profile_key_vendor'] == $function['vendor_name'] && $row['profile_key_type'] == $function['value']) { if ($row['profile_key_vendor'] == $function['vendor_name'] && $row['profile_key_type'] == $function['value']) {
$selected = "selected='selected'"; $selected = "selected='selected'";
} }
if (strlen($row['profile_key_vendor']) == 0) { if (empty($row['profile_key_vendor'])) {
echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n"; echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n";
} }
if (strlen($row['profile_key_vendor']) > 0 && $row['profile_key_vendor'] == $function['vendor_name']) { if (!empty($row['profile_key_vendor']) && $row['profile_key_vendor'] == $function['vendor_name']) {
echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n"; echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."' $selected >".$text['label-'.$function['type']]."</option>\n";
} }
$previous_vendor = $function['vendor_name']; $previous_vendor = $function['vendor_name'];
$i++; $i++;
} }
if (strlen($row['profile_key_vendor']) == 0) { if (empty($row['profile_key_vendor'])) {
echo " </optgroup>\n"; echo " </optgroup>\n";
} }
echo " </select>\n"; echo " </select>\n";

View File

@ -88,7 +88,7 @@
$order = $_GET["order"]; $order = $_GET["order"];
//add the search term //add the search term
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = "and ("; $sql_search = "and (";
$sql_search .= " lower(device_profile_name) like :search "; $sql_search .= " lower(device_profile_name) like :search ";
$sql_search .= " or lower(device_profile_description) like :search "; $sql_search .= " or lower(device_profile_description) like :search ";
@ -132,7 +132,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -248,7 +248,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('device_profile_all')) { if ($_GET['show'] == "all" && permission_exists('device_profile_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {

View File

@ -62,7 +62,7 @@
} }
//process the data //process the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid //get the uuid
if ($action == "update") { if ($action == "update") {
@ -79,10 +79,10 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; } if (empty($name)) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; } if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; } //if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -141,7 +141,7 @@
} }
//set the defaults //set the defaults
if (strlen($enabled) == 0) { $enabled = true; } if (empty($enabled)) { $enabled = true; }
//create token //create token
$object = new token; $object = new token;

View File

@ -97,7 +97,7 @@
} }
//process the http variables //process the http variables
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid //get the uuid
if ($action == "update") { if ($action == "update") {
@ -114,12 +114,12 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."<br>\n"; } //if (empty($label)) { $msg .= $text['message-required']." ".$text['label-label']."<br>\n"; }
if (strlen($type) == 0) { $msg .= $text['message-required']." ".$text['label-type']."<br>\n"; } if (empty($type)) { $msg .= $text['message-required']." ".$text['label-type']."<br>\n"; }
if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; } if (empty($value)) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; } if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; } //if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -241,7 +241,7 @@
//set the assigned_groups array //set the assigned_groups array
if (is_array($function_groups) && @sizeof($function_groups) != 0) { if (is_array($function_groups) && @sizeof($function_groups) != 0) {
foreach($function_groups as $field) { foreach($function_groups as $field) {
if (strlen($field['group_name']) > 0) { if (!empty($field['group_name'])) {
$assigned_groups[] = $field['group_uuid']; $assigned_groups[] = $field['group_uuid'];
} }
} }
@ -325,7 +325,7 @@
if (is_array($function_groups) && @sizeof($function_groups) != 0) { if (is_array($function_groups) && @sizeof($function_groups) != 0) {
echo "<table cellpadding='0' cellspacing='0' border='0'>\n"; echo "<table cellpadding='0' cellspacing='0' border='0'>\n";
foreach ($function_groups as $field) { foreach ($function_groups as $field) {
if (strlen($field['group_name']) > 0) { if (!empty($field['group_name'])) {
echo "<tr>\n"; echo "<tr>\n";
echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>"; echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>";
echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null); echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);

View File

@ -103,7 +103,7 @@
$param = ""; $param = "";
if (isset($_GET['page'])) { if (isset($_GET['page'])) {
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;

View File

@ -80,7 +80,7 @@
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_where = "where ("; $sql_where = "where (";
$sql_where .= "lower(name) like :search "; $sql_where .= "lower(name) like :search ";
$sql_where .= "or lower(enabled) like :search "; $sql_where .= "or lower(enabled) like :search ";
@ -99,7 +99,7 @@
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".$search; $param = "&search=".$search;
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;

View File

@ -53,8 +53,8 @@
} }
//get the search //get the search
$search = strtolower($_REQUEST["search"]); $search = strtolower($_REQUEST["search"] ?? '');
$fields = strtolower($_REQUEST["fields"]); $fields = strtolower($_REQUEST["fields"] ?? '');
//process the http post data by action //process the http post data by action
if ($action != '' && is_array($devices) && @sizeof($devices) != 0) { if ($action != '' && is_array($devices) && @sizeof($devices) != 0) {
@ -112,7 +112,7 @@
//prepare to page the results //prepare to page the results
$sql = "select count(*) from v_devices as d "; $sql = "select count(*) from v_devices as d ";
if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) { if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) {
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "where "; $sql .= "where ";
} }
} }
@ -123,12 +123,12 @@
$sql .= " or d.domain_uuid is null "; $sql .= " or d.domain_uuid is null ";
} }
$sql .= ") "; $sql .= ") ";
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and "; $sql .= "and ";
} }
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "("; $sql .= "(";
$sql .= " lower(d.device_mac_address) like :search "; $sql .= " lower(d.device_mac_address) like :search ";
$sql .= " or lower(d.device_label) like :search "; $sql .= " or lower(d.device_label) like :search ";
@ -178,7 +178,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -214,7 +214,7 @@
$sql .= "and d.device_user_uuid = :user_uuid "; $sql .= "and d.device_user_uuid = :user_uuid ";
$parameters['user_uuid'] = $_SESSION['user_uuid']; $parameters['user_uuid'] = $_SESSION['user_uuid'];
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql .= "and ("; $sql .= "and (";
$sql .= " lower(d.device_mac_address) like :search "; $sql .= " lower(d.device_mac_address) like :search ";
$sql .= " or lower(d.device_label) like :search "; $sql .= " or lower(d.device_label) like :search ";
@ -250,7 +250,7 @@
$sql .= ") "; $sql .= ") ";
$parameters['search'] = '%'.strtolower($search).'%'; $parameters['search'] = '%'.strtolower($search).'%';
} }
if (strlen($order_by) == 0) { if (empty($order_by)) {
$sql .= "order by d.device_label, d.device_description asc "; $sql .= "order by d.device_label, d.device_description asc ";
} }
else { else {
@ -421,7 +421,7 @@
echo " </td>\n"; echo " </td>\n";
echo " <td>".escape($row['device_label'])."&nbsp;</td>\n"; echo " <td>".escape($row['device_label'])."&nbsp;</td>\n";
if ($device_alternate) { if ($device_alternate) {
if (strlen($row['device_uuid_alternate']) > 0) { if (!empty($row['device_uuid_alternate'])) {
echo " <td class='no-link'>\n"; echo " <td class='no-link'>\n";
echo " <a href='device_edit.php?id=".urlencode($row['device_uuid_alternate'])."'>".escape($row['alternate_label'])."</a>\n"; echo " <a href='device_edit.php?id=".urlencode($row['device_uuid_alternate'])."'>".escape($row['alternate_label'])."</a>\n";
echo " </td>\n"; echo " </td>\n";

View File

@ -57,7 +57,12 @@
return $this->domain_uuid; return $this->domain_uuid;
} }
public static function get_vendor($mac){ public static function get_vendor($mac) {
//return if the mac address is empty
if(empty($mac)) {
return '';
}
//use the mac address to find the vendor //use the mac address to find the vendor
$mac = preg_replace('#[^a-fA-F0-9./]#', '', $mac); $mac = preg_replace('#[^a-fA-F0-9./]#', '', $mac);
$mac = strtolower($mac); $mac = strtolower($mac);
@ -226,7 +231,7 @@
//set the default template directory //set the default template directory
if (PHP_OS == "Linux") { if (PHP_OS == "Linux") {
//set the default template dir //set the default template dir
if (strlen($this->template_dir) == 0) { if (empty($this->template_dir)) {
if (file_exists('/usr/share/fusionpbx/templates/provision')) { if (file_exists('/usr/share/fusionpbx/templates/provision')) {
$this->template_dir = '/usr/share/fusionpbx/templates/provision'; $this->template_dir = '/usr/share/fusionpbx/templates/provision';
} }
@ -240,7 +245,7 @@
} }
elseif (PHP_OS == "FreeBSD") { elseif (PHP_OS == "FreeBSD") {
//if the FreeBSD port is installed use the following paths by default. //if the FreeBSD port is installed use the following paths by default.
if (strlen($this->template_dir) == 0) { if (empty($this->template_dir)) {
if (file_exists('/usr/local/share/fusionpbx/templates/provision')) { if (file_exists('/usr/local/share/fusionpbx/templates/provision')) {
$this->template_dir = '/usr/local/share/fusionpbx/templates/provision'; $this->template_dir = '/usr/local/share/fusionpbx/templates/provision';
} }
@ -254,19 +259,19 @@
} }
elseif (PHP_OS == "NetBSD") { elseif (PHP_OS == "NetBSD") {
//set the default template_dir //set the default template_dir
if (strlen($this->template_dir) == 0) { if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision'; $this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
} }
} }
elseif (PHP_OS == "OpenBSD") { elseif (PHP_OS == "OpenBSD") {
//set the default template_dir //set the default template_dir
if (strlen($this->template_dir) == 0) { if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision'; $this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
} }
} }
else { else {
//set the default template_dir //set the default template_dir
if (strlen($this->template_dir) == 0) { if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision'; $this->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/provision';
} }
} }
@ -346,7 +351,7 @@
$p->delete('device_key_delete', 'temp'); $p->delete('device_key_delete', 'temp');
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $_SESSION['domain_uuid']; $prov->domain_uuid = $_SESSION['domain_uuid'];
$response = $prov->write(); $response = $prov->write();
@ -853,7 +858,7 @@
unset($array); unset($array);
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $_SESSION['domain_uuid']; $prov->domain_uuid = $_SESSION['domain_uuid'];
$response = $prov->write(); $response = $prov->write();

View File

@ -66,7 +66,7 @@
unset($sql, $sql_where_or, $parameters); unset($sql, $sql_where_or, $parameters);
//add or update the database //add or update the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
@ -189,7 +189,7 @@
$device_key_vendor = $row["device_key_vendor"]; $device_key_vendor = $row["device_key_vendor"];
//process the profile keys //process the profile keys
if (strlen($row["device_profile_uuid"]) > 0) { if (!empty($row["device_profile_uuid"])) {
//get the profile key settings from the array //get the profile key settings from the array
foreach ($device_profile_keys as &$field) { foreach ($device_profile_keys as &$field) {
if ($device_key_uuid == $field["device_key_uuid"]) { if ($device_key_uuid == $field["device_key_uuid"]) {
@ -213,10 +213,10 @@
//sql add or update //sql add or update
if (!is_uuid($device_key_uuid)) { if (!is_uuid($device_key_uuid)) {
if (permission_exists('device_key_add') && strlen($device_key_type) > 0 && strlen($device_key_value) > 0) { if (permission_exists('device_key_add') && strlen($device_key_type) > 0 && !empty($device_key_value)) {
//if the device_uuid is not in the array then get the device_uuid from the database //if the device_uuid is not in the array then get the device_uuid from the database
if (strlen($device_uuid) == 0) { if (empty($device_uuid)) {
$sql = "select device_uuid from v_devices "; $sql = "select device_uuid from v_devices ";
$sql .= "where device_user_uuid = :device_user_uuid "; $sql .= "where device_user_uuid = :device_user_uuid ";
$parameters['device_user_uuid'] = $_SESSION['user_uuid']; $parameters['device_user_uuid'] = $_SESSION['user_uuid'];
@ -281,7 +281,7 @@
} }
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $domain_uuid; $prov->domain_uuid = $domain_uuid;
$response = $prov->write(); $response = $prov->write();
@ -465,7 +465,7 @@
if ($previous_device_key_vendor != $row['device_key_vendor'] || $row['device_key_vendor'] == '') { if ($previous_device_key_vendor != $row['device_key_vendor'] || $row['device_key_vendor'] == '') {
echo " <tr class='list-header'>\n"; echo " <tr class='list-header'>\n";
echo " <th class='shrink'>".$text['label-device_key_id']."</th>\n"; echo " <th class='shrink'>".$text['label-device_key_id']."</th>\n";
if (strlen($row['device_key_vendor']) > 0) { if (!empty($row['device_key_vendor'])) {
echo " <th>".ucwords($row['device_key_vendor'])."</th>\n"; echo " <th>".ucwords($row['device_key_vendor'])."</th>\n";
} }
else { else {
@ -480,7 +480,7 @@
} }
//determine whether to hide the element //determine whether to hide the element
if (strlen($device_key_uuid) == 0) { if (empty($device_key_uuid)) {
$element['hidden'] = false; $element['hidden'] = false;
$element['visibility'] = "visibility:visible;"; $element['visibility'] = "visibility:visible;";
} }
@ -490,7 +490,7 @@
} }
//add the primary key uuid //add the primary key uuid
if (strlen($row['device_key_uuid']) > 0) { if (!empty($row['device_key_uuid'])) {
echo " <input name='device_keys[".$x."][device_key_uuid]' type='hidden' value=\"".$row['device_key_uuid']."\">\n"; echo " <input name='device_keys[".$x."][device_key_uuid]' type='hidden' value=\"".$row['device_key_uuid']."\">\n";
} }
@ -518,7 +518,7 @@
else { else {
echo " <option value='programmable'>".$text['label-programmable']."</option>\n"; echo " <option value='programmable'>".$text['label-programmable']."</option>\n";
} }
if (strlen($device_vendor) == 0) { if (empty($device_vendor)) {
if ($row['device_key_category'] == "expansion") { if ($row['device_key_category'] == "expansion") {
echo " <option value='expansion' selected='selected'>".$text['label-expansion']."</option>\n"; echo " <option value='expansion' selected='selected'>".$text['label-expansion']."</option>\n";
} }
@ -585,7 +585,7 @@
$i = 0; $i = 0;
if (is_array($vendor_functions)) { if (is_array($vendor_functions)) {
foreach ($vendor_functions as $function) { foreach ($vendor_functions as $function) {
if (strlen($row['device_key_vendor']) == 0 && $function['vendor_name'] != $previous_vendor) { if (empty($row['device_key_vendor']) && $function['vendor_name'] != $previous_vendor) {
if ($i > 0) { if ($i > 0) {
echo " </optgroup>\n"; echo " </optgroup>\n";
} }
@ -595,17 +595,17 @@
if ($row['device_key_vendor'] == $function['vendor_name'] && $row['device_key_type'] == $function['value']) { if ($row['device_key_vendor'] == $function['vendor_name'] && $row['device_key_type'] == $function['value']) {
$selected = "selected='selected'"; $selected = "selected='selected'";
} }
if (strlen($row['device_key_vendor']) == 0) { if (empty($row['device_key_vendor'])) {
echo " <option value='".$function['value']."' $selected >".$text['label-'.$function['name']]."</option>\n"; echo " <option value='".$function['value']."' $selected >".$text['label-'.$function['name']]."</option>\n";
} }
if (strlen($row['device_key_vendor']) > 0 && $row['device_key_vendor'] == $function['vendor_name']) { if (!empty($row['device_key_vendor']) && $row['device_key_vendor'] == $function['vendor_name']) {
echo " <option value='".$function['value']."' $selected >".$text['label-'.$function['name']]."</option>\n"; echo " <option value='".$function['value']."' $selected >".$text['label-'.$function['name']]."</option>\n";
} }
$previous_vendor = $function['vendor_name']; $previous_vendor = $function['vendor_name'];
$i++; $i++;
} }
} }
if (strlen($row['device_key_vendor']) == 0) { if (empty($row['device_key_vendor'])) {
echo " </optgroup>\n"; echo " </optgroup>\n";
} }
echo " </select>\n"; echo " </select>\n";

View File

@ -51,7 +51,7 @@
//if the public directory doesn't exist then create it //if the public directory doesn't exist then create it
if ($domains_processed == 1) { if ($domains_processed == 1) {
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) { if (!empty($_SESSION['switch']['dialplan']['dir'])) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) {
mkdir($_SESSION['switch']['dialplan']['dir'].'/public', 0770, false); mkdir($_SESSION['switch']['dialplan']['dir'].'/public', 0770, false);
} }
@ -61,7 +61,7 @@
//if multiple domains then make sure that the dialplan/public/domain_name.xml file exists //if multiple domains then make sure that the dialplan/public/domain_name.xml file exists
if (count($_SESSION["domains"]) > 1) { if (count($_SESSION["domains"]) > 1) {
//make sure the public directory and xml file exist //make sure the public directory and xml file exist
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) { if (!empty($_SESSION['switch']['dialplan']['dir'])) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) { if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) {
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'], 0770, false); mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'], 0770, false);
} }

View File

@ -111,7 +111,7 @@
//allow users with group advanced control, not always superadmin. You may change this in group permissions //allow users with group advanced control, not always superadmin. You may change this in group permissions
} }
else { else {
if (strlen($condition_field_1) == 0) { $condition_field_1 = "destination_number"; } if (empty($condition_field_1)) { $condition_field_1 = "destination_number"; }
if (is_numeric($condition_expression_1)) { if (is_numeric($condition_expression_1)) {
//the number is numeric //the number is numeric
$condition_expression_1 = str_replace("+", "\+", $condition_expression_1); $condition_expression_1 = str_replace("+", "\+", $condition_expression_1);
@ -120,11 +120,11 @@
} }
$dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_description = $_POST["dialplan_description"]; $dialplan_description = $_POST["dialplan_description"];
if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } //set default to enabled if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; } //set default to enabled
} }
//process the http post data //process the http post data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -135,15 +135,15 @@
} }
//check for all required data //check for all required data
if (strlen($domain_uuid) == 0) { $msg .= "".$text['label-required-domain_uuid']."<br>\n"; } if (empty($domain_uuid)) { $msg .= "".$text['label-required-domain_uuid']."<br>\n"; }
if (strlen($dialplan_name) == 0) { $msg .= "".$text['label-required-dialplan_name']."<br>\n"; } if (empty($dialplan_name)) { $msg .= "".$text['label-required-dialplan_name']."<br>\n"; }
if (strlen($condition_field_1) == 0) { $msg .= "".$text['label-required-condition_field_1']."<br>\n"; } if (empty($condition_field_1)) { $msg .= "".$text['label-required-condition_field_1']."<br>\n"; }
if (strlen($condition_expression_1) == 0) { $msg .= "".$text['label-required-condition_expression_1']."<br>\n"; } if (empty($condition_expression_1)) { $msg .= "".$text['label-required-condition_expression_1']."<br>\n"; }
if (strlen($action_application_1) == 0) { $msg .= "".$text['label-required-action_application_1']."<br>\n"; } if (empty($action_application_1)) { $msg .= "".$text['label-required-action_application_1']."<br>\n"; }
//if (strlen($limit) == 0) { $msg .= "Please provide: Limit<br>\n"; } //if (empty($limit)) { $msg .= "Please provide: Limit<br>\n"; }
//if (strlen($dialplan_enabled) == 0) { $msg .= "Please provide: Enabled True or False<br>\n"; } //if (empty($dialplan_enabled)) { $msg .= "Please provide: Enabled True or False<br>\n"; }
//if (strlen($dialplan_description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($dialplan_description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -192,7 +192,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
//add condition 2 //add condition 2
if (strlen($condition_field_2) > 0) { if (!empty($condition_field_2)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -205,7 +205,7 @@
} }
//set accountcode //set accountcode
if (strlen($destination_accountcode) > 0) { if (!empty($destination_accountcode)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -218,7 +218,7 @@
} }
//set carrier //set carrier
if (strlen($destination_carrier) > 0) { if (!empty($destination_carrier)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -231,7 +231,7 @@
} }
//set limit //set limit
if (strlen($limit) > 0) { if (!empty($limit)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -244,7 +244,7 @@
} }
//set redial outbound prefix //set redial outbound prefix
if (strlen($caller_id_outbound_prefix) > 0) { if (!empty($caller_id_outbound_prefix)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -380,7 +380,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
//add action 2 //add action 2
if (strlen($action_application_2) > 0) { if (!empty($action_application_2)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
@ -556,7 +556,7 @@
echo " <select class='formfld' name='condition_field_1' id='condition_field_1' onchange='changeToInput_condition_field_1(this);this.style.visibility = \"hidden\";'>\n"; echo " <select class='formfld' name='condition_field_1' id='condition_field_1' onchange='changeToInput_condition_field_1(this);this.style.visibility = \"hidden\";'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if (strlen($condition_field_1) > 0) { if (!empty($condition_field_1)) {
echo " <option value='".escape($condition_field_1)."' selected>".escape($condition_field_1)."</option>\n"; echo " <option value='".escape($condition_field_1)."' selected>".escape($condition_field_1)."</option>\n";
} }
echo " <option value='context'>".$text['option-context']."</option>\n"; echo " <option value='context'>".$text['option-context']."</option>\n";
@ -631,7 +631,7 @@
<?php <?php
echo " <select class='formfld' name='condition_field_2' id='condition_field_2' onchange='changeToInput_condition_field_2(this);this.style.visibility = \"hidden\";'>\n"; echo " <select class='formfld' name='condition_field_2' id='condition_field_2' onchange='changeToInput_condition_field_2(this);this.style.visibility = \"hidden\";'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if (strlen($condition_field_2) > 0) { if (!empty($condition_field_2)) {
echo " <option value='".escape($condition_field_2)."' selected>".escape($condition_field_2)."</option>\n"; echo " <option value='".escape($condition_field_2)."' selected>".escape($condition_field_2)."</option>\n";
} }
echo " <option value='context'>".$text['option-context']."</option>\n"; echo " <option value='context'>".$text['option-context']."</option>\n";
@ -680,7 +680,7 @@
echo " <select name='destination_uuid' id='destination_uuid' class='formfld' >\n"; echo " <select name='destination_uuid' id='destination_uuid' class='formfld' >\n";
echo " <option></option>\n"; echo " <option></option>\n";
foreach ($result as &$row) { foreach ($result as &$row) {
if (strlen($row["dialplan_uuid"]) == 0) { if (empty($row["dialplan_uuid"])) {
echo " <option value='".escape($row["destination_uuid"])."' style=\"font-weight:bold;\">".escape($row["destination_number"])." ".escape($row["destination_description"])."</option>\n"; echo " <option value='".escape($row["destination_uuid"])."' style=\"font-weight:bold;\">".escape($row["destination_number"])." ".escape($row["destination_description"])."</option>\n";
} }
else { else {

View File

@ -51,22 +51,22 @@
$text = $language->get(); $text = $language->get();
//get the http post values and set theme as php variables //get the http post values and set theme as php variables
if (is_array($_POST) > 0) { if (!empty($_POST)) {
//set the variables //set the variables
$dialplan_name = $_POST["dialplan_name"]; $dialplan_name = $_POST["dialplan_name"] ?? '';
$dialplan_order = $_POST["dialplan_order"]; $dialplan_order = $_POST["dialplan_order"] ?? '';
$dialplan_expression = $_POST["dialplan_expression"]; $dialplan_expression = $_POST["dialplan_expression"] ?? '';
$prefix_number = $_POST["prefix_number"]; $prefix_number = $_POST["prefix_number"] ?? '';
$condition_field_1 = $_POST["condition_field_1"]; $condition_field_1 = $_POST["condition_field_1"] ?? '';
$condition_expression_1 = $_POST["condition_expression_1"]; $condition_expression_1 = $_POST["condition_expression_1"] ?? '';
$condition_field_2 = $_POST["condition_field_2"]; $condition_field_2 = $_POST["condition_field_2"] ?? '';
$condition_expression_2 = $_POST["condition_expression_2"]; $condition_expression_2 = $_POST["condition_expression_2"] ?? '';
$gateway = $_POST["gateway"]; $gateway = $_POST["gateway"] ?? '';
$limit = $_POST["limit"]; $limit = $_POST["limit"] ?? '';
$accountcode = $_POST["accountcode"]; $accountcode = $_POST["accountcode"] ?? '';
$toll_allow = $_POST["toll_allow"]; $toll_allow = $_POST["toll_allow"] ?? '';
$pin_numbers_enable = $_POST["pin_numbers_enabled"]; $pin_numbers_enable = $_POST["pin_numbers_enabled"] ?? null;
if (strlen($pin_numbers_enable) == 0) { $pin_numbers_enable = "false"; } if (empty($pin_numbers_enable)) { $pin_numbers_enable = "false"; }
//set the default type //set the default type
$gateway_type = 'gateway'; $gateway_type = 'gateway';
$gateway_2_type = 'gateway'; $gateway_2_type = 'gateway';
@ -125,7 +125,7 @@
$gateway_2_type = 'xmpp'; $gateway_2_type = 'xmpp';
} }
//set the gateway_2_id and gateway_2_name //set the gateway_2_id and gateway_2_name
if ($gateway_2_type == "gateway" && strlen($_POST["gateway_2"]) > 0) { if ($gateway_2_type == "gateway" && !empty($_POST["gateway_2"])) {
$gateway_2_array = explode(":",$gateway_2); $gateway_2_array = explode(":",$gateway_2);
$gateway_2_id = $gateway_2_array[0]; $gateway_2_id = $gateway_2_array[0];
$gateway_2_name = $gateway_2_array[1]; $gateway_2_name = $gateway_2_array[1];
@ -158,7 +158,7 @@
$gateway_type = 'transfer'; $gateway_type = 'transfer';
} }
//set the gateway_3_id and gateway_3_name //set the gateway_3_id and gateway_3_name
if ($gateway_3_type == "gateway" && strlen($_POST["gateway_3"]) > 0) { if ($gateway_3_type == "gateway" && !empty($_POST["gateway_3"])) {
$gateway_3_array = explode(":",$gateway_3); $gateway_3_array = explode(":",$gateway_3);
$gateway_3_id = $gateway_3_array[0]; $gateway_3_id = $gateway_3_array[0];
$gateway_3_name = $gateway_3_array[1]; $gateway_3_name = $gateway_3_array[1];
@ -171,11 +171,11 @@
$dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_description = $_POST["dialplan_description"]; $dialplan_description = $_POST["dialplan_description"];
//set default to enabled //set default to enabled
if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; }
} }
//process the http form values //process the http form values
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -186,17 +186,17 @@
} }
//check for all required data //check for all required data
if (strlen($gateway) == 0) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."<br>\n"; } if (empty($gateway)) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."<br>\n"; }
//if (strlen($gateway_2) == 0) { $msg .= "Please provide: Alternat 1<br>\n"; } //if (empty($gateway_2)) { $msg .= "Please provide: Alternat 1<br>\n"; }
//if (strlen($gateway_3) == 0) { $msg .= "Please provide: Alternat 2<br>\n"; } //if (empty($gateway_3)) { $msg .= "Please provide: Alternat 2<br>\n"; }
if (strlen($dialplan_expression) == 0) { $msg .= $text['message-provide'].": ".$text['label-dialplan-expression']."<br>\n"; } if (empty($dialplan_expression)) { $msg .= $text['message-provide'].": ".$text['label-dialplan-expression']."<br>\n"; }
//if (strlen($dialplan_name) == 0) { $msg .= "Please provide: Extension Name<br>\n"; } //if (empty($dialplan_name)) { $msg .= "Please provide: Extension Name<br>\n"; }
//if (strlen($condition_field_1) == 0) { $msg .= "Please provide: Condition Field<br>\n"; } //if (empty($condition_field_1)) { $msg .= "Please provide: Condition Field<br>\n"; }
//if (strlen($condition_expression_1) == 0) { $msg .= "Please provide: Condition Expression<br>\n"; } //if (empty($condition_expression_1)) { $msg .= "Please provide: Condition Expression<br>\n"; }
//if (strlen($limit) == 0) { $msg .= "Please provide: Limit<br>\n"; } //if (empty($limit)) { $msg .= "Please provide: Limit<br>\n"; }
//if (strlen($dialplan_enabled) == 0) { $msg .= "Please provide: Enabled True or False<br>\n"; } //if (empty($dialplan_enabled)) { $msg .= "Please provide: Enabled True or False<br>\n"; }
//if (strlen($description) == 0) { $msg .= "Please provide: Description<br>\n"; } //if (empty($description)) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -210,13 +210,13 @@
} }
//prepare to build the array //prepare to build the array
if (strlen(trim($_POST['dialplan_expression'])) > 0) { if (!empty(trim($_POST['dialplan_expression']))) {
$tmp_array = explode("\n", $_POST['dialplan_expression']); $tmp_array = explode("\n", $_POST['dialplan_expression']);
$x = 0; $x = 0;
foreach($tmp_array as $dialplan_expression) { foreach($tmp_array as $dialplan_expression) {
$dialplan_expression = trim($dialplan_expression); $dialplan_expression = trim($dialplan_expression);
if (strlen($dialplan_expression) > 0) { if (!empty($dialplan_expression)) {
switch ($dialplan_expression) { switch ($dialplan_expression) {
case "^(\d{7})$": case "^(\d{7})$":
$label = $text['label-7d']; $label = $text['label-7d'];
@ -325,7 +325,7 @@
$bridge_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1"; $bridge_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1";
} }
} }
if (strlen($gateway_2_name) > 0 && $gateway_2_type == "gateway") { if (!empty($gateway_2_name) && $gateway_2_type == "gateway") {
$extension_2_name = $gateway_2_id.".".$abbrv; $extension_2_name = $gateway_2_id.".".$abbrv;
if ($abbrv == "988") { if ($abbrv == "988") {
$bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."18002738255"; $bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."18002738255";
@ -333,7 +333,7 @@
$bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."\$1"; $bridge_2_data = "sofia/gateway/".$gateway_2_id."/".$prefix_number."\$1";
} }
} }
if (strlen($gateway_3_name) > 0 && $gateway_3_type == "gateway") { if (!empty($gateway_3_name) && $gateway_3_type == "gateway") {
$extension_3_name = $gateway_3_id.".".$abbrv; $extension_3_name = $gateway_3_id.".".$abbrv;
if ($abbrv == "988") { if ($abbrv == "988") {
$bridge_3_data = "sofia/gateway/".$gateway_3_id."/".$prefix_number."18002738255"; $bridge_3_data = "sofia/gateway/".$gateway_3_id."/".$prefix_number."18002738255";
@ -383,7 +383,7 @@
} }
if ($gateway_type == "enum") { if ($gateway_type == "enum") {
if (strlen($bridge_2_data) == 0) { if (empty($bridge_2_data)) {
$dialplan_name = "enum.".$abbrv; $dialplan_name = "enum.".$abbrv;
} }
else { else {
@ -412,7 +412,7 @@
$bridge_3_data = $gateway_array[1]; $bridge_3_data = $gateway_array[1];
} }
if (strlen($dialplan_order) == 0) { if (empty($dialplan_order)) {
$dialplan_order ='333'; $dialplan_order ='333';
} }
$dialplan_context = $_SESSION['domain_name']; $dialplan_context = $_SESSION['domain_name'];
@ -502,7 +502,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
$y++; $y++;
if (strlen($toll_allow) > 0) { if (!empty($toll_allow)) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid;
@ -526,7 +526,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
if ($gateway_type != "transfer") { if ($gateway_type != "transfer") {
if (strlen($accountcode) > 0) { if (!empty($accountcode)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -690,7 +690,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
} }
if (strlen($limit) > 0) { if (!empty($limit)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -703,7 +703,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
} }
if (strlen($outbound_prefix) > 0) { if (!empty($outbound_prefix)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -765,7 +765,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0';
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
if (strlen($bridge_2_data) > 0) { if (!empty($bridge_2_data)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -778,7 +778,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_enabled'] = 'true';
} }
if (strlen($bridge_3_data) > 0) { if (!empty($bridge_3_data)) {
$y++; $y++;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid(); $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = uuid();
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid']; $array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
@ -996,7 +996,7 @@ function type_onchange(dialplan_detail_type) {
break; break;
} }
} }
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; } if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo "</optgroup>"; echo "</optgroup>";
echo "<optgroup label='&nbsp; &nbsp;".$domain_name."'>\n"; echo "<optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
} }
@ -1056,7 +1056,7 @@ function type_onchange(dialplan_detail_type) {
break; break;
} }
} }
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; } if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo " </optgroup>\n"; echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n"; echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
} }
@ -1116,7 +1116,7 @@ function type_onchange(dialplan_detail_type) {
break; break;
} }
} }
if (strlen($domain_name) == 0) { $domain_name = $text['label-global']; } if (empty($domain_name)) { $domain_name = $text['label-global']; }
echo " </optgroup>\n"; echo " </optgroup>\n";
echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n"; echo " <optgroup label='&nbsp; &nbsp;".$domain_name."'>\n";
} }

View File

@ -78,14 +78,14 @@
$dialplan_order = $_POST["dialplan_order"]; $dialplan_order = $_POST["dialplan_order"];
$dialplan_enabled = $_POST["dialplan_enabled"]; $dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_description = $_POST["dialplan_description"]; $dialplan_description = $_POST["dialplan_description"];
if (strlen($dialplan_enabled) == 0) { $dialplan_enabled = "true"; } //set default to enabled if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; } //set default to enabled
} }
//set the default //set the default
if (strlen($dialplan_context) == 0) { $dialplan_context = $_SESSION['domain_name']; } if (empty($dialplan_context)) { $dialplan_context = $_SESSION['domain_name']; }
//add or update data from http post //add or update data from http post
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST)>0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -96,14 +96,14 @@
} }
//check for all required data //check for all required data
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; } if (empty($domain_uuid)) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
if (strlen($dialplan_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; } if (empty($dialplan_name)) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
if (strlen($condition_field_1) == 0) { $msg .= $text['message-required'].$text['label-condition_1']." ".$text['label-field']."<br>\n"; } if (empty($condition_field_1)) { $msg .= $text['message-required'].$text['label-condition_1']." ".$text['label-field']."<br>\n"; }
if (strlen($condition_expression_1) == 0) { $msg .= $text['message-required'].$text['label-condition_1']." ".$text['label-expression']."<br>\n"; } if (empty($condition_expression_1)) { $msg .= $text['message-required'].$text['label-condition_1']." ".$text['label-expression']."<br>\n"; }
if (strlen($action_application_1) == 0) { $msg .= $text['message-required'].$text['label-action_1']."<br>\n"; } if (empty($action_application_1)) { $msg .= $text['message-required'].$text['label-action_1']."<br>\n"; }
//if (strlen($dialplan_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; } //if (empty($dialplan_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($dialplan_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } //if (empty($dialplan_description)) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -143,7 +143,7 @@
$array['dialplan_details'][0]['dialplan_detail_order'] = '1'; $array['dialplan_details'][0]['dialplan_detail_order'] = '1';
//add condition 2 //add condition 2
if (strlen($condition_field_2) > 0) { if (!empty($condition_field_2)) {
$dialplan_detail_uuid = uuid(); $dialplan_detail_uuid = uuid();
$array['dialplan_details'][1]['domain_uuid'] = $domain_uuid; $array['dialplan_details'][1]['domain_uuid'] = $domain_uuid;
$array['dialplan_details'][1]['dialplan_uuid'] = $dialplan_uuid; $array['dialplan_details'][1]['dialplan_uuid'] = $dialplan_uuid;
@ -167,7 +167,7 @@
$array['dialplan_details'][2]['dialplan_detail_order'] = '3'; $array['dialplan_details'][2]['dialplan_detail_order'] = '3';
//add action 2 //add action 2
if (strlen($action_application_2) > 0) { if (!empty($action_application_2)) {
$dialplan_detail_uuid = uuid(); $dialplan_detail_uuid = uuid();
$array['dialplan_details'][3]['domain_uuid'] = $domain_uuid; $array['dialplan_details'][3]['domain_uuid'] = $domain_uuid;
$array['dialplan_details'][3]['dialplan_uuid'] = $dialplan_uuid; $array['dialplan_details'][3]['dialplan_uuid'] = $dialplan_uuid;
@ -335,7 +335,7 @@
echo " <td nowrap='nowrap'>\n"; echo " <td nowrap='nowrap'>\n";
echo " <select class='formfld' name='condition_field_1' id='condition_field_1' onchange='changeToInput_condition_field_1(this);this.style.visibility = \"hidden\";'>\n"; echo " <select class='formfld' name='condition_field_1' id='condition_field_1' onchange='changeToInput_condition_field_1(this);this.style.visibility = \"hidden\";'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if (strlen($condition_field_1) > 0) { if (!empty($condition_field_1)) {
echo " <option value='".escape($condition_field_1)."' selected='selected'>".escape($condition_field_1)."</option>\n"; echo " <option value='".escape($condition_field_1)."' selected='selected'>".escape($condition_field_1)."</option>\n";
} }
echo " <optgroup label='Field'>\n"; echo " <optgroup label='Field'>\n";
@ -424,7 +424,7 @@
<?php <?php
echo " <select class='formfld' name='condition_field_2' id='condition_field_2' onchange='changeToInput_condition_field_2(this);this.style.visibility = \"hidden\";'>\n"; echo " <select class='formfld' name='condition_field_2' id='condition_field_2' onchange='changeToInput_condition_field_2(this);this.style.visibility = \"hidden\";'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if (strlen($condition_field_2) > 0) { if (!empty($condition_field_2)) {
echo " <option value='".escape($condition_field_2)."' selected>".escape($condition_field_2)."</option>\n"; echo " <option value='".escape($condition_field_2)."' selected>".escape($condition_field_2)."</option>\n";
} }
echo " <optgroup label='Field'>\n"; echo " <optgroup label='Field'>\n";
@ -506,7 +506,7 @@
echo "<td class='vtable' align='left'>\n"; echo "<td class='vtable' align='left'>\n";
echo " <select name='dialplan_order' class='formfld'>\n"; echo " <select name='dialplan_order' class='formfld'>\n";
//echo " <option></option>\n"; //echo " <option></option>\n";
if (strlen($dialplan_order) > 0) { if (!empty($dialplan_order)) {
echo " <option selected='selected' value='".escape($dialplan_order)."'>".escape($dialplan_order)."</option>\n"; echo " <option selected='selected' value='".escape($dialplan_order)."'>".escape($dialplan_order)."</option>\n";
} }
$i = 200; $i = 200;

View File

@ -97,7 +97,7 @@
$previous_application = null; $previous_application = null;
foreach($raw_applications as $row) { foreach($raw_applications as $row) {
if (strlen($row) > 0) { if (!empty($row)) {
$application_array = explode(",", $row); $application_array = explode(",", $row);
$application = $application_array[0]; $application = $application_array[0];
@ -124,7 +124,7 @@
} }
//process and save the data //process and save the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the dialplan uuid //get the dialplan uuid
if ($action == "update") { if ($action == "update") {
@ -183,13 +183,13 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($dialplan_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; } if (empty($dialplan_name)) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
if (strlen($dialplan_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; } if (empty($dialplan_order)) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
if (strlen($dialplan_continue) == 0) { $msg .= $text['message-required'].$text['label-continue']."<br>\n"; } if (empty($dialplan_continue)) { $msg .= $text['message-required'].$text['label-continue']."<br>\n"; }
if (strlen($dialplan_context) == 0) { $msg .= $text['message-required'].$text['label-context']."<br>\n"; } if (empty($dialplan_context)) { $msg .= $text['message-required'].$text['label-context']."<br>\n"; }
if (strlen($dialplan_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; } if (empty($dialplan_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($dialplan_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } //if (empty($dialplan_description)) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -242,8 +242,8 @@
$y = 0; $y = 0;
if (is_array($_POST["dialplan_details"])) { if (is_array($_POST["dialplan_details"])) {
foreach ($_POST["dialplan_details"] as $row) { foreach ($_POST["dialplan_details"] as $row) {
if (strlen($row["dialplan_detail_tag"]) > 0) { if (!empty($row["dialplan_detail_tag"])) {
if (strlen($row["dialplan_detail_uuid"]) > 0) { if (!empty($row["dialplan_detail_uuid"])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row["dialplan_detail_uuid"]; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row["dialplan_detail_uuid"];
} }
if (!preg_match("/system/i", $row["dialplan_detail_type"])) { if (!preg_match("/system/i", $row["dialplan_detail_type"])) {
@ -323,7 +323,7 @@
header("Location: ?id=".escape($dialplan_uuid).(is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null)); header("Location: ?id=".escape($dialplan_uuid).(is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null));
exit; exit;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && empty($_POST["persistformvar"]))
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
@ -348,13 +348,13 @@
} }
//set the defaults //set the defaults
if (strlen($dialplan_context) == 0) { if (empty($dialplan_context)) {
$dialplan_context = $_SESSION['domain_name']; $dialplan_context = $_SESSION['domain_name'];
} }
if (strlen($dialplan_order) == 0) { if (empty($dialplan_order)) {
$dialplan_order = '200'; $dialplan_order = '200';
} }
if (strlen($dialplan_destination) == 0) { if (empty($dialplan_destination)) {
$dialplan_destination = 'false'; $dialplan_destination = 'false';
} }
@ -813,7 +813,7 @@
$dialplan_detail_enabled = $row['dialplan_detail_enabled']; $dialplan_detail_enabled = $row['dialplan_detail_enabled'];
//default to enabled true //default to enabled true
if (strlen($dialplan_detail_enabled) == 0) { if (empty($dialplan_detail_enabled)) {
$dialplan_detail_enabled = 'true'; $dialplan_detail_enabled = 'true';
} }
@ -823,7 +823,7 @@
//begin the row //begin the row
echo "<tr>\n"; echo "<tr>\n";
//determine whether to hide the element //determine whether to hide the element
if (strlen($dialplan_detail_tag) == 0) { if (empty($dialplan_detail_tag)) {
$element['hidden'] = false; $element['hidden'] = false;
$element['visibility'] = ""; $element['visibility'] = "";
} }
@ -855,7 +855,7 @@
echo " <label id=\"label_dialplan_detail_type_".$x."\">".escape($dialplan_detail_type)."</label>\n"; echo " <label id=\"label_dialplan_detail_type_".$x."\">".escape($dialplan_detail_type)."</label>\n";
} }
echo " <select id='dialplan_detail_type_".$x."' name='dialplan_details[".$x."][dialplan_detail_type]' class='formfld' style='width: auto; ".$element['visibility']."' onchange='change_to_input(this);'>\n"; echo " <select id='dialplan_detail_type_".$x."' name='dialplan_details[".$x."][dialplan_detail_type]' class='formfld' style='width: auto; ".$element['visibility']."' onchange='change_to_input(this);'>\n";
if (strlen($dialplan_detail_type) > 0) { if (!empty($dialplan_detail_type)) {
echo " <optgroup label='selected'>\n"; echo " <optgroup label='selected'>\n";
echo " <option value=\"".escape($dialplan_detail_type)."\">".escape($dialplan_detail_type)."</option>\n"; echo " <option value=\"".escape($dialplan_detail_type)."\">".escape($dialplan_detail_type)."</option>\n";
echo " </optgroup>\n"; echo " </optgroup>\n";
@ -863,7 +863,7 @@
else { else {
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
} }
//if (strlen($dialplan_detail_tag) == 0 || $dialplan_detail_tag == "condition" || $dialplan_detail_tag == "regex") { //if (empty($dialplan_detail_tag) || $dialplan_detail_tag == "condition" || $dialplan_detail_tag == "regex") {
echo " <optgroup label='".$text['optgroup-condition_or_regex']."'>\n"; echo " <optgroup label='".$text['optgroup-condition_or_regex']."'>\n";
echo " <option value='ani'>".$text['option-ani']."</option>\n"; echo " <option value='ani'>".$text['option-ani']."</option>\n";
echo " <option value='ani2'>".$text['option-ani2']."</option>\n"; echo " <option value='ani2'>".$text['option-ani2']."</option>\n";
@ -892,7 +892,7 @@
echo " <option value='\${toll_allow}'>\${toll_allow}</option>\n"; echo " <option value='\${toll_allow}'>\${toll_allow}</option>\n";
echo " </optgroup>\n"; echo " </optgroup>\n";
//} //}
//if (strlen($dialplan_detail_tag) == 0 || $dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") { //if (empty($dialplan_detail_tag) || $dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") {
echo " <optgroup label='".$text['optgroup-applications']."'>\n"; echo " <optgroup label='".$text['optgroup-applications']."'>\n";
if (is_array($_SESSION['switch']['applications'])) { if (is_array($_SESSION['switch']['applications'])) {
foreach ($_SESSION['switch']['applications'] as $application) { foreach ($_SESSION['switch']['applications'] as $application) {

View File

@ -52,7 +52,7 @@
$dialplan_xml = $_REQUEST['dialplan_xml']; $dialplan_xml = $_REQUEST['dialplan_xml'];
//process the HTTP POST //process the HTTP POST
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;

View File

@ -189,7 +189,7 @@
$param = $params ? implode('&', $params) : null; $param = $params ? implode('&', $params) : null;
unset($params); unset($params);
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -421,7 +421,7 @@
} }
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>"; echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']); echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
$params[] = "app_uuid=".urlencode($app_uuid); $params[] = "app_uuid=".urlencode($app_uuid ?? '');
if ($order_by) { $params[] = "order_by=".urlencode($order_by); } if ($order_by) { $params[] = "order_by=".urlencode($order_by); }
if ($order) { $params[] = "order=".urlencode($order); } if ($order) { $params[] = "order=".urlencode($order); }
if ($_GET['show'] && permission_exists('dialplan_all')) { $params[] = "show=".urlencode($_GET['show']); } if ($_GET['show'] && permission_exists('dialplan_all')) { $params[] = "show=".urlencode($_GET['show']); }
@ -555,7 +555,7 @@
echo " </td>\n"; echo " </td>\n";
} }
if ($_GET['show'] == "all" && permission_exists('dialplan_all')) { if ($_GET['show'] == "all" && permission_exists('dialplan_all')) {
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
else { else {
@ -571,7 +571,7 @@
echo escape($row['dialplan_name']); echo escape($row['dialplan_name']);
} }
echo " </td>\n"; echo " </td>\n";
echo " <td>".((strlen($row['dialplan_number']) > 0) ? escape(format_phone($row['dialplan_number'])) : "&nbsp;")."</td>\n"; echo " <td>".((!empty($row['dialplan_number'])) ? escape(format_phone($row['dialplan_number'])) : "&nbsp;")."</td>\n";
if (permission_exists('dialplan_context')) { if (permission_exists('dialplan_context')) {
echo " <td>".escape($row['dialplan_context'])."</td>\n"; echo " <td>".escape($row['dialplan_context'])."</td>\n";
} }

View File

@ -130,7 +130,7 @@
//build update array //build update array
$array['dialplans'][0]['dialplan_uuid'] = $this->dialplan_uuid; $array['dialplans'][0]['dialplan_uuid'] = $this->dialplan_uuid;
$array['dialplans'][0]['dialplan_name'] = $this->dialplan_name; $array['dialplans'][0]['dialplan_name'] = $this->dialplan_name;
if (strlen($this->dialplan_continue) > 0) { if (!empty($this->dialplan_continue)) {
$array['dialplans'][0]['dialplan_continue'] = $this->dialplan_continue; $array['dialplans'][0]['dialplan_continue'] = $this->dialplan_continue;
} }
$array['dialplans'][0]['dialplan_order'] = $this->dialplan_order; $array['dialplans'][0]['dialplan_order'] = $this->dialplan_order;
@ -188,7 +188,7 @@
$xml_string = file_get_contents($xml_file); $xml_string = file_get_contents($xml_file);
//prepare the xml //prepare the xml
if (strlen($xml_string) > 0) { if (!empty($xml_string)) {
//replace the variables //replace the variables
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8; $length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string); $xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
@ -200,7 +200,7 @@
//convert to an array //convert to an array
$dialplan = json_decode($json, true); $dialplan = json_decode($json, true);
} }
if (strlen($this->json) > 0) { if (!empty($this->json)) {
//convert to an array //convert to an array
$dialplan = json_decode($json, true); $dialplan = json_decode($json, true);
} }
@ -232,7 +232,7 @@
$xml_string = file_get_contents($xml_file); $xml_string = file_get_contents($xml_file);
//prepare the xml //prepare the xml
if (strlen($xml_string) > 0) { if (!empty($xml_string)) {
//replace the variables //replace the variables
$length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8; $length = (is_numeric($_SESSION["security"]["pin_length"]["var"])) ? $_SESSION["security"]["pin_length"]["var"] : 8;
$xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string); $xml_string = str_replace("{v_context}", $domain['domain_name'], $xml_string);
@ -248,7 +248,7 @@
$dialplan = json_decode($json, true); $dialplan = json_decode($json, true);
} }
if (strlen($this->json) > 0) { if (!empty($this->json)) {
//convert to an array //convert to an array
$dialplan = json_decode($json, true); $dialplan = json_decode($json, true);
} }
@ -302,14 +302,14 @@
$array['dialplans'][$x]['dialplan_name'] = $dialplan['@attributes']['name']; $array['dialplans'][$x]['dialplan_name'] = $dialplan['@attributes']['name'];
$array['dialplans'][$x]['dialplan_number'] = $dialplan['@attributes']['number']; $array['dialplans'][$x]['dialplan_number'] = $dialplan['@attributes']['number'];
$array['dialplans'][$x]['dialplan_context'] = $dialplan_context; $array['dialplans'][$x]['dialplan_context'] = $dialplan_context;
if (strlen($dialplan['@attributes']['destination']) > 0) { if (!empty($dialplan['@attributes']['destination'])) {
$array['dialplans'][$x]['dialplan_destination'] = $dialplan['@attributes']['destination']; $array['dialplans'][$x]['dialplan_destination'] = $dialplan['@attributes']['destination'];
} }
if (strlen($dialplan['@attributes']['continue']) > 0) { if (!empty($dialplan['@attributes']['continue'])) {
$array['dialplans'][$x]['dialplan_continue'] = $dialplan['@attributes']['continue']; $array['dialplans'][$x]['dialplan_continue'] = $dialplan['@attributes']['continue'];
} }
$array['dialplans'][$x]['dialplan_order'] = $dialplan['@attributes']['order']; $array['dialplans'][$x]['dialplan_order'] = $dialplan['@attributes']['order'];
if (strlen($dialplan['@attributes']['enabled']) > 0) { if (!empty($dialplan['@attributes']['enabled'])) {
$array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled']; $array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled'];
} }
else { else {
@ -330,7 +330,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row['@attributes']['field']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row['@attributes']['field'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row['@attributes']['expression']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row['@attributes']['expression'];
if (strlen($row['@attributes']['break']) > 0) { if (!empty($row['@attributes']['break'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_break'] = $row['@attributes']['break']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_break'] = $row['@attributes']['break'];
} }
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = $group; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = $group;
@ -367,7 +367,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data'];
if (strlen($row2['@attributes']['inline']) > 0) { if (!empty($row2['@attributes']['inline'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline'];
} }
else { else {
@ -394,7 +394,7 @@
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $order;
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $row2['@attributes']['application'];
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $row2['@attributes']['data'];
if (strlen($row2['@attributes']['inline']) > 0) { if (!empty($row2['@attributes']['inline'])) {
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline']; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_inline'] = $row2['@attributes']['inline'];
} }
else { else {
@ -522,7 +522,7 @@
$array[$x]['dialplan_order'] = $row['dialplan_order']; $array[$x]['dialplan_order'] = $row['dialplan_order'];
$array[$x]['dialplan_enabled'] = $row['dialplan_enabled']; $array[$x]['dialplan_enabled'] = $row['dialplan_enabled'];
$array[$x]['dialplan_description'] = $row['dialplan_description']; $array[$x]['dialplan_description'] = $row['dialplan_description'];
if (strlen($row['dialplan_detail_uuid']) > 0) { if (!empty($row['dialplan_detail_uuid'])) {
$array[$x]['dialplan_details'][$y]['dialplan_uuid'] = $row['dialplan_uuid']; $array[$x]['dialplan_details'][$y]['dialplan_uuid'] = $row['dialplan_uuid'];
$array[$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row['dialplan_detail_uuid']; $array[$x]['dialplan_details'][$y]['dialplan_detail_uuid'] = $row['dialplan_detail_uuid'];
$array[$x]['dialplan_details'][$y]['dialplan_detail_tag'] = $row['dialplan_detail_tag']; $array[$x]['dialplan_details'][$y]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
@ -714,7 +714,7 @@
//get the dialplan detail inline //get the dialplan detail inline
$detail_inline = ""; $detail_inline = "";
if ($dialplan_detail_inline) { if ($dialplan_detail_inline) {
if (strlen($dialplan_detail_inline) > 0) { if (!empty($dialplan_detail_inline)) {
$detail_inline = " inline=\"" . $dialplan_detail_inline . "\""; $detail_inline = " inline=\"" . $dialplan_detail_inline . "\"";
} }
} }
@ -723,12 +723,12 @@
if ($dialplan_tag_status != "closed") { if ($dialplan_tag_status != "closed") {
if (($previous_dialplan_uuid != $dialplan_uuid) || ($previous_dialplan_detail_group != $dialplan_detail_group)) { if (($previous_dialplan_uuid != $dialplan_uuid) || ($previous_dialplan_detail_group != $dialplan_detail_group)) {
if ($condition_tag_status != "closed") { if ($condition_tag_status != "closed") {
if ($condition_attribute && (strlen($condition_attribute) > 0)) { if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n"; $xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
$condition_attribute = ""; $condition_attribute = "";
$condition_tag_status = "closed"; $condition_tag_status = "closed";
} }
else if ($condition && (strlen($condition) > 0)) { else if ($condition && (!empty($condition))) {
$xml .= " ".$condition . "/>"; $xml .= " ".$condition . "/>";
$condition = ""; $condition = "";
$condition_tag_status = "closed"; $condition_tag_status = "closed";
@ -804,12 +804,12 @@
// finalize any previous pending condition statements // finalize any previous pending condition statements
if ($condition_tag_status == "open") { if ($condition_tag_status == "open") {
if (strlen($condition) > 0) { if (!empty($condition)) {
$xml .= $condition . "/>\n"; $xml .= $condition . "/>\n";
$condition = ''; $condition = '';
$condition_tag_status = "closed"; $condition_tag_status = "closed";
} }
else if (strlen($condition_attribute) > 0 && $condition_tag_status == "open") { else if (!empty($condition_attribute) && $condition_tag_status == "open") {
// previous condition(s) must have been of type time // previous condition(s) must have been of type time
// do not finalize if new condition is also of type time // do not finalize if new condition is also of type time
if ($condition_type != 'time') { if ($condition_type != 'time') {
@ -828,7 +828,7 @@
//get the condition break attribute //get the condition break attribute
$condition_break = ""; $condition_break = "";
if ($dialplan_detail_break) { if ($dialplan_detail_break) {
if (strlen($dialplan_detail_break) > 0) { if (!empty($dialplan_detail_break)) {
$condition_break = " break=\"" . $dialplan_detail_break . "\""; $condition_break = " break=\"" . $dialplan_detail_break . "\"";
} }
} }
@ -854,11 +854,11 @@
if ($dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") { if ($dialplan_detail_tag == "action" || $dialplan_detail_tag == "anti-action") {
if ($condition_tag_status == "open") { if ($condition_tag_status == "open") {
if ($condition_attribute && (strlen($condition_attribute) > 0)) { if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . ">\n"; $xml .= " <condition " . $condition_attribute . $condition_break . ">\n";
$condition_attribute = ""; $condition_attribute = "";
} }
else if ($condition && (strlen($condition) > 0)) { else if ($condition && (!empty($condition))) {
$xml .= $condition . ">\n"; $xml .= $condition . ">\n";
$condition = ""; $condition = "";
} }
@ -923,10 +923,10 @@
//close the extension tag if it was left open //close the extension tag if it was left open
if ($dialplan_tag_status == "open") { if ($dialplan_tag_status == "open") {
if ($condition_tag_status == "open") { if ($condition_tag_status == "open") {
if ($condition_attribute and (strlen($condition_attribute) > 0)) { if ($condition_attribute and (!empty($condition_attribute))) {
$xml .= " <condition " . $condition_attribute . $condition_break . "/>\n"; $xml .= " <condition " . $condition_attribute . $condition_break . "/>\n";
} }
else if ($condition && (strlen($condition) > 0)) { else if ($condition && (!empty($condition))) {
$xml .= $condition . "/>\n"; $xml .= $condition . "/>\n";
} }
else { else {

View File

@ -81,7 +81,7 @@
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql = "and ("; $sql = "and (";
$sql .= "lower(type) like :search "; $sql .= "lower(type) like :search ";
$sql .= "or lower(email) like :search "; $sql .= "or lower(email) like :search ";
@ -98,7 +98,7 @@
$param .= "&show=all"; $param .= "&show=all";
} }
$page = $_GET['page']; $page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page; $offset = $rows_per_page * $page;
@ -112,7 +112,7 @@
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid; $parameters['domain_uuid'] = $domain_uuid;
} }
if (strlen($search) > 0) { if (!empty($search)) {
$sql = "and ("; $sql = "and (";
$sql .= "lower(type) like :search "; $sql .= "lower(type) like :search ";
$sql .= "or lower(email) like :search "; $sql .= "or lower(email) like :search ";

View File

@ -45,7 +45,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -56,7 +56,7 @@
} }
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) { if ($_POST['action'] != '' && !empty($_POST['action'])) {
//prepare the array(s) //prepare the array(s)
//send the array to the database class //send the array to the database class
@ -90,13 +90,13 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($email_date) == 0) { $msg .= $text['message-required']." ".$text['label-email_date']."<br>\n"; } //if (empty($email_date)) { $msg .= $text['message-required']." ".$text['label-email_date']."<br>\n"; }
//if (strlen($email_from) == 0) { $msg .= $text['message-required']." ".$text['label-email_from']."<br>\n"; } //if (empty($email_from)) { $msg .= $text['message-required']." ".$text['label-email_from']."<br>\n"; }
//if (strlen($email_to) == 0) { $msg .= $text['message-required']." ".$text['label-email_to']."<br>\n"; } //if (empty($email_to)) { $msg .= $text['message-required']." ".$text['label-email_to']."<br>\n"; }
//if (strlen($email_subject) == 0) { $msg .= $text['message-required']." ".$text['label-email_subject']."<br>\n"; } //if (empty($email_subject)) { $msg .= $text['message-required']." ".$text['label-email_subject']."<br>\n"; }
//if (strlen($email_body) == 0) { $msg .= $text['message-required']." ".$text['label-email_body']."<br>\n"; } //if (empty($email_body)) { $msg .= $text['message-required']." ".$text['label-email_body']."<br>\n"; }
//if (strlen($email_status) == 0) { $msg .= $text['message-required']." ".$text['label-email_status']."<br>\n"; } //if (empty($email_status)) { $msg .= $text['message-required']." ".$text['label-email_status']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -122,10 +122,10 @@ if (!function_exists('transcribe')) {
$transcribe_language = $_SESSION['voicemail']['transcribe_language']['text']; $transcribe_language = $_SESSION['voicemail']['transcribe_language']['text'];
$transcribe_alternate_language = $_SESSION['voicemail']['transcribe_alternate_language']['text']; $transcribe_alternate_language = $_SESSION['voicemail']['transcribe_alternate_language']['text'];
if (!isset($transcribe_language) && strlen($transcribe_language) == 0) { if (!isset($transcribe_language) && empty($transcribe_language)) {
$transcribe_language = 'en-Us'; $transcribe_language = 'en-Us';
} }
if (!isset($transcribe_alternate_language) && strlen($transcribe_alternate_language) == 0) { if (!isset($transcribe_alternate_language) && empty($transcribe_alternate_language)) {
$transcribe_alternate_language = 'es-Us'; $transcribe_alternate_language = 'es-Us';
} }
if ($file_extension == "mp3") { if ($file_extension == "mp3") {
@ -183,7 +183,7 @@ if (!function_exists('transcribe')) {
$api_key = $_SESSION['voicemail']['azure_key']['text']; $api_key = $_SESSION['voicemail']['azure_key']['text'];
$api_url = $_SESSION['voicemail']['azure_server_region']['text']; $api_url = $_SESSION['voicemail']['azure_server_region']['text'];
if (strlen($transcribe_language) == 0) { if (empty($transcribe_language)) {
$transcribe_language = 'en-US'; $transcribe_language = 'en-US';
} }
@ -197,7 +197,7 @@ if (!function_exists('transcribe')) {
if (isset($api_key) && $api_key != '') { if (isset($api_key) && $api_key != '') {
$command = "curl -X POST \"https://".$api_url.".api.cognitive.microsoft.com/sts/v1.0/issueToken\" -H \"Content-type: application/x-www-form-urlencoded\" -H \"Content-Length: 0\" -H \"Ocp-Apim-Subscription-Key: ".$api_key."\""; $command = "curl -X POST \"https://".$api_url.".api.cognitive.microsoft.com/sts/v1.0/issueToken\" -H \"Content-type: application/x-www-form-urlencoded\" -H \"Content-Length: 0\" -H \"Ocp-Apim-Subscription-Key: ".$api_key."\"";
$access_token_result = shell_exec($command); $access_token_result = shell_exec($command);
if (strlen($access_token_result) == 0) { if (empty($access_token_result)) {
return false; return false;
} }
else { else {
@ -229,7 +229,7 @@ if (!function_exists('transcribe')) {
$api_key = $_SESSION['voicemail']['api_key']['text']; $api_key = $_SESSION['voicemail']['api_key']['text'];
$api_url = $_SESSION['voicemail']['transcription_server']['text']; $api_url = $_SESSION['voicemail']['transcription_server']['text'];
if (strlen($transcribe_language) == 0) { if (empty($transcribe_language)) {
$transcribe_language = 'en-US'; $transcribe_language = 'en-US';
} }

View File

@ -150,7 +150,7 @@
//$retry_interval = $_SESSION['email_queue']['retry_interval']['numeric']; //$retry_interval = $_SESSION['email_queue']['retry_interval']['numeric'];
//set defaults //set defaults
if (strlen($email_retry_count) == 0) { if (empty($email_retry_count)) {
$email_retry_count = 0; $email_retry_count = 0;
} }

View File

@ -65,7 +65,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid from the POST //get the uuid from the POST
if ($action == "update") { if ($action == "update") {
@ -82,16 +82,16 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($template_language) == 0) { $msg .= $text['message-required']." ".$text['label-template_language']."<br>\n"; } if (empty($template_language)) { $msg .= $text['message-required']." ".$text['label-template_language']."<br>\n"; }
if (strlen($template_category) == 0) { $msg .= $text['message-required']." ".$text['label-template_category']."<br>\n"; } if (empty($template_category)) { $msg .= $text['message-required']." ".$text['label-template_category']."<br>\n"; }
//if (strlen($template_subcategory) == 0) { $msg .= $text['message-required']." ".$text['label-template_subcategory']."<br>\n"; } //if (empty($template_subcategory)) { $msg .= $text['message-required']." ".$text['label-template_subcategory']."<br>\n"; }
if (strlen($template_subject) == 0) { $msg .= $text['message-required']." ".$text['label-template_subject']."<br>\n"; } if (empty($template_subject)) { $msg .= $text['message-required']." ".$text['label-template_subject']."<br>\n"; }
if (strlen($template_body) == 0) { $msg .= $text['message-required']." ".$text['label-template_body']."<br>\n"; } if (empty($template_body)) { $msg .= $text['message-required']." ".$text['label-template_body']."<br>\n"; }
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($template_type) == 0) { $msg .= $text['message-required']." ".$text['label-template_type']."<br>\n"; } //if (empty($template_type)) { $msg .= $text['message-required']." ".$text['label-template_type']."<br>\n"; }
if (strlen($template_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-template_enabled']."<br>\n"; } if (empty($template_enabled)) { $msg .= $text['message-required']." ".$text['label-template_enabled']."<br>\n"; }
//if (strlen($template_description) == 0) { $msg .= $text['message-required']." ".$text['label-template_description']."<br>\n"; } //if (empty($template_description)) { $msg .= $text['message-required']." ".$text['label-template_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -125,7 +125,7 @@
$database = new database; $database = new database;
$database->app_name = 'email_templates'; $database->app_name = 'email_templates';
$database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd'; $database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd';
if (strlen($email_template_uuid) > 0) { if (!empty($email_template_uuid)) {
$database->uuid($email_template_uuid); $database->uuid($email_template_uuid);
} }
$database->save($array); $database->save($array);
@ -169,7 +169,7 @@
} }
//set the defaults //set the defaults
if (strlen($template_enabled) == 0) { $template_enabled = 'true'; } if (empty($template_enabled)) { $template_enabled = 'true'; }
//load editor preferences/defaults //load editor preferences/defaults
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px'; $setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';

View File

@ -92,8 +92,8 @@
} }
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"] ?? '');
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " ("; $sql_search = " (";
$sql_search .= " lower(template_language) like :search "; $sql_search .= " lower(template_language) like :search ";
//$sql_search .= " or lower(template_category) like :search "; //$sql_search .= " or lower(template_category) like :search ";

View File

@ -63,7 +63,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -74,7 +74,7 @@
} }
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) { if ($_POST['action'] != '' && !empty($_POST['action'])) {
//prepare the array(s) //prepare the array(s)
//send the array to the database class //send the array to the database class
@ -108,14 +108,14 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($hostname) == 0) { $msg .= $text['message-required']." ".$text['label-hostname']."<br>\n"; } if (empty($hostname)) { $msg .= $text['message-required']." ".$text['label-hostname']."<br>\n"; }
if (strlen($log_date) == 0) { $msg .= $text['message-required']." ".$text['label-log_date']."<br>\n"; } if (empty($log_date)) { $msg .= $text['message-required']." ".$text['label-log_date']."<br>\n"; }
if (strlen($filter) == 0) { $msg .= $text['message-required']." ".$text['label-filter']."<br>\n"; } if (empty($filter)) { $msg .= $text['message-required']." ".$text['label-filter']."<br>\n"; }
if (strlen($ip_address) == 0) { $msg .= $text['message-required']." ".$text['label-ip_address']."<br>\n"; } if (empty($ip_address)) { $msg .= $text['message-required']." ".$text['label-ip_address']."<br>\n"; }
if (strlen($extension) == 0) { $msg .= $text['message-required']." ".$text['label-extension']."<br>\n"; } if (empty($extension)) { $msg .= $text['message-required']." ".$text['label-extension']."<br>\n"; }
//if (strlen($user_agent) == 0) { $msg .= $text['message-required']." ".$text['label-user_agent']."<br>\n"; } //if (empty($user_agent)) { $msg .= $text['message-required']." ".$text['label-user_agent']."<br>\n"; }
if (strlen($log_status) == 0) { $msg .= $text['message-required']." ".$text['label-log_status']."<br>\n"; } if (empty($log_status)) { $msg .= $text['message-required']." ".$text['label-log_status']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";

View File

@ -71,7 +71,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token //validate the token
$token = new token; $token = new token;
@ -82,7 +82,7 @@
} }
//process the http post data by submitted action //process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) { if ($_POST['action'] != '' && !empty($_POST['action'])) {
//prepare the array(s) //prepare the array(s)
//send the array to the database class //send the array to the database class
@ -116,13 +116,13 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; } //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($extension_setting_type) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']."<br>\n"; } if (empty($extension_setting_type)) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']."<br>\n"; }
if (strlen($extension_setting_name) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']."<br>\n"; } if (empty($extension_setting_name)) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']."<br>\n"; }
//if (strlen($extension_setting_value) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']."<br>\n"; } //if (empty($extension_setting_value)) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']."<br>\n"; }
if (strlen($extension_setting_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."<br>\n"; } if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']."<br>\n"; }
//if (strlen($extension_setting_description) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']."<br>\n"; } //if (empty($extension_setting_description)) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -214,7 +214,7 @@
} }
//set the defaults //set the defaults
if (strlen($extension_setting_enabled) == 0) { $extension_setting_enabled = 'true'; } if (empty($extension_setting_enabled)) { $extension_setting_enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;
@ -265,7 +265,7 @@
//echo "</td>\n"; //echo "</td>\n";
//echo "<td class='vtable' style='position: relative;' align='left'>\n"; //echo "<td class='vtable' style='position: relative;' align='left'>\n";
//echo " <select class='formfld' name='domain_uuid'>\n"; //echo " <select class='formfld' name='domain_uuid'>\n";
//if (strlen($domain_uuid) == 0) { //if (empty($domain_uuid)) {
// echo " <option value='' selected='selected'>".$text['select-global']."</option>\n"; // echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
//} //}
//else { //else {

View File

@ -28,7 +28,7 @@
if ($domains_processed == 1) { if ($domains_processed == 1) {
//create the directory //create the directory
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) { if (!empty($_SESSION['switch']['extensions']['dir'])) {
if (!is_dir($_SESSION['switch']['extensions']['dir'])) { if (!is_dir($_SESSION['switch']['extensions']['dir'])) {
mkdir($_SESSION['switch']['extensions']['dir'], 0770, false); mkdir($_SESSION['switch']['extensions']['dir'], 0770, false);
} }
@ -44,7 +44,7 @@
if (is_array($extensions) && @sizeof($extensions) != 0) { if (is_array($extensions) && @sizeof($extensions) != 0) {
foreach($extensions as $index => $row) { foreach($extensions as $index => $row) {
$name = explode(' ', $row['directory_first_name']); $name = explode(' ', $row['directory_first_name']);
if (strlen($name[1]) > 0) { if (!empty($name[1])) {
$array['extensions'][$index]['extension_uuid'] = $row['extension_uuid']; $array['extensions'][$index]['extension_uuid'] = $row['extension_uuid'];
$array['extensions'][$index]['directory_first_name'] = $name[0]; $array['extensions'][$index]['directory_first_name'] = $name[0];
$array['extensions'][$index]['directory_last_name'] = $name[1]; $array['extensions'][$index]['directory_last_name'] = $name[1];

View File

@ -167,7 +167,7 @@
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
//set the new voicemail password //set the new voicemail password
if (strlen($voicemail_password) == 0) { if (empty($voicemail_password)) {
$voicemail_password = generate_password(9, 1); $voicemail_password = generate_password(9, 1);
} }

View File

@ -140,12 +140,12 @@
$description = $_POST["description"]; $description = $_POST["description"];
//outbound caller id number - only allow numeric and + //outbound caller id number - only allow numeric and +
if (strlen($outbound_caller_id_number) > 0) { if (!empty($outbound_caller_id_number)) {
$outbound_caller_id_number = preg_replace('#[^\+0-9]#', '', $outbound_caller_id_number); $outbound_caller_id_number = preg_replace('#[^\+0-9]#', '', $outbound_caller_id_number);
} }
$voicemail_id = $extension; $voicemail_id = $extension;
if (permission_exists('number_alias') && strlen($number_alias) > 0) { if (permission_exists('number_alias') && !empty($number_alias)) {
$voicemail_id = $number_alias; $voicemail_id = $number_alias;
} }
@ -285,7 +285,7 @@
} }
//process the user data and save it to the database //process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//set the domain_uuid //set the domain_uuid
if (permission_exists('extension_domain') && is_uuid($_POST["domain_uuid"])) { if (permission_exists('extension_domain') && is_uuid($_POST["domain_uuid"])) {
@ -305,11 +305,11 @@
//check for all required data //check for all required data
$msg = ''; $msg = '';
if (strlen($extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; } if (empty($extension)) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; }
if (permission_exists('extension_enabled')) { if (permission_exists('extension_enabled')) {
if (strlen($enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; } if (empty($enabled)) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
} }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php"; require_once "resources/header.php";
require_once "resources/persist_form_var.php"; require_once "resources/persist_form_var.php";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
@ -392,17 +392,17 @@
} }
//prepare the values for mwi account //prepare the values for mwi account
if (strlen($mwi_account) > 0) { if (!empty($mwi_account)) {
if (strpos($mwi_account, '@') === false) { if (strpos($mwi_account, '@') === false) {
$mwi_account .= "@".$_SESSION['domain_name']; $mwi_account .= "@".$_SESSION['domain_name'];
} }
} }
//generate a password //generate a password
if ($action == "add" && strlen($password) == 0) { if ($action == "add" && empty($password)) {
$password = generate_password($password_length, $password_strength); $password = generate_password($password_length, $password_strength);
} }
if ($action == "update" && permission_exists('extension_password') && strlen($password) == 0) { if ($action == "update" && permission_exists('extension_password') && empty($password)) {
$password = generate_password($password_length, $password_strength); $password = generate_password($password_length, $password_strength);
} }
@ -413,7 +413,7 @@
if (permission_exists('number_alias')) { if (permission_exists('number_alias')) {
$array["extensions"][$i]["number_alias"] = $number_alias; $array["extensions"][$i]["number_alias"] = $number_alias;
} }
if (strlen($password) > 0) { if (!empty($password)) {
$array["extensions"][$i]["password"] = $password; $array["extensions"][$i]["password"] = $password;
} }
if (permission_exists('extension_accountcode')) { if (permission_exists('extension_accountcode')) {
@ -475,7 +475,7 @@
if (permission_exists('extension_toll')) { if (permission_exists('extension_toll')) {
$array["extensions"][$i]["toll_allow"] = $toll_allow; $array["extensions"][$i]["toll_allow"] = $toll_allow;
} }
if (strlen($call_timeout) > 0) { if (!empty($call_timeout)) {
$array["extensions"][$i]["call_timeout"] = $call_timeout; $array["extensions"][$i]["call_timeout"] = $call_timeout;
} }
if (permission_exists("extension_call_group")) { if (permission_exists("extension_call_group")) {
@ -496,7 +496,7 @@
$array["extensions"][$i]["sip_force_contact"] = $sip_force_contact; $array["extensions"][$i]["sip_force_contact"] = $sip_force_contact;
$array["extensions"][$i]["sip_force_expires"] = $sip_force_expires; $array["extensions"][$i]["sip_force_expires"] = $sip_force_expires;
if (permission_exists('extension_nibble_account')) { if (permission_exists('extension_nibble_account')) {
if (strlen($nibble_account) > 0) { if (!empty($nibble_account)) {
$array["extensions"][$i]["nibble_account"] = $nibble_account; $array["extensions"][$i]["nibble_account"] = $nibble_account;
} }
} }
@ -541,16 +541,16 @@
} }
//determine the name //determine the name
if (strlen($effective_caller_id_name) > 0) { if (!empty($effective_caller_id_name)) {
$name = $effective_caller_id_name; $name = $effective_caller_id_name;
} }
elseif (strlen($directory_first_name) > 0 && strlen($directory_last_name) > 0) { elseif (strlen($directory_first_name) > 0 && !empty($directory_last_name)) {
$name = $directory_first_name.' '.$directory_last_name; $name = $directory_first_name.' '.$directory_last_name;
} }
elseif (strlen($directory_first_name) > 0) { elseif (!empty($directory_first_name)) {
$name = $directory_first_name; $name = $directory_first_name;
} }
elseif (strlen($directory_first_name) > 0) { elseif (!empty($directory_first_name)) {
$name = $directory_first_name.' '.$directory_last_name; $name = $directory_first_name.' '.$directory_last_name;
} }
else { else {
@ -604,7 +604,7 @@
$array["devices"][$j]["device_mac_address"] = $device_mac_address; $array["devices"][$j]["device_mac_address"] = $device_mac_address;
$array["devices"][$j]["device_label"] = $extension; $array["devices"][$j]["device_label"] = $extension;
$array["devices"][$j]["device_vendor"] = $device_vendor; $array["devices"][$j]["device_vendor"] = $device_vendor;
if (strlen($device_templates[$d]) > 0) { if (!empty($device_templates[$d])) {
$array["devices"][$j]["device_template"] = $device_templates[$d]; $array["devices"][$j]["device_template"] = $device_templates[$d];
} }
$array["devices"][$j]["device_enabled"] = "true"; $array["devices"][$j]["device_enabled"] = "true";
@ -639,7 +639,7 @@
//add or update voicemail //add or update voicemail
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
//set the voicemail password //set the voicemail password
if (strlen($voicemail_password) == 0) { if (empty($voicemail_password)) {
$voicemail_password = generate_password($_SESSION['voicemail']['password_length']['numeric'], 1); $voicemail_password = generate_password($_SESSION['voicemail']['password_length']['numeric'], 1);
} }
@ -702,12 +702,12 @@
$extension++; $extension++;
$voicemail_id = $extension; $voicemail_id = $extension;
if (strlen($number_alias) > 0) { if (!empty($number_alias)) {
$number_alias++; $number_alias++;
$voicemail_id = $number_alias; $voicemail_id = $number_alias;
} }
if (strlen($mwi_account) > 0) { if (!empty($mwi_account)) {
$mwi_account_array = explode('@', $mwi_account); $mwi_account_array = explode('@', $mwi_account);
$mwi_account_array[0]++; $mwi_account_array[0]++;
$mwi_account = implode('@', $mwi_account_array); $mwi_account = implode('@', $mwi_account_array);
@ -733,7 +733,7 @@
} }
//update device key label //update device key label
if (strlen($effective_caller_id_name) > 0) { if (!empty($effective_caller_id_name)) {
$sql = "update v_device_keys set "; $sql = "update v_device_keys set ";
$sql .= "device_key_label = :device_key_label "; $sql .= "device_key_label = :device_key_label ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
@ -772,7 +772,7 @@
} }
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $domain_uuid; $prov->domain_uuid = $domain_uuid;
@ -790,7 +790,7 @@
} }
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$extension."@".$user_context); $cache->delete("directory:".$extension."@".$user_context);
if (permission_exists('number_alias') && strlen($number_alias) > 0) { if (permission_exists('number_alias') && !empty($number_alias)) {
$cache->delete("directory:".$number_alias."@".$user_context); $cache->delete("directory:".$number_alias."@".$user_context);
} }
@ -870,7 +870,7 @@
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
//outbound caller id number - only allow numeric and + //outbound caller id number - only allow numeric and +
if (strlen($outbound_caller_id_number) > 0) { if (!empty($outbound_caller_id_number)) {
$outbound_caller_id_number = preg_replace('#[^\+0-9]#', '', $outbound_caller_id_number); $outbound_caller_id_number = preg_replace('#[^\+0-9]#', '', $outbound_caller_id_number);
} }
@ -997,17 +997,17 @@
$toll_allow = str_replace(':',',', $toll_allow); $toll_allow = str_replace(':',',', $toll_allow);
//set the defaults //set the defaults
if (strlen($user_context) == 0) { $user_context = $_SESSION['domain_name']; } if (empty($user_context)) { $user_context = $_SESSION['domain_name']; }
if (strlen($max_registrations) == 0) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric']; } if (empty($max_registrations)) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric']; }
if (strlen($accountcode) == 0) { $accountcode = get_accountcode(); } if (empty($accountcode)) { $accountcode = get_accountcode(); }
if (strlen($limit_max) == 0) { $limit_max = '5'; } if (empty($limit_max)) { $limit_max = '5'; }
if (strlen($limit_destination) == 0) { $limit_destination = '!USER_BUSY'; } if (empty($limit_destination)) { $limit_destination = '!USER_BUSY'; }
if (strlen($call_timeout) == 0) { $call_timeout = '30'; } if (empty($call_timeout)) { $call_timeout = '30'; }
if (strlen($call_screen_enabled) == 0) { $call_screen_enabled = 'false'; } if (empty($call_screen_enabled)) { $call_screen_enabled = 'false'; }
if (strlen($user_record) == 0) { $user_record = $_SESSION['extension']['user_record_default']['text']; } if (empty($user_record)) { $user_record = $_SESSION['extension']['user_record_default']['text']; }
if (strlen($voicemail_transcription_enabled) == 0) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; } if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; }
if (strlen($voicemail_enabled) == 0) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; } if (empty($voicemail_enabled)) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; }
if (strlen($enabled) == 0) { $enabled = 'true'; } if (empty($enabled)) { $enabled = 'true'; }
//create token //create token
$object = new token; $object = new token;
@ -1334,7 +1334,7 @@
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if (is_array($devices) && @sizeof($devices) != 0) { if (is_array($devices) && @sizeof($devices) != 0) {
foreach ($devices as $field) { foreach ($devices as $field) {
if (strlen($field["device_mac_address"]) > 0) { if (!empty($field["device_mac_address"])) {
$selected = $field_current_value == $field["device_mac_address"] ? "selected='selected'" : null; $selected = $field_current_value == $field["device_mac_address"] ? "selected='selected'" : null;
echo " <option value='".escape($field["device_mac_address"])."' ".$selected.">".escape($field["device_mac_address"])." - ".escape($field['device_model'])." ".escape($field['device_description'])."</option>\n"; echo " <option value='".escape($field["device_mac_address"])."' ".$selected.">".escape($field["device_mac_address"])." - ".escape($field['device_model'])." ".escape($field['device_description'])."</option>\n";
} }
@ -1425,10 +1425,10 @@
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
foreach ($destinations as &$row) { foreach ($destinations as &$row) {
$tmp = $row["destination_caller_id_name"]; $tmp = $row["destination_caller_id_name"];
if(strlen($tmp) == 0){ if(empty($tmp)){
// $tmp = $row["destination_description"]; // $tmp = $row["destination_description"];
} }
if(strlen($tmp) > 0 && !in_array($tmp, $in_list)){ if(!empty($tmp) && !in_array($tmp, $in_list)){
$in_list[] = $tmp; $in_list[] = $tmp;
if ($outbound_caller_id_name == $tmp) { if ($outbound_caller_id_name == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n"; echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
@ -1467,10 +1467,10 @@
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
foreach ($destinations as &$row) { foreach ($destinations as &$row) {
$tmp = $row["destination_caller_id_number"]; $tmp = $row["destination_caller_id_number"];
if(strlen($tmp) == 0){ if(empty($tmp)){
$tmp = $row["destination_number"]; $tmp = $row["destination_number"];
} }
if(strlen($tmp) > 0){ if(!empty($tmp)){
if ($outbound_caller_id_number == $tmp) { if ($outbound_caller_id_number == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n"; echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
} }
@ -1508,10 +1508,10 @@
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
foreach ($emergency_destinations as &$row) { foreach ($emergency_destinations as &$row) {
$tmp = $row["destination_caller_id_name"]; $tmp = $row["destination_caller_id_name"];
if(strlen($tmp) == 0){ if(empty($tmp)){
$tmp = $row["destination_description"]; $tmp = $row["destination_description"];
} }
if(strlen($tmp) > 0){ if(!empty($tmp)){
if ($emergency_caller_id_name == $tmp) { if ($emergency_caller_id_name == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n"; echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
} }
@ -1554,10 +1554,10 @@
} }
foreach ($emergency_destinations as &$row) { foreach ($emergency_destinations as &$row) {
$tmp = $row["destination_caller_id_number"]; $tmp = $row["destination_caller_id_number"];
if(strlen($tmp) == 0){ if(empty($tmp)){
$tmp = $row["destination_number"]; $tmp = $row["destination_number"];
} }
if(strlen($tmp) > 0){ if(!empty($tmp)){
if ($emergency_caller_id_number == $tmp) { if ($emergency_caller_id_number == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n"; echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
} }

View File

@ -51,7 +51,7 @@
$fp = fopen("php://memory", 'r+'); $fp = fopen("php://memory", 'r+');
fputs($fp, $input); fputs($fp, $input);
rewind($fp); rewind($fp);
$data = fgetcsv($fp, null, $delimiter, $enclosure); // $escape only got added in 5.3.0 $data = fgetcsv($fp, null, $delimiter, $enclosure, $escape);
fclose($fp); fclose($fp);
return $data; return $data;
} }
@ -84,7 +84,7 @@
} }
//get the schema //get the schema
if (strlen($delimiter) > 0) { if (!empty($delimiter)) {
//get the first line //get the first line
$line = fgets(fopen($_SESSION['file'], 'r')); $line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line); $line_fields = explode($delimiter, $line);
@ -132,7 +132,7 @@
} }
//match the column names to the field names //match the column names to the field names
if (strlen($delimiter) > 0 && file_exists($_SESSION['file']) && $action != 'import') { if (!empty($delimiter) && file_exists($_SESSION['file']) && $action != 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -236,7 +236,7 @@
} }
//upload the csv //upload the csv
if (file_exists($_SESSION['file']) && $action == 'import') { if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
//validate the token //validate the token
$token = new token; $token = new token;
@ -297,8 +297,8 @@
} }
//build the data array //build the data array
if (strlen($table_name) > 0) { if (!empty($table_name)) {
if (strlen($parent) == 0) { if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key]; $array[$table_name][$row_id][$field_name] = $result[$key];
} }

View File

@ -95,7 +95,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
//add the search term //add the search term
$search = strtolower($_GET["search"]); $search = strtolower($_GET["search"]);
if (strlen($search) > 0) { if (!empty($search)) {
$sql_search = " and ( "; $sql_search = " and ( ";
$sql_search .= "lower(extension) like :search "; $sql_search .= "lower(extension) like :search ";
$sql_search .= "or lower(number_alias) like :search "; $sql_search .= "or lower(number_alias) like :search ";
@ -315,7 +315,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
echo " <td>"; echo " <td>";
$extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name']; $extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
$extension_number_alias = $row['number_alias']; $extension_number_alias = $row['number_alias'];
if (strlen($extension_number_alias) > 0) { if (!empty($extension_number_alias)) {
$extension_number_alias .= '@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name']; $extension_number_alias .= '@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
} }
$found_count = 0; $found_count = 0;

View File

@ -216,8 +216,8 @@ if (!class_exists('extension')) {
$tmp_array = explode(",", $call_group); $tmp_array = explode(",", $call_group);
foreach ($tmp_array as &$tmp_call_group) { foreach ($tmp_array as &$tmp_call_group) {
$tmp_call_group = trim($tmp_call_group); $tmp_call_group = trim($tmp_call_group);
if (strlen($tmp_call_group) > 0) { if (!empty($tmp_call_group)) {
if (strlen($call_group_array[$tmp_call_group]) == 0) { if (empty($call_group_array[$tmp_call_group])) {
$call_group_array[$tmp_call_group] = $row['extension']; $call_group_array[$tmp_call_group] = $row['extension'];
} }
else { else {
@ -239,8 +239,8 @@ if (!class_exists('extension')) {
$extension = str_replace(" ", "_", $extension); $extension = str_replace(" ", "_", $extension);
$extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension); $extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension);
$dial_string = $row['dial_string']; $dial_string = $row['dial_string'];
if (strlen($dial_string) == 0) { if (empty($dial_string)) {
if (strlen($_SESSION['domain']['dial_string']['text']) > 0) { if (!empty($_SESSION['domain']['dial_string']['text'])) {
$dial_string = $_SESSION['domain']['dial_string']['text']; $dial_string = $_SESSION['domain']['dial_string']['text'];
} }
else { else {
@ -254,11 +254,11 @@ if (!class_exists('extension')) {
$xml .= "<include>\n"; $xml .= "<include>\n";
$cidr = ''; $cidr = '';
if (strlen($row['cidr']) > 0) { if (!empty($row['cidr'])) {
$cidr = " cidr=\"" . $row['cidr'] . "\""; $cidr = " cidr=\"" . $row['cidr'] . "\"";
} }
$number_alias = ''; $number_alias = '';
if (strlen($row['number_alias']) > 0) { if (!empty($row['number_alias'])) {
$number_alias = " number-alias=\"".$row['number_alias']."\""; $number_alias = " number-alias=\"".$row['number_alias']."\"";
} }
$xml .= " <user id=\"".$row['extension']."\"".$cidr."".$number_alias.">\n"; $xml .= " <user id=\"".$row['extension']."\"".$cidr."".$number_alias.">\n";
@ -281,7 +281,7 @@ if (!class_exists('extension')) {
default: default:
$xml .= " <param name=\"vm-enabled\" value=\"true\"/>\n"; $xml .= " <param name=\"vm-enabled\" value=\"true\"/>\n";
} }
if (strlen($row['voicemail_mail_to']) > 0) { if (!empty($row['voicemail_mail_to'])) {
$xml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n"; $xml .= " <param name=\"vm-email-all-messages\" value=\"true\"/>\n";
switch ($row['voicemail_file']) { switch ($row['voicemail_file']) {
case "attach": case "attach":
@ -303,13 +303,13 @@ if (!class_exists('extension')) {
$xml .= " <param name=\"vm-mailto\" value=\"" . $row['voicemail_mail_to'] . "\"/>\n"; $xml .= " <param name=\"vm-mailto\" value=\"" . $row['voicemail_mail_to'] . "\"/>\n";
} }
if (strlen($row['mwi_account']) > 0) { if (!empty($row['mwi_account'])) {
$xml .= " <param name=\"MWI-Account\" value=\"" . $row['mwi_account'] . "\"/>\n"; $xml .= " <param name=\"MWI-Account\" value=\"" . $row['mwi_account'] . "\"/>\n";
} }
if (strlen($row['auth_acl']) > 0) { if (!empty($row['auth_acl'])) {
$xml .= " <param name=\"auth-acl\" value=\"" . $row['auth_acl'] . "\"/>\n"; $xml .= " <param name=\"auth-acl\" value=\"" . $row['auth_acl'] . "\"/>\n";
} }
if (strlen($row['directory_exten_visible']) > 0) { if (!empty($row['directory_exten_visible'])) {
$xml .= " <param name=\"directory-exten-visible\" value=\"" . $row['directory_exten_visible'] . "\"/>\n"; $xml .= " <param name=\"directory-exten-visible\" value=\"" . $row['directory_exten_visible'] . "\"/>\n";
} }
$xml .= " <param name=\"dial-string\" value=\"" . $dial_string . "\"/>\n"; $xml .= " <param name=\"dial-string\" value=\"" . $dial_string . "\"/>\n";
@ -318,66 +318,66 @@ if (!class_exists('extension')) {
$xml .= " <variable name=\"domain_name\" value=\"" . $_SESSION['domain_name'] . "\"/>\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_uuid\" value=\"" . $_SESSION['domain_uuid'] . "\"/>\n";
$xml .= " <variable name=\"extension_uuid\" value=\"" . $extension_uuid . "\"/>\n"; $xml .= " <variable name=\"extension_uuid\" value=\"" . $extension_uuid . "\"/>\n";
if (strlen($row['call_group']) > 0) { if (!empty($row['call_group'])) {
$xml .= " <variable name=\"call_group\" value=\"" . $row['call_group'] . "\"/>\n"; $xml .= " <variable name=\"call_group\" value=\"" . $row['call_group'] . "\"/>\n";
} }
if (strlen($row['user_record']) > 0) { if (!empty($row['user_record'])) {
$xml .= " <variable name=\"user_record\" value=\"" . $row['user_record'] . "\"/>\n"; $xml .= " <variable name=\"user_record\" value=\"" . $row['user_record'] . "\"/>\n";
} }
if (strlen($row['hold_music']) > 0) { if (!empty($row['hold_music'])) {
$xml .= " <variable name=\"hold_music\" value=\"" . $row['hold_music'] . "\"/>\n"; $xml .= " <variable name=\"hold_music\" value=\"" . $row['hold_music'] . "\"/>\n";
} }
$xml .= " <variable name=\"toll_allow\" value=\"" . $row['toll_allow'] . "\"/>\n"; $xml .= " <variable name=\"toll_allow\" value=\"" . $row['toll_allow'] . "\"/>\n";
if (strlen($row['call_timeout']) > 0) { if (!empty($row['call_timeout'])) {
$xml .= " <variable name=\"call_timeout\" value=\"" . $row['call_timeout'] . "\"/>\n"; $xml .= " <variable name=\"call_timeout\" value=\"" . $row['call_timeout'] . "\"/>\n";
} }
if (strlen($switch_account_code) > 0) { if (!empty($switch_account_code)) {
$xml .= " <variable name=\"accountcode\" value=\"" . $switch_account_code . "\"/>\n"; $xml .= " <variable name=\"accountcode\" value=\"" . $switch_account_code . "\"/>\n";
} }
else { else {
$xml .= " <variable name=\"accountcode\" value=\"" . $row['accountcode'] . "\"/>\n"; $xml .= " <variable name=\"accountcode\" value=\"" . $row['accountcode'] . "\"/>\n";
} }
$xml .= " <variable name=\"user_context\" value=\"" . $row['user_context'] . "\"/>\n"; $xml .= " <variable name=\"user_context\" value=\"" . $row['user_context'] . "\"/>\n";
if (strlen($row['effective_caller_id_name']) > 0) { if (!empty($row['effective_caller_id_name'])) {
$xml .= " <variable name=\"effective_caller_id_name\" value=\"" . $row['effective_caller_id_name'] . "\"/>\n"; $xml .= " <variable name=\"effective_caller_id_name\" value=\"" . $row['effective_caller_id_name'] . "\"/>\n";
} }
if (strlen($row['effective_caller_id_number']) > 0) { if (!empty($row['effective_caller_id_number'])) {
$xml .= " <variable name=\"effective_caller_id_number\" value=\"" . $row['effective_caller_id_number'] . "\"/>\n"; $xml .= " <variable name=\"effective_caller_id_number\" value=\"" . $row['effective_caller_id_number'] . "\"/>\n";
} }
if (strlen($row['outbound_caller_id_name']) > 0) { if (!empty($row['outbound_caller_id_name'])) {
$xml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $row['outbound_caller_id_name'] . "\"/>\n"; $xml .= " <variable name=\"outbound_caller_id_name\" value=\"" . $row['outbound_caller_id_name'] . "\"/>\n";
} }
if (strlen($row['outbound_caller_id_number']) > 0) { if (!empty($row['outbound_caller_id_number'])) {
$xml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $row['outbound_caller_id_number'] . "\"/>\n"; $xml .= " <variable name=\"outbound_caller_id_number\" value=\"" . $row['outbound_caller_id_number'] . "\"/>\n";
} }
if (strlen($row['emergency_caller_id_name']) > 0) { if (!empty($row['emergency_caller_id_name'])) {
$xml .= " <variable name=\"emergency_caller_id_name\" value=\"" . $row['emergency_caller_id_name'] . "\"/>\n"; $xml .= " <variable name=\"emergency_caller_id_name\" value=\"" . $row['emergency_caller_id_name'] . "\"/>\n";
} }
if (strlen($row['emergency_caller_id_number']) > 0) { if (!empty($row['emergency_caller_id_number'])) {
$xml .= " <variable name=\"emergency_caller_id_number\" value=\"" . $row['emergency_caller_id_number'] . "\"/>\n"; $xml .= " <variable name=\"emergency_caller_id_number\" value=\"" . $row['emergency_caller_id_number'] . "\"/>\n";
} }
if (strlen($row['directory_full_name']) > 0) { if (!empty($row['directory_full_name'])) {
$xml .= " <variable name=\"directory_full_name\" value=\"" . $row['directory_full_name'] . "\"/>\n"; $xml .= " <variable name=\"directory_full_name\" value=\"" . $row['directory_full_name'] . "\"/>\n";
} }
if (strlen($row['directory_visible']) > 0) { if (!empty($row['directory_visible'])) {
$xml .= " <variable name=\"directory-visible\" value=\"" . $row['directory_visible'] . "\"/>\n"; $xml .= " <variable name=\"directory-visible\" value=\"" . $row['directory_visible'] . "\"/>\n";
} }
if (strlen($row['limit_max']) > 0) { if (!empty($row['limit_max'])) {
$xml .= " <variable name=\"limit_max\" value=\"" . $row['limit_max'] . "\"/>\n"; $xml .= " <variable name=\"limit_max\" value=\"" . $row['limit_max'] . "\"/>\n";
} }
else { else {
$xml .= " <variable name=\"limit_max\" value=\"5\"/>\n"; $xml .= " <variable name=\"limit_max\" value=\"5\"/>\n";
} }
if (strlen($row['limit_destination']) > 0) { if (!empty($row['limit_destination'])) {
$xml .= " <variable name=\"limit_destination\" value=\"" . $row['limit_destination'] . "\"/>\n"; $xml .= " <variable name=\"limit_destination\" value=\"" . $row['limit_destination'] . "\"/>\n";
} }
if (strlen($row['sip_force_contact']) > 0) { if (!empty($row['sip_force_contact'])) {
$xml .= " <variable name=\"sip-force-contact\" value=\"" . $row['sip_force_contact'] . "\"/>\n"; $xml .= " <variable name=\"sip-force-contact\" value=\"" . $row['sip_force_contact'] . "\"/>\n";
} }
if (strlen($row['sip_force_expires']) > 0) { if (!empty($row['sip_force_expires'])) {
$xml .= " <variable name=\"sip-force-expires\" value=\"" . $row['sip_force_expires'] . "\"/>\n"; $xml .= " <variable name=\"sip-force-expires\" value=\"" . $row['sip_force_expires'] . "\"/>\n";
} }
if (strlen($row['nibble_account']) > 0) { if (!empty($row['nibble_account'])) {
$xml .= " <variable name=\"nibble_account\" value=\"" . $row['nibble_account'] . "\"/>\n"; $xml .= " <variable name=\"nibble_account\" value=\"" . $row['nibble_account'] . "\"/>\n";
} }
switch ($row['sip_bypass_media']) { switch ($row['sip_bypass_media']) {
@ -391,35 +391,35 @@ if (!class_exists('extension')) {
$xml .= " <variable name=\"proxy_media\" value=\"true\"/>\n"; $xml .= " <variable name=\"proxy_media\" value=\"true\"/>\n";
break; break;
} }
if (strlen($row['absolute_codec_string']) > 0) { if (!empty($row['absolute_codec_string'])) {
$xml .= " <variable name=\"absolute_codec_string\" value=\"" . $row['absolute_codec_string'] . "\"/>\n"; $xml .= " <variable name=\"absolute_codec_string\" value=\"" . $row['absolute_codec_string'] . "\"/>\n";
} }
if (strlen($row['forward_all_enabled']) > 0) { if (!empty($row['forward_all_enabled'])) {
$xml .= " <variable name=\"forward_all_enabled\" value=\"" . $row['forward_all_enabled'] . "\"/>\n"; $xml .= " <variable name=\"forward_all_enabled\" value=\"" . $row['forward_all_enabled'] . "\"/>\n";
} }
if (strlen($row['forward_all_destination']) > 0) { if (!empty($row['forward_all_destination'])) {
$xml .= " <variable name=\"forward_all_destination\" value=\"" . $row['forward_all_destination'] . "\"/>\n"; $xml .= " <variable name=\"forward_all_destination\" value=\"" . $row['forward_all_destination'] . "\"/>\n";
} }
if (strlen($row['forward_busy_enabled']) > 0) { if (!empty($row['forward_busy_enabled'])) {
$xml .= " <variable name=\"forward_busy_enabled\" value=\"" . $row['forward_busy_enabled'] . "\"/>\n"; $xml .= " <variable name=\"forward_busy_enabled\" value=\"" . $row['forward_busy_enabled'] . "\"/>\n";
} }
if (strlen($row['forward_busy_destination']) > 0) { if (!empty($row['forward_busy_destination'])) {
$xml .= " <variable name=\"forward_busy_destination\" value=\"" . $row['forward_busy_destination'] . "\"/>\n"; $xml .= " <variable name=\"forward_busy_destination\" value=\"" . $row['forward_busy_destination'] . "\"/>\n";
} }
if (strlen($row['forward_no_answer_enabled']) > 0) { if (!empty($row['forward_no_answer_enabled'])) {
$xml .= " <variable name=\"forward_no_answer_enabled\" value=\"" . $row['forward_no_answer_enabled'] . "\"/>\n"; $xml .= " <variable name=\"forward_no_answer_enabled\" value=\"" . $row['forward_no_answer_enabled'] . "\"/>\n";
} }
if (strlen($row['forward_no_answer_destination']) > 0) { if (!empty($row['forward_no_answer_destination'])) {
$xml .= " <variable name=\"forward_no_answer_destination\" value=\"" . $row['forward_no_answer_destination'] . "\"/>\n"; $xml .= " <variable name=\"forward_no_answer_destination\" value=\"" . $row['forward_no_answer_destination'] . "\"/>\n";
} }
if (strlen($row['forward_user_not_registered_enabled']) > 0) { if (!empty($row['forward_user_not_registered_enabled'])) {
$xml .= " <variable name=\"forward_user_not_registered_enabled\" value=\"" . $row['forward_user_not_registered_enabled'] . "\"/>\n"; $xml .= " <variable name=\"forward_user_not_registered_enabled\" value=\"" . $row['forward_user_not_registered_enabled'] . "\"/>\n";
} }
if (strlen($row['forward_user_not_registered_destination']) > 0) { if (!empty($row['forward_user_not_registered_destination'])) {
$xml .= " <variable name=\"forward_user_not_registered_destination\" value=\"" . $row['forward_user_not_registered_destination'] . "\"/>\n"; $xml .= " <variable name=\"forward_user_not_registered_destination\" value=\"" . $row['forward_user_not_registered_destination'] . "\"/>\n";
} }
if (strlen($row['do_not_disturb']) > 0) { if (!empty($row['do_not_disturb'])) {
$xml .= " <variable name=\"do_not_disturb\" value=\"" . $row['do_not_disturb'] . "\"/>\n"; $xml .= " <variable name=\"do_not_disturb\" value=\"" . $row['do_not_disturb'] . "\"/>\n";
} }
$xml .= " </variables>\n"; $xml .= " </variables>\n";
@ -428,7 +428,7 @@ if (!class_exists('extension')) {
if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) { if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) {
mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'], 0770, false); mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'], 0770, false);
} }
if (strlen($extension) > 0) { if (!empty($extension)) {
$fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w"); $fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w");
} }
$xml .= "</include>\n"; $xml .= "</include>\n";
@ -496,7 +496,7 @@ if (!class_exists('extension')) {
foreach ($call_group_array as $key => $value) { foreach ($call_group_array as $key => $value) {
$call_group = trim($key); $call_group = trim($key);
$extension_list = trim($value); $extension_list = trim($value);
if (strlen($call_group) > 0) { if (!empty($call_group)) {
if ($previous_call_group != $call_group) { if ($previous_call_group != $call_group) {
$xml .= " <group name=\"$call_group\">\n"; $xml .= " <group name=\"$call_group\">\n";
$xml .= " <users>\n"; $xml .= " <users>\n";
@ -523,7 +523,7 @@ if (!class_exists('extension')) {
$xml .= "</include>"; $xml .= "</include>";
//write the xml file //write the xml file
if (is_readable($extension_dir) && strlen($extension_dir) > 0) { if (is_readable($extension_dir) && !empty($extension_dir)) {
$fout = fopen($extension_dir."/".$user_context.".xml","w"); $fout = fopen($extension_dir."/".$user_context.".xml","w");
fwrite($fout, $xml); fwrite($fout, $xml);
unset($xml); unset($xml);
@ -662,7 +662,7 @@ if (!class_exists('extension')) {
foreach ($extensions as $x => $extension) { foreach ($extensions as $x => $extension) {
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$extension['extension']."@".$extension['user_context']); $cache->delete("directory:".$extension['extension']."@".$extension['user_context']);
if (permission_exists('number_alias') && strlen($extension['number_alias']) > 0) { if (permission_exists('number_alias') && !empty($extension['number_alias'])) {
$cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']); $cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']);
} }
} }
@ -764,7 +764,7 @@ if (!class_exists('extension')) {
} }
//write the provision files //write the provision files
if (strlen($_SESSION['provision']['path']['text']) > 0) { if (!empty($_SESSION['provision']['path']['text'])) {
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) { if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) {
$prov = new provision; $prov = new provision;
$prov->domain_uuid = $_SESSION['domain_uuid']; $prov->domain_uuid = $_SESSION['domain_uuid'];
@ -776,7 +776,7 @@ if (!class_exists('extension')) {
foreach ($extensions as $uuid => $extension) { foreach ($extensions as $uuid => $extension) {
$cache = new cache; $cache = new cache;
$cache->delete("directory:".$extension['extension']."@".$extension['user_context']); $cache->delete("directory:".$extension['extension']."@".$extension['user_context']);
if (permission_exists('number_alias') && strlen($extension['number_alias']) > 0) { if (permission_exists('number_alias') && !empty($extension['number_alias'])) {
$cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']); $cache->delete("directory:".$extension['number_alias']."@".$extension['user_context']);
} }
} }

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