@@ -129,16 +129,10 @@ function render_page($user, $TAB, $page) {
129129 extract ($ GLOBALS , EXTR_SKIP );
130130
131131 // Body
132- if (($ _SESSION ['userContext ' ] != 'admin ' ) && (@include ($ __template_dir . "user/ $ page.html " ))) {
133- // User page loaded
134- } else {
135- // Not admin or user page doesn't exist
136- // Load admin page
137- @include ($ __template_dir . "admin/ $ page.html " );
138- }
132+ include ($ __template_dir . "pages/ $ page.html " );
139133
140134 // Including common js files
141- @include_once (dirname (__DIR__ ) . '/templates/scripts .html ' );
135+ @include_once (dirname (__DIR__ ) . '/templates/includes/end_js .html ' );
142136 // Including page specific js file
143137 if (file_exists ($ __pages_js_dir .$ page .'.js ' ))
144138 echo '<script type="text/javascript" src="/js/pages/ ' .$ page .'.js? ' .JS_LATEST_UPDATE .'"></script> ' ;
@@ -152,7 +146,7 @@ function top_panel($user, $TAB) {
152146 $ command = HESTIA_CMD ."v-list-user " .escapeshellarg ($ user )." 'json' " ;
153147 exec ($ command , $ output , $ return_var );
154148 if ( $ return_var > 0 ) {
155- header ("Location: /error / " );
149+ header ("Location: /logout / " );
156150 exit ;
157151 }
158152 $ panel = json_decode (implode ('' , $ output ), true );
@@ -167,6 +161,9 @@ function top_panel($user, $TAB) {
167161 if ($ _SESSION ['POLICY_USER_CHANGE_THEME ' ] === 'no ' ) {
168162 unset($ _SESSION ['userTheme ' ]);
169163 }
164+
165+ // Set preferred sort order
166+ $ _SESSION ['userSortOrder ' ] = $ panel [$ user ]['PREF_UI_SORT ' ];
170167
171168 // Set home location URLs
172169 if (($ _SESSION ['userContext ' ] === 'admin ' ) && (!isset ($ _SESSION ['look ' ]))) {
@@ -189,11 +186,7 @@ function top_panel($user, $TAB) {
189186 }
190187 }
191188
192- if (($ _SESSION ['userContext ' ] === 'admin ' )) {
193- include (dirname (__FILE__ ).'/../templates/admin/panel.html ' );
194- } else {
195- include (dirname (__FILE__ ).'/../templates/user/panel.html ' );
196- }
189+ include (dirname (__FILE__ ).'/../templates/includes/panel.html ' );
197190
198191}
199192
0 commit comments