diff --git a/app/basic_operator_panel/autocomplete.php b/app/basic_operator_panel/autocomplete.php index c5f647c247..1d5e92b05a 100644 --- a/app/basic_operator_panel/autocomplete.php +++ b/app/basic_operator_panel/autocomplete.php @@ -37,7 +37,7 @@ } //search term - $term = check_str($_GET['term']); + $term = $_GET['term'] ?? ''; if (isset($_GET['debug'])) { echo "Search Term: ".escape($term)."

"; } diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index 1982a5cb72..485ba914fe 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -54,17 +54,17 @@ if (is_array($_GET) && isset($_GET['src']) && isset($_GET['dest'])) { //retrieve submitted variables - $src = check_str($_GET['src']); - $src_cid_name = check_str($_GET['src_cid_name']); - $src_cid_number = check_str($_GET['src_cid_number']); + $src = $_GET['src'] ?? ''; + $src_cid_name = $_GET['src_cid_name'] ?? ''; + $src_cid_number = $_GET['src_cid_number'] ?? ''; - $dest = check_str($_GET['dest']); - $dest_cid_name = check_str($_GET['dest_cid_name']); - $dest_cid_number = check_str($_GET['dest_cid_number']); + $dest = $_GET['dest'] ?? ''; + $dest_cid_name = $_GET['dest_cid_name'] ?? ''; + $dest_cid_number = $_GET['dest_cid_number'] ?? ''; - $auto_answer = check_str($_GET['auto_answer']); //true,false - $rec = check_str($_GET['rec']); //true,false - $ringback = check_str($_GET['ringback']); + $auto_answer = $_GET['auto_answer'] ?? ''; //true,false + $rec = $_GET['rec'] ?? ''; //true,false + $ringback = $_GET['ringback'] ?? ''; $context = $_SESSION['domain_name']; //clean up variable values diff --git a/app/conferences_active/conference_interactive.php b/app/conferences_active/conference_interactive.php index 99752972d1..2389303da3 100644 --- a/app/conferences_active/conference_interactive.php +++ b/app/conferences_active/conference_interactive.php @@ -43,7 +43,7 @@ $text = $language->get(); //get and prepare the conference name - $conference_name = check_str(trim($_REQUEST["c"])); + $conference_name = trim($_REQUEST["c"] ?? ''); $conference_display_name = str_replace("-", " ", $conference_name); $conference_display_name = str_replace("_", " ", $conference_display_name); diff --git a/app/provision/index.php b/app/provision/index.php index 249191f2db..d60a33d199 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -358,7 +358,7 @@ if (!$authorized) { //access denied - syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt but failed http basic authentication for ".check_str($_REQUEST['mac'])); + syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt but failed http basic authentication for ".$_REQUEST['mac']); header('HTTP/1.0 401 Unauthorized'); header('WWW-Authenticate: Basic realm="'.$domain_name.'"'); unset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); @@ -373,10 +373,10 @@ //if the password was defined in the settings then require the password. if (!empty($provision['password'])) { //deny access if the password doesn't match - if ($provision['password'] != check_str($_REQUEST['password'])) { + if ($provision['password'] != $_REQUEST['password'] ?? '') { //log the failed auth attempt to the system, to be available for fail2ban. openlog('FusionPBX', LOG_NDELAY, LOG_AUTH); - syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt bad password for ".check_str($_REQUEST['mac'])); + syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] provision attempt bad password for ".($_REQUEST['mac'] ?? '')); closelog(); echo "access denied"; return; diff --git a/core/notifications/notification_edit.php b/core/notifications/notification_edit.php index 8cb998de70..9d5fb323b3 100644 --- a/core/notifications/notification_edit.php +++ b/core/notifications/notification_edit.php @@ -143,13 +143,13 @@ Mark J Crane } // retrieve submitted values - $project_notifications = check_str($_POST["project_notifications"]); - $project_security = check_str($_POST["project_security"]); - $project_releases = check_str($_POST["project_releases"]); - $project_events = check_str($_POST["project_events"]); - $project_news = check_str($_POST["project_news"]); - $project_notification_method = check_str($_POST["project_notification_method"]); - $project_notification_recipient = check_str($_POST["project_notification_recipient"]); + $project_notifications = $_POST["project_notifications"] ?? ''; + $project_security = $_POST["project_security"] ?? ''; + $project_releases = $_POST["project_releases"] ?? ''; + $project_events = $_POST["project_events"] ?? ''; + $project_news = $_POST["project_news"] ?? ''; + $project_notification_method = $_POST["project_notification_method"] ?? ''; + $project_notification_recipient = $_POST["project_notification_recipient"] ?? ''; // get local project notification participation flag $sql = "select project_notifications from v_notifications"; diff --git a/core/upgrade/index.php b/core/upgrade/index.php index 360a2a9580..ee675e903e 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -159,7 +159,7 @@ $autoload->reload_classes(); $autoload->update_cache(); } - $sel_menu = explode('|', check_str($_POST["sel_menu"])); + $sel_menu = explode('|', $_POST["sel_menu"] ?? ''); $menu_uuid = $sel_menu[0]; $menu_language = $sel_menu[1]; $included = true; diff --git a/resources/functions.php b/resources/functions.php index b7757effd2..1166c5aaf1 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -433,6 +433,9 @@ if (!function_exists('html_select')) { //define the global variables global $database, $domain_uuid; + //define the variable + $html = ''; + //html select: build a select box from distinct items in db $table_name = preg_replace("#[^a-zA-Z0-9_]#", "", $table_name); $field_name = preg_replace("#[^a-zA-Z0-9_]#", "", $field_name); @@ -713,10 +716,10 @@ if (!function_exists('add_extension_user')) { if ($num_rows == 0) { //build insert array $extension_user_uuid = uuid(); - $array['extension_users'][$x]['extension_user_uuid'] = $extension_user_uuid; - $array['extension_users'][$x]['domain_uuid'] = $domain_uuid; - $array['extension_users'][$x]['extension_uuid'] = $extension_uuid; - $array['extension_users'][$x]['user_uuid'] = $row["user_uuid"]; + $array['extension_users'][0]['extension_user_uuid'] = $extension_user_uuid; + $array['extension_users'][0]['domain_uuid'] = $domain_uuid; + $array['extension_users'][0]['extension_uuid'] = $extension_uuid; + $array['extension_users'][0]['user_uuid'] = $user_uuid; //grant temporary permissions $p = permissions::new(); $p->add('extension_user_add', 'temp'); @@ -1338,8 +1341,8 @@ if (!function_exists('rgb_to_hsl')) { $max = max($r, $g, $b); $min = min($r, $g, $b); - $h; - $s; + $h = 0; + $s = 0; $l = ($max + $min) / 2; $d = $max - $min; @@ -1370,9 +1373,9 @@ if (!function_exists('rgb_to_hsl')) { //function to convert an hsl color array to an rgb color array if (!function_exists('hsl_to_rgb')) { function hsl_to_rgb($h, $s, $l) { - $r; - $g; - $b; + $r = 0; + $g = 0; + $b = 0; $c = (1 - abs((2 * $l) - 1)) * $s; $x = $c * (1 - abs(fmod(($h / 60), 2) - 1)); @@ -2203,7 +2206,8 @@ if (!function_exists('limit_offset')) { //add a random_bytes function when it doesn't exist for old versions of PHP if (!function_exists('random_bytes')) { function random_bytes($length) { - $chars .= "0123456789"; + $string = ''; + $chars = "0123456789"; $chars .= "abcdefghijkmnopqrstuvwxyz"; $chars .= "ABCDEFGHIJKLMNPQRSTUVWXYZ"; for ($i = 0; $i < $length; $i++) {