diff --git a/core/dashboard/dashboard.php b/core/dashboard/dashboard.php index d604b33683..92eff0ecdf 100644 --- a/core/dashboard/dashboard.php +++ b/core/dashboard/dashboard.php @@ -43,14 +43,14 @@ $text = $language->get(); //get the http post data - if (is_array($_POST['dashboard'])) { + if (!empty($_POST['dashboard'])) { $action = $_POST['action']; $search = $_POST['search']; $dashboard = $_POST['dashboard']; } //process the http post data by action - if ($action != '' && is_array($dashboard) && @sizeof($dashboard) != 0) { + if (!empty($action) && is_array($dashboard) && @sizeof($dashboard) != 0) { switch ($action) { case 'copy': @@ -79,8 +79,8 @@ } //get order and order by - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; + $order_by = $_GET["order_by"] ?? null; + $order = $_GET["order"] ?? null; //add the search if (isset($_GET["search"])) { @@ -195,7 +195,7 @@ $parameters['search'] = '%'.$search.'%'; } $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); + $num_rows = $database->select($sql, $parameters ?? null, 'column'); unset($sql, $parameters); //get the list @@ -224,9 +224,9 @@ $parameters['search'] = '%'.strtolower($search).'%'; } $sql .= order_by($order_by, $order, 'dashboard_order', 'asc'); - $sql .= limit_offset($rows_per_page, $offset); + $sql .= limit_offset($rows_per_page ?? null, $offset ?? null); $database = new database; - $dashboard = $database->select($sql, $parameters, 'all'); + $dashboard = $database->select($sql, $parameters ?? null, 'all'); unset($sql, $parameters); //create token @@ -245,20 +245,20 @@ if (permission_exists('dashboard_add')) { echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_edit.php']); } - if (permission_exists('dashboard_add') && $dashboard) { + if (permission_exists('dashboard_add') && !empty($dashboard)) { echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display:none;','onclick'=>"modal_open('modal-copy','btn_copy');"]); } - if (permission_exists('dashboard_edit') && $dashboard) { + if (permission_exists('dashboard_edit') && !empty($dashboard)) { echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display:none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]); } - if (permission_exists('dashboard_delete') && $dashboard) { + if (permission_exists('dashboard_delete') && !empty($dashboard)) { echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); } echo "
\n"; @@ -266,26 +266,26 @@ echo " \n"; echo "\n"; - if (permission_exists('dashboard_add') && $dashboard) { + if (permission_exists('dashboard_add') && !empty($dashboard)) { echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]); } - if (permission_exists('dashboard_edit') && $dashboard) { + if (permission_exists('dashboard_edit') && !empty($dashboard)) { echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]); } - if (permission_exists('dashboard_delete') && $dashboard) { + if (permission_exists('dashboard_delete') && !empty($dashboard)) { echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]); } echo "\n"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file