diff --git a/app/access_controls/access_control_edit.php b/app/access_controls/access_control_edit.php
index a20eb722ee..0a335a205f 100644
--- a/app/access_controls/access_control_edit.php
+++ b/app/access_controls/access_control_edit.php
@@ -61,7 +61,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"])) {
//enforce valid data
if ($access_control_name == 'providers' || $access_control_name == 'domains') {
@@ -80,7 +80,7 @@
}
//process the http post data by submitted action
- if ($_POST['action'] != '' && strlen($_POST['action']) > 0) {
+ if (!empty($_POST['action'])) {
//prepare the array(s)
$x = 0;
@@ -134,11 +134,11 @@
//check for all required data
$msg = '';
- if (strlen($access_control_name) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_name']."
\n"; }
- if (strlen($access_control_default) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_default']."
\n"; }
- //if (strlen($access_control_nodes) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_nodes']."
\n"; }
- //if (strlen($access_control_description) == 0) { $msg .= $text['message-required']." ".$text['label-access_control_description']."
\n"; }
- if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (empty($access_control_name)) { $msg .= $text['message-required']." ".$text['label-access_control_name']."
\n"; }
+ if (empty($access_control_default)) { $msg .= $text['message-required']." ".$text['label-access_control_default']."
\n"; }
+ //if (empty($access_control_nodes)) { $msg .= $text['message-required']." ".$text['label-access_control_nodes']."
\n"; }
+ //if (empty($access_control_description)) { $msg .= $text['message-required']." ".$text['label-access_control_description']."
\n"; }
+ if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "
| \n";
diff --git a/app/conference_centers/resources/classes/conference_centers.php b/app/conference_centers/resources/classes/conference_centers.php
index 123a798baf..1499288acf 100644
--- a/app/conference_centers/resources/classes/conference_centers.php
+++ b/app/conference_centers/resources/classes/conference_centers.php
@@ -110,7 +110,7 @@ if (!class_exists('conference_centers')) {
$order = $this->order;
//validate order by
- if (strlen($order_by) > 0) {
+ if (!empty($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 ";
$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 ";
}
else {
diff --git a/app/conference_controls/app_defaults.php b/app/conference_controls/app_defaults.php
index b2bca8313e..d3d588cfc8 100644
--- a/app/conference_controls/app_defaults.php
+++ b/app/conference_controls/app_defaults.php
@@ -93,7 +93,7 @@
$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_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_enabled'] = $control_enabled;
diff --git a/app/conference_controls/conference_control_detail_edit.php b/app/conference_controls/conference_control_detail_edit.php
index c2ff10ae6b..e7160c2faf 100644
--- a/app/conference_controls/conference_control_detail_edit.php
+++ b/app/conference_controls/conference_control_detail_edit.php
@@ -44,7 +44,7 @@
}
//process the http post
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid
if ($action == "update") {
@@ -61,11 +61,11 @@
//check for all required data
$msg = '';
- //if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']." \n"; } - if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']." \n"; } - //if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']." \n"; } - if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($control_digits)) { $msg .= $text['message-required']." ".$text['label-control_digits']." \n"; } + if (empty($control_action)) { $msg .= $text['message-required']." ".$text['label-control_action']." \n"; } + //if (empty($control_data)) { $msg .= $text['message-required']." ".$text['label-control_data']." \n"; } + if (empty($control_enabled)) { $msg .= $text['message-required']." ".$text['label-control_enabled']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -131,7 +131,7 @@
}
//set the defaults
- if (strlen($control_enabled) == 0) { $control_enabled = 'true'; }
+ if (empty($control_enabled)) { $control_enabled = 'true'; }
//create token
$object = new token;
diff --git a/app/conference_controls/conference_control_details.php b/app/conference_controls/conference_control_details.php
index 8aab132d78..34108036ac 100644
--- a/app/conference_controls/conference_control_details.php
+++ b/app/conference_controls/conference_control_details.php
@@ -82,7 +82,7 @@
//add the search term
$search = $_GET["search"];
- if (strlen($search) > 0) {
+ if (!empty($search)) {
$sql_search = "and (";
$sql_search .= "control_digits like :search";
$sql_search .= "or control_action like :search";
diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php
index 764785d7d2..d82a0a78e4 100644
--- a/app/conference_controls/conference_control_edit.php
+++ b/app/conference_controls/conference_control_edit.php
@@ -38,7 +38,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"])) {
//get the uuid from the POST
if ($action == "update") {
@@ -55,10 +55,10 @@
//check for all required data
$msg = '';
- if (strlen($control_name) == 0) { $msg .= $text['message-required']." ".$text['label-control_name']." \n"; } - if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']." \n"; } - //if (strlen($control_description) == 0) { $msg .= $text['message-required']." ".$text['label-control_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($control_name)) { $msg .= $text['message-required']." ".$text['label-control_name']." \n"; } + if (empty($control_enabled)) { $msg .= $text['message-required']." ".$text['label-control_enabled']." \n"; } + //if (empty($control_description)) { $msg .= $text['message-required']." ".$text['label-control_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { $document['title'] = $text['title-conference_control']; require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -87,7 +87,7 @@ $database = new database; $database->app_name = 'conference_controls'; $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->save($array); @@ -104,7 +104,7 @@ header("Location: conference_controls.php"); return; } - } //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) + } //(is_array($_POST) && empty($_POST["persistformvar"])) //pre-populate the form if (is_array($_GET) && $_POST["persistformvar"] != "true") { @@ -124,7 +124,7 @@ } //set the defaults - if (strlen($control_enabled) == 0) { $control_enabled = 'true'; } + if (empty($control_enabled)) { $control_enabled = 'true'; } //create token $object = new token; diff --git a/app/conference_controls/conference_controls.php b/app/conference_controls/conference_controls.php index 1fef8af0b9..b886b50994 100644 --- a/app/conference_controls/conference_controls.php +++ b/app/conference_controls/conference_controls.php @@ -86,7 +86,7 @@ //add the search string $search = strtolower($_GET["search"]); - if (strlen($search) > 0) { + if (!empty($search)) { $sql_search = "where ("; $sql_search .= " lower(control_name) like :search "; $sql_search .= " or lower(control_description) like :search "; diff --git a/app/conference_profiles/conference_profile_edit.php b/app/conference_profiles/conference_profile_edit.php index d20f2aeaf2..2b42ed1aca 100644 --- a/app/conference_profiles/conference_profile_edit.php +++ b/app/conference_profiles/conference_profile_edit.php @@ -37,7 +37,7 @@ $profile_description = $_POST["profile_description"]; } //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 if ($action == "update") { @@ -54,10 +54,10 @@ //check for all required data $msg = ''; - if (strlen($profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-profile_name']." \n"; } - if (strlen($profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-profile_enabled']." \n"; } - //if (strlen($profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-profile_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($profile_name)) { $msg .= $text['message-required']." ".$text['label-profile_name']." \n"; } + if (empty($profile_enabled)) { $msg .= $text['message-required']." ".$text['label-profile_enabled']." \n"; } + //if (empty($profile_description)) { $msg .= $text['message-required']." ".$text['label-profile_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { $document['title'] = $text['title-conference_profile']; require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -121,7 +121,7 @@ } //set the defaults - if (strlen($profile_enabled) == 0) { $profile_enabled = 'true'; } + if (empty($profile_enabled)) { $profile_enabled = 'true'; } //create token $object = new token; diff --git a/app/conference_profiles/conference_profile_param_edit.php b/app/conference_profiles/conference_profile_param_edit.php index f371a3b5c0..ccbcefc726 100644 --- a/app/conference_profiles/conference_profile_param_edit.php +++ b/app/conference_profiles/conference_profile_param_edit.php @@ -44,7 +44,7 @@ } //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 if ($action == "update") { @@ -61,10 +61,10 @@ //check for all required data $msg = ''; - if (strlen($profile_param_name) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_name']." \n"; } - if (strlen($profile_param_value) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_value']." \n"; } - if (strlen($profile_param_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-profile_param_enabled']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($profile_param_name)) { $msg .= $text['message-required']." ".$text['label-profile_param_name']." \n"; } + if (empty($profile_param_value)) { $msg .= $text['message-required']." ".$text['label-profile_param_value']." \n"; } + if (empty($profile_param_enabled)) { $msg .= $text['message-required']." ".$text['label-profile_param_enabled']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { $document['title'] = $text['title-conference_profile_param']; require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -129,7 +129,7 @@ } //set the defaults - if (strlen($profile_param_enabled) == 0) { $profile_param_enabled = 'true'; } + if (empty($profile_param_enabled)) { $profile_param_enabled = 'true'; } //create token $object = new token; diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index ad21903cf7..c3f4eca6c4 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -131,7 +131,7 @@ } //process http post variables - if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (count($_POST) > 0 && empty($_POST["persistformvar"])) { //get the conference id if ($action == "add") { @@ -152,16 +152,16 @@ //check for all required data $msg = ''; - //if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID \n"; } - if (strlen($conference_name) == 0) { $msg .= "".$text['confirm-name']." \n"; } - if (strlen($conference_extension) == 0) { $msg .= "".$text['confirm-extension']." \n"; } - //if (strlen($conference_pin_number) == 0) { $msg .= "Please provide: Pin Number \n"; } - if (strlen($conference_profile) == 0) { $msg .= "".$text['confirm-profile']." \n"; } - //if (strlen($conference_flags) == 0) { $msg .= "Please provide: Flags \n"; } - //if (strlen($conference_order) == 0) { $msg .= "Please provide: Order \n"; } - //if (strlen($conference_description) == 0) { $msg .= "Please provide: Description \n"; } - if (strlen($conference_enabled) == 0) { $msg .= "".$text['confirm-enabled']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($dialplan_uuid)) { $msg .= "Please provide: Dialplan UUID \n"; } + if (empty($conference_name)) { $msg .= "".$text['confirm-name']." \n"; } + if (empty($conference_extension)) { $msg .= "".$text['confirm-extension']." \n"; } + //if (empty($conference_pin_number)) { $msg .= "Please provide: Pin Number \n"; } + if (empty($conference_profile)) { $msg .= "".$text['confirm-profile']." \n"; } + //if (empty($conference_flags)) { $msg .= "Please provide: Flags \n"; } + //if (empty($conference_order)) { $msg .= "Please provide: Order \n"; } + //if (empty($conference_description)) { $msg .= "Please provide: Description \n"; } + if (empty($conference_enabled)) { $msg .= "".$text['confirm-enabled']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { $document['title'] = $text['title-conference']; require_once "resources/header.php"; require_once "resources/persist_form_var.php"; @@ -198,7 +198,7 @@ $array['conferences'][0]['conference_enabled'] = $conference_enabled; //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 $dialplan_xml = " | \n";
}
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'];
}
else {
diff --git a/app/conferences_active/conference_exec.php b/app/conferences_active/conference_exec.php
index 590b4391bb..ab37718066 100644
--- a/app/conferences_active/conference_exec.php
+++ b/app/conferences_active/conference_exec.php
@@ -73,7 +73,7 @@
}
//get the conference name
- if (isset($name) && strlen($name) > 0) {
+ if (isset($name) && !empty($name)) {
$name_array = explode('@', $name);
$name = $name_array[0];
}
@@ -182,12 +182,12 @@
//execute the command
if (count($_GET) > 0) {
- if (strlen($cmd) > 0) {
+ if (!empty($cmd)) {
//prepare the switch cmd
$switch_cmd = $cmd . " ";
$switch_cmd .= $name . " ";
$switch_cmd .= $data . " ";
- if ($id && strlen($id) > 0) {
+ if ($id && !empty($id)) {
$switch_cmd .= " ".$id;
}
diff --git a/app/conferences_active/conference_interactive_inc.php b/app/conferences_active/conference_interactive_inc.php
index e2b7001d8c..59ef97d757 100644
--- a/app/conferences_active/conference_interactive_inc.php
+++ b/app/conferences_active/conference_interactive_inc.php
@@ -96,7 +96,7 @@
$member_count = $xml->conference['member-count'];
$locked = $xml->conference['locked'];
$recording = $xml->conference['recording'];
- if (strlen($member_count) == 0) {
+ if (empty($member_count)) {
$member_count = 0;
}
@@ -191,7 +191,7 @@
$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);
- if (strlen($record_path) == 0) {
+ if (empty($record_path)) {
if (permission_exists('conference_interactive_mute')) {
$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)."');\"";
diff --git a/app/contacts/contact_address_edit.php b/app/contacts/contact_address_edit.php
index 1e371c0aa7..d5dfe9edf1 100644
--- a/app/contacts/contact_address_edit.php
+++ b/app/contacts/contact_address_edit.php
@@ -82,7 +82,7 @@
}
//process the form data
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//set the uuid
if ($action == "update") {
@@ -99,7 +99,7 @@
//check for all required data
$msg = '';
- 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 "\n";
echo "
".$text['description-lines']."\n"; } echo " | ";
@@ -1397,7 +1397,7 @@
if (permission_exists('device_key_id')) {
echo " ".$text['label-device_key_id']." | \n"; } - if ($vendor_count > 1 && strlen($row['device_key_vendor']) > 0) { + if ($vendor_count > 1 && !empty($row['device_key_vendor'])) { echo "".ucwords($row['device_key_vendor'])." | \n"; if ($show_key_subtype) { echo "".$text['label-device_key_subtype']." | \n"; @@ -1467,7 +1467,7 @@ echo " \n"; } if ($row['device_key_vendor'] !== "polycom") { - if (strlen($device_vendor) == 0) { + if (empty($device_vendor)) { if ($row['device_key_category'] == "expansion") { echo " \n"; } @@ -1571,7 +1571,7 @@ echo "\n";
//echo " \n";
- if (strlen($row['device_key_vendor']) > 0) {
+ if (!empty($row['device_key_vendor'])) {
$device_key_vendor = $row['device_key_vendor'];
}
else {
@@ -1585,7 +1585,7 @@
$previous_vendor = '';
$i=0;
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 " \n"; }
echo " |
| ".escape($label)." | "; diff --git a/app/devices/device_imports.php b/app/devices/device_imports.php index a6e13c7092..4b1e0e90be 100644 --- a/app/devices/device_imports.php +++ b/app/devices/device_imports.php @@ -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; } @@ -86,7 +86,7 @@ } //get the schema - if (strlen($delimiter) > 0 && file_exists($_SESSION['file'])) { + if (!empty($delimiter) && file_exists($_SESSION['file'] ?? '')) { //get the first line $line = fgets(fopen($_SESSION['file'], 'r')); $line_fields = explode($delimiter, $line); @@ -135,7 +135,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; @@ -239,7 +239,7 @@ } //upload the csv - if (file_exists($_SESSION['file']) && $action == 'import') { + if (file_exists($_SESSION['file'] ?? '') && $action == 'import') { //validate the token $token = new token; @@ -316,8 +316,8 @@ } //build the data array - if (strlen($table_name) > 0) { - if (strlen($parent) == 0) { + if (!empty($table_name)) { + if (empty($parent)) { if ($field_name != "username") { $array[$table_name][$row_id]['domain_uuid'] = $domain_uuid; $array[$table_name][$row_id][$field_name] = $result[$key]; @@ -450,7 +450,7 @@ //view_array($message); } - if (strlen($_SESSION['provision']['path']['text']) > 0) { + if (!empty($_SESSION['provision']['path']['text'])) { $prov = new provision; $prov->domain_uuid = $domain_uuid; $response = $prov->write(); diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 0243fab1b3..8d6f1a680e 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -55,7 +55,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"])) { //process the http post data by submitted action if ($_POST['action'] != '' && is_uuid($_POST['device_profile_uuid'])) { @@ -115,13 +115,13 @@ //check for all required data $msg = ''; - if (strlen($device_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-device_profile_name']."|||||||||||||||||||||||||||||||||||||||||||||||||||||
| "; echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null); diff --git a/app/devices/device_vendor_functions.php b/app/devices/device_vendor_functions.php index b9a0e2e1a0..cd1c6efdf2 100644 --- a/app/devices/device_vendor_functions.php +++ b/app/devices/device_vendor_functions.php @@ -103,7 +103,7 @@ $param = ""; if (isset($_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_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; diff --git a/app/devices/device_vendors.php b/app/devices/device_vendors.php index 7f8942cb3a..97202c2604 100644 --- a/app/devices/device_vendors.php +++ b/app/devices/device_vendors.php @@ -80,7 +80,7 @@ //add the search term $search = strtolower($_GET["search"]); - if (strlen($search) > 0) { + if (!empty($search)) { $sql_where = "where ("; $sql_where .= "lower(name) 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; $param = "&search=".$search; $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_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; diff --git a/app/devices/devices.php b/app/devices/devices.php index a6dbb9c249..84ea960856 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -53,8 +53,8 @@ } //get the search - $search = strtolower($_REQUEST["search"]); - $fields = strtolower($_REQUEST["fields"]); + $search = strtolower($_REQUEST["search"] ?? ''); + $fields = strtolower($_REQUEST["fields"] ?? ''); //process the http post data by action if ($action != '' && is_array($devices) && @sizeof($devices) != 0) { @@ -112,7 +112,7 @@ //prepare to page the results $sql = "select count(*) from v_devices as d "; if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('device_all')) { - if (strlen($search) > 0) { + if (!empty($search)) { $sql .= "where "; } } @@ -123,12 +123,12 @@ $sql .= " or d.domain_uuid is null "; } $sql .= ") "; - if (strlen($search) > 0) { + if (!empty($search)) { $sql .= "and "; } $parameters['domain_uuid'] = $domain_uuid; } - if (strlen($search) > 0) { + if (!empty($search)) { $sql .= "("; $sql .= " lower(d.device_mac_address) like :search "; $sql .= " or lower(d.device_label) like :search "; @@ -178,7 +178,7 @@ $param .= "&show=all"; } $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_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; @@ -214,7 +214,7 @@ $sql .= "and d.device_user_uuid = :user_uuid "; $parameters['user_uuid'] = $_SESSION['user_uuid']; } - if (strlen($search) > 0) { + if (!empty($search)) { $sql .= "and ("; $sql .= " lower(d.device_mac_address) like :search "; $sql .= " or lower(d.device_label) like :search "; @@ -250,7 +250,7 @@ $sql .= ") "; $parameters['search'] = '%'.strtolower($search).'%'; } - if (strlen($order_by) == 0) { + if (empty($order_by)) { $sql .= "order by d.device_label, d.device_description asc "; } else { @@ -421,7 +421,7 @@ echo " | \n"; echo "".escape($row['device_label'])." | \n"; if ($device_alternate) { - if (strlen($row['device_uuid_alternate']) > 0) { + if (!empty($row['device_uuid_alternate'])) { echo "\n"; echo " ".escape($row['alternate_label'])."\n"; echo " | \n"; diff --git a/app/devices/resources/classes/device.php b/app/devices/resources/classes/device.php index fb9c20c326..f07556c813 100644 --- a/app/devices/resources/classes/device.php +++ b/app/devices/resources/classes/device.php @@ -57,7 +57,12 @@ 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 $mac = preg_replace('#[^a-fA-F0-9./]#', '', $mac); $mac = strtolower($mac); @@ -226,7 +231,7 @@ //set the default template directory if (PHP_OS == "Linux") { //set the default template dir - if (strlen($this->template_dir) == 0) { + if (empty($this->template_dir)) { if (file_exists('/usr/share/fusionpbx/templates/provision')) { $this->template_dir = '/usr/share/fusionpbx/templates/provision'; } @@ -240,7 +245,7 @@ } elseif (PHP_OS == "FreeBSD") { //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')) { $this->template_dir = '/usr/local/share/fusionpbx/templates/provision'; } @@ -254,19 +259,19 @@ } elseif (PHP_OS == "NetBSD") { //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'; } } elseif (PHP_OS == "OpenBSD") { //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'; } } else { //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'; } } @@ -346,7 +351,7 @@ $p->delete('device_key_delete', 'temp'); //write the provision files - if (strlen($_SESSION['provision']['path']['text']) > 0) { + if (!empty($_SESSION['provision']['path']['text'])) { $prov = new provision; $prov->domain_uuid = $_SESSION['domain_uuid']; $response = $prov->write(); @@ -853,7 +858,7 @@ unset($array); //write the provision files - if (strlen($_SESSION['provision']['path']['text']) > 0) { + if (!empty($_SESSION['provision']['path']['text'])) { $prov = new provision; $prov->domain_uuid = $_SESSION['domain_uuid']; $response = $prov->write(); diff --git a/app/devices/resources/dashboard/device_keys.php b/app/devices/resources/dashboard/device_keys.php index 8a9de465da..b01d1f32b7 100644 --- a/app/devices/resources/dashboard/device_keys.php +++ b/app/devices/resources/dashboard/device_keys.php @@ -66,7 +66,7 @@ unset($sql, $sql_where_or, $parameters); //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 if ($_POST["persistformvar"] != "true") { @@ -189,7 +189,7 @@ $device_key_vendor = $row["device_key_vendor"]; //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 foreach ($device_profile_keys as &$field) { if ($device_key_uuid == $field["device_key_uuid"]) { @@ -213,10 +213,10 @@ //sql add or update 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 (strlen($device_uuid) == 0) { + if (empty($device_uuid)) { $sql = "select device_uuid from v_devices "; $sql .= "where device_user_uuid = :device_user_uuid "; $parameters['device_user_uuid'] = $_SESSION['user_uuid']; @@ -281,7 +281,7 @@ } //write the provision files - if (strlen($_SESSION['provision']['path']['text']) > 0) { + if (!empty($_SESSION['provision']['path']['text'])) { $prov = new provision; $prov->domain_uuid = $domain_uuid; $response = $prov->write(); @@ -465,7 +465,7 @@ if ($previous_device_key_vendor != $row['device_key_vendor'] || $row['device_key_vendor'] == '') { echo "|||||||||||||||||||||||
| ".$text['label-device_key_id']." | \n"; - if (strlen($row['device_key_vendor']) > 0) { + if (!empty($row['device_key_vendor'])) { echo "".ucwords($row['device_key_vendor'])." | \n"; } else { @@ -480,7 +480,7 @@ } //determine whether to hide the element - if (strlen($device_key_uuid) == 0) { + if (empty($device_key_uuid)) { $element['hidden'] = false; $element['visibility'] = "visibility:visible;"; } @@ -490,7 +490,7 @@ } //add the primary key uuid - if (strlen($row['device_key_uuid']) > 0) { + if (!empty($row['device_key_uuid'])) { echo " \n"; } @@ -518,7 +518,7 @@ else { echo " \n"; } - if (strlen($device_vendor) == 0) { + if (empty($device_vendor)) { if ($row['device_key_category'] == "expansion") { echo " \n"; } @@ -585,7 +585,7 @@ $i = 0; if (is_array($vendor_functions)) { 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 " \n"; } @@ -595,17 +595,17 @@ if ($row['device_key_vendor'] == $function['vendor_name'] && $row['device_key_type'] == $function['value']) { $selected = "selected='selected'"; } - if (strlen($row['device_key_vendor']) == 0) { + if (empty($row['device_key_vendor'])) { echo " \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 " \n"; } $previous_vendor = $function['vendor_name']; $i++; } } - if (strlen($row['device_key_vendor']) == 0) { + if (empty($row['device_key_vendor'])) { echo " \n"; } echo " \n"; diff --git a/app/dialplan_inbound/app_defaults.php b/app/dialplan_inbound/app_defaults.php index 94eb8378a8..6b4b509097 100644 --- a/app/dialplan_inbound/app_defaults.php +++ b/app/dialplan_inbound/app_defaults.php @@ -51,7 +51,7 @@ //if the public directory doesn't exist then create it 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')) { 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 (count($_SESSION["domains"]) > 1) { //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'])) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'], 0770, false); } diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index d3a90f3ba1..dc40e625c9 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -111,7 +111,7 @@ //allow users with group advanced control, not always superadmin. You may change this in group permissions } 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)) { //the number is numeric $condition_expression_1 = str_replace("+", "\+", $condition_expression_1); @@ -120,11 +120,11 @@ } $dialplan_enabled = $_POST["dialplan_enabled"]; $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 - if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (count($_POST) > 0 && empty($_POST["persistformvar"])) { //validate the token $token = new token; @@ -135,15 +135,15 @@ } //check for all required data - if (strlen($domain_uuid) == 0) { $msg .= "".$text['label-required-domain_uuid']."\n";
echo " | \n";
echo " | \n";
echo " \n"; } - if (strlen($dialplan_order) == 0) { $msg .= $text['message-required'].$text['label-order']." \n"; } - if (strlen($dialplan_continue) == 0) { $msg .= $text['message-required'].$text['label-continue']." \n"; } - if (strlen($dialplan_context) == 0) { $msg .= $text['message-required'].$text['label-context']." \n"; } - if (strlen($dialplan_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']." \n"; } - //if (strlen($dialplan_description) == 0) { $msg .= $text['message-required'].$text['label-description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($dialplan_name)) { $msg .= $text['message-required'].$text['label-name']." \n"; } + if (empty($dialplan_order)) { $msg .= $text['message-required'].$text['label-order']." \n"; } + if (empty($dialplan_continue)) { $msg .= $text['message-required'].$text['label-continue']." \n"; } + if (empty($dialplan_context)) { $msg .= $text['message-required'].$text['label-context']." \n"; } + if (empty($dialplan_enabled)) { $msg .= $text['message-required'].$text['label-enabled']." \n"; } + //if (empty($dialplan_description)) { $msg .= $text['message-required'].$text['label-description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -242,8 +242,8 @@
$y = 0;
if (is_array($_POST["dialplan_details"])) {
foreach ($_POST["dialplan_details"] as $row) {
- if (strlen($row["dialplan_detail_tag"]) > 0) {
- if (strlen($row["dialplan_detail_uuid"]) > 0) {
+ if (!empty($row["dialplan_detail_tag"])) {
+ if (!empty($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"])) {
@@ -323,7 +323,7 @@
header("Location: ?id=".escape($dialplan_uuid).(is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null));
exit;
- } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
+ } //(count($_POST)>0 && empty($_POST["persistformvar"]))
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
@@ -348,13 +348,13 @@
}
//set the defaults
- if (strlen($dialplan_context) == 0) {
+ if (empty($dialplan_context)) {
$dialplan_context = $_SESSION['domain_name'];
}
- if (strlen($dialplan_order) == 0) {
+ if (empty($dialplan_order)) {
$dialplan_order = '200';
}
- if (strlen($dialplan_destination) == 0) {
+ if (empty($dialplan_destination)) {
$dialplan_destination = 'false';
}
@@ -813,7 +813,7 @@
$dialplan_detail_enabled = $row['dialplan_detail_enabled'];
//default to enabled true
- if (strlen($dialplan_detail_enabled) == 0) {
+ if (empty($dialplan_detail_enabled)) {
$dialplan_detail_enabled = 'true';
}
@@ -823,7 +823,7 @@
//begin the row
echo " ".((strlen($row['dialplan_number']) > 0) ? escape(format_phone($row['dialplan_number'])) : " ")." | \n";
+ echo " ".((!empty($row['dialplan_number'])) ? escape(format_phone($row['dialplan_number'])) : " ")." | \n";
if (permission_exists('dialplan_context')) {
echo " ".escape($row['dialplan_context'])." | \n";
}
diff --git a/app/dialplans/resources/classes/dialplan.php b/app/dialplans/resources/classes/dialplan.php
index 164807dd92..76eab3e775 100644
--- a/app/dialplans/resources/classes/dialplan.php
+++ b/app/dialplans/resources/classes/dialplan.php
@@ -130,7 +130,7 @@
//build update array
$array['dialplans'][0]['dialplan_uuid'] = $this->dialplan_uuid;
$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_order'] = $this->dialplan_order;
@@ -188,7 +188,7 @@
$xml_string = file_get_contents($xml_file);
//prepare the xml
- if (strlen($xml_string) > 0) {
+ if (!empty($xml_string)) {
//replace the variables
$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);
@@ -200,7 +200,7 @@
//convert to an array
$dialplan = json_decode($json, true);
}
- if (strlen($this->json) > 0) {
+ if (!empty($this->json)) {
//convert to an array
$dialplan = json_decode($json, true);
}
@@ -232,7 +232,7 @@
$xml_string = file_get_contents($xml_file);
//prepare the xml
- if (strlen($xml_string) > 0) {
+ if (!empty($xml_string)) {
//replace the variables
$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);
@@ -248,7 +248,7 @@
$dialplan = json_decode($json, true);
}
- if (strlen($this->json) > 0) {
+ if (!empty($this->json)) {
//convert to an array
$dialplan = json_decode($json, true);
}
@@ -302,14 +302,14 @@
$array['dialplans'][$x]['dialplan_name'] = $dialplan['@attributes']['name'];
$array['dialplans'][$x]['dialplan_number'] = $dialplan['@attributes']['number'];
$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'];
}
- if (strlen($dialplan['@attributes']['continue']) > 0) {
+ if (!empty($dialplan['@attributes']['continue'])) {
$array['dialplans'][$x]['dialplan_continue'] = $dialplan['@attributes']['continue'];
}
$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'];
}
else {
@@ -330,7 +330,7 @@
$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_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_group'] = $group;
@@ -367,7 +367,7 @@
$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_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'];
}
else {
@@ -394,7 +394,7 @@
$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_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'];
}
else {
@@ -522,7 +522,7 @@
$array[$x]['dialplan_order'] = $row['dialplan_order'];
$array[$x]['dialplan_enabled'] = $row['dialplan_enabled'];
$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_detail_uuid'] = $row['dialplan_detail_uuid'];
$array[$x]['dialplan_details'][$y]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
@@ -714,7 +714,7 @@
//get the dialplan detail inline
$detail_inline = "";
if ($dialplan_detail_inline) {
- if (strlen($dialplan_detail_inline) > 0) {
+ if (!empty($dialplan_detail_inline)) {
$detail_inline = " inline=\"" . $dialplan_detail_inline . "\"";
}
}
@@ -723,12 +723,12 @@
if ($dialplan_tag_status != "closed") {
if (($previous_dialplan_uuid != $dialplan_uuid) || ($previous_dialplan_detail_group != $dialplan_detail_group)) {
if ($condition_tag_status != "closed") {
- if ($condition_attribute && (strlen($condition_attribute) > 0)) {
+ if ($condition_attribute && (!empty($condition_attribute))) {
$xml .= " \n"; } - //if (strlen($email_from) == 0) { $msg .= $text['message-required']." ".$text['label-email_from']." \n"; } - //if (strlen($email_to) == 0) { $msg .= $text['message-required']." ".$text['label-email_to']." \n"; } - //if (strlen($email_subject) == 0) { $msg .= $text['message-required']." ".$text['label-email_subject']." \n"; } - //if (strlen($email_body) == 0) { $msg .= $text['message-required']." ".$text['label-email_body']." \n"; } - //if (strlen($email_status) == 0) { $msg .= $text['message-required']." ".$text['label-email_status']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($email_date)) { $msg .= $text['message-required']." ".$text['label-email_date']." \n"; } + //if (empty($email_from)) { $msg .= $text['message-required']." ".$text['label-email_from']." \n"; } + //if (empty($email_to)) { $msg .= $text['message-required']." ".$text['label-email_to']." \n"; } + //if (empty($email_subject)) { $msg .= $text['message-required']." ".$text['label-email_subject']." \n"; } + //if (empty($email_body)) { $msg .= $text['message-required']." ".$text['label-email_body']." \n"; } + //if (empty($email_status)) { $msg .= $text['message-required']." ".$text['label-email_status']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/email_queue/resources/functions/transcribe.php b/app/email_queue/resources/functions/transcribe.php
index 1a09ebd175..82c8705197 100644
--- a/app/email_queue/resources/functions/transcribe.php
+++ b/app/email_queue/resources/functions/transcribe.php
@@ -122,10 +122,10 @@ if (!function_exists('transcribe')) {
$transcribe_language = $_SESSION['voicemail']['transcribe_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';
}
- if (!isset($transcribe_alternate_language) && strlen($transcribe_alternate_language) == 0) {
+ if (!isset($transcribe_alternate_language) && empty($transcribe_alternate_language)) {
$transcribe_alternate_language = 'es-Us';
}
if ($file_extension == "mp3") {
@@ -183,7 +183,7 @@ if (!function_exists('transcribe')) {
$api_key = $_SESSION['voicemail']['azure_key']['text'];
$api_url = $_SESSION['voicemail']['azure_server_region']['text'];
- if (strlen($transcribe_language) == 0) {
+ if (empty($transcribe_language)) {
$transcribe_language = 'en-US';
}
@@ -197,7 +197,7 @@ if (!function_exists('transcribe')) {
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."\"";
$access_token_result = shell_exec($command);
- if (strlen($access_token_result) == 0) {
+ if (empty($access_token_result)) {
return false;
}
else {
@@ -229,7 +229,7 @@ if (!function_exists('transcribe')) {
$api_key = $_SESSION['voicemail']['api_key']['text'];
$api_url = $_SESSION['voicemail']['transcription_server']['text'];
- if (strlen($transcribe_language) == 0) {
+ if (empty($transcribe_language)) {
$transcribe_language = 'en-US';
}
diff --git a/app/email_queue/resources/jobs/email_send.php b/app/email_queue/resources/jobs/email_send.php
index 151cd15113..01f3d4a4bf 100644
--- a/app/email_queue/resources/jobs/email_send.php
+++ b/app/email_queue/resources/jobs/email_send.php
@@ -150,7 +150,7 @@
//$retry_interval = $_SESSION['email_queue']['retry_interval']['numeric'];
//set defaults
- if (strlen($email_retry_count) == 0) {
+ if (empty($email_retry_count)) {
$email_retry_count = 0;
}
diff --git a/app/email_templates/email_template_edit.php b/app/email_templates/email_template_edit.php
index b446cf155c..b6e0a25e0a 100644
--- a/app/email_templates/email_template_edit.php
+++ b/app/email_templates/email_template_edit.php
@@ -65,7 +65,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"])) {
//get the uuid from the POST
if ($action == "update") {
@@ -82,16 +82,16 @@
//check for all required data
$msg = '';
- if (strlen($template_language) == 0) { $msg .= $text['message-required']." ".$text['label-template_language']." \n"; } - if (strlen($template_category) == 0) { $msg .= $text['message-required']." ".$text['label-template_category']." \n"; } - //if (strlen($template_subcategory) == 0) { $msg .= $text['message-required']." ".$text['label-template_subcategory']." \n"; } - if (strlen($template_subject) == 0) { $msg .= $text['message-required']." ".$text['label-template_subject']." \n"; } - if (strlen($template_body) == 0) { $msg .= $text['message-required']." ".$text['label-template_body']." \n"; } - //if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } - //if (strlen($template_type) == 0) { $msg .= $text['message-required']." ".$text['label-template_type']." \n"; } - if (strlen($template_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-template_enabled']." \n"; } - //if (strlen($template_description) == 0) { $msg .= $text['message-required']." ".$text['label-template_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($template_language)) { $msg .= $text['message-required']." ".$text['label-template_language']." \n"; } + if (empty($template_category)) { $msg .= $text['message-required']." ".$text['label-template_category']." \n"; } + //if (empty($template_subcategory)) { $msg .= $text['message-required']." ".$text['label-template_subcategory']." \n"; } + if (empty($template_subject)) { $msg .= $text['message-required']." ".$text['label-template_subject']." \n"; } + if (empty($template_body)) { $msg .= $text['message-required']." ".$text['label-template_body']." \n"; } + //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } + //if (empty($template_type)) { $msg .= $text['message-required']." ".$text['label-template_type']." \n"; } + if (empty($template_enabled)) { $msg .= $text['message-required']." ".$text['label-template_enabled']." \n"; } + //if (empty($template_description)) { $msg .= $text['message-required']." ".$text['label-template_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -125,7 +125,7 @@
$database = new database;
$database->app_name = 'email_templates';
$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->save($array);
@@ -169,7 +169,7 @@
}
//set the defaults
- if (strlen($template_enabled) == 0) { $template_enabled = 'true'; }
+ if (empty($template_enabled)) { $template_enabled = 'true'; }
//load editor preferences/defaults
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';
diff --git a/app/email_templates/email_templates.php b/app/email_templates/email_templates.php
index 83ae6ab439..7fbd241a5d 100644
--- a/app/email_templates/email_templates.php
+++ b/app/email_templates/email_templates.php
@@ -92,8 +92,8 @@
}
//add the search term
- $search = strtolower($_GET["search"]);
- if (strlen($search) > 0) {
+ $search = strtolower($_GET["search"] ?? '');
+ if (!empty($search)) {
$sql_search = " (";
$sql_search .= " lower(template_language) like :search ";
//$sql_search .= " or lower(template_category) like :search ";
diff --git a/app/event_guard/event_guard_log_edit.php b/app/event_guard/event_guard_log_edit.php
index 6c72d0e0d5..bedd9c5758 100644
--- a/app/event_guard/event_guard_log_edit.php
+++ b/app/event_guard/event_guard_log_edit.php
@@ -63,7 +63,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"])) {
//validate the token
$token = new token;
@@ -74,7 +74,7 @@
}
//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)
//send the array to the database class
@@ -108,14 +108,14 @@
//check for all required data
$msg = '';
- if (strlen($hostname) == 0) { $msg .= $text['message-required']." ".$text['label-hostname']." \n"; } - if (strlen($log_date) == 0) { $msg .= $text['message-required']." ".$text['label-log_date']." \n"; } - if (strlen($filter) == 0) { $msg .= $text['message-required']." ".$text['label-filter']." \n"; } - if (strlen($ip_address) == 0) { $msg .= $text['message-required']." ".$text['label-ip_address']." \n"; } - if (strlen($extension) == 0) { $msg .= $text['message-required']." ".$text['label-extension']." \n"; } - //if (strlen($user_agent) == 0) { $msg .= $text['message-required']." ".$text['label-user_agent']." \n"; } - if (strlen($log_status) == 0) { $msg .= $text['message-required']." ".$text['label-log_status']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($hostname)) { $msg .= $text['message-required']." ".$text['label-hostname']." \n"; } + if (empty($log_date)) { $msg .= $text['message-required']." ".$text['label-log_date']." \n"; } + if (empty($filter)) { $msg .= $text['message-required']." ".$text['label-filter']." \n"; } + if (empty($ip_address)) { $msg .= $text['message-required']." ".$text['label-ip_address']." \n"; } + if (empty($extension)) { $msg .= $text['message-required']." ".$text['label-extension']." \n"; } + //if (empty($user_agent)) { $msg .= $text['message-required']." ".$text['label-user_agent']." \n"; } + if (empty($log_status)) { $msg .= $text['message-required']." ".$text['label-log_status']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/extension_settings/extension_setting_edit.php b/app/extension_settings/extension_setting_edit.php
index 71dd53842e..f294a1719b 100644
--- a/app/extension_settings/extension_setting_edit.php
+++ b/app/extension_settings/extension_setting_edit.php
@@ -71,7 +71,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"])) {
//validate the token
$token = new token;
@@ -82,7 +82,7 @@
}
//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)
//send the array to the database class
@@ -116,13 +116,13 @@
//check for all required data
$msg = '';
- //if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } - if (strlen($extension_setting_type) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']." \n"; } - if (strlen($extension_setting_name) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']." \n"; } - //if (strlen($extension_setting_value) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']." \n"; } - if (strlen($extension_setting_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']." \n"; } - //if (strlen($extension_setting_description) == 0) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } + if (empty($extension_setting_type)) { $msg .= $text['message-required']." ".$text['label-extension_setting_type']." \n"; } + if (empty($extension_setting_name)) { $msg .= $text['message-required']." ".$text['label-extension_setting_name']." \n"; } + //if (empty($extension_setting_value)) { $msg .= $text['message-required']." ".$text['label-extension_setting_value']." \n"; } + if (empty($extension_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-extension_setting_enabled']." \n"; } + //if (empty($extension_setting_description)) { $msg .= $text['message-required']." ".$text['label-extension_setting_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -214,7 +214,7 @@
}
//set the defaults
- if (strlen($extension_setting_enabled) == 0) { $extension_setting_enabled = 'true'; }
+ if (empty($extension_setting_enabled)) { $extension_setting_enabled = 'true'; }
//create token
$object = new token;
@@ -265,7 +265,7 @@
//echo "\n";
//echo " \n";
//echo " | \n";
}
if ($_GET['show'] == "all" && permission_exists('recording_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'];
}
else {
diff --git a/app/recordings/resources/classes/switch_recordings.php b/app/recordings/resources/classes/switch_recordings.php
index a0f94d5dae..f10c5e5306 100644
--- a/app/recordings/resources/classes/switch_recordings.php
+++ b/app/recordings/resources/classes/switch_recordings.php
@@ -135,7 +135,7 @@ if (!class_exists('switch_recordings')) {
//delete recording files
if (is_array($filenames) && @sizeof($filenames) != 0) {
foreach ($filenames as $filename) {
- if (isset($filename) && strlen($filename) > 0 && file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename)) {
+ if (isset($filename) && !empty($filename) && file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename)) {
@unlink($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$filename);
}
}
diff --git a/app/registrations/registration_reload.php b/app/registrations/registration_reload.php
index 77783bb0b0..aa2ec790a1 100644
--- a/app/registrations/registration_reload.php
+++ b/app/registrations/registration_reload.php
@@ -100,7 +100,7 @@
var url = 'registrations.php?reload&show=';
new loadXmlHttp(url, 'ajax_response');
}
diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php
index 47b7f4d994..0f89866d16 100644
--- a/app/ring_groups/ring_group_edit.php
+++ b/app/ring_groups/ring_group_edit.php
@@ -234,7 +234,7 @@
}
//process the HTTP POST
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token
$token = new token;
@@ -246,17 +246,17 @@
//check for all required data
$msg = '';
- if (strlen($ring_group_name) == 0) { $msg .= $text['message-name']."\n"; } + if (empty($extension)) { $msg .= $text['message-required'].$text['label-extension']." \n"; } if (permission_exists('extension_enabled')) { - if (strlen($enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']." \n"; } + if (empty($enabled)) { $msg .= $text['message-required'].$text['label-enabled']." \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 " \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 " \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 " \n";
}
@@ -1425,10 +1425,10 @@
echo " \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 " \n";
@@ -1467,10 +1467,10 @@
echo " \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 " \n";
}
@@ -1508,10 +1508,10 @@
echo " \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 " \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 " \n";
}
diff --git a/app/extensions/extension_imports.php b/app/extensions/extension_imports.php
index 4dd62c1a73..33634d7e5b 100644
--- a/app/extensions/extension_imports.php
+++ b/app/extensions/extension_imports.php
@@ -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];
}
diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php
index 9ff8f69dd1..87453779a0 100644
--- a/app/extensions/extensions.php
+++ b/app/extensions/extensions.php
@@ -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 " ";
$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;
diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php
index 87443bc135..79c4b6c76c 100644
--- a/app/extensions/resources/classes/extension.php
+++ b/app/extensions/resources/classes/extension.php
@@ -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 .= " | \n";
echo "\n"; } - if (strlen($fax_name) == 0) { $msg .= "".$text['confirm-fax']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($fax_extension)) { $msg .= "".$text['confirm-ext']." \n"; } + if (empty($fax_name)) { $msg .= "".$text['confirm-fax']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -343,11 +343,11 @@
$array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
$array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number;
$array['fax'][0]['fax_toll_allow'] = $fax_toll_allow;
- if ($action == "add" && strlen($fax_forward_number) > 0) {
+ if ($action == "add" && !empty($fax_forward_number)) {
$array['fax'][0]['fax_forward_number'] = $fax_forward_number;
}
if ($action == "update") {
- $array['fax'][0]['fax_forward_number'] = strlen($fax_forward_number) > 0 ? $fax_forward_number : null;
+ $array['fax'][0]['fax_forward_number'] = !empty($fax_forward_number) ? $fax_forward_number : null;
}
if (permission_exists('fax_send_greeting')) {
$array['fax'][0]['fax_send_greeting'] = strlen($fax_send_greeting) != 0 ? $fax_send_greeting : null;
@@ -775,7 +775,7 @@
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file[0] != '.') {
if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) {
- $selected = ($fax_send_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($fax_send_greeting) > 0) ? true : false;
+ $selected = ($fax_send_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && !empty($fax_send_greeting)) ? true : false;
echo " \n";
if ($selected) { $tmp_selected = true; }
}
@@ -805,7 +805,7 @@
if (is_array($sound_files)) {
echo " \n"; } - if (strlen($fax_date) == 0) { $msg .= $text['message-required']." ".$text['label-fax_date']." \n"; } - if (strlen($hostname) == 0) { $msg .= $text['message-required']." ".$text['label-hostname']." \n"; } - //if (strlen($fax_caller_id_name) == 0) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_name']." \n"; } - //if (strlen($fax_caller_id_number) == 0) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_number']." \n"; } - if (strlen($fax_number) == 0) { $msg .= $text['message-required']." ".$text['label-fax_number']." \n"; } - //if (strlen($fax_prefix) == 0) { $msg .= $text['message-required']." ".$text['label-fax_prefix']." \n"; } - //if (strlen($fax_email_address) == 0) { $msg .= $text['message-required']." ".$text['label-fax_email_address']." \n"; } - if (strlen($fax_file) == 0) { $msg .= $text['message-required']." ".$text['label-fax_file']." \n"; } - if (strlen($fax_status) == 0) { $msg .= $text['message-required']." ".$text['label-fax_status']." \n"; } - //if (strlen($fax_retry_date) == 0) { $msg .= $text['message-required']." ".$text['label-fax_retry_date']." \n"; } - //if (strlen($fax_retry_count) == 0) { $msg .= $text['message-required']." ".$text['label-fax_retry_count']." \n"; } - //if (strlen($fax_accountcode) == 0) { $msg .= $text['message-required']." ".$text['label-fax_accountcode']." \n"; } - //if (strlen($fax_command) == 0) { $msg .= $text['message-required']." ".$text['label-fax_command']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($fax_uuid)) { $msg .= $text['message-required']." ".$text['label-fax_uuid']." \n"; } + if (empty($fax_date)) { $msg .= $text['message-required']." ".$text['label-fax_date']." \n"; } + if (empty($hostname)) { $msg .= $text['message-required']." ".$text['label-hostname']." \n"; } + //if (empty($fax_caller_id_name)) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_name']." \n"; } + //if (empty($fax_caller_id_number)) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_number']." \n"; } + if (empty($fax_number)) { $msg .= $text['message-required']." ".$text['label-fax_number']." \n"; } + //if (empty($fax_prefix)) { $msg .= $text['message-required']." ".$text['label-fax_prefix']." \n"; } + //if (empty($fax_email_address)) { $msg .= $text['message-required']." ".$text['label-fax_email_address']." \n"; } + if (empty($fax_file)) { $msg .= $text['message-required']." ".$text['label-fax_file']." \n"; } + if (empty($fax_status)) { $msg .= $text['message-required']." ".$text['label-fax_status']." \n"; } + //if (empty($fax_retry_date)) { $msg .= $text['message-required']." ".$text['label-fax_retry_date']." \n"; } + //if (empty($fax_retry_count)) { $msg .= $text['message-required']." ".$text['label-fax_retry_count']." \n"; } + //if (empty($fax_accountcode)) { $msg .= $text['message-required']." ".$text['label-fax_accountcode']." \n"; } + //if (empty($fax_command)) { $msg .= $text['message-required']." ".$text['label-fax_command']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/fax_queue/resources/job/fax_send.php b/app/fax_queue/resources/job/fax_send.php
index 4de8d9b669..935f114c9e 100644
--- a/app/fax_queue/resources/job/fax_send.php
+++ b/app/fax_queue/resources/job/fax_send.php
@@ -263,10 +263,10 @@
//prepare the smtp from and from name variables
$email_from = $_SESSION['email']['smtp_from']['text'];
$email_from_name = $_SESSION['email']['smtp_from_name']['text'];
- if (isset($_SESSION['fax']['smtp_from']['text']) && strlen($_SESSION['fax']['smtp_from']['text']) > 0) {
+ if (isset($_SESSION['fax']['smtp_from']['text']) && !empty($_SESSION['fax']['smtp_from']['text'])) {
$email_from = $_SESSION['fax']['smtp_from']['text'];
}
- if (isset($_SESSION['fax']['smtp_from_name']['text']) && strlen($_SESSION['fax']['smtp_from_name']['text']) > 0) {
+ if (isset($_SESSION['fax']['smtp_from_name']['text']) && !empty($_SESSION['fax']['smtp_from_name']['text'])) {
$email_from_name = $_SESSION['fax']['smtp_from_name']['text'];
}
@@ -276,7 +276,7 @@
//$retry_interval = $_SESSION['fax_queue']['retry_interval']['numeric'];
//prepare the fax retry count
- if (strlen($fax_retry_count) == 0) {
+ if (empty($fax_retry_count)) {
$fax_retry_count = 0;
}
elseif ($fax_status != 'busy') {
@@ -347,7 +347,7 @@
fax_split_dtmf($fax_number, $fax_dtmf);
//prepare the fax command
- if (strlen($fax_toll_allow) > 0) {
+ if (!empty($fax_toll_allow)) {
$channel_variables["toll_allow"] = $fax_toll_allow;
}
$route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables);
@@ -434,7 +434,7 @@
if (in_array($fax_status, array('sent', 'failed'))) {
//send the email
- if (strlen($fax_email_address) > 0 && file_exists($fax_file)) {
+ if (!empty($fax_email_address) && file_exists($fax_file)) {
//get the language code
$language_code = $_SESSION['domain']['language']['code'];
@@ -447,7 +447,7 @@
}
//get the email template from the database
- if (isset($fax_email_address) && strlen($fax_email_address) > 0) {
+ if (isset($fax_email_address) && !empty($fax_email_address)) {
$sql = "select template_subcategory, template_subject, template_body from v_email_templates ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and template_language = :template_language ";
@@ -505,7 +505,7 @@
}
//get fax log data for email variables
- if (isset($fax_email_address) && strlen($fax_email_address) > 0 && isset($fax_log_uuid)) {
+ if (isset($fax_email_address) && !empty($fax_email_address) && isset($fax_log_uuid)) {
$sql = "select * ";
$sql .= "from v_fax_logs ";
$sql .= "where fax_log_uuid = :fax_log_uuid ";
@@ -580,9 +580,9 @@
$email_body = str_replace('${fax_duration_formatted}', $fax_duration_formatted, $email_body);
//send the email
- if (isset($fax_email_address) && strlen($fax_email_address) > 0) {
+ if (isset($fax_email_address) && !empty($fax_email_address)) {
//add the attachment
- if (strlen($fax_file_name) > 0) {
+ if (!empty($fax_file_name)) {
$email_attachments[0]['type'] = 'file';
$email_attachments[0]['name'] = $fax_file_name;
$email_attachments[0]['value'] = path_join($fax_file_dirname, '.', $fax_file_name);
diff --git a/app/fifo/fifo_add.php b/app/fifo/fifo_add.php
index 8e296af9b5..5670d5afbf 100644
--- a/app/fifo/fifo_add.php
+++ b/app/fifo/fifo_add.php
@@ -61,11 +61,11 @@
$flags = $_POST["flags"];
$dialplan_enabled = $_POST["dialplan_enabled"];
$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
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//validate the token
$token = new token;
@@ -76,10 +76,10 @@
}
//check for all required data
- if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid \n"; } - if (strlen($extension_name) == 0) { $msg .= $text['message-required'].$text['label-name']." \n"; } - if (strlen($queue_extension_number) == 0) { $msg .= $text['message-required'].$text['label-extension']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($domain_uuid)) { $msg .= $text['message-required']."domain_uuid \n"; } + if (empty($extension_name)) { $msg .= $text['message-required'].$text['label-name']." \n"; } + if (empty($queue_extension_number)) { $msg .= $text['message-required'].$text['label-extension']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -92,7 +92,7 @@
return;
}
- if (strlen($queue_extension_number) > 0) {
+ if (!empty($queue_extension_number)) {
//--------------------------------------------------------
//Caller Queue [FIFO in]
// \n"; } + if (empty($gateway)) { $msg .= $text['message-required']." ".$text['label-gateway']." \n"; } if ($register == "true") { - if (strlen($username) == 0) { $msg .= $text['message-required']." ".$text['label-username']." \n"; } - if (strlen($password) == 0) { $msg .= $text['message-required']." ".$text['label-password']." \n"; } + if (empty($username)) { $msg .= $text['message-required']." ".$text['label-username']." \n"; } + if (empty($password)) { $msg .= $text['message-required']." ".$text['label-password']." \n"; } } - if (strlen($proxy) == 0) { $msg .= $text['message-required']." ".$text['label-proxy']." \n"; } - if (strlen($expire_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-expire_seconds']." \n"; } - if (strlen($register) == 0) { $msg .= $text['message-required']." ".$text['label-register']." \n"; } - if (strlen($retry_seconds) == 0) { $msg .= $text['message-required']." ".$text['label-retry_seconds']." \n"; } - if (strlen($channels) == 0) { + if (empty($proxy)) { $msg .= $text['message-required']." ".$text['label-proxy']." \n"; } + if (empty($expire_seconds)) { $msg .= $text['message-required']." ".$text['label-expire_seconds']." \n"; } + if (empty($register)) { $msg .= $text['message-required']." ".$text['label-register']." \n"; } + if (empty($retry_seconds)) { $msg .= $text['message-required']." ".$text['label-retry_seconds']." \n"; } + if (empty($channels)) { //$msg .= $text['message-required']." ".$text['label-channels']." \n"; $channels = 0; } - if (strlen($context) == 0) { $msg .= $text['message-required']." ".$text['label-context']." \n"; } - if (strlen($profile) == 0) { $msg .= $text['message-required']." ".$text['label-profile']." \n"; } - if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($context)) { $msg .= $text['message-required']." ".$text['label-context']." \n"; } + if (empty($profile)) { $msg .= $text['message-required']." ".$text['label-profile']." \n"; } + if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -197,7 +197,7 @@
$array['gateways'][$x]["extension_in_contact"] = $extension_in_contact;
$array['gateways'][$x]["context"] = $context;
$array['gateways'][$x]["profile"] = $profile;
- $array['gateways'][$x]["hostname"] = strlen($hostname) != 0 ? $hostname : null;
+ $array['gateways'][$x]["hostname"] = empty($hostname) ? null : $hostname;
$array['gateways'][$x]["enabled"] = $enabled;
$array['gateways'][$x]["description"] = $description;
@@ -318,9 +318,9 @@
unset($sql);
//set defaults
- if (strlen($enabled) == 0) { $enabled = "true"; }
- if (strlen($register) == 0) { $register = "true"; }
- if (strlen($retry_seconds) == 0) { $retry_seconds = "30"; }
+ if (empty($enabled)) { $enabled = "true"; }
+ if (empty($register)) { $register = "true"; }
+ if (empty($retry_seconds)) { $retry_seconds = "30"; }
//create token
$object = new token;
@@ -453,7 +453,7 @@
echo " ".$text['label-expire_seconds']."\n";
echo " \n";
- if (strlen($expire_seconds) == 0) { $expire_seconds = "800"; }
+ if (empty($expire_seconds)) { $expire_seconds = "800"; }
echo " \n";
echo " | \n";
echo "\n"; echo $text['description-expire_seconds']."\n"; @@ -810,7 +810,7 @@ echo " \n";
echo " | \n";
echo "\n";
- if (strlen($context) == 0) { $context = "public"; }
+ if (empty($context)) { $context = "public"; }
echo " \n";
echo " | \n";
echo "\n"; echo $text['description-context']."\n"; diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index 7b79718022..5024331df6 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -119,7 +119,7 @@ //add the search term $search = strtolower($_GET["search"]); - if (strlen($search) > 0) { + if (!empty($search)) { $sql_search = "and ("; $sql_search .= "lower(gateway) like :search "; $sql_search .= "or lower(username) like :search "; diff --git a/app/gateways/resources/classes/gateways.php b/app/gateways/resources/classes/gateways.php index 4a1b88f2b9..77a734b7da 100644 --- a/app/gateways/resources/classes/gateways.php +++ b/app/gateways/resources/classes/gateways.php @@ -548,10 +548,10 @@ if (!class_exists('gateways')) { unset($array[$this->table][$x]['channels']); //defaults - if (strlen($row['expire_seconds']) == 0) { + if (empty($row['expire_seconds'])) { $array[$this->table][$x]['expire_seconds'] = '800'; } - if (strlen($row['retry_seconds']) == 0) { + if (empty($row['retry_seconds'])) { $array[$this->table][$x]['retry_seconds'] = '30'; } diff --git a/app/gswave/index.php b/app/gswave/index.php index 81e4ae4ac0..09856b5dbb 100644 --- a/app/gswave/index.php +++ b/app/gswave/index.php @@ -89,7 +89,7 @@ //get the username $username = $field['extension']; - if (isset($field['number_alias']) && strlen($field['number_alias']) > 0) { + if (isset($field['number_alias']) && !empty($field['number_alias'])) { $username = $field['number_alias']; } diff --git a/app/ivr_menus/ivr_menu_copy.php b/app/ivr_menus/ivr_menu_copy.php index a3499ba0fa..bce52b0da6 100644 --- a/app/ivr_menus/ivr_menu_copy.php +++ b/app/ivr_menus/ivr_menu_copy.php @@ -122,13 +122,13 @@ $dialplan_xml .= " \n"; } - if (strlen($ivr_menu_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']." \n"; } - if (strlen($ivr_menu_greet_long) == 0) { $msg .= $text['message-required'].$text['label-greet_long']." \n"; } - //if (strlen($ivr_menu_greet_short) == 0) { $msg .= $text['message-required'].$text['label-greet_short']." \n"; } - //if (strlen($ivr_menu_invalid_sound) == 0) { $msg .= $text['message-required'].$text['label-invalid_sound']." \n"; } - //if (strlen($ivr_menu_exit_sound) == 0) { $msg .= $text['message-required'].$text['label-exit_sound']." \n"; } - //if (strlen($ivr_menu_confirm_macro) == 0) { $msg .= $text['message-required'].$text['label-comfirm_macro']." \n"; } - //if (strlen($ivr_menu_confirm_key) == 0) { $msg .= $text['message-required'].$text['label-comfirm_key']." \n"; } - //if (strlen($ivr_menu_tts_engine) == 0) { $msg .= $text['message-required'].$text['label-tts_engine']." \n"; } - //if (strlen($ivr_menu_tts_voice) == 0) { $msg .= $text['message-required'].$text['label-tts_voice']." \n"; } - if (strlen($ivr_menu_confirm_attempts) == 0) { $msg .= $text['message-required'].$text['label-comfirm_attempts']." \n"; } - if (strlen($ivr_menu_timeout) == 0) { $msg .= $text['message-required'].$text['label-timeout']." \n"; } - //if (strlen($ivr_menu_exit_app) == 0) { $msg .= $text['message-required'].$text['label-exit_action']." \n"; } - if (strlen($ivr_menu_inter_digit_timeout) == 0) { $msg .= $text['message-required'].$text['label-inter_digit_timeout']." \n"; } - if (strlen($ivr_menu_max_failures) == 0) { $msg .= $text['message-required'].$text['label-max_failures']." \n"; } - if (strlen($ivr_menu_max_timeouts) == 0) { $msg .= $text['message-required'].$text['label-max_timeouts']." \n"; } - if (strlen($ivr_menu_digit_len) == 0) { $msg .= $text['message-required'].$text['label-digit_length']." \n"; } - if (strlen($ivr_menu_direct_dial) == 0) { $msg .= $text['message-required'].$text['label-direct_dial']." \n"; } - //if (strlen($ivr_menu_ringback) == 0) { $msg .= $text['message-required'].$text['label-ring_back']." \n"; } + if (empty($ivr_menu_name)) { $msg .= $text['message-required'].$text['label-name']." \n"; } + if (empty($ivr_menu_extension)) { $msg .= $text['message-required'].$text['label-extension']." \n"; } + if (empty($ivr_menu_greet_long)) { $msg .= $text['message-required'].$text['label-greet_long']." \n"; } + //if (empty($ivr_menu_greet_short)) { $msg .= $text['message-required'].$text['label-greet_short']." \n"; } + //if (empty($ivr_menu_invalid_sound)) { $msg .= $text['message-required'].$text['label-invalid_sound']." \n"; } + //if (empty($ivr_menu_exit_sound)) { $msg .= $text['message-required'].$text['label-exit_sound']." \n"; } + //if (empty($ivr_menu_confirm_macro)) { $msg .= $text['message-required'].$text['label-comfirm_macro']." \n"; } + //if (empty($ivr_menu_confirm_key)) { $msg .= $text['message-required'].$text['label-comfirm_key']." \n"; } + //if (empty($ivr_menu_tts_engine)) { $msg .= $text['message-required'].$text['label-tts_engine']." \n"; } + //if (empty($ivr_menu_tts_voice)) { $msg .= $text['message-required'].$text['label-tts_voice']." \n"; } + if (empty($ivr_menu_confirm_attempts)) { $msg .= $text['message-required'].$text['label-comfirm_attempts']." \n"; } + if (empty($ivr_menu_timeout)) { $msg .= $text['message-required'].$text['label-timeout']." \n"; } + //if (empty($ivr_menu_exit_app)) { $msg .= $text['message-required'].$text['label-exit_action']." \n"; } + if (empty($ivr_menu_inter_digit_timeout)) { $msg .= $text['message-required'].$text['label-inter_digit_timeout']." \n"; } + if (empty($ivr_menu_max_failures)) { $msg .= $text['message-required'].$text['label-max_failures']." \n"; } + if (empty($ivr_menu_max_timeouts)) { $msg .= $text['message-required'].$text['label-max_timeouts']." \n"; } + if (empty($ivr_menu_digit_len)) { $msg .= $text['message-required'].$text['label-digit_length']." \n"; } + if (empty($ivr_menu_direct_dial)) { $msg .= $text['message-required'].$text['label-direct_dial']." \n"; } + //if (empty($ivr_menu_ringback)) { $msg .= $text['message-required'].$text['label-ring_back']." \n"; } - //if (strlen($ivr_menu_description) == 0) { $msg .= $text['message-required'].$text['label-description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($ivr_menu_description)) { $msg .= $text['message-required'].$text['label-description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -296,7 +296,7 @@
$array['ivr_menus'][0]["ivr_menu_description"] = $ivr_menu_description;
$y = 0;
foreach ($ivr_menu_options as $row) {
- if (strlen($row['ivr_menu_option_digits']) > 0) {
+ if (!empty($row['ivr_menu_option_digits'])) {
if (is_uuid($row['ivr_menu_option_uuid'])) {
$ivr_menu_option_uuid = $row['ivr_menu_option_uuid'];
}
@@ -338,16 +338,16 @@
}
$dialplan_xml .= " \n";
echo " | \n";
}
if ($_GET['show'] == "all" && permission_exists('music_on_hold_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'];
}
else {
diff --git a/app/music_on_hold/music_on_hold_edit.php b/app/music_on_hold/music_on_hold_edit.php
index 18bc816772..6813658499 100644
--- a/app/music_on_hold/music_on_hold_edit.php
+++ b/app/music_on_hold/music_on_hold_edit.php
@@ -72,7 +72,7 @@
}
//add or update the data
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid
if ($action == "update") {
@@ -89,17 +89,17 @@
//check for all required data
$msg = '';
- if (strlen($music_on_hold_name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."\n";
$destination_action = '';
- if (strlen($field['ivr_menu_option_action'].$field['ivr_menu_option_param']) > 0) {
+ if (!empty($field['ivr_menu_option_action'].$field['ivr_menu_option_param'])) {
$destination_action = $field['ivr_menu_option_action'].':'.$field['ivr_menu_option_param'];
} else { $destination_action = ''; }
echo $destination->select('ivr', 'ivr_menu_options['.$x.'][ivr_menu_option_param]', $destination_action);
@@ -1285,11 +1285,11 @@
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
- if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($ivr_menu_invalid_sound) > 0) {
+ if ($ivr_menu_invalid_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && !empty($ivr_menu_invalid_sound)) {
$tmp_selected = true;
echo " \n";
}
- else if ($ivr_menu_invalid_sound == $recording_filename && strlen($ivr_menu_invalid_sound) > 0) {
+ else if ($ivr_menu_invalid_sound == $recording_filename && !empty($ivr_menu_invalid_sound)) {
$tmp_selected = true;
echo " \n";
}
@@ -1317,7 +1317,7 @@
if (is_array($sound_files)) {
echo " | \n";
}
if ($_GET['show'] == "all" && permission_exists('ivr_menu_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'];
}
else {
diff --git a/app/ivr_menus/resources/functions/ivr_menu_xml.php b/app/ivr_menus/resources/functions/ivr_menu_xml.php
index ee5de986e7..f2d990d9b0 100644
--- a/app/ivr_menus/resources/functions/ivr_menu_xml.php
+++ b/app/ivr_menus/resources/functions/ivr_menu_xml.php
@@ -91,7 +91,7 @@
//add each IVR menu to the XML config
$tmp = "\n"; } - if (strlen($module_name) == 0) { $msg .= $text['message-required'].$text['label-module_name']." \n"; } - //if (strlen($module_description) == 0) { $msg .= $text['message-required'].$text['label-description']." \n"; } - if (strlen($module_category) == 0) { $msg .= $text['message-required'].$text['label-module_category']." \n"; } - if (strlen($module_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']." \n"; } - if (strlen($module_default_enabled) == 0) { $msg .= $text['message-required'].$text['label-default_enabled']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($module_label)) { $msg .= $text['message-required'].$text['label-label']." \n"; } + if (empty($module_name)) { $msg .= $text['message-required'].$text['label-module_name']." \n"; } + //if (empty($module_description)) { $msg .= $text['message-required'].$text['label-description']." \n"; } + if (empty($module_category)) { $msg .= $text['message-required'].$text['label-module_category']." \n"; } + if (empty($module_enabled)) { $msg .= $text['message-required'].$text['label-enabled']." \n"; } + if (empty($module_default_enabled)) { $msg .= $text['message-required'].$text['label-default_enabled']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -164,8 +164,8 @@
}
//set the defaults
- if (strlen($module_enabled) == 0) { $module_enabled = 'true'; }
- if (strlen($module_default_enabled) == 0) { $module_default_enabled = 'true'; }
+ if (empty($module_enabled)) { $module_enabled = 'true'; }
+ if (empty($module_default_enabled)) { $module_default_enabled = 'true'; }
//create token
$object = new token;
diff --git a/app/modules/modules.php b/app/modules/modules.php
index 94b97bbea0..47d4b2812b 100644
--- a/app/modules/modules.php
+++ b/app/modules/modules.php
@@ -99,7 +99,6 @@
//use the module class to get the list of modules from the db and add any missing modules
$module = new modules;
- $module->db = $db;
$module->dir = $_SESSION['switch']['mod']['dir'];
$module->get_modules();
$modules = $module->modules;
diff --git a/app/modules/resources/classes/modules.php b/app/modules/resources/classes/modules.php
index 1b716726b0..6018b74a89 100644
--- a/app/modules/resources/classes/modules.php
+++ b/app/modules/resources/classes/modules.php
@@ -705,7 +705,7 @@ if (!class_exists('modules')) {
//add missing modules for more module info see http://wiki.freeswitch.com/wiki/Modules
public function synch() {
- if ($handle = opendir($this->dir)) {
+ if (false !== ($handle = opendir($this->dir ?? ''))) {
$modules_new = '';
$module_found = false;
$x = 0;
diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php
index cd8a809d2a..a7b878de6f 100644
--- a/app/music_on_hold/music_on_hold.php
+++ b/app/music_on_hold/music_on_hold.php
@@ -379,9 +379,9 @@
echo " \n"; } - if (strlen($music_on_hold_path) == 0) { $msg .= $text['message-required']." ".$text['label-path']." \n"; } - //if (strlen($music_on_hold_rate) == 0) { $msg .= $text['message-required']." ".$text['label-rate']." \n"; } - if (strlen($music_on_hold_shuffle) == 0) { $msg .= $text['message-required']." ".$text['label-shuffle']." \n"; } - if (strlen($music_on_hold_channels) == 0) { $msg .= $text['message-required']." ".$text['label-channels']." \n"; } - //if (strlen($music_on_hold_interval) == 0) { $msg .= $text['message-required']." ".$text['label-interval']." \n"; } - //if (strlen($music_on_hold_timer_name) == 0) { $msg .= $text['message-required']." ".$text['label-timer_name']." \n"; } - //if (strlen($music_on_hold_chime_list) == 0) { $msg .= $text['message-required']." ".$text['label-chime_list']." \n"; } - //if (strlen($music_on_hold_chime_freq) == 0) { $msg .= $text['message-required']." ".$text['label-chime_freq']." \n"; } - //if (strlen($music_on_hold_chime_max) == 0) { $msg .= $text['message-required']." ".$text['label-chime_max']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($music_on_hold_name)) { $msg .= $text['message-required']." ".$text['label-name']." \n"; } + if (empty($music_on_hold_path)) { $msg .= $text['message-required']." ".$text['label-path']." \n"; } + //if (empty($music_on_hold_rate)) { $msg .= $text['message-required']." ".$text['label-rate']." \n"; } + if (empty($music_on_hold_shuffle)) { $msg .= $text['message-required']." ".$text['label-shuffle']." \n"; } + if (empty($music_on_hold_channels)) { $msg .= $text['message-required']." ".$text['label-channels']." \n"; } + //if (empty($music_on_hold_interval)) { $msg .= $text['message-required']." ".$text['label-interval']." \n"; } + //if (empty($music_on_hold_timer_name)) { $msg .= $text['message-required']." ".$text['label-timer_name']." \n"; } + //if (empty($music_on_hold_chime_list)) { $msg .= $text['message-required']." ".$text['label-chime_list']." \n"; } + //if (empty($music_on_hold_chime_freq)) { $msg .= $text['message-required']." ".$text['label-chime_freq']." \n"; } + //if (empty($music_on_hold_chime_max)) { $msg .= $text['message-required']." ".$text['label-chime_max']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -377,11 +377,11 @@
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
- if ($music_on_hold_chime_list == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && strlen($music_on_hold_chime_list) > 0) {
+ if ($music_on_hold_chime_list == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && !empty($music_on_hold_chime_list)) {
$tmp_selected = true;
echo " \n";
}
- else if ($music_on_hold_chime_list == $recording_filename && strlen($music_on_hold_chime_list) > 0) {
+ else if ($music_on_hold_chime_list == $recording_filename && !empty($music_on_hold_chime_list)) {
$tmp_selected = true;
echo " \n";
}
@@ -418,7 +418,7 @@
if (is_array($sound_files) && @sizeof($sound_files) != 0) {
echo " \n";
echo " | \n";
echo "\n"; } - //if (strlen($number_translation_details) == 0) { $msg .= $text['message-required']." ".$text['label-number_translation_details']." \n"; } - if (strlen($number_translation_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-number_translation_enabled']." \n"; } - //if (strlen($number_translation_description) == 0) { $msg .= $text['message-required']." ".$text['label-number_translation_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($number_translation_name)) { $msg .= $text['message-required']." ".$text['label-number_translation_name']." \n"; } + //if (empty($number_translation_details)) { $msg .= $text['message-required']." ".$text['label-number_translation_details']." \n"; } + if (empty($number_translation_enabled)) { $msg .= $text['message-required']." ".$text['label-number_translation_enabled']." \n"; } + //if (empty($number_translation_description)) { $msg .= $text['message-required']." ".$text['label-number_translation_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -145,7 +145,7 @@
$y = 0;
if (is_array($number_translation_details)) {
foreach ($number_translation_details as $row) {
- if (strlen($row['number_translation_detail_regex']) > 0) {
+ if (!empty($row['number_translation_detail_regex'])) {
$array['number_translations'][0]['number_translation_details'][$y]['number_translation_detail_uuid'] = $row["number_translation_detail_uuid"];
$array['number_translations'][0]['number_translation_details'][$y]['number_translation_detail_regex'] = $row["number_translation_detail_regex"];
$array['number_translations'][0]['number_translation_details'][$y]['number_translation_detail_replace'] = $row["number_translation_detail_replace"];
diff --git a/app/number_translations/resources/classes/number_translations.php b/app/number_translations/resources/classes/number_translations.php
index c1ff76bd8c..be5f3ed3fd 100644
--- a/app/number_translations/resources/classes/number_translations.php
+++ b/app/number_translations/resources/classes/number_translations.php
@@ -79,7 +79,7 @@ if (!class_exists('number_translations')) {
*/
public function import() {
//get the xml from the number templates
- if (strlen($this->xml) > 0) {
+ if (!empty($this->xml)) {
//convert the xml string to an xml object
$xml = simplexml_load_string($this->xml);
//convert to json
@@ -87,7 +87,7 @@ if (!class_exists('number_translations')) {
//convert to an array
$number_translation = json_decode($json, true);
}
- else if (strlen($this->json) > 0) {
+ else if (!empty($this->json)) {
//convert to an array
$number_translation = json_decode($this->json, true);
}
@@ -100,7 +100,7 @@ if (!class_exists('number_translations')) {
$x = 0;
$array['number_translations'][$x]['number_translation_name'] = $number_translation['@attributes']['name'];
$array['number_translations'][$x]['number_translation_enabled'] = "true";
- if (strlen($number_translation['@attributes']['enabled']) > 0) {
+ if (!empty($number_translation['@attributes']['enabled'])) {
$array['number_translations'][$x]['number_translation_enabled'] = $number_translation['@attributes']['enabled'];
}
$array['number_translations'][$x]['number_translation_description'] = $number_translation['@attributes']['description'];
diff --git a/app/phrases/app_defaults.php b/app/phrases/app_defaults.php
index 44e5386a2f..5b0038b0c3 100644
--- a/app/phrases/app_defaults.php
+++ b/app/phrases/app_defaults.php
@@ -28,7 +28,7 @@ if ($domains_processed == 1) {
//create phrases folder and add include line in xml for each language found
/*
- if (strlen($_SESSION['switch']['languages']['dir']) > 0) {
+ if (!empty($_SESSION['switch']['languages']['dir'])) {
if (is_readable($_SESSION['switch']['languages']['dir'])) {
$conf_lang_folders = glob($_SESSION['switch']['languages']['dir']."/*");
foreach ($conf_lang_folders as $conf_lang_folder) {
diff --git a/app/phrases/phrase_edit.php b/app/phrases/phrase_edit.php
index ac6d89da3e..cc398dd911 100644
--- a/app/phrases/phrase_edit.php
+++ b/app/phrases/phrase_edit.php
@@ -90,7 +90,7 @@
}
//process the changes from the http post
- if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+ if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get the uuid
if ($action == "update") {
@@ -107,9 +107,9 @@
//check for all required data
$msg = '';
- if (strlen($phrase_name) == 0) { $msg .= $text['message-required']." ".$text['label-name']." \n"; } - if (strlen($phrase_language) == 0) { $msg .= $text['message-required']." ".$text['label-language']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($phrase_name)) { $msg .= $text['message-required']." ".$text['label-name']." \n"; } + if (empty($phrase_language)) { $msg .= $text['message-required']." ".$text['label-language']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -287,7 +287,7 @@
}
//set the defaults
- if (strlen($phrase_enabled) == 0) { $phrase_enabled = 'true'; }
+ if (empty($phrase_enabled)) { $phrase_enabled = 'true'; }
//get the phrase details
if (is_uuid($phrase_uuid)) {
@@ -366,7 +366,7 @@
echo "var opt_group = document.createElement('optgroup');\n";
echo "opt_group.label = \"".$text['label-sounds']."\";\n";
foreach ($sound_files as $value) {
- if (strlen($value) > 0) {
+ if (!empty($value)) {
echo "opt_group.appendChild(new Option(\"".$value."\", \"".$value."\"));\n";
}
}
@@ -585,7 +585,7 @@
echo " \n";
echo " | \n";
}
if ($_GET['show'] == "all" && permission_exists('phrase_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'];
}
else {
diff --git a/app/pin_numbers/pin_number_edit.php b/app/pin_numbers/pin_number_edit.php
index c6f1635937..7799fa4d6f 100644
--- a/app/pin_numbers/pin_number_edit.php
+++ b/app/pin_numbers/pin_number_edit.php
@@ -62,7 +62,7 @@
$description = $_POST["description"];
}
-if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
+if (count($_POST)>0 && empty($_POST["persistformvar"])) {
$msg = '';
if ($action == "update") {
@@ -78,11 +78,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
- if (strlen($pin_number) == 0) { $msg .= $text['message-required']." ".$text['label-pin_number']."\n"; } - //if (strlen($accountcode) == 0) { $msg .= $text['message-required']." ".$text['label-accountcode']." \n"; } - if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']." \n"; } - //if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($pin_number)) { $msg .= $text['message-required']." ".$text['label-pin_number']." \n"; } + //if (empty($accountcode)) { $msg .= $text['message-required']." ".$text['label-accountcode']." \n"; } + if (empty($enabled)) { $msg .= $text['message-required']." ".$text['label-enabled']." \n"; } + //if (empty($description)) { $msg .= $text['message-required']." ".$text['label-description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/pin_numbers/pin_numbers.php b/app/pin_numbers/pin_numbers.php
index 69fa0b57f7..68dffc4546 100644
--- a/app/pin_numbers/pin_numbers.php
+++ b/app/pin_numbers/pin_numbers.php
@@ -86,7 +86,7 @@
//add the search term
$search = strtolower($_GET["search"]);
- if (strlen($search) > 0) {
+ if (!empty($search)) {
$sql_search = "and (";
$sql_search .= "lower(pin_number) like :search ";
$sql_search .= "or lower(accountcode) like :search ";
diff --git a/app/provision/index.php b/app/provision/index.php
index 34a0e952cf..8083100000 100644
--- a/app/provision/index.php
+++ b/app/provision/index.php
@@ -45,7 +45,7 @@
$mac = $_REQUEST['mac'];
$file = $_REQUEST['file'];
$ext = $_REQUEST['ext'];
- //if (strlen($_REQUEST['template']) > 0) {
+ //if (!empty($_REQUEST['template'])) {
// $device_template = $_REQUEST['template'];
//}
@@ -191,7 +191,7 @@
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
- if (strlen($subcategory) == 0) {
+ if (empty($subcategory)) {
if ($name == "array") {
$_SESSION[$category][] = $row['default_setting_value'];
}
@@ -236,7 +236,7 @@
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
- if (strlen($subcategory) == 0) {
+ if (empty($subcategory)) {
//$$category[$name] = $row['domain_setting_value'];
if ($name == "array") {
$_SESSION[$category][] = $row['domain_setting_value'];
@@ -260,11 +260,11 @@
//build the provision array
foreach($_SESSION['provision'] as $key=>$val) {
- if (strlen($val['var']) > 0) { $value = $val['var']; }
- if (strlen($val['text']) > 0) { $value = $val['text']; }
- if (strlen($val['boolean']) > 0) { $value = $val['boolean']; }
- if (strlen($val['numeric']) > 0) { $value = $val['numeric']; }
- if (strlen($value) > 0) { $provision[$key] = $value; }
+ if (!empty($val['var'])) { $value = $val['var']; }
+ if (!empty($val['text'])) { $value = $val['text']; }
+ if (!empty($val['boolean'])) { $value = $val['boolean']; }
+ if (!empty($val['numeric'])) { $value = $val['numeric']; }
+ if (!empty($value)) { $provision[$key] = $value; }
unset($value);
}
@@ -275,7 +275,7 @@
}
//send a request to a remote server to validate the MAC address and secret
- if (strlen($_SERVER['auth_server']) > 0) {
+ if (!empty($_SERVER['auth_server'])) {
$result = send_http_request($_SERVER['auth_server'], 'mac='.check_str($_REQUEST['mac']).'&secret='.check_str($_REQUEST['secret']));
if ($result == "false") {
syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt but the remote auth server said no for ".check_str($_REQUEST['mac']));
@@ -287,7 +287,7 @@
$device_vendor = device::get_vendor($mac);
//keep backwards compatibility
- if (strlen($_SESSION['provision']["cidr"]["text"]) > 0) {
+ if (!empty($_SESSION['provision']["cidr"]["text"])) {
$_SESSION['provision']["cidr"][] = $_SESSION['provision']["cidr"]["text"];
}
@@ -307,8 +307,8 @@
}
//http authentication - digest
- if (strlen($provision["http_auth_username"]) > 0 && strlen($provision["http_auth_type"]) == 0) { $provision["http_auth_type"] = "digest"; }
- if (strlen($provision["http_auth_username"]) > 0 && $provision["http_auth_type"] === "digest" && $provision["http_auth_enabled"] === "true") {
+ if (!empty($provision["http_auth_username"]) && empty($provision["http_auth_type"])) { $provision["http_auth_type"] = "digest"; }
+ if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "digest" && $provision["http_auth_enabled"] === "true") {
//function to parse the http auth header
function http_digest_parse($txt) {
//protect against missing data
@@ -379,7 +379,7 @@
}
//http authentication - basic
- if (strlen($provision["http_auth_username"]) > 0 && $provision["http_auth_type"] === "basic" && $provision["http_auth_enabled"] === "true") {
+ if (!empty($provision["http_auth_username"]) && $provision["http_auth_type"] === "basic" && $provision["http_auth_enabled"] === "true") {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name'].'"');
header('HTTP/1.0 401 Authorization Required');
@@ -415,7 +415,7 @@
}
//if password was defined in the system -> variables page then require the password.
- if (strlen($provision['password']) > 0) {
+ if (!empty($provision['password'])) {
//deny access if the password doesn't match
if ($provision['password'] != check_str($_REQUEST['password'])) {
//log the failed auth attempt to the system, to be available for fail2ban.
diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php
index 6b11997a05..121954f23d 100644
--- a/app/provision/resources/classes/provision.php
+++ b/app/provision/resources/classes/provision.php
@@ -37,7 +37,7 @@
//set the default template directory
if (PHP_OS == "Linux") {
//set the default template dir
- if (strlen($this->template_dir) == 0) {
+ if (empty($this->template_dir)) {
if (file_exists('/usr/share/fusionpbx/templates/provision')) {
$this->template_dir = '/usr/share/fusionpbx/templates/provision';
}
@@ -51,7 +51,7 @@
}
elseif (PHP_OS == "FreeBSD") {
//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')) {
$this->template_dir = '/usr/local/share/fusionpbx/templates/provision';
}
@@ -65,19 +65,19 @@
}
else if (PHP_OS == "NetBSD") {
//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';
}
}
else if (PHP_OS == "OpenBSD") {
//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';
}
}
else {
//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';
}
}
@@ -264,7 +264,7 @@
$mac = strtolower($mac);
//get the device template
- //if (strlen($_REQUEST['template']) > 0) {
+ //if (!empty($_REQUEST['template'])) {
// $device_template = $_REQUEST['template'];
// $search = array('..', '/./');
// $device_template = str_replace($search, "", $device_template);
@@ -276,7 +276,7 @@
$file = str_replace($search, "", $file);
//get the domain_name
- if (strlen($domain_name) == 0) {
+ if (empty($domain_name)) {
$sql = "select domain_name from v_domains ";
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -309,7 +309,7 @@
}
//check to see if the mac_address exists in devices
- //if (strlen($_REQUEST['user_id']) == 0 || strlen($_REQUEST['userid']) == 0) {
+ //if (empty($_REQUEST['user_id']) || empty($_REQUEST['userid'])) {
if ($this->mac_exists($mac)) {
//get the device_template
@@ -359,7 +359,7 @@
$device_user_uuid = $row["device_user_uuid"];
$device_model = $row["device_model"];
$device_firmware_version = $row["device_firmware_version"];
- if (strlen($row["device_vendor"]) > 0) {
+ if (!empty($row["device_vendor"])) {
$device_vendor = strtolower($row["device_vendor"]);
}
$device_location = $row["device_location"];
@@ -369,7 +369,7 @@
unset($row);
//find a template that was defined on another phone and use that as the default.
- if (strlen($device_template) == 0) {
+ if (empty($device_template)) {
$sql = "select * from v_devices ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and device_enabled = 'true' ";
@@ -546,7 +546,7 @@
$database = new database;
$database->app_name = 'devices';
$database->app_uuid = '4efa1a1a-32e7-bf83-534b-6c8299958a8e';
- if (strlen($device_uuid) > 0) {
+ if (!empty($device_uuid)) {
$database->uuid($device_uuid);
}
$database->save($array);
@@ -642,7 +642,7 @@
}
//set the template directory
- if (strlen($provision["template_dir"]) > 0) {
+ if (!empty($provision["template_dir"])) {
$template_dir = $provision["template_dir"];
}
@@ -653,7 +653,7 @@
//initialize a template object
$view = new template();
- if (strlen($_SESSION['provision']['template_engine']['text']) > 0) {
+ if (!empty($_SESSION['provision']['template_engine']['text'])) {
$view->engine = $_SESSION['provision']['template_engine']['text']; //raintpl, smarty, twig
}
else {
@@ -812,9 +812,9 @@
$sip_port = $row['sip_port'];
//set defaults
- if (strlen($register_expires) == 0) { $register_expires = "120"; }
- if (strlen($sip_transport) == 0) { $sip_transport = "tcp"; }
- if (strlen($sip_port) == 0) {
+ if (empty($register_expires)) { $register_expires = "120"; }
+ if (empty($sip_transport)) { $sip_transport = "tcp"; }
+ if (empty($sip_port)) {
if ($line_number == "" || $line_number == "1") {
$sip_port = "5060";
}
@@ -921,7 +921,7 @@
//get the contact_uuid
$uuid = $row['contact_uuid'];
//get the names
- if (strlen($row['directory_first_name']) > 0) {
+ if (!empty($row['directory_first_name'])) {
$contact_name_given = $row['directory_first_name'];
$contact_name_family = $row['directory_last_name'];
} else {
@@ -986,7 +986,7 @@
foreach($variables as $name => $value) {
if (is_array($device_keys)) {
foreach($device_keys as $k => $field) {
- if (strlen($field['device_key_uuid']) > 0) {
+ if (!empty($field['device_key_uuid'])) {
if (isset($field['device_key_value'])) {
$device_keys[$k]['device_key_value'] = str_replace("\${".$name."}", $value, $field['device_key_value']);
}
@@ -1088,7 +1088,7 @@
}
//assign the variables
- if (strlen($device_key_category) == 0) {
+ if (empty($device_key_category)) {
$view->assign("key_id_".$device_key_id, $device_key_id);
$view->assign("key_type_".$device_key_id, $device_key_type);
$view->assign("key_line_".$device_key_id, $device_key_line);
@@ -1114,7 +1114,7 @@
$mac = $this->format_mac($mac, $device_vendor);
// set date/time for versioning provisioning templates
- if (strlen($_SESSION['provision']['version_format']['text']) > 0) {
+ if (!empty($_SESSION['provision']['version_format']['text'])) {
$time = date($_SESSION['provision']['version_format']['text']);
}
else {
@@ -1152,7 +1152,7 @@
//get the time zone
$time_zone_name = $_SESSION['domain']['time_zone']['name'];
- if (strlen($time_zone_name) > 0) {
+ if (!empty($time_zone_name)) {
$time_zone_offset_raw = get_time_zone_offset($time_zone_name)/3600;
$time_zone_offset_hours = floor($time_zone_offset_raw);
$time_zone_offset_minutes = ($time_zone_offset_raw - $time_zone_offset_hours) * 60;
@@ -1187,7 +1187,7 @@
}
//if $file is not provided then look for a default file that exists
- if (strlen($file) == 0) {
+ if (empty($file)) {
if (file_exists($template_dir."/".$device_template ."/{\$mac}")) {
$file = "{\$mac}";
}
@@ -1250,7 +1250,7 @@
}
//check either we have destination path to write files
- if (strlen($provision["path"]) == 0) {
+ if (empty($provision["path"])) {
return;
}
@@ -1283,7 +1283,7 @@
//loop through the provision template directory
$dir_array = array();
- if (strlen($device_template) > 0) {
+ if (!empty($device_template)) {
$template_path = path_join($this->template_dir, $device_template);
$dir_list = opendir($template_path);
if ($dir_list) {
diff --git a/app/recordings/app_defaults.php b/app/recordings/app_defaults.php
index 95e2733382..64faa9b454 100644
--- a/app/recordings/app_defaults.php
+++ b/app/recordings/app_defaults.php
@@ -25,7 +25,7 @@
*/
//if the recordings directory doesn't exist then create it
- if (is_array($_SESSION['switch']['recordings']) && strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) {
+ if (is_array($_SESSION['switch']['recordings']) && !empty($_SESSION['switch']['recordings']['dir']."/".$domain_name)) {
if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) {
mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name, 0770, true);
}
diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php
index ab26002d3d..b3408ccdc1 100644
--- a/app/recordings/recording_edit.php
+++ b/app/recordings/recording_edit.php
@@ -72,7 +72,7 @@
$recording_name = str_replace("'", '', $recording_name);
}
-if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
//get recording uuid to edit
$recording_uuid = $_POST["recording_uuid"];
@@ -101,9 +101,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//check for all required data
$msg = '';
- if (strlen($recording_filename) == 0) { $msg .= $text['label-edit-file']." \n"; } - if (strlen($recording_name) == 0) { $msg .= $text['label-edit-recording']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($recording_filename)) { $msg .= $text['label-edit-file']." \n"; } + if (empty($recording_name)) { $msg .= $text['label-edit-recording']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php
index b56e4790d4..634e114b8e 100644
--- a/app/recordings/recordings.php
+++ b/app/recordings/recordings.php
@@ -289,7 +289,7 @@
//add the search term
$search = strtolower($_GET["search"]);
- if (strlen($search) > 0) {
+ if (!empty($search)) {
$sql_search = "and (";
$sql_search .= "lower(recording_name) like :search ";
$sql_search .= "or lower(recording_filename) like :search ";
@@ -492,7 +492,7 @@
echo " \n"; } - if (strlen($ring_group_extension) == 0) { $msg .= $text['message-extension']." \n"; } - //if (strlen($ring_group_greeting) == 0) { $msg .= $text['message-greeting']." \n"; } - if (strlen($ring_group_strategy) == 0) { $msg .= $text['message-strategy']." \n"; } - if (strlen($ring_group_call_timeout) == 0) { $msg .= $text['message-call_timeout']." \n"; } - //if (strlen($ring_group_timeout_app) == 0) { $msg .= $text['message-timeout_action']." \n"; } - //if (strlen($ring_group_cid_name_prefix) == 0) { $msg .= "Please provide: Caller ID Name Prefix \n"; } - //if (strlen($ring_group_cid_number_prefix) == 0) { $msg .= "Please provide: Caller ID Number Prefix \n"; } - //if (strlen($ring_group_ringback) == 0) { $msg .= "Please provide: Ringback \n"; } - //if (strlen($ring_group_description) == 0) { $msg .= "Please provide: Description \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($ring_group_name)) { $msg .= $text['message-name']." \n"; } + if (empty($ring_group_extension)) { $msg .= $text['message-extension']." \n"; } + //if (empty($ring_group_greeting)) { $msg .= $text['message-greeting']." \n"; } + if (empty($ring_group_strategy)) { $msg .= $text['message-strategy']." \n"; } + if (empty($ring_group_call_timeout)) { $msg .= $text['message-call_timeout']." \n"; } + //if (empty($ring_group_timeout_app)) { $msg .= $text['message-timeout_action']." \n"; } + //if (empty($ring_group_cid_name_prefix)) { $msg .= "Please provide: Caller ID Name Prefix \n"; } + //if (empty($ring_group_cid_number_prefix)) { $msg .= "Please provide: Caller ID Number Prefix \n"; } + //if (empty($ring_group_ringback)) { $msg .= "Please provide: Ringback \n"; } + //if (empty($ring_group_description)) { $msg .= "Please provide: Description \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -371,7 +371,7 @@
else {
$ring_group_destination_uuid = uuid();
}
- if (strlen($row['destination_number']) > 0) {
+ if (!empty($row['destination_number'])) {
$array["ring_groups"][0]["ring_group_destinations"][$y]["ring_group_uuid"] = $ring_group_uuid;
$array['ring_groups'][0]["ring_group_destinations"][$y]["ring_group_destination_uuid"] = $ring_group_destination_uuid;
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_number"] = $row['destination_number'];
@@ -498,7 +498,7 @@
$dialplan_uuid = $row["dialplan_uuid"];
}
unset($sql, $parameters, $row);
- if (strlen($ring_group_timeout_app) > 0) {
+ if (!empty($ring_group_timeout_app)) {
$ring_group_timeout_action = $ring_group_timeout_app.":".$ring_group_timeout_data;
}
}
@@ -506,13 +506,13 @@
//set the defaults
$destination_delay_max = $_SESSION['ring_group']['destination_delay_max']['numeric'];
$destination_timeout_max = $_SESSION['ring_group']['destination_timeout_max']['numeric'];
- if (strlen($ring_group_ringback) == 0) {
+ if (empty($ring_group_ringback)) {
$ring_group_ringback = '${us-ring}';
}
- if (strlen($ring_group_call_timeout) == 0) {
+ if (empty($ring_group_call_timeout)) {
$ring_group_call_timeout = '30';
}
- if (strlen($ring_group_enabled) == 0) { $ring_group_enabled = 'true'; }
+ if (empty($ring_group_enabled)) { $ring_group_enabled = 'true'; }
//get the ring group destination array
if ($action == "add") {
@@ -577,10 +577,10 @@
unset($sql, $parameters);
//set defaults
- if (strlen($ring_group_enabled) == 0) { $ring_group_enabled = 'true'; }
+ if (empty($ring_group_enabled)) { $ring_group_enabled = 'true'; }
//set the default ring group context
- if (strlen($ring_group_context) == 0) {
+ if (empty($ring_group_context)) {
$ring_group_context = $_SESSION['domain_name'];
}
@@ -714,7 +714,7 @@
echo "\n";
}
if (if_group("superadmin")) {
- if (!$selected && strlen($ring_group_greeting) > 0) {
+ if (!$selected && !empty($ring_group_greeting)) {
echo " \n";
}
unset($selected);
@@ -766,10 +766,10 @@
echo " \n"; } - //if (strlen($default_gateway) == 0) { $msg .= "Please provide: Default Gateway \n"; } - if (strlen($event_socket_port) == 0) { $msg .= "Please provide: Event Socket Port \n"; } - if (strlen($event_socket_password) == 0) { $msg .= "Please provide: Event Socket Password \n"; } - //if (strlen($event_socket_acl) == 0) { $msg .= "Please provide: Event Socket ACL \n"; } - //if (strlen($xml_rpc_http_port) == 0) { $msg .= "Please provide: XML RPC HTTP Port \n"; } - //if (strlen($xml_rpc_auth_realm) == 0) { $msg .= "Please provide: XML RPC Auth Realm \n"; } - //if (strlen($xml_rpc_auth_user) == 0) { $msg .= "Please provide: XML RPC Auth User \n"; } - //if (strlen($xml_rpc_auth_pass) == 0) { $msg .= "Please provide: XML RPC Auth Password \n"; } - //if (strlen($admin_pin) == 0) { $msg .= "Please provide: Admin PIN Number \n"; } - //if (strlen($mod_shout_decoder) == 0) { $msg .= "Please provide: Mod Shout Decoder \n"; } - //if (strlen($mod_shout_volume) == 0) { $msg .= "Please provide: Mod Shout Volume \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($numbering_plan)) { $msg .= "Please provide: Numbering Plan \n"; } + //if (empty($default_gateway)) { $msg .= "Please provide: Default Gateway \n"; } + if (empty($event_socket_port)) { $msg .= "Please provide: Event Socket Port \n"; } + if (empty($event_socket_password)) { $msg .= "Please provide: Event Socket Password \n"; } + //if (empty($event_socket_acl)) { $msg .= "Please provide: Event Socket ACL \n"; } + //if (empty($xml_rpc_http_port)) { $msg .= "Please provide: XML RPC HTTP Port \n"; } + //if (empty($xml_rpc_auth_realm)) { $msg .= "Please provide: XML RPC Auth Realm \n"; } + //if (empty($xml_rpc_auth_user)) { $msg .= "Please provide: XML RPC Auth User \n"; } + //if (empty($xml_rpc_auth_pass)) { $msg .= "Please provide: XML RPC Auth Password \n"; } + //if (empty($admin_pin)) { $msg .= "Please provide: Admin PIN Number \n"; } + //if (empty($mod_shout_decoder)) { $msg .= "Please provide: Mod Shout Decoder \n"; } + //if (empty($mod_shout_volume)) { $msg .= "Please provide: Mod Shout Volume \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
diff --git a/app/sip_profiles/sip_profile_edit.php b/app/sip_profiles/sip_profile_edit.php
index d2fe3f6665..54fc022fee 100644
--- a/app/sip_profiles/sip_profile_edit.php
+++ b/app/sip_profiles/sip_profile_edit.php
@@ -87,7 +87,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"])) {
//get the uuid from the POST
if ($action == "update") {
@@ -104,12 +104,12 @@
//check for all required data
$msg = '';
- //if (strlen($sip_profile_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_uuid']." \n"; } - if (strlen($sip_profile_name) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_name']." \n"; } - //if (strlen($sip_profile_hostname) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_hostname']." \n"; } - if (strlen($sip_profile_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_enabled']." \n"; } - if (strlen($sip_profile_description) == 0) { $msg .= $text['message-required']." ".$text['label-sip_profile_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + //if (empty($sip_profile_uuid)) { $msg .= $text['message-required']." ".$text['label-sip_profile_uuid']." \n"; } + if (empty($sip_profile_name)) { $msg .= $text['message-required']." ".$text['label-sip_profile_name']." \n"; } + //if (empty($sip_profile_hostname)) { $msg .= $text['message-required']." ".$text['label-sip_profile_hostname']." \n"; } + if (empty($sip_profile_enabled)) { $msg .= $text['message-required']." ".$text['label-sip_profile_enabled']." \n"; } + if (empty($sip_profile_description)) { $msg .= $text['message-required']." ".$text['label-sip_profile_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -158,14 +158,14 @@
$array['sip_profiles'][0]['sip_profile_description'] = $sip_profile_description;
$y = 0;
foreach ($sip_profile_domains as $row) {
- if (strlen($row['sip_profile_domain_uuid']) > 0) {
+ if (!empty($row['sip_profile_domain_uuid'])) {
if (is_uuid($row['sip_profile_domain_uuid'])) {
$sip_profile_domain_uuid = $row['sip_profile_domain_uuid'];
}
else {
$sip_profile_domain_uuid = uuid();
}
- if (strlen($row["sip_profile_domain_alias"]) > 0) {
+ if (!empty($row["sip_profile_domain_alias"])) {
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_uuid"] = $sip_profile_uuid;
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_uuid"] = $sip_profile_domain_uuid;
$array['sip_profiles'][0]['sip_profile_domains'][$y]["sip_profile_domain_name"] = $row["sip_profile_domain_name"];
@@ -177,14 +177,14 @@
}
$y = 0;
foreach ($sip_profile_settings as $row) {
- if (strlen($row['sip_profile_setting_uuid']) > 0) {
+ if (!empty($row['sip_profile_setting_uuid'])) {
if (is_uuid($row['sip_profile_setting_uuid'])) {
$sip_profile_setting_uuid = $row['sip_profile_setting_uuid'];
}
else {
$sip_profile_setting_uuid = uuid();
}
- if (strlen($row["sip_profile_setting_name"]) > 0) {
+ if (!empty($row["sip_profile_setting_name"])) {
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_uuid"] = $sip_profile_uuid;
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_uuid"] = $sip_profile_setting_uuid;
$array['sip_profiles'][0]['sip_profile_settings'][$y]["sip_profile_setting_name"] = $row["sip_profile_setting_name"];
@@ -283,7 +283,7 @@
}
//set the defaults
- if (strlen($sip_profile_enabled) == 0) { $sip_profile_enabled = 'true'; }
+ if (empty($sip_profile_enabled)) { $sip_profile_enabled = 'true'; }
//get the child data
$sql = "select * from v_sip_profile_settings ";
@@ -560,7 +560,7 @@
echo " \n";
echo " \n";
- echo " \n";
+ echo " \n";
echo " \n";
echo " | \n";
echo " \n";
diff --git a/app/sip_profiles/sip_profiles.php b/app/sip_profiles/sip_profiles.php
index a49ebd2dfe..4ee200ca22 100644
--- a/app/sip_profiles/sip_profiles.php
+++ b/app/sip_profiles/sip_profiles.php
@@ -84,7 +84,7 @@
//add the search string
$search = strtolower($_GET["search"]);
- if (strlen($search) > 0) {
+ if (!empty($search)) {
$sql_search = "where (";
$sql_search .= "lower(sip_profile_name) like :search ";
$sql_search .= "or lower(sip_profile_hostname) like :search ";
diff --git a/app/sofia_global_settings/sofia_global_setting_edit.php b/app/sofia_global_settings/sofia_global_setting_edit.php
index 2577df800c..bb5b2a0f27 100644
--- a/app/sofia_global_settings/sofia_global_setting_edit.php
+++ b/app/sofia_global_settings/sofia_global_setting_edit.php
@@ -40,7 +40,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"])) {
//validate the token
$token = new token;
@@ -51,7 +51,7 @@
}
//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)
//send the array to the database class
@@ -85,11 +85,11 @@
//check for all required data
$msg = '';
- if (strlen($global_setting_name) == 0) { $msg .= $text['message-required']." ".$text['label-global_setting_name']." | \n";
echo "\n"; } - if (strlen($global_setting_value) == 0) { $msg .= $text['message-required']." ".$text['label-global_setting_value']." \n"; } - if (strlen($global_setting_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-global_setting_enabled']." \n"; } - //if (strlen($global_setting_description) == 0) { $msg .= $text['message-required']." ".$text['label-global_setting_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($global_setting_name)) { $msg .= $text['message-required']." ".$text['label-global_setting_name']." \n"; } + if (empty($global_setting_value)) { $msg .= $text['message-required']." ".$text['label-global_setting_value']." \n"; } + if (empty($global_setting_enabled)) { $msg .= $text['message-required']." ".$text['label-global_setting_enabled']." \n"; } + //if (empty($global_setting_description)) { $msg .= $text['message-required']." ".$text['label-global_setting_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -157,7 +157,7 @@
}
//set the defaults
- if (strlen($global_setting_enabled) == 0) { $global_setting_enabled = true; }
+ if (empty($global_setting_enabled)) { $global_setting_enabled = true; }
//create token
$object = new token;
diff --git a/app/streams/stream_edit.php b/app/streams/stream_edit.php
index 054f896463..f06b1c78fa 100644
--- a/app/streams/stream_edit.php
+++ b/app/streams/stream_edit.php
@@ -63,7 +63,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"])) {
//get the uuid from the POST
if ($action == "update") {
@@ -80,12 +80,12 @@
//check for all required data
$msg = '';
- if (strlen($stream_name) == 0) { $msg .= $text['message-required']." ".$text['label-stream_name']." \n"; } - if (strlen($stream_location) == 0) { $msg .= $text['message-required']." ".$text['label-stream_location']." \n"; } - if (strlen($stream_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-stream_enabled']." \n"; } - //if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } - //if (strlen($stream_description) == 0) { $msg .= $text['message-required']." ".$text['label-stream_description']." \n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + if (empty($stream_name)) { $msg .= $text['message-required']." ".$text['label-stream_name']." \n"; } + if (empty($stream_location)) { $msg .= $text['message-required']." ".$text['label-stream_location']." \n"; } + if (empty($stream_enabled)) { $msg .= $text['message-required']." ".$text['label-stream_enabled']." \n"; } + //if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']." \n"; } + //if (empty($stream_description)) { $msg .= $text['message-required']." ".$text['label-stream_description']." \n"; } + if (!empty($msg) && empty($_POST["persistformvar"])) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo " \n";
@@ -99,7 +99,7 @@
}
//add the stream_uuid
- if (strlen($_POST["stream_uuid"]) == 0) {
+ if (empty($_POST["stream_uuid"])) {
$stream_uuid = uuid();
}
@@ -155,7 +155,7 @@
}
//set the defaults
- if (strlen($stream_enabled) == 0) { $stream_enabled = 'true'; }
+ if (empty($stream_enabled)) { $stream_enabled = 'true'; }
//need stream_all permission to edit a global stream
if (!permission_exists('stream_all') && $domain_uuid == null) {
@@ -236,7 +236,7 @@
echo " \n";
echo " | \n";
echo " \n";
- if (strlen($row['stream_location']) > 0) {
+ if (!empty($row['stream_location'])) {
$location_parts = explode('://',$row['stream_location']);
$http_protocol = ($location_parts[0] == "shout") ? 'http' : 'https';
echo "\n";
diff --git a/app/switch/app_config.php b/app/switch/app_config.php
index 541bc0a844..4371fd9aec 100644
--- a/app/switch/app_config.php
+++ b/app/switch/app_config.php
@@ -37,8 +37,8 @@
if (count($path_array) <> 3 || strlen($path_array[0]) <> 2 || strlen($path_array[1]) <> 2) {
unset($languages[$key]);
}
- $languages[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$languages[$key]);
- if (strlen($languages[$key]) == 0) {
+ $languages[$key] = str_replace($_SESSION["switch"]['sounds']['dir']."/","",$languages[$key] ?? '');
+ if (empty($languages[$key])) {
unset($languages[$key]);
}
}
diff --git a/app/system/resources/dashboard/system_status.php b/app/system/resources/dashboard/system_status.php
index ac99c48992..5bf05a01d3 100644
--- a/app/system/resources/dashboard/system_status.php
+++ b/app/system/resources/dashboard/system_status.php
@@ -115,9 +115,9 @@
$cut = shell_exec("/usr/bin/which cut");
$uptime = trim(shell_exec(escapeshellcmd($cut." -d. -f1 /proc/uptime")));
$tmp['y'] = floor($uptime/60/60/24/365);
- $tmp['d'] = $uptime/60/60/24%365;
- $tmp['h'] = $uptime/60/60%24;
- $tmp['m'] = $uptime/60%60;
+ $tmp['d'] = intdiv(intdiv(intdiv($uptime,60),60),24)%365;
+ $tmp['h'] = intdiv(intdiv($uptime,60),60)%24;
+ $tmp['m'] = intdiv($uptime,60)%60;
$tmp['s'] = $uptime%60;
$uptime = (($tmp['y'] != 0 && $tmp['y'] != '') ? $tmp['y'].'y ' : null);
$uptime .= (($tmp['d'] != 0 && $tmp['d'] != '') ? $tmp['d'].'d ' : null);
diff --git a/app/system/system.php b/app/system/system.php
index 8c8e9ec12d..b00c249aa5 100644
--- a/app/system/system.php
+++ b/app/system/system.php
@@ -119,7 +119,8 @@
rtrim($git_origin);
$git_origin = preg_replace('/\.git$/','',$git_origin);
$git_status = shell_exec($git_exe.' --git-dir='.$git_path.' status | grep "Your branch"');
- rtrim($git_status);
+ if(!empty($git_status))
+ rtrim($git_status);
$git_age = shell_exec($git_exe.' --git-dir='.$git_path.' log --pretty=format:%at "HEAD^!"');
rtrim($git_age);
$git_date = DateTime::createFromFormat('U', $git_age);
@@ -161,7 +162,7 @@
echo " | | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \n"; echo " ".$text['label-switch']." ".$text['label-git_info']."\n"; @@ -199,7 +200,7 @@ echo "-->\n"; } - if (strlen($os_name) > 0) { + if (!empty($os_name)) { echo " | |||||||||||||||||||||||||
| \n"; echo " ".$text['label-os']." \n"; @@ -209,7 +210,7 @@ echo " | \n"; echo "|||||||||||||||||||||||||
| \n"; echo " ".$text['label-version']." \n"; @@ -219,7 +220,7 @@ echo " | \n"; echo "|||||||||||||||||||||||||
| \n"; echo " ".$text['label-kernel']." \n"; @@ -234,7 +235,7 @@ echo "\n"; - if (strlen($tmp_result) > 0) { + if (!empty($tmp_result)) { echo " | |||||||||||||||||||||||||
\n";
echo " Uptime\n";
@@ -265,7 +266,7 @@
$shell_cmd = 'free -hw';
$shell_result = shell_exec($shell_cmd);
echo "-->\n";
- if (strlen($shell_result) > 0) {
+ if (!empty($shell_result)) {
echo "
| |||||||||||||||||||||||||