Streams: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-06-08 20:57:33 +00:00
parent ec40d59152
commit a07e7af955
No known key found for this signature in database
3 changed files with 19 additions and 19 deletions

View File

@ -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-2019
Portions created by the Initial Developer are Copyright (C) 2018-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -80,7 +80,7 @@ if (!class_exists('streams')) {
//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'];
}
}
@ -126,7 +126,7 @@ if (!class_exists('streams')) {
//get current toggle state
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}
@ -195,7 +195,7 @@ if (!class_exists('streams')) {
//get checked records
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}

View File

@ -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.
*/
@ -143,7 +143,7 @@
}
//pre-populate the form
if (!empty($_GET) && $_POST["persistformvar"] != "true") {
if (!empty($_GET) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$stream_uuid = $_GET["id"];
$sql = "select * from v_streams ";
$sql .= "where stream_uuid = :stream_uuid ";

View File

@ -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-2022
Portions created by the Initial Developer are Copyright (C) 2018-2023
the Initial Developer. All Rights Reserved.
*/
@ -88,21 +88,21 @@
$order = $_GET["order"] ?? '';
//add the search term
if (isset($_GET["search"])) {
$search = strtolower($_GET["search"]);
if (!empty($_GET["search"])) {
$search = $_GET["search"];
}
//prepare to page the results
$sql = "select count(stream_uuid) from v_streams ";
$sql .= "where true ";
if (isset($search) && $search != '') {
$sql = "and (";
if (!empty($search)) {
$sql .= "and (";
$sql .= "lower(stream_name) like :search ";
$sql .= "or lower(stream_location) like :search ";
$sql .= "or lower(stream_enabled) like :search ";
$sql .= "or lower(stream_description) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
$parameters['search'] = '%'.strtolower($search).'%';
}
if (permission_exists('stream_all') && $show == "all") {
//show all
@ -132,14 +132,14 @@
//get the list
$sql = "select * from v_streams ";
$sql .= "where true ";
if (isset($search) && $search != '') {
$sql = "and (";
if (!empty($search)) {
$sql .= "and (";
$sql .= " lower(stream_name) like :search ";
$sql .= " or lower(stream_location) like :search ";
$sql .= " or lower(stream_enabled) like :search ";
$sql .= " or lower(stream_description) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
$parameters['search'] = '%'.strtolower($search).'%';
}
if (permission_exists('stream_all') && $show == "all") {
//show all
@ -233,7 +233,7 @@
echo "<tr class='list-header'>\n";
if (permission_exists('stream_add') || permission_exists('stream_edit') || permission_exists('stream_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($streams ?: "style='visibility: hidden;'").">\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($streams) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
if ($show == 'all' && permission_exists('stream_all')) {
@ -261,7 +261,7 @@
echo " <input type='hidden' name='streams[$x][uuid]' value='".escape($row['stream_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == 'all' && permission_exists('stream_all')) {
if (!empty($_GET['show']) && $_GET['show'] == 'all' && permission_exists('stream_all')) {
echo " <td>";
if ($_SESSION['domains'][$row['domain_uuid']]['domain_name'] != '') {
echo escape($_SESSION['domains'][$row['domain_uuid']]['domain_name']);
@ -283,7 +283,7 @@
if (!empty($row['stream_location'])) {
$location_parts = explode('://',$row['stream_location']);
$http_protocol = ($location_parts[0] == "shout") ? 'http' : 'https';
echo "<audio src='".$http_protocol."://".$location_parts[1]."' controls='controls' />\n";
echo "<audio src='".$http_protocol."://".($location_parts[1] ?? '')."' controls='controls' />\n";
}
echo " </td>\n";
if (permission_exists('stream_edit')) {
@ -296,7 +296,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['stream_description'])."&nbsp;</td>\n";
if (permission_exists('stream_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
if (permission_exists('stream_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";