@@ -27,15 +27,15 @@ function selectAll(idCheck,numRows,action) {
2727
2828$ page = isset ($ _GET ['page ' ]) ? (int ) $ _GET ['page ' ] : null ;
2929$ action = isset ($ _REQUEST ['action ' ]) ? Security::remove_XSS ($ _REQUEST ['action ' ]) : null ;
30- $ sort = isset ($ _GET ['sort ' ]) && in_array ($ _GET ['sort ' ], ['name ' , 'nbr_session ' , 'date_start ' , 'date_end ' ])
31- ? Security::remove_XSS ($ _GET ['sort ' ])
32- : 'name ' ;
30+ $ columns = ['name ' , 'nbr_session ' , 'date_start ' , 'date_end ' ];
31+ $ sort = isset ($ _GET ['sort ' ]) && in_array ($ _GET ['sort ' ], $ columns ) ? Security::remove_XSS ($ _GET ['sort ' ]) : 'name ' ;
3332$ idChecked = isset ($ _REQUEST ['idChecked ' ]) ? Security::remove_XSS ($ _REQUEST ['idChecked ' ]) : null ;
34- $ order = isset ($ _REQUEST ['order ' ]) ? Security::remove_XSS ($ _REQUEST ['order ' ]) : 'ASC ' ;
33+ $ order = $ _REQUEST ['order ' ] ?? 'ASC ' ;
34+ $ order = $ order === 'ASC ' ? 'DESC ' : 'ASC ' ;
3535$ keyword = isset ($ _REQUEST ['keyword ' ]) ? Security::remove_XSS ($ _REQUEST ['keyword ' ]) : null ;
3636
3737if ($ action === 'delete_on_session ' || $ action === 'delete_off_session ' ) {
38- $ delete_session = $ action == 'delete_on_session ' ? true : false ;
38+ $ delete_session = $ action === 'delete_on_session ' ? true : false ;
3939 SessionManager::delete_session_category ($ idChecked , $ delete_session );
4040 Display::addFlash (Display::return_message (get_lang ('SessionCategoryDelete ' )));
4141 header ('Location: ' .api_get_self ().'?sort= ' .$ sort );
@@ -91,7 +91,6 @@ function selectAll(idCheck,numRows,action) {
9191
9292 $ query_rows = "SELECT count(*) as total_rows
9393 FROM $ tbl_session_category sc $ where " ;
94- $ order = ($ order == 'ASC ' ) ? 'DESC ' : 'ASC ' ;
9594 $ result_rows = Database::query ($ query_rows );
9695 $ recorset = Database::fetch_array ($ result_rows );
9796 $ num = $ recorset ['total_rows ' ];
0 commit comments