Code updates for PHP8 compatibility in all PHP scripts

Added PHP_error_reporting_OVERRIDE options for each web directory

git-svn-id: svn://192.168.202.10@3863 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2024-08-06 15:02:09 +00:00
parent 3226d9b172
commit 0820807d85
121 changed files with 1421 additions and 967 deletions
+29 -11
View File
@@ -1,7 +1,7 @@
<?php
# customer_chat_code.php
#
# Copyright (C) 2022 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2024 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Example for incorporating the customer side of the Vicidial chat into a web page.
# Can be called as an include file, if desired.
@@ -13,8 +13,26 @@
# 160108-1659 - Added available_agents variable
# 160120-1944 - Added show_email variable
# 220220-1921 - Added allow_web_debug system setting
# 240801-1130 - Code updates for PHP8 compatibility
# 240805-2103 - Added PHP_error_reporting_OVERRIDE options
#
$PHP_error_reporting_OVERRIDE=0;
if (file_exists('options.php'))
{
require('options.php');
}
if ($PHP_error_reporting_OVERRIDE > 0)
{
$php_err_suppression_value=32767; # E_ALL
$php_err_suppression_value-=($PHP_error_reporting_HIDE_ERRORS ? 1 : 0);
$php_err_suppression_value-=($PHP_error_reporting_HIDE_WARNINGS ? 2 : 0);
$php_err_suppression_value-=($PHP_error_reporting_HIDE_PARSES ? 4 : 0);
$php_err_suppression_value-=($PHP_error_reporting_HIDE_NOTICES ? 8 : 0);
$php_err_suppression_value-=($PHP_error_reporting_HIDE_DEPRECATIONS ? 8192 : 0);
error_reporting($php_err_suppression_value);
}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["chat_id"])) {$chat_id=$_GET["chat_id"];}
@@ -34,17 +52,17 @@ if (isset($_GET["available_agents"])) {$available_agents=$_GET["available_agen
if (isset($_GET["show_email"])) {$show_email=$_GET["show_email"];}
elseif (isset($_POST["show_email"])) {$show_email=$_POST["show_email"];}
$lead_id = preg_replace("/[^0-9]/","",$lead_id);
$chat_id = preg_replace('/[^-\_\.0-9a-zA-Z]/','',$chat_id);
$group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$group_id);
$chat_group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$chat_group_id);
$email = preg_replace('/[^-\.\:\/\@\_0-9\p{L}]/u','',$email);
$unique_userID = preg_replace('/[^-\.\_0-9a-zA-Z]/','',$unique_userID);
$language = preg_replace('/[^-\_0-9a-zA-Z]/','',$language);
$available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents);
$show_email = preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email);
if (isset($lead_id)) {$lead_id = preg_replace("/[^0-9]/","",$lead_id);}
if (isset($chat_id)) {$chat_id = preg_replace('/[^-\_\.0-9a-zA-Z]/','',$chat_id);}
if (isset($group_id)) {$group_id = preg_replace('/[^-\_0-9\p{L}]/u','',$group_id);}
if (isset($chat_group_id)) {$chat_group_id = urlencode(preg_replace('/[^-\_0-9\p{L}]/u','',$chat_group_id));}
if (isset($email)) {$email = urlencode(preg_replace('/[^-\.\:\/\@\_0-9\p{L}]/u','',$email));}
if (isset($unique_userID)) {$unique_userID = urlencode(preg_replace('/[^-\.\_0-9a-zA-Z]/','',$unique_userID));}
if (isset($language)) {$language = urlencode(preg_replace('/[^-\_0-9a-zA-Z]/','',$language));}
if (isset($available_agents)) {urlencode($available_agents = preg_replace('/[^-\_0-9a-zA-Z]/','',$available_agents));}
if (isset($show_email)) {$show_email = urlencode(preg_replace('/[^-\_0-9a-zA-Z]/','',$show_email));}
$URL_vars="?user=".urlencode($unique_userID)."&lead_id=".$lead_id."&group_id=".urlencode($chat_group_id)."&chat_id=".$chat_id."&email=".urlencode($email)."&language=".urlencode($language)."&available_agents=".urlencode($available_agents)."&show_email=".urlencode($show_email);
$URL_vars="?user=".$unique_userID."&lead_id=".$lead_id."&group_id=".$chat_group_id."&chat_id=".$chat_id."&email=".$email."&language=".$language."&available_agents=".$available_agents."&show_email=".$show_email;
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0