Fix all PHP 8.1 messages for upgrade.php

This commit is contained in:
markjcrane
2023-05-17 10:07:49 -06:00
parent 6816921f47
commit 6d7e125743
22 changed files with 215 additions and 152 deletions

View File

@@ -34,25 +34,27 @@
//process the xml files
foreach ($xml_list as &$xml_file) {
//get and parse the xml
$number_translation->display_type = $display_type;
$number_translation->xml = file_get_contents($xml_file);
$number_translation->import();
}
//check for existing configuration
if (file_exists($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml")) {
if (!empty($_SESSION['switch']['conf']['dir']) && file_exists($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml")) {
//import existing data
$xml = file_get_contents($_SESSION['switch']['conf']['dir']."/autoload_configs/translate.conf.xml");
//convert the xml string to an xml object
$xml = simplexml_load_string($xml);
//convert to json
$json = json_encode($xml);
//convert to an array
$number_translations = json_decode($json, true);
if (array_key_exists('include', $number_translations)) {
$number_translations = $number_translations['include'];
}
if ($number_translations['configuration']['@attributes']['autogenerated'] != 'true') {
if (!empty($number_translations['configuration']) && $number_translations['configuration']['@attributes']['autogenerated'] != 'true') {
foreach ($number_translations['configuration']['profiles']['profile'] as $profile) {
$json = json_encode($profile);
$number_translation->display_type = $display_type;

View File

@@ -127,7 +127,7 @@ if (!class_exists('number_translations')) {
$database->app_uuid = '6ad54de6-4909-11e7-a919-92ebcb67fe33';
$database->save($array);
unset($array);
if ($this->display_type == "text") {
if (!empty($this->display_type) && $this->display_type == "text") {
if ($database->message['code'] != '200') {
echo "number_translation:".$number_translation['@attributes']['name'].": failed: ".$database->message['message']."\n";
}