From 410f5e6f683960bde832b282b84d108b629492ae Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Wed, 31 May 2023 09:11:50 -0600 Subject: [PATCH] more php 8.1 changes (#6727) * Update call_broadcast.php * Update call_broadcast_edit.php * Update conference_center_edit.php * Update call_flows.php * Update conference_room_edit.php * Update conference_sessions.php * Update conference_session_details.php * Update conference_rooms.php * Update conference_controls.php * Update conference_control_edit.php * Update conference_control_details.php * Update conference_control_detail_edit.php * Update conference_profiles.php * Update conference_profile_edit.php * Update conference_profile_params.php * Update conference_profile_param_edit.php * Update conferences.php * Update conference_edit.php * Update conferences.php * Update conference_interactive_inc.php * Update contacts.php --- app/call_broadcast/call_broadcast.php | 16 ++-- app/call_broadcast/call_broadcast_edit.php | 12 +++ app/call_flows/call_flows.php | 15 ++-- .../conference_center_edit.php | 23 +++--- .../conference_room_edit.php | 47 ++++++----- app/conference_centers/conference_rooms.php | 34 ++++---- .../conference_session_details.php | 47 ++++++----- .../conference_sessions.php | 33 ++++---- .../conference_control_detail_edit.php | 29 ++++--- .../conference_control_details.php | 45 ++++++----- .../conference_control_edit.php | 16 ++-- .../conference_controls.php | 33 ++++---- .../conference_profile_edit.php | 16 ++-- .../conference_profile_param_edit.php | 23 +++--- .../conference_profile_params.php | 31 +++---- .../conference_profiles.php | 34 ++++---- app/conferences/conference_edit.php | 40 ++++++---- app/conferences/conferences.php | 44 +++++----- .../conference_interactive_inc.php | 4 +- app/contacts/contacts.php | 80 ++++++++++--------- 20 files changed, 357 insertions(+), 265 deletions(-) diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index 08af5738c9..683b2e7a29 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -120,8 +120,8 @@ } $page = $_GET['page'] ?? ''; if (empty($page)) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); - list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); + list($paging_controls, $rows_per_page) = paging($num_rows, $param ?? null, $rows_per_page); + list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param ?? null, $rows_per_page, true); $offset = $rows_per_page * $page; //get the call broadcasts @@ -175,11 +175,11 @@ } echo "\n"; @@ -150,12 +153,12 @@ echo "".$text['label-time']."\n"; echo th_order_by('start_epoch', $text['label-start'], $order_by, $order); echo th_order_by('end_epoch', $text['label-end'], $order_by, $order); - if (permission_exists('conference_session_details') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_session_details') && $list_row_edit_button == 'true') { echo "  \n"; } echo "\n"; - if (is_array($conference_session_details) && sizeof($conference_session_details) != 0) { + if (!empty($conference_session_details)) { foreach($conference_session_details as $row) { if (defined('TIME_24HR') && TIME_24HR == 1) { $start_date = date("j M Y H:i:s", $row['start_epoch']); @@ -189,7 +192,7 @@ echo " ".$time_difference." \n"; echo " ".$start_date." \n"; echo " ".$end_date." \n"; - if (permission_exists('conference_session_details') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_session_details') && $list_row_edit_button == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/conference_centers/conference_sessions.php b/app/conference_centers/conference_sessions.php index 79dea51897..b44641bc5f 100644 --- a/app/conference_centers/conference_sessions.php +++ b/app/conference_centers/conference_sessions.php @@ -46,15 +46,18 @@ $language = new text; $text = $language->get(); +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get the http post data - if (is_array($_POST['conference_sessions'])) { + if (!empty($_POST['conference_sessions'])) { $action = $_POST['action']; $meeting_uuid = $_POST['meeting_uuid']; $conference_sessions = $_POST['conference_sessions']; } //process the http post data by action - if ($action != '' && is_array($conference_sessions) && @sizeof($conference_sessions) != 0) { + if (!empty($action) && !empty($conference_sessions)) { switch ($action) { case 'delete': if (permission_exists('conference_session_delete')) { @@ -70,12 +73,12 @@ } //set variables from the http values - $meeting_uuid = $_GET["id"]; - $order_by = $_GET["order_by"] != '' ? $_GET["order_by"] : 'start_epoch'; - $order = $_GET["order"] != '' ? $_GET["order"] : 'desc'; + $meeting_uuid = $_GET["id"] ?? ''; + $order_by = $_GET["order_by"] ?? '' ? $_GET["order_by"] : 'start_epoch'; + $order = $_GET["order"] ?? '' ? $_GET["order"] : 'desc'; //add meeting_uuid to a session variable - if (is_uuid($meeting_uuid)) { + if (!empty($meeting_uuid) && is_uuid($meeting_uuid)) { $_SESSION['meeting']['uuid'] = $meeting_uuid; } @@ -84,15 +87,15 @@ $sql .= "where domain_uuid = :domain_uuid "; $sql .= "and meeting_uuid = :meeting_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['meeting_uuid'] = $_SESSION['meeting']['uuid']; + $parameters['meeting_uuid'] = $_SESSION['meeting']['uuid'] ?? ''; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); unset($sql, $parameters); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $param = ''; - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $page = isset($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; @@ -105,9 +108,9 @@ $sql .= order_by($order_by, $order); $sql .= limit_offset($rows_per_page, $offset); $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['meeting_uuid'] = $_SESSION['meeting']['uuid']; + $parameters['meeting_uuid'] = $_SESSION['meeting']['uuid'] ?? ''; $database = new database; - $conference_sessions = $database->select($sql, $parameters, 'all'); + $conference_sessions = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -172,12 +175,12 @@ echo th_order_by('profile', $text['label-profile'], $order_by, $order); //echo th_order_by('recording', $text['label-recording'], $order_by, $order); echo "".$text['label-tools']."\n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if ($list_row_edit_button == 'true') { echo "  \n"; } echo "\n"; - if (is_array($conference_sessions) && sizeof($conference_sessions) != 0) { + if (!empty($conference_sessions)) { $x = 0; foreach($conference_sessions as $row) { $tmp_year = date("Y", $row['start_epoch']); @@ -232,7 +235,7 @@ echo "\n"; } echo " \n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if ($list_row_edit_button == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/conference_controls/conference_control_detail_edit.php b/app/conference_controls/conference_control_detail_edit.php index e7160c2faf..040905884c 100644 --- a/app/conference_controls/conference_control_detail_edit.php +++ b/app/conference_controls/conference_control_detail_edit.php @@ -21,8 +21,13 @@ $language = new text; $text = $language->get(); +//set the defaults + $control_digits = ''; + $control_action = ''; + $control_data = ''; + //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $conference_control_detail_uuid = $_REQUEST["id"]; } @@ -31,12 +36,12 @@ } //set the parent uuid - if (is_uuid($_GET["conference_control_uuid"])) { + if (!empty($_GET["conference_control_uuid"]) && is_uuid($_GET["conference_control_uuid"])) { $conference_control_uuid = $_GET["conference_control_uuid"]; } //get http post variables and set them to php variables - if (count($_POST) > 0) { + if (!empty($_POST)) { $control_digits = $_POST["control_digits"]; $control_action = $_POST["control_action"]; $control_data = $_POST["control_data"]; @@ -44,7 +49,7 @@ } //process the http post - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //get the uuid if ($action == "update") { @@ -79,7 +84,7 @@ } //add or update the database - if ($_POST["persistformvar"] != "true") { + if (empty($_POST["persistformvar"])) { $array['conference_control_details'][0]['conference_control_uuid'] = $conference_control_uuid; $array['conference_control_details'][0]['control_digits'] = $control_digits; @@ -112,16 +117,16 @@ } //pre-populate the form - if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { - $conference_control_detail_uuid = $_GET["id"]; + if (!empty($_GET) && empty($_POST["persistformvar"])) { + $conference_control_detail_uuid = $_GET["id"] ?? ''; $sql = "select * from v_conference_control_details "; $sql .= "where conference_control_detail_uuid = :conference_control_detail_uuid "; //$sql .= "and domain_uuid = :domain_uuid "; $parameters['conference_control_detail_uuid'] = $conference_control_detail_uuid; //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && sizeof($row) != 0) { + $row = $database->select($sql, $parameters ?? null, 'row'); + if (!empty($row)) { $control_digits = $row["control_digits"]; $control_action = $row["control_action"]; $control_data = $row["control_data"]; @@ -147,7 +152,7 @@ echo "
\n"; echo "
".$text['title-conference_control_detail']."
\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_control_edit.php?id='.urlencode($conference_control_uuid)]); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'conference_control_edit.php?id='.urlencode($conference_control_uuid ?? '')]); echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']); echo "
\n"; echo "
\n"; @@ -213,9 +218,9 @@ echo ""; echo "

"; - echo "\n"; + echo "\n"; if ($action == "update") { - echo "\n"; + echo "\n"; } echo "\n"; diff --git a/app/conference_controls/conference_control_details.php b/app/conference_controls/conference_control_details.php index 34108036ac..ab533dab46 100644 --- a/app/conference_controls/conference_control_details.php +++ b/app/conference_controls/conference_control_details.php @@ -46,15 +46,18 @@ $language = new text; $text = $language->get(); +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get the http post data - if (is_array($_POST['conference_control_details'])) { + if (!empty($_POST['conference_control_details'])) { $action = $_POST['action']; $conference_control_uuid = $_POST['conference_control_uuid']; $conference_control_details = $_POST['conference_control_details']; } //process the http post data by action - if ($action != '' && is_array($conference_control_details) && @sizeof($conference_control_details) != 0) { + if (!empty($action) && !empty($conference_control_details)) { switch ($action) { case 'toggle': if (permission_exists('conference_control_detail_edit')) { @@ -77,11 +80,11 @@ } //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //add the search term - $search = $_GET["search"]; + $search = $_GET["search"] ?? ''; if (!empty($search)) { $sql_search = "and ("; $sql_search .= "control_digits like :search"; @@ -96,27 +99,27 @@ $sql = "select count(conference_control_detail_uuid) "; $sql .= "from v_conference_control_details "; $sql .= "where conference_control_uuid = :conference_control_uuid "; - $sql .= $sql_search; - $parameters['conference_control_uuid'] = $conference_control_uuid; + $sql .= $sql_search ?? ''; + $parameters['conference_control_uuid'] = $conference_control_uuid ?? ''; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = "&id=".$conference_control_uuid; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; + $param = "&id=".!empty($conference_control_uuid); if (isset($_GET['page'])) { - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $page = isset($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; } //get the list $sql = str_replace('count(conference_control_detail_uuid)', '*', $sql); - $sql .= $sql_search; + $sql .= $sql_search ?? ''; $sql .= order_by($order_by, $order, 'control_digits', 'asc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page, !empty($offset)); $database = new database; - $result = $database->select($sql, $parameters, 'all'); + $result = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -129,7 +132,7 @@ echo "
\n"; echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'margin-right: 15px; display: none;','link'=>'conference_controls.php']); if (permission_exists('conference_control_detail_add')) { - echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'name'=>'btn_add','collapse'=>'hide-xs','link'=>'conference_control_detail_edit.php?conference_control_uuid='.urlencode($_GET['id'])]); + echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'name'=>'btn_add','collapse'=>'hide-xs','link'=>'conference_control_detail_edit.php?conference_control_uuid='.urlencode($_GET['id'] ?? '')]); } if (permission_exists('conference_control_detail_edit') && $result) { echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'name'=>'btn_toggle','collapse'=>'hide-xs','onclick'=>"modal_open('modal-toggle','btn_toggle');"]); @@ -150,7 +153,7 @@ echo "
\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -163,12 +166,12 @@ echo th_order_by('control_action', $text['label-control_action'], $order_by, $order, null, null, $param); echo th_order_by('control_data', $text['label-control_data'], $order_by, $order, null, "class='pct-50 hide-xs'", $param); echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order, null, "class='center'", $param); - if (permission_exists('conference_control_detail_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_control_detail_edit') && $list_row_edit_button == 'true') { echo " \n"; } echo "\n"; - if (is_array($result) && @sizeof($result) != 0) { + if (!empty($result)) { $x = 0; foreach ($result as $row) { if (permission_exists('conference_control_detail_edit')) { @@ -200,7 +203,7 @@ echo $text['label-'.$row['control_enabled']]; } echo " \n"; - if (permission_exists('conference_control_detail_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_control_detail_edit') && $list_row_edit_button == 'true') { echo " \n"; @@ -213,7 +216,7 @@ echo "
 
\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
\n"; echo "
\n"; - echo "
".$paging_controls."
\n"; + echo "
".!empty($paging_controls)."
\n"; echo "\n"; echo "
\n"; @@ -237,4 +240,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/conference_controls/conference_control_edit.php b/app/conference_controls/conference_control_edit.php index d82a0a78e4..2cd8fbeafd 100644 --- a/app/conference_controls/conference_control_edit.php +++ b/app/conference_controls/conference_control_edit.php @@ -21,8 +21,12 @@ $language = new text; $text = $language->get(); +//set the defaults + $control_name = ''; + $control_description = ''; + //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $conference_control_uuid = $_REQUEST["id"]; } @@ -31,14 +35,14 @@ } //get http post variables and set them to php variables - if (count($_POST) > 0) { + if (!empty($_POST)) { $control_name = $_POST["control_name"]; $control_enabled = $_POST["control_enabled"] ?: 'false'; $control_description = $_POST["control_description"]; } //process the user data and save it to the database - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //get the uuid from the POST if ($action == "update") { @@ -107,15 +111,15 @@ } //(is_array($_POST) && empty($_POST["persistformvar"])) //pre-populate the form - if (is_array($_GET) && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && !empty($_POST["persistformvar"])) { $conference_control_uuid = $_GET["id"]; $sql = "select * from v_conference_controls "; //$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where conference_control_uuid = :conference_control_uuid "; $parameters['conference_control_uuid'] = $conference_control_uuid; $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && sizeof($row) != 0) { + $row = $database->select($sql, $parameters ?? null, 'row'); + if (!empty($row)) { $control_name = $row["control_name"]; $control_enabled = $row["control_enabled"]; $control_description = $row["control_description"]; diff --git a/app/conference_controls/conference_controls.php b/app/conference_controls/conference_controls.php index b886b50994..6e35f0111f 100644 --- a/app/conference_controls/conference_controls.php +++ b/app/conference_controls/conference_controls.php @@ -46,15 +46,18 @@ $language = new text; $text = $language->get(); +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get the http post data - if (is_array($_POST['conference_controls'])) { + if (!empty($_POST['conference_controls'])) { $action = $_POST['action']; $search = $_POST['search']; $conference_controls = $_POST['conference_controls']; } //process the http post data by action - if ($action != '' && is_array($conference_controls) && @sizeof($conference_controls) != 0) { + if (!empty($action) && !empty($conference_controls)) { switch ($action) { case 'copy': if (permission_exists('conference_control_add')) { @@ -76,16 +79,16 @@ break; } - header('Location: conference_controls.php'.($search != '' ? '?search='.urlencode($search) : null)); + header('Location: conference_controls.php'.(!empty($search) ? '?search='.urlencode($search) : null)); exit; } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //add the search string - $search = strtolower($_GET["search"]); + $search = strtolower($_GET["search"] ?? ''); if (!empty($search)) { $sql_search = "where ("; $sql_search .= " lower(control_name) like :search "; @@ -96,14 +99,14 @@ //get the count $sql = "select count(conference_control_uuid) from v_conference_controls "; - $sql .= $sql_search; + $sql .= $sql_search ?? ''; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $param = $search ? "&search=".$search : null; - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $page = isset($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; @@ -113,7 +116,7 @@ $sql .= order_by($order_by, $order, 'control_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $conference_controls = $database->select($sql, $parameters, 'all'); + $conference_controls = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -173,18 +176,18 @@ echo "\n"; if (permission_exists('conference_control_add') || permission_exists('conference_control_edit') || permission_exists('conference_control_delete')) { echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; } echo th_order_by('control_name', $text['label-control_name'], $order_by, $order); echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order, null, "class='center shrink'"); echo " ".$text['label-control_description']."\n"; - if (permission_exists('conference_control_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_control_edit') && $list_row_edit_button == 'true') { echo "  \n"; } echo "\n"; - if (is_array($conference_controls) && @sizeof($conference_controls) != 0) { + if (!empty($conference_controls)) { $x = 0; foreach ($conference_controls as $row) { if (permission_exists('conference_control_edit')) { @@ -215,7 +218,7 @@ } echo " \n"; echo " ".escape($row['control_description'])."\n"; - if (permission_exists('conference_control_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_control_edit') && $list_row_edit_button == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; diff --git a/app/conference_profiles/conference_profile_edit.php b/app/conference_profiles/conference_profile_edit.php index 2b42ed1aca..638ed5a0c5 100644 --- a/app/conference_profiles/conference_profile_edit.php +++ b/app/conference_profiles/conference_profile_edit.php @@ -21,8 +21,12 @@ $language = new text; $text = $language->get(); +//set the defaults + $profile_name = ''; + $profile_description = ''; + //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $conference_profile_uuid = $_REQUEST["id"]; } @@ -31,13 +35,13 @@ } //get http post variables and set them to php variables - if (count($_POST) > 0) { + if (!empty($_POST)) { $profile_name = $_POST["profile_name"]; $profile_enabled = $_POST["profile_enabled"] ?: 'false'; $profile_description = $_POST["profile_description"]; } //check to see if the http post exists - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //get the uuid if ($action == "update") { @@ -72,7 +76,7 @@ } //add or update the database - if ($_POST["persistformvar"] != "true") { + if (empty($_POST["persistformvar"])) { $array['conference_profiles'][0]['profile_name'] = $profile_name; $array['conference_profiles'][0]['profile_enabled'] = $profile_enabled; @@ -103,7 +107,7 @@ } //pre-populate the form - if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && empty($_POST["persistformvar"])) { $conference_profile_uuid = $_GET["id"]; $sql = "select * from v_conference_profiles "; $sql .= "where conference_profile_uuid = :conference_profile_uuid "; @@ -111,7 +115,7 @@ $parameters['conference_profile_uuid'] = $conference_profile_uuid; //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; - $row = $database->select($sql, $parameters, 'row'); + $row = $database->select($sql, $parameters ?? null, 'row'); if (is_array($row) && sizeof($row) != 0) { $profile_name = $row["profile_name"]; $profile_enabled = $row["profile_enabled"]; diff --git a/app/conference_profiles/conference_profile_param_edit.php b/app/conference_profiles/conference_profile_param_edit.php index ccbcefc726..7546189882 100644 --- a/app/conference_profiles/conference_profile_param_edit.php +++ b/app/conference_profiles/conference_profile_param_edit.php @@ -21,8 +21,13 @@ $language = new text; $text = $language->get(); +//set the defaults + $profile_param_name = ''; + $profile_param_value = ''; + $profile_param_description = ''; + //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $conference_profile_param_uuid = $_REQUEST["id"]; } @@ -31,12 +36,12 @@ } //set the parent uuid - if (is_uuid($_GET["conference_profile_uuid"])) { + if (!empty($_GET["conference_profile_uuid"]) && is_uuid($_GET["conference_profile_uuid"])) { $conference_profile_uuid = $_GET["conference_profile_uuid"]; } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (!empty($_POST)) { $profile_param_name = $_POST["profile_param_name"]; $profile_param_value = $_POST["profile_param_value"]; $profile_param_enabled = $_POST["profile_param_enabled"] ?: 'false'; @@ -44,7 +49,7 @@ } //process the http post if it exists - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //get the uuid if ($action == "update") { @@ -79,7 +84,7 @@ } //add or update the database - if ($_POST["persistformvar"] != "true") { + if (!empty($_POST["persistformvar"])) { $array['conference_profile_params'][0]['conference_profile_uuid'] = $conference_profile_uuid; $array['conference_profile_params'][0]['profile_param_name'] = $profile_param_name; @@ -112,14 +117,14 @@ } //pre-populate the form - if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { - $conference_profile_param_uuid = $_GET["id"]; + if (!empty($_GET) && empty($_POST["persistformvar"])) { + $conference_profile_param_uuid = $_GET["id"] ?? ''; $sql = "select * from v_conference_profile_params "; $sql .= "where conference_profile_param_uuid = :conference_profile_param_uuid "; $parameters['conference_profile_param_uuid'] = $conference_profile_param_uuid; $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && sizeof($row)) { + $row = $database->select($sql, $parameters ?? null, 'row'); + if (!empty($row)) { $profile_param_name = $row["profile_param_name"]; $profile_param_value = $row["profile_param_value"]; $profile_param_enabled = $row["profile_param_enabled"]; diff --git a/app/conference_profiles/conference_profile_params.php b/app/conference_profiles/conference_profile_params.php index 253c0ee88f..d00605a474 100644 --- a/app/conference_profiles/conference_profile_params.php +++ b/app/conference_profiles/conference_profile_params.php @@ -22,15 +22,18 @@ $language = new text; $text = $language->get(); +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get the http post data - if (is_array($_POST['conference_profile_params'])) { + if (!empty($_POST['conference_profile_params'])) { $action = $_POST['action']; $conference_profile_uuid = $_POST['conference_profile_uuid']; $conference_profile_params = $_POST['conference_profile_params']; } //process the http post data by action - if ($action != '' && is_array($conference_profile_params) && @sizeof($conference_profile_params) != 0) { + if (!empty($action) && !empty($conference_profile_params)) { switch ($action) { case 'toggle': if (permission_exists('conference_profile_param_edit')) { @@ -53,8 +56,8 @@ } //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //prepare to page the results $sql = "select count(conference_profile_param_uuid) "; @@ -65,10 +68,10 @@ $num_rows = $database->select($sql, $parameters, 'column'); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $param = "&id=".$conference_profile_uuid; if (isset($_GET['page'])) { - $page = is_numeric($_GET['page']) ? $_GET['page'] : 0; + $page = isset($_GET['page']) ? $_GET['page'] : 0; list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; } @@ -76,9 +79,9 @@ //get the list $sql = str_replace('count(conference_profile_param_uuid)', '*', $sql); $sql .= order_by($order_by, $order, 'profile_param_name', 'asc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page ?? '', $offset ?? ''); $database = new database; - $result = $database->select($sql, $parameters, 'all'); + $result = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -121,19 +124,19 @@ echo "\n"; if (permission_exists('conference_profile_param_edit') || permission_exists('conference_profile_param_delete')) { echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; } echo th_order_by('profile_param_name', $text['label-profile_param_name'], $order_by, $order, null, null, $param); echo th_order_by('profile_param_value', $text['label-profile_param_value'], $order_by, $order, null, "class='pct-40'", $param); echo th_order_by('profile_param_enabled', $text['label-profile_param_enabled'], $order_by, $order, null, "class='center'", $param); echo th_order_by('profile_param_description', $text['label-profile_param_description'], $order_by, $order, null, "class='hide-sm-dn'", $param); - if (permission_exists('conference_profile_param_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_profile_param_edit') && $list_row_edit_button == 'true') { echo "  \n"; } echo "\n"; - if (is_array($result) && @sizeof($result) != 0) { + if (!empty($result)) { $x = 0; foreach ($result as $row) { if (permission_exists('conference_profile_param_edit')) { @@ -165,7 +168,7 @@ } echo " \n"; echo " ".escape($row['profile_param_description'])." \n"; - if (permission_exists('conference_profile_param_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_profile_param_edit') && $list_row_edit_button == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; @@ -178,7 +181,7 @@ echo "\n"; echo "
\n"; - echo "
".$paging_controls."
\n"; + echo "
".!empty($paging_controls)."
\n"; echo "\n"; echo "\n"; @@ -200,4 +203,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/conference_profiles/conference_profiles.php b/app/conference_profiles/conference_profiles.php index 7bcbf7c8f7..2fe5c18400 100644 --- a/app/conference_profiles/conference_profiles.php +++ b/app/conference_profiles/conference_profiles.php @@ -45,15 +45,21 @@ $language = new text; $text = $language->get(); +//set additional variables + $search = $_GET["search"] ?? ''; + +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get the http post data - if (is_array($_POST['conference_profiles'])) { + if (!empty($_POST['conference_profiles'])) { $action = $_POST['action']; $search = $_POST['search']; $conference_profiles = $_POST['conference_profiles']; } //process the http post data by action - if ($action != '' && is_array($conference_profiles) && @sizeof($conference_profiles) != 0) { + if (!empty($action) && !empty($conference_profiles)) { switch ($action) { case 'copy': if (permission_exists('conference_profile_add')) { @@ -75,13 +81,13 @@ break; } - header('Location: conference_profiles.php'.($search != '' ? '?search='.urlencode($search) : null)); + header('Location: conference_profiles.php'.(!empty($search) ? '?search='.urlencode($search) : null)); exit; } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //add the search string if (isset($_GET["search"])) { @@ -99,14 +105,14 @@ $sql .= "where ".$sql_search; } $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //get the list $sql = str_replace('count(conference_profile_uuid)', '*', $sql); $sql .= order_by($order_by, $order, 'profile_name', 'asc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page ?? '', $offset ?? ''); $database = new database; - $conference_profiles = $database->select($sql, $parameters, 'all'); + $conference_profiles = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -137,7 +143,7 @@ echo ""; echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']); //echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'conference_profiles.php','style'=>($search == '' ? 'display: none;' : null)]); - if ($paging_controls_mini != '') { + if (!empty($paging_controls_mini)) { echo "".$paging_controls_mini."\n"; } echo " \n"; @@ -166,18 +172,18 @@ echo "\n"; if (permission_exists('conference_profile_add') || permission_exists('conference_profile_edit') || permission_exists('conference_profile_delete')) { echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; } echo th_order_by('profile_name', $text['label-profile_name'], $order_by, $order); echo th_order_by('profile_enabled', $text['label-profile_enabled'], $order_by, $order, null, "class='center'"); echo " ".$text['label-profile_description']."\n"; - if (permission_exists('conference_profile_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_profile_edit') && $list_row_edit_button == 'true') { echo "  \n"; } echo "\n"; - if (is_array($conference_profiles) && @sizeof($conference_profiles) != 0) { + if (!empty($conference_profiles)) { $x = 0; foreach ($conference_profiles as $row) { if (permission_exists('conference_profile_edit')) { @@ -208,7 +214,7 @@ } echo " \n"; echo " ".escape($row['profile_description'])."\n"; - if (permission_exists('conference_profile_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_profile_edit') && $list_row_edit_button == 'true') { echo " \n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo " \n"; @@ -221,7 +227,7 @@ echo "\n"; echo "
\n"; - echo "
".$paging_controls."
\n"; + echo "
".!empty($paging_controls)."
\n"; echo "\n"; echo "\n"; diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index f75be8fba3..a257f37833 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -45,8 +45,16 @@ $language = new text; $text = $language->get(); +//set the defaults + $conference_name = ''; + $conference_extension = ''; + $conference_pin_number = ''; + $conference_flags = ''; + $conference_account_code = ''; + $conference_description = ''; + //action add or update - if (is_uuid($_REQUEST["id"])) { + if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) { $action = "update"; $conference_uuid = $_REQUEST["id"]; } @@ -55,7 +63,7 @@ } //get http post variables and set them to php variables - if (count($_POST) > 0) { + if (!empty($_POST)) { $dialplan_uuid = $_POST["dialplan_uuid"]; $conference_name = $_POST["conference_name"]; $conference_extension = $_POST["conference_extension"]; @@ -74,7 +82,7 @@ } //delete the user from the v_conference_users - if ($_GET["a"] == "delete" && permission_exists("conference_delete")) { + if (!empty($_GET["a"]) && $_GET["a"] == "delete" && permission_exists("conference_delete")) { $user_uuid = $_REQUEST["user_uuid"]; $conference_uuid = $_REQUEST["id"]; @@ -101,7 +109,7 @@ } //add the user to the v_conference_users - if (is_uuid($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] != "delete") { + if (!empty($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] != "delete") { //set the variables $user_uuid = $_REQUEST["user_uuid"]; $conference_uuid = $_REQUEST["id"]; @@ -131,7 +139,7 @@ } //process http post variables - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //get the conference id if ($action == "add") { @@ -176,7 +184,7 @@ } //add or update the database - if ($_POST["persistformvar"] != "true") { + if (!empty($_POST["persistformvar"])) { //update the conference extension $array['conferences'][0]['domain_uuid'] = $_SESSION['domain_uuid']; @@ -245,7 +253,7 @@ //$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['dialplan_uuid'] = $dialplan_uuid; $database = new database; - $database->execute($sql, $parameters); + $database->execute($sql, $parameters ?? null); unset($sql, $parameters); //add the message @@ -271,7 +279,7 @@ } //pre-populate the form - if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { + if (!empty($_GET) && !empty($_POST["persistformvar"])) { $conference_uuid = $_GET["id"]; $sql = "select * from v_conferences "; $sql .= "where domain_uuid = :domain_uuid "; @@ -279,8 +287,8 @@ $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['conference_uuid'] = $conference_uuid; $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && sizeof($row) != 0) { + $row = $database->select($sql, $parameters ?? null, 'row'); + if (!empty($row)) { $dialplan_uuid = $row["dialplan_uuid"]; $conference_name = $row["conference_name"]; $conference_extension = $row["conference_extension"]; @@ -316,9 +324,9 @@ $sql .= "and e.domain_uuid = :domain_uuid "; $sql .= "and e.conference_uuid = :conference_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['conference_uuid'] = $conference_uuid; + $parameters['conference_uuid'] = $conference_uuid ?? ''; $database = new database; - $conference_users = $database->select($sql, $parameters, 'all'); + $conference_users = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //get the users @@ -327,11 +335,11 @@ $sql .= "and user_enabled = 'true' "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; - $users = $database->select($sql, $parameters, 'all'); + $users = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //set the default - if ($conference_profile == "") { $conference_profile = "default"; } + if (empty($conference_profile)) { $conference_profile = "default"; } //create token $object = new token; @@ -411,7 +419,7 @@ echo " ".$text['label-user_list'].""; echo " "; - if (is_array($conference_users) && @sizeof($conference_users) != 0) { + if (!empty($conference_users)) { echo " \n"; foreach ($conference_users as $field) { echo " \n"; @@ -557,7 +565,7 @@ echo "

"; if ($action == "update") { - echo "\n"; + echo "\n"; echo "\n"; } echo "\n"; diff --git a/app/conferences/conferences.php b/app/conferences/conferences.php index 562cef79e2..bd4c33f27e 100644 --- a/app/conferences/conferences.php +++ b/app/conferences/conferences.php @@ -46,15 +46,21 @@ $language = new text; $text = $language->get(); +//set additional variables + $show = $_GET["show"] ?? ''; + +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get posted data - if (is_array($_POST['conferences'])) { + if (!empty($_POST['conferences'])) { $action = $_POST['action']; $search = $_POST['search']; $conferences = $_POST['conferences']; } //process the http post data by action - if ($action != '' && is_array($conferences) && @sizeof($conferences) != 0) { + if (!empty($action) && !empty($conferences)) { switch ($action) { case 'copy': if (permission_exists('conference_add')) { @@ -81,11 +87,11 @@ } //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //add the search term - $search = strtolower($_GET["search"]); + $search = strtolower($_GET["search"] ?? ''); if (!empty($search)) { $sql_search = "and ("; $sql_search .= "lower(conference_name) like :search "; @@ -101,7 +107,7 @@ //show all extensions $sql = "select count(*) from v_conferences "; $sql .= "where true "; - if ($_GET['show'] != "all" || !permission_exists('conference_all')) { + if ($show != "all" || !permission_exists('conference_all')) { $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } @@ -114,17 +120,17 @@ $sql .= "and u.user_uuid = :user_uuid "; $parameters['user_uuid'] = $_SESSION['user_uuid']; } - $sql .= $sql_search; + $sql .= $sql_search ?? ''; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $param = "&search=".urlencode($search); - if ($_GET['show'] == "all" && permission_exists('conference_all')) { + if ($show == "all" && permission_exists('conference_all')) { $param .= "&show=all"; } - $page = $_GET['page']; + $page = $_GET['page'] ?? ''; if (empty($page)) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); @@ -135,7 +141,7 @@ $sql .= order_by($order_by, $order); $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $conferences = $database->select($sql, $parameters, 'all'); + $conferences = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -167,7 +173,7 @@ } echo "\n"; if (permission_exists('conference_all')) { - if ($_GET['show'] == 'all') { + if ($show == 'all') { echo " "; } else { @@ -206,10 +212,10 @@ echo "\n"; if (permission_exists('conference_add') || permission_exists('conference_edit') || permission_exists('conference_delete')) { echo " \n"; } - if ($_GET['show'] == "all" && permission_exists('conference_all')) { + if ($show == "all" && permission_exists('conference_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'"); } echo th_order_by('conference_name', $text['table-name'], $order_by, $order); @@ -219,12 +225,12 @@ echo "\n"; echo th_order_by('conference_enabled', $text['table-enabled'], $order_by, $order, null, "class='center'"); echo th_order_by('conference_description', $text['table-description'], $order_by, $order, null, "class='hide-sm-dn'"); - if (permission_exists('conference_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_edit') && $list_row_edit_button == 'true') { echo " \n"; } echo "\n"; - if (is_array($conferences) && @sizeof($conferences) != 0) { + if (!empty($conferences)) { $x = 0; foreach($conferences as $row) { if (permission_exists('conference_edit')) { @@ -237,7 +243,7 @@ echo " \n"; echo " \n"; } - if ($_GET['show'] == "all" && permission_exists('conference_all')) { + if ($show == "all" && permission_exists('conference_all')) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) { $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; } @@ -273,7 +279,7 @@ echo $text['label-'.$row['conference_enabled']]; } echo " \n"; - if (permission_exists('conference_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if (permission_exists('conference_edit') && $list_row_edit_button == 'true') { echo " \n"; diff --git a/app/conferences_active/conference_interactive_inc.php b/app/conferences_active/conference_interactive_inc.php index ef6cb51e1a..e521bab063 100644 --- a/app/conferences_active/conference_interactive_inc.php +++ b/app/conferences_active/conference_interactive_inc.php @@ -55,7 +55,7 @@ } //replace the space with underscore - $conference_name = $conference_id.'@'.$_SESSION['domain_name']; + $conference_name = !empty($conference_id).'@'.$_SESSION['domain_name']; //create the conference list command $switch_cmd = "conference '".$conference_name."' xml_list"; @@ -276,4 +276,4 @@ echo "

"; } -?> \ No newline at end of file +?> diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 514c1bfb52..cbed8984ad 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -46,15 +46,21 @@ $language = new text; $text = $language->get(); +//set additional variables + $show = $_GET["show"] ?? ''; + +//set from session variables + $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false'; + //get posted data - if (is_array($_POST['contacts'])) { + if (!empty($_POST['contacts'])) { $action = $_POST['action']; $search = $_POST['search']; $contacts = $_POST['contacts']; } //process the http post data by action - if ($action != '' && is_array($contacts) && @sizeof($contacts) != 0) { + if (!empty($action) && !empty($contacts)) { switch ($action) { case 'delete': if (permission_exists('contact_delete')) { @@ -64,7 +70,7 @@ break; } - header('Location: contacts.php'.($search != '' ? '?search='.urlencode($search) : null)); + header('Location: contacts.php'.(!empty($search) ? '?search='.urlencode($search) : null)); exit; } @@ -90,14 +96,14 @@ $sql .= " contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_groups "; $sql .= " where "; - if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) { + if (!empty($user_group_uuids)) { foreach ($user_group_uuids as $index => $user_group_uuid) { if (is_uuid($user_group_uuid)) { $sql_where_or[] = "group_uuid = :group_uuid_".$index; $parameters['group_uuid_'.$index] = $user_group_uuid; } } - if (is_array($sql_where_or) && @sizeof($sql_where_or) != 0) { + if (!empty($sql_where_or)) { $sql .= " ( ".implode(' or ', $sql_where_or)." ) "; } unset($sql_where_or, $index, $user_group_uuid); @@ -113,10 +119,10 @@ $sql .= ") "; } $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $parameters['group_uuid'] = $_SESSION['group_uuid']; + $parameters['group_uuid'] = $_SESSION['group_uuid'] ?? ''; $database = new database; - $result = $database->select($sql, $parameters, 'all'); - if (is_array($result) && @sizeof($result) != 0) { + $result = $database->select($sql, $parameters ?? null, 'all'); + if (!empty($result)) { foreach($result as $row) { $contact_sync_sources[$row['contact_uuid']][] = $row['contact_setting_value']; } @@ -124,11 +130,11 @@ unset($sql, $parameters, $result); //get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? ''; + $order = $_GET["order"] ?? ''; //add the search term - $search = strtolower($_GET["search"]); + $search = strtolower($_GET["search"] ?? ''); if (!empty($search)) { if (is_numeric($search)) { $sql_search .= "and contact_uuid in ( "; @@ -186,7 +192,7 @@ $sql = "select count(*) "; $sql .= "from v_contacts as c "; $sql .= "where true "; - if ($_GET['show'] != "all" || !permission_exists('contact_all')) { + if ($show != "all" || !permission_exists('contact_all')) { $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } @@ -195,14 +201,14 @@ $sql .= " contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_groups "; $sql .= " where "; - if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) { + if (!empty($user_group_uuids)) { foreach ($user_group_uuids as $index => $user_group_uuid) { if (is_uuid($user_group_uuid)) { $sql_where_or[] = "group_uuid = :group_uuid_".$index; $parameters['group_uuid_'.$index] = $user_group_uuid; } } - if (is_array($sql_where_or) && @sizeof($sql_where_or) != 0) { + if (!empty($sql_where_or)) { $sql .= " ( ".implode(' or ', $sql_where_or)." ) "; } unset($sql_where_or, $index, $user_group_uuid); @@ -218,17 +224,17 @@ $sql .= ") "; $parameters['user_uuid'] = $_SESSION['user_uuid']; } - $sql .= $sql_search; + $sql .= $sql_search ?? ''; $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; + $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50; $param = "&search=".urlencode($search); - if ($_GET['show'] == "all" && permission_exists('contact_all')) { + if ($show == "all" && permission_exists('contact_all')) { $param .= "&show=all"; } - $page = $_GET['page']; + $page = $_GET['page'] ?? ''; if (empty($page)) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top @@ -239,7 +245,7 @@ $sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1) as contact_attachment_uuid "; $sql .= "from v_contacts as c "; $sql .= "where true "; - if ($_GET['show'] != "all" || !permission_exists('contact_all')) { + if ($show != "all" || !permission_exists('contact_all')) { $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } @@ -248,14 +254,14 @@ $sql .= " contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_groups "; $sql .= " where "; - if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) { + if (!empty($user_group_uuids)) { foreach ($user_group_uuids as $index => $user_group_uuid) { if (is_uuid($user_group_uuid)) { $sql_where_or[] = "group_uuid = :group_uuid_".$index; $parameters['group_uuid_'.$index] = $user_group_uuid; } } - if (is_array($sql_where_or) && @sizeof($sql_where_or) != 0) { + if (!empty($sql_where_or)) { $sql .= " ( ".implode(' or ', $sql_where_or)." ) "; } unset($sql_where_or, $index, $user_group_uuid); @@ -271,15 +277,15 @@ $sql .= ") "; $parameters['user_uuid'] = $_SESSION['user_uuid']; } - $sql .= $sql_search; + $sql .= $sql_search ?? ''; $database = new database; - if ($order_by != '') { + if (!empty($order_by)) { $sql .= order_by($order_by, $order); $sql .= ", contact_organization asc "; } else { - $contact_default_sort_column = $_SESSION['contacts']['default_sort_column']['text'] != '' ? $_SESSION['contacts']['default_sort_column']['text'] : "last_mod_date"; - $contact_default_sort_order = $_SESSION['contacts']['default_sort_order']['text'] != '' ? $_SESSION['contacts']['default_sort_order']['text'] : "desc"; + $contact_default_sort_column = !empty($_SESSION['contacts']['default_sort_column']['text']) ? $_SESSION['contacts']['default_sort_column']['text'] : "last_mod_date"; + $contact_default_sort_order = !empty($_SESSION['contacts']['default_sort_order']['text']) ? $_SESSION['contacts']['default_sort_order']['text'] : "desc"; $sql .= order_by($contact_default_sort_column, $contact_default_sort_order); if ($db_type == "pgsql") { @@ -288,7 +294,7 @@ } $sql .= limit_offset($rows_per_page, $offset); $database = new database; - $contacts = $database->select($sql, $parameters, 'all'); + $contacts = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -329,17 +335,17 @@ } echo "\n"; if (permission_exists('contact_all')) { - if ($_GET['show'] == 'all') { + if ($show == 'all') { echo " "; } else { - echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.($search != '' ? "&search=".urlencode($search) : null)]); + echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type=&show=all'.(!empty($search) ? "&search=".urlencode($search) : null)]); } } echo ""; echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','collapse'=>'hide-sm-dn']); //echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','collapse'=>'hide-sm-dn','link'=>'contacts.php','style'=>($search == '' ? 'display: none;' : null)]); - if ($paging_controls_mini != '') { + if (!empty($paging_controls_mini)) { echo "".$paging_controls_mini.""; } echo " \n"; @@ -362,10 +368,10 @@ echo "\n"; if (permission_exists('contact_delete')) { echo " \n"; } - if ($_GET['show'] == "all" && permission_exists('contact_all')) { + if ($show == "all" && permission_exists('contact_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'"); } echo th_order_by('contact_type', $text['label-contact_type'], $order_by, $order); @@ -377,12 +383,12 @@ echo th_order_by('contact_title', $text['label-contact_title'], $order_by, $order, null, "class='hide-sm-dn'"); echo th_order_by('contact_role', $text['label-contact_role'], $order_by, $order, null, "class='hide-sm-dn'"); echo "\n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if ($list_row_edit_button == 'true') { echo " \n"; } echo "\n"; - if (is_array($contacts) && @sizeof($contacts) != 0) { + if (!empty($contacts)) { $x = 0; foreach($contacts as $row) { $list_row_url = "contact_view.php?id=".urlencode($row['contact_uuid'])."&query_string=".urlencode($_SERVER["QUERY_STRING"]); @@ -393,7 +399,7 @@ echo " \n"; echo " \n"; } - if ($_GET['show'] == "all" && permission_exists('contact_all')) { + if ($show == "all" && permission_exists('contact_all')) { if (!empty($_SESSION['domains'][$row['domain_uuid']]['domain_name'])) { $domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name']; } @@ -415,7 +421,7 @@ echo " \n"; echo " \n"; echo " \n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + if ($list_row_edit_button == 'true') { echo " \n";
\n"; - echo " \n"; + echo " \n"; echo " ".$text['label-tools']." 
".escape($row['conference_description'])." "; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
\n"; - echo " \n"; + echo " \n"; echo "   
".escape($row['contact_title'])." ".escape($row['contact_role'])." "; - if (is_array($contact_sync_sources[$row['contact_uuid']]) && @sizeof($contact_sync_sources[$row['contact_uuid']]) != 0) { + if (!empty($contact_sync_sources[$row['contact_uuid']])) { foreach ($contact_sync_sources[$row['contact_uuid']] as $contact_sync_source) { switch ($contact_sync_source) { case 'google': echo "".$text["; break; @@ -426,7 +432,7 @@ echo " "; } echo " "; echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); echo "