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 10:46:37 -06:00
committed by GitHub
co-authored by Tim Fry FusionPBX
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions
+2 -2
View File
@@ -28,7 +28,7 @@
if ($domains_processed == 1) {
//create the directory
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
if (!empty($_SESSION['switch']['extensions']['dir'])) {
if (!is_dir($_SESSION['switch']['extensions']['dir'])) {
mkdir($_SESSION['switch']['extensions']['dir'], 0770, false);
}
@@ -44,7 +44,7 @@
if (is_array($extensions) && @sizeof($extensions) != 0) {
foreach($extensions as $index => $row) {
$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]['directory_first_name'] = $name[0];
$array['extensions'][$index]['directory_last_name'] = $name[1];
+1 -1
View File
@@ -167,7 +167,7 @@
unset($sql, $parameters, $row);
//set the new voicemail password
if (strlen($voicemail_password) == 0) {
if (empty($voicemail_password)) {
$voicemail_password = generate_password(9, 1);
}
+44 -44
View File
@@ -140,12 +140,12 @@
$description = $_POST["description"];
//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);
}
$voicemail_id = $extension;
if (permission_exists('number_alias') && strlen($number_alias) > 0) {
if (permission_exists('number_alias') && !empty($number_alias)) {
$voicemail_id = $number_alias;
}
@@ -285,7 +285,7 @@
}
//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
if (permission_exists('extension_domain') && is_uuid($_POST["domain_uuid"])) {
@@ -305,11 +305,11 @@
//check for all required data
$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 (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/persist_form_var.php";
echo "<div align='center'>\n";
@@ -392,17 +392,17 @@
}
//prepare the values for mwi account
if (strlen($mwi_account) > 0) {
if (!empty($mwi_account)) {
if (strpos($mwi_account, '@') === false) {
$mwi_account .= "@".$_SESSION['domain_name'];
}
}
//generate a password
if ($action == "add" && strlen($password) == 0) {
if ($action == "add" && empty($password)) {
$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);
}
@@ -413,7 +413,7 @@
if (permission_exists('number_alias')) {
$array["extensions"][$i]["number_alias"] = $number_alias;
}
if (strlen($password) > 0) {
if (!empty($password)) {
$array["extensions"][$i]["password"] = $password;
}
if (permission_exists('extension_accountcode')) {
@@ -475,7 +475,7 @@
if (permission_exists('extension_toll')) {
$array["extensions"][$i]["toll_allow"] = $toll_allow;
}
if (strlen($call_timeout) > 0) {
if (!empty($call_timeout)) {
$array["extensions"][$i]["call_timeout"] = $call_timeout;
}
if (permission_exists("extension_call_group")) {
@@ -496,7 +496,7 @@
$array["extensions"][$i]["sip_force_contact"] = $sip_force_contact;
$array["extensions"][$i]["sip_force_expires"] = $sip_force_expires;
if (permission_exists('extension_nibble_account')) {
if (strlen($nibble_account) > 0) {
if (!empty($nibble_account)) {
$array["extensions"][$i]["nibble_account"] = $nibble_account;
}
}
@@ -541,16 +541,16 @@
}
//determine the name
if (strlen($effective_caller_id_name) > 0) {
if (!empty($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;
}
elseif (strlen($directory_first_name) > 0) {
elseif (!empty($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;
}
else {
@@ -604,7 +604,7 @@
$array["devices"][$j]["device_mac_address"] = $device_mac_address;
$array["devices"][$j]["device_label"] = $extension;
$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_enabled"] = "true";
@@ -639,7 +639,7 @@
//add or update voicemail
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
//set the voicemail password
if (strlen($voicemail_password) == 0) {
if (empty($voicemail_password)) {
$voicemail_password = generate_password($_SESSION['voicemail']['password_length']['numeric'], 1);
}
@@ -702,12 +702,12 @@
$extension++;
$voicemail_id = $extension;
if (strlen($number_alias) > 0) {
if (!empty($number_alias)) {
$number_alias++;
$voicemail_id = $number_alias;
}
if (strlen($mwi_account) > 0) {
if (!empty($mwi_account)) {
$mwi_account_array = explode('@', $mwi_account);
$mwi_account_array[0]++;
$mwi_account = implode('@', $mwi_account_array);
@@ -733,7 +733,7 @@
}
//update device key label
if (strlen($effective_caller_id_name) > 0) {
if (!empty($effective_caller_id_name)) {
$sql = "update v_device_keys set ";
$sql .= "device_key_label = :device_key_label ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -772,7 +772,7 @@
}
//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')) {
$prov = new provision;
$prov->domain_uuid = $domain_uuid;
@@ -790,7 +790,7 @@
}
$cache = new cache;
$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);
}
@@ -870,7 +870,7 @@
unset($sql, $parameters, $row);
//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);
}
@@ -997,17 +997,17 @@
$toll_allow = str_replace(':',',', $toll_allow);
//set the defaults
if (strlen($user_context) == 0) { $user_context = $_SESSION['domain_name']; }
if (strlen($max_registrations) == 0) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric']; }
if (strlen($accountcode) == 0) { $accountcode = get_accountcode(); }
if (strlen($limit_max) == 0) { $limit_max = '5'; }
if (strlen($limit_destination) == 0) { $limit_destination = '!USER_BUSY'; }
if (strlen($call_timeout) == 0) { $call_timeout = '30'; }
if (strlen($call_screen_enabled) == 0) { $call_screen_enabled = 'false'; }
if (strlen($user_record) == 0) { $user_record = $_SESSION['extension']['user_record_default']['text']; }
if (strlen($voicemail_transcription_enabled) == 0) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; }
if (strlen($voicemail_enabled) == 0) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; }
if (strlen($enabled) == 0) { $enabled = 'true'; }
if (empty($user_context)) { $user_context = $_SESSION['domain_name']; }
if (empty($max_registrations)) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric']; }
if (empty($accountcode)) { $accountcode = get_accountcode(); }
if (empty($limit_max)) { $limit_max = '5'; }
if (empty($limit_destination)) { $limit_destination = '!USER_BUSY'; }
if (empty($call_timeout)) { $call_timeout = '30'; }
if (empty($call_screen_enabled)) { $call_screen_enabled = 'false'; }
if (empty($user_record)) { $user_record = $_SESSION['extension']['user_record_default']['text']; }
if (empty($voicemail_transcription_enabled)) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; }
if (empty($voicemail_enabled)) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; }
if (empty($enabled)) { $enabled = 'true'; }
//create token
$object = new token;
@@ -1334,7 +1334,7 @@
echo " <option value=''></option>\n";
if (is_array($devices) && @sizeof($devices) != 0) {
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;
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";
foreach ($destinations as &$row) {
$tmp = $row["destination_caller_id_name"];
if(strlen($tmp) == 0){
if(empty($tmp)){
// $tmp = $row["destination_description"];
}
if(strlen($tmp) > 0 && !in_array($tmp, $in_list)){
if(!empty($tmp) && !in_array($tmp, $in_list)){
$in_list[] = $tmp;
if ($outbound_caller_id_name == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
@@ -1467,10 +1467,10 @@
echo " <option value=''></option>\n";
foreach ($destinations as &$row) {
$tmp = $row["destination_caller_id_number"];
if(strlen($tmp) == 0){
if(empty($tmp)){
$tmp = $row["destination_number"];
}
if(strlen($tmp) > 0){
if(!empty($tmp)){
if ($outbound_caller_id_number == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
}
@@ -1508,10 +1508,10 @@
echo " <option value=''></option>\n";
foreach ($emergency_destinations as &$row) {
$tmp = $row["destination_caller_id_name"];
if(strlen($tmp) == 0){
if(empty($tmp)){
$tmp = $row["destination_description"];
}
if(strlen($tmp) > 0){
if(!empty($tmp)){
if ($emergency_caller_id_name == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
}
@@ -1554,10 +1554,10 @@
}
foreach ($emergency_destinations as &$row) {
$tmp = $row["destination_caller_id_number"];
if(strlen($tmp) == 0){
if(empty($tmp)){
$tmp = $row["destination_number"];
}
if(strlen($tmp) > 0){
if(!empty($tmp)){
if ($emergency_caller_id_number == $tmp) {
echo " <option value='".escape($tmp)."' selected='selected'>".escape($tmp)."</option>\n";
}
+6 -6
View File
@@ -51,7 +51,7 @@
$fp = fopen("php://memory", 'r+');
fputs($fp, $input);
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);
return $data;
}
@@ -84,7 +84,7 @@
}
//get the schema
if (strlen($delimiter) > 0) {
if (!empty($delimiter)) {
//get the first line
$line = fgets(fopen($_SESSION['file'], 'r'));
$line_fields = explode($delimiter, $line);
@@ -132,7 +132,7 @@
}
//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
$token = new token;
@@ -236,7 +236,7 @@
}
//upload the csv
if (file_exists($_SESSION['file']) && $action == 'import') {
if (file_exists($_SESSION['file'] ?? '') && $action == 'import') {
//validate the token
$token = new token;
@@ -297,8 +297,8 @@
}
//build the data array
if (strlen($table_name) > 0) {
if (strlen($parent) == 0) {
if (!empty($table_name)) {
if (empty($parent)) {
$array[$table_name][$row_id]['domain_uuid'] = $domain_uuid;
$array[$table_name][$row_id][$field_name] = $result[$key];
}
+2 -2
View File
@@ -95,7 +95,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
//add the search term
$search = strtolower($_GET["search"]);
if (strlen($search) > 0) {
if (!empty($search)) {
$sql_search = " and ( ";
$sql_search .= "lower(extension) like :search ";
$sql_search .= "or lower(number_alias) like :search ";
@@ -315,7 +315,7 @@ if (is_numeric($_SESSION['limit']['extensions']['numeric'])) {
echo " <td>";
$extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
$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'];
}
$found_count = 0;
+44 -44
View File
@@ -216,8 +216,8 @@ if (!class_exists('extension')) {
$tmp_array = explode(",", $call_group);
foreach ($tmp_array as &$tmp_call_group) {
$tmp_call_group = trim($tmp_call_group);
if (strlen($tmp_call_group) > 0) {
if (strlen($call_group_array[$tmp_call_group]) == 0) {
if (!empty($tmp_call_group)) {
if (empty($call_group_array[$tmp_call_group])) {
$call_group_array[$tmp_call_group] = $row['extension'];
}
else {
@@ -239,8 +239,8 @@ if (!class_exists('extension')) {
$extension = str_replace(" ", "_", $extension);
$extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension);
$dial_string = $row['dial_string'];
if (strlen($dial_string) == 0) {
if (strlen($_SESSION['domain']['dial_string']['text']) > 0) {
if (empty($dial_string)) {
if (!empty($_SESSION['domain']['dial_string']['text'])) {
$dial_string = $_SESSION['domain']['dial_string']['text'];
}
else {
@@ -254,11 +254,11 @@ if (!class_exists('extension')) {
$xml .= "<include>\n";
$cidr = '';
if (strlen($row['cidr']) > 0) {
if (!empty($row['cidr'])) {
$cidr = " cidr=\"" . $row['cidr'] . "\"";
}
$number_alias = '';
if (strlen($row['number_alias']) > 0) {
if (!empty($row['number_alias'])) {
$number_alias = " number-alias=\"".$row['number_alias']."\"";
}
$xml .= " <user id=\"".$row['extension']."\"".$cidr."".$number_alias.">\n";
@@ -281,7 +281,7 @@ if (!class_exists('extension')) {
default:
$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";
switch ($row['voicemail_file']) {
case "attach":
@@ -303,13 +303,13 @@ if (!class_exists('extension')) {
$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";
}
if (strlen($row['auth_acl']) > 0) {
if (!empty($row['auth_acl'])) {
$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=\"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_uuid\" value=\"" . $_SESSION['domain_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";
}
if (strlen($row['user_record']) > 0) {
if (!empty($row['user_record'])) {
$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=\"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";
}
if (strlen($switch_account_code) > 0) {
if (!empty($switch_account_code)) {
$xml .= " <variable name=\"accountcode\" value=\"" . $switch_account_code . "\"/>\n";
}
else {
$xml .= " <variable name=\"accountcode\" value=\"" . $row['accountcode'] . "\"/>\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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
if (strlen($row['directory_visible']) > 0) {
if (!empty($row['directory_visible'])) {
$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";
}
else {
$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";
}
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";
}
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";
}
if (strlen($row['nibble_account']) > 0) {
if (!empty($row['nibble_account'])) {
$xml .= " <variable name=\"nibble_account\" value=\"" . $row['nibble_account'] . "\"/>\n";
}
switch ($row['sip_bypass_media']) {
@@ -391,35 +391,35 @@ if (!class_exists('extension')) {
$xml .= " <variable name=\"proxy_media\" value=\"true\"/>\n";
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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";
}
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 .= " </variables>\n";
@@ -428,7 +428,7 @@ if (!class_exists('extension')) {
if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) {
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");
}
$xml .= "</include>\n";
@@ -496,7 +496,7 @@ if (!class_exists('extension')) {
foreach ($call_group_array as $key => $value) {
$call_group = trim($key);
$extension_list = trim($value);
if (strlen($call_group) > 0) {
if (!empty($call_group)) {
if ($previous_call_group != $call_group) {
$xml .= " <group name=\"$call_group\">\n";
$xml .= " <users>\n";
@@ -523,7 +523,7 @@ if (!class_exists('extension')) {
$xml .= "</include>";
//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");
fwrite($fout, $xml);
unset($xml);
@@ -662,7 +662,7 @@ if (!class_exists('extension')) {
foreach ($extensions as $x => $extension) {
$cache = new cache;
$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']);
}
}
@@ -764,7 +764,7 @@ if (!class_exists('extension')) {
}
//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')) {
$prov = new provision;
$prov->domain_uuid = $_SESSION['domain_uuid'];
@@ -776,7 +776,7 @@ if (!class_exists('extension')) {
foreach ($extensions as $uuid => $extension) {
$cache = new cache;
$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']);
}
}
@@ -269,7 +269,7 @@
echo "<select class='formfld' name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number_".$x."' style='width: 100%; min-width: 150px;'>\n";
echo " <option value=''></option>\n";
foreach ($destinations as &$field) {
if (strlen($field['destination_caller_id_number']) > 0) {
if (!empty($field['destination_caller_id_number'])) {
echo "<option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' ".($row['outbound_caller_id_number'] == $field['destination_caller_id_number'] ? "selected='selected'" : null).">".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
}
}