PluginProbe
ShiftController Employee Shift Scheduling / 2.2.3
ShiftController Employee Shift Scheduling v2.2.3
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
← All changes | happ/application/core/Backend_controller.php +25 -47 3.2.42.2.3 View file →
@@ -1,75 +1,53 @@
1 1 <?php
2 -abstract class _Backend_HC_controller extends MY_HC_Controller
2 +class Backend_controller extends MY_Controller
3 3 {
4 - function __construct( $user_level = 0 )
4 + function __construct( $user_level = 0, $default_path = '' )
5 5 {
6 6 parent::__construct();
7 - $this->_do_init( $user_level );
8 - }
9 7
10 - private function _do_init( $user_level = 0 )
11 - {
12 - static $did = FALSE;
13 - if( $did ){
14 - return;
15 - }
16 -
17 8 $this->load->library('migration');
18 9 if ( ! $this->migration->current()){
19 10 // show_error($this->migration->error_string());
20 11 return false;
21 - }
12 + }
13 + $this->load->library( 'conf/app_conf' );
14 + $this->load->library( 'hc_time' );
15 + $this->load->library( 'hc_form' );
22 16
23 - $nts_config = HC_Lib::nts_config();
24 - if( isset($nts_config['FORCE_LOGIN_ID']) ){
25 - $id = $nts_config['FORCE_LOGIN_ID'];
17 + $app = $this->config->item('nts_app');
18 +
19 + if( isset($GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID']) )
20 + {
21 + $id = $GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID'];
26 22 $this->auth->login( $id );
27 23 }
28 24
29 - if ( ! $this->auth->check() ){
30 - $this->redirect('auth/login');
25 + if ( ! $this->auth->check() )
26 + {
27 + ci_redirect('auth/login');
31 28 exit;
32 29 }
33 30
34 31 /* check user active */
35 - $user_active = 1;
36 - if( $test_user = $this->auth->user() ){
37 - if( strlen($test_user->active) ){
38 - $user_active = $test_user->active;
39 - }
32 + $user_active = 0;
33 + if( $test_user = $this->auth->user() )
34 + {
35 + $user_active = $test_user->active;
40 36 }
41 37
42 - if( ! $user_active ){
38 + if( ! $user_active )
39 + {
43 40 $to = 'auth/notallowed';
44 - $this->redirect( $to );
41 + ci_redirect( $to );
45 42 exit;
46 43 }
47 44
48 45 /* check user level */
49 - if( $user_level ){
46 + if( $user_level )
47 + {
50 48 $this->check_level( $user_level );
49 + if( $default_path )
50 + $this->conf['path'] = $default_path;
51 51 }
52 -
53 - /* check license code */
54 - if( $this->hc_modules->exists('license') ){
55 - $license_model = HC_App::model('hitcode_license');
56 - $code = $license_model->get();
57 - if( ! $code ){
58 - $to = 'license/admin';
59 -
60 - $current_slug = $this->get_current_slug();
61 - if( $current_slug != $to ){
62 - $this->session->set_flashdata(
63 - 'error',
64 - 'license_code_required'
65 - );
66 -
67 - $this->redirect( $to );
68 - exit;
69 - }
70 - }
71 - }
72 -
73 - $did = TRUE;
74 52 }
75 53 }