Frytimo pr patches for php8.1 (#6630)

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

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

* php 8.1 fixes

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

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

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

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

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

* php 8.1 fixes - strlower with null

* php 8.1 fixes - strreplace with null

* php 8.1 fixes - passing null to base64_decode

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

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

* php 8.1 fixes - avoid sending null to substr

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

* php 8.1 fixes - check for null before preg_replace

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

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

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

* php 8.1 fixes

* php 8.1 fixes - correct $_POST checking syntax

* php 8.1 fixes - correct $_POST variables

* php 8.1 fixes

* Use brackets consistently

* Update user_setting_edit.php

* Change to not empty

* Update device.php

* Update text.php

---------

Co-authored-by: Tim Fry <tim@voipstratus.com>
Co-authored-by: FusionPBX <markjcrane@gmail.com>
This commit is contained in:
frytimo
2023-05-05 13:46:37 -03:00
committed by GitHub
parent ebbb2f1a72
commit fef8165be2
230 changed files with 1948 additions and 1937 deletions

View File

@@ -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 "</tr>\n";
preg_match("/\(git\s*(.*?)\s*\d+\w+\s*\)/", $switch_version, $matches);
$switch_git_info = $matches[1];
if(strlen($switch_git_info) > 0){
if(!empty($switch_git_info)){
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\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 "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-os']." \n";
@@ -209,7 +210,7 @@
echo " </td>\n";
echo "</tr>\n";
}
if (strlen($os_version) > 0) {
if (!empty($os_version)) {
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-version']." \n";
@@ -219,7 +220,7 @@
echo " </td>\n";
echo "</tr>\n";
}
if (strlen($os_kernel) > 0) {
if (!empty($os_kernel)) {
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " ".$text['label-kernel']." \n";
@@ -234,7 +235,7 @@
echo "<!--\n";
$tmp_result = shell_exec('uptime');
echo "-->\n";
if (strlen($tmp_result) > 0) {
if (!empty($tmp_result)) {
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\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 "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo " <th colspan='2' align='left' valign='top'>".$text['title-mem']."</th>\n";
@@ -292,7 +293,7 @@
$shell_cmd = 'sysctl vm.vmtotal';
$shell_result = shell_exec($shell_cmd);
echo "-->\n";
if (strlen($shell_result) > 0) {
if (!empty($shell_result)) {
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo " <th colspan='2' align='left' valign='top'>".$text['title-mem']."</th>\n";
@@ -324,7 +325,7 @@
$system = $res->ItemIndex(0);
$shell_result = round($system->TotalPhysicalMemory / 1024 /1024, 0);
echo "-->\n";
if (strlen($shell_result) > 0) {
if (!empty($shell_result)) {
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo " <th class='th' colspan='2' align='left'>".$text['Physical Memory']."</th>\n";
@@ -352,7 +353,7 @@
$shell_cmd = "ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'";
$shell_result = shell_exec($shell_cmd);
echo "-->\n";
if (strlen($shell_result) > 0) {
if (!empty($shell_result)) {
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo " <th class='th' colspan='2' align='left' valign='top'>".$text['title-cpu']."</th>\n";
@@ -387,7 +388,7 @@
$shell_cmd = 'top';
$shell_result = shell_exec($shell_cmd);
echo "-->\n";
if (strlen($shell_result) > 0) {
if (!empty($shell_result)) {
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo "<tr>\n";
echo " <th class='th' colspan='2' align='left' valign='top'>".$text['title-cpu']."</th>\n";
@@ -553,7 +554,7 @@
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$memcache_lines = preg_split('/\n/', $switch_result);
foreach($memcache_lines as $memcache_line) {
if (strlen(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ') > 0) {
if (!empty(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ')) {
$memcache_temp = explode(': ', $memcache_line);
$memcache_status[$memcache_temp[0]] = $memcache_temp[1];
}