Phrases: Updates for PHP 8.1
This commit is contained in:
parent
4ac06a9194
commit
6b07e8d168
|
|
@ -128,7 +128,7 @@
|
|||
}
|
||||
|
||||
//add the phrase
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('phrase_add')) {
|
||||
//build data array
|
||||
$phrase_uuid = uuid();
|
||||
|
|
@ -154,11 +154,11 @@
|
|||
$array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['phrase_details'][0]['phrase_detail_order'] = $_POST['phrase_detail_order'];
|
||||
$array['phrase_details'][0]['phrase_detail_tag'] = $_POST['phrase_detail_tag'];
|
||||
$array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'];
|
||||
$array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_function'] = $_POST['phrase_detail_function'];
|
||||
$array['phrase_details'][0]['phrase_detail_data'] = $_POST['phrase_detail_data'];
|
||||
$array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'];
|
||||
$array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'];
|
||||
$array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_group'] = $_POST['phrase_detail_group'];
|
||||
}
|
||||
}
|
||||
|
|
@ -218,11 +218,11 @@
|
|||
$array['phrase_details'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['phrase_details'][0]['phrase_detail_order'] = $_POST['phrase_detail_order'];
|
||||
$array['phrase_details'][0]['phrase_detail_tag'] = $_POST['phrase_detail_tag'];
|
||||
$array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'];
|
||||
$array['phrase_details'][0]['phrase_detail_pattern'] = $_POST['phrase_detail_pattern'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_function'] = $_POST['phrase_detail_function'];
|
||||
$array['phrase_details'][0]['phrase_detail_data'] = $_POST['phrase_detail_data'];
|
||||
$array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'];
|
||||
$array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'];
|
||||
$array['phrase_details'][0]['phrase_detail_method'] = $_POST['phrase_detail_method'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_type'] = $_POST['phrase_detail_type'] ?? null;
|
||||
$array['phrase_details'][0]['phrase_detail_group'] = $_POST['phrase_detail_group'];
|
||||
}
|
||||
}
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
echo "var opt_group = document.createElement('optgroup');\n";
|
||||
echo "opt_group.label = \"".$text['label-recordings']."\";\n";
|
||||
foreach ($recordings as &$row) {
|
||||
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
|
||||
if (!empty($_SESSION['recordings']['storage_type']['text']) && $_SESSION['recordings']['storage_type']['text'] == 'base64') {
|
||||
echo "opt_group.appendChild(new Option(\"".$row["recording_name"]."\", \"\${lua streamfile.lua ".$row["recording_filename"]."}\"));\n";
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -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) 2018-2020
|
||||
Portions created by the Initial Developer are Copyright (C) 2018-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('phrase_add') || permission_exists('phrase_edit') || permission_exists('phrase_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($phrases ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($phrases) ? "style='visibility: hidden;'" : null).">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
if ($show == "all" && permission_exists('phrase_all')) {
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
echo " <input type='hidden' name='phrases[$x][uuid]' value='".escape($row['phrase_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('phrase_all')) {
|
||||
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('phrase_all')) {
|
||||
if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
|
||||
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['phrase_description'])." </td>\n";
|
||||
if (permission_exists('phrase_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('phrase_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
|
@ -274,4 +274,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -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
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Reference in New Issue