@@ -27,15 +27,15 @@ function selectAll(idCheck,numRows,action) {
27
27
28
28
$ page = isset ($ _GET ['page ' ]) ? (int ) $ _GET ['page ' ] : null ;
29
29
$ 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 ' ;
33
32
$ 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 ' ;
35
35
$ keyword = isset ($ _REQUEST ['keyword ' ]) ? Security::remove_XSS ($ _REQUEST ['keyword ' ]) : null ;
36
36
37
37
if ($ 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 ;
39
39
SessionManager::delete_session_category ($ idChecked , $ delete_session );
40
40
Display::addFlash (Display::return_message (get_lang ('SessionCategoryDelete ' )));
41
41
header ('Location: ' .api_get_self ().'?sort= ' .$ sort );
@@ -91,7 +91,6 @@ function selectAll(idCheck,numRows,action) {
91
91
92
92
$ query_rows = "SELECT count(*) as total_rows
93
93
FROM $ tbl_session_category sc $ where " ;
94
- $ order = ($ order == 'ASC ' ) ? 'DESC ' : 'ASC ' ;
95
94
$ result_rows = Database::query ($ query_rows );
96
95
$ recorset = Database::fetch_array ($ result_rows );
97
96
$ num = $ recorset ['total_rows ' ];
0 commit comments