diff --git a/app/access_controls/access_controls.php b/app/access_controls/access_controls.php index 8f922869ba..258ae61aab 100644 --- a/app/access_controls/access_controls.php +++ b/app/access_controls/access_controls.php @@ -126,7 +126,7 @@ $sql .= ") "; } $database = new database; - $num_rows = $database->select($sql, $parameters ?? '', 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); //get the list $sql = "select "; @@ -144,7 +144,7 @@ } $sql .= order_by($order_by, $order, 'access_control_name', 'asc'); $database = new database; - $access_controls = $database->select($sql, $parameters ?? '', 'all'); + $access_controls = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token diff --git a/app/bridges/bridge_edit.php b/app/bridges/bridge_edit.php index 173f258505..c981a22cbc 100644 --- a/app/bridges/bridge_edit.php +++ b/app/bridges/bridge_edit.php @@ -49,6 +49,13 @@ $action = "add"; } +//set the defaults + $bridge_uuid = ''; + $bridge_name = ''; + $bridge_destination = ''; + $bridge_enabled = ''; + $bridge_description = ''; + //get http post variables and set them to php variables if (!empty($_POST)) { $bridge_uuid = $_POST["bridge_uuid"] ?? null; @@ -59,7 +66,7 @@ } //process the user data and save it to the database - if (count($_POST) > 0 && empty($_POST["persistformvar"])) { + if (!empty($_POST) && empty($_POST["persistformvar"])) { //delete the bridge if (permission_exists('bridge_delete')) { @@ -152,8 +159,8 @@ $sql .= "where bridge_uuid = :bridge_uuid "; $parameters['bridge_uuid'] = $bridge_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)) { $bridge_name = $row["bridge_name"]; $bridge_destination = $row["bridge_destination"]; $bridge_enabled = $row["bridge_enabled"]; @@ -199,7 +206,7 @@ echo " ".$text['label-bridge_name']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-bridge_name']."\n"; echo "\n"; @@ -210,7 +217,7 @@ echo " ".$text['label-bridge_destination']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-bridge_destination']."\n"; echo "\n"; @@ -243,7 +250,7 @@ echo " ".$text['label-bridge_description']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo $text['description-bridge_description']."\n"; echo "\n"; diff --git a/app/bridges/bridges.php b/app/bridges/bridges.php index 9e73ad909c..750cb48273 100644 --- a/app/bridges/bridges.php +++ b/app/bridges/bridges.php @@ -46,15 +46,22 @@ $language = new text; $text = $language->get(); +//set additional variables + $search = $_GET["search"] ?? ''; + $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 the http post data - if (isset($_POST['bridges']) && is_array($_POST['bridges'])) { + if (!empty($_POST['bridges'])) { $action = $_POST['action']; $search = $_POST['search']; $bridges = $_POST['bridges']; } //process the http post data by action - if (isset($action) && $action != '' && is_array($bridges) && @sizeof($bridges) != 0) { + if (!empty($action) && !empty($bridges)) { switch ($action) { case 'copy': if (permission_exists('bridge_add')) { @@ -76,7 +83,7 @@ break; } - header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null)); + header('Location: bridges.php'.(!empty($search) ? '?search='.urlencode($search) : null)); exit; } @@ -85,7 +92,7 @@ $order = $_GET["order"] ?? ''; //add the search string - if (isset($_GET["search"])) { + if (!empty($search)) { $search = strtolower($_GET["search"]); $sql_search = " ("; $sql_search .= " lower(bridge_name) like :search "; @@ -98,7 +105,7 @@ //get the count $sql = "select count(bridge_uuid) from v_bridges "; - if (isset($_GET['show']) && $_GET['show'] == "all" && permission_exists('bridge_all')) { + if (!empty($show) && $show == "all" && permission_exists('bridge_all')) { if (isset($sql_search)) { $sql .= "where ".$sql_search; } @@ -156,14 +163,14 @@ } echo "