Phrases: Updates for PHP 8.1
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -85,7 +85,7 @@ if (!class_exists('phrases')) {
|
||||
|
||||
//filter out unchecked phrases, build where clause for below
|
||||
foreach ($records as $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ if (!class_exists('phrases')) {
|
||||
|
||||
//filter out unchecked phrases, build the delete array
|
||||
foreach ($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
|
||||
$array[$this->table][$x]['phrase_uuid'] = $this->phrase_uuid;
|
||||
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
@@ -189,7 +189,7 @@ if (!class_exists('phrases')) {
|
||||
}
|
||||
|
||||
//get phrase languages
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
$sql = "select phrase_language as lang from v_phrases ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and phrase_uuid = :phrase_uuid ";
|
||||
@@ -201,7 +201,7 @@ if (!class_exists('phrases')) {
|
||||
}
|
||||
|
||||
//delete the checked rows
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array) && is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
@@ -251,8 +251,8 @@ if (!class_exists('phrases')) {
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get current toggle state and language
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
foreach ($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -291,10 +291,12 @@ if (!class_exists('phrases')) {
|
||||
unset($array);
|
||||
|
||||
//clear the cache
|
||||
$phrase_languages = array_unique($phrase_languages);
|
||||
$cache = new cache;
|
||||
foreach ($phrase_languages as $phrase_language) {
|
||||
$cache->delete("languages:".$phrase_language);
|
||||
if (!empty($phrase_languages) && is_array($phrase_languages) && @sizeof($phrase_languages) != 0) {
|
||||
$phrase_languages = array_unique($phrase_languages);
|
||||
$cache = new cache;
|
||||
foreach ($phrase_languages as $phrase_language) {
|
||||
$cache->delete("languages:".$phrase_language);
|
||||
}
|
||||
}
|
||||
|
||||
//clear the destinations session array
|
||||
@@ -333,8 +335,8 @@ if (!class_exists('phrases')) {
|
||||
if (is_array($records) && @sizeof($records) != 0) {
|
||||
|
||||
//get checked records
|
||||
foreach($records as $x => $record) {
|
||||
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
foreach ($records as $x => $record) {
|
||||
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
|
||||
$uuids[] = "'".$record['uuid']."'";
|
||||
}
|
||||
}
|
||||
@@ -384,7 +386,9 @@ if (!class_exists('phrases')) {
|
||||
unset($sql_2, $parameters_2, $rows_2, $row_2);
|
||||
|
||||
//create array of languages
|
||||
$phrase_languages[] = $row['phrase_languages'];
|
||||
if (!empty($row['phrase_languages'])) {
|
||||
$phrase_languages[] = $row['phrase_languages'];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters, $rows, $row);
|
||||
@@ -408,10 +412,12 @@ if (!class_exists('phrases')) {
|
||||
$p->delete('phrase_detail_add', 'temp');
|
||||
|
||||
//clear the cache
|
||||
$phrase_languages = array_unique($phrase_languages);
|
||||
$cache = new cache;
|
||||
foreach ($phrase_languages as $phrase_language) {
|
||||
$cache->delete("languages:".$phrase_language);
|
||||
if (!empty($phrase_languages) && is_array($phrase_languages) && @sizeof($phrase_languages) != 0) {
|
||||
$phrase_languages = array_unique($phrase_languages);
|
||||
$cache = new cache;
|
||||
foreach ($phrase_languages as $phrase_language) {
|
||||
$cache->delete("languages:".$phrase_language);
|
||||
}
|
||||
}
|
||||
|
||||
//set message
|
||||
@@ -427,4 +433,4 @@ if (!class_exists('phrases')) {
|
||||
} //class
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user