Subversion Repositories SmartDukaan

Rev

Rev 20107 | Rev 20327 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20107 Rev 20135
Line 18... Line 18...
18
 
18
 
19
	public $components = array(
19
	public $components = array(
20
		'Session','Resize','Cookie',
20
		'Session','Resize','Cookie',
21
		'Auth' => array(
21
		'Auth' => array(
22
			'loginAction' => array('controller' => 'users', 'action' => 'login')
22
			'loginAction' => array('controller' => 'users', 'action' => 'login')
23
// 			'allowedActions' => array('index', 'view', 'display')
23
//  			'allowedActions' => array('index', 'view', 'display')
24
		)			
24
		)			
25
	);
25
	);
26
 
26
 
27
	var $helpers = array('Session', 'Form', 'Html');
27
	var $helpers = array('Session', 'Form', 'Html');
28
	var $keywords = array('instagram followers','instagram button','instagram follow back','instagram tool','instagram automation','free istagram followers','instagram stats','instagram follow button');
28
	var $keywords = array('instagram followers','instagram button','instagram follow back','instagram tool','instagram automation','free istagram followers','instagram stats','instagram follow button');
29
 
29
 
30
	function beforeFilter() {
30
	function beforeFilter() {
31
		$this->Auth->autoRedirect = false;		
31
		$this->Auth->autoRedirect = false;
-
 
32
		if($this->request->is('ajax')){
-
 
33
			$this->Auth->allow($this->params->params['action']);
32
	
34
		}
33
		//Set config settings according to domain
35
		//Set config settings according to domain
34
		// get host name from URL
36
		// get host name from URL
35
		preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
37
		preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
36
		$host = $matches[1];
38
		$host = $matches[1];
37
		switch($host){			
39
		switch($host){			
Line 50... Line 52...
50
				break;
52
				break;
51
		}
53
		}
52
 
54
 
53
		$facebookConfig = Configure::read("Facebook");		
55
		$facebookConfig = Configure::read("Facebook");		
54
		$categories = Configure::read('Categories');
56
		$categories = Configure::read('Categories');
55
		$userId = $this->isAuthorized();
-
 
56
		if(!$userId){
-
 
57
			$userId = $this->request->query('user_id');
57
//		$allowedController = Configure::read('allowcontroller');
58
			if(isset($userId) && !empty($userId)) {
-
 
59
				$this->loadModel('User');
-
 
60
				$dbuser = $this->User->findById($userId);
-
 
61
				$this->Auth->login($dbuser['User']);
-
 
62
			}else 
-
 
63
				return;
-
 
64
		}
-
 
65
		
58
		
66
		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' 
59
// 		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' 
67
	||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands'){
60
// 	||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands')
-
 
61
// 		if(in_array($this->params->params['controller'] , $allowedController))		
-
 
62
// 		{
68
			//Check access for apps tab	
63
			//Check access for apps tab	
-
 
64
 
69
// 			if($this->isAuthorized()) {
65
			$userId = $this->isAuthorized();
-
 
66
			if(!$userId){
70
// 				$userId = $this->Auth->user('id');
67
				$userId = $this->request->query('user_id');
-
 
68
				if(isset($userId) && !empty($userId)) {
-
 
69
					$this->loadModel('User');
-
 
70
					$dbuser = $this->User->findById($userId);
-
 
71
					$this->Auth->login($dbuser['User']);
-
 
72
				}else
-
 
73
					return;
71
// 			}
74
			}
72
			$cachekey = 'appacls-'.$userId;			
75
			$cachekey = 'appacls-'.$userId;			
73
			$access = Cache::read($cachekey,'day');
76
			$access = Cache::read($cachekey,'day');
74
			if(empty($access)) {
77
			if(empty($access)) {
75
				$this->loadModel('Appacl');
78
				$this->loadModel('Appacl');
76
				$this->Appacl->recursive = -1;
79
				$this->Appacl->recursive = -1;
Line 80... Line 83...
80
					unset($categories[2]);
83
					unset($categories[2]);
81
					$this->set('noappcashback',true);
84
					$this->set('noappcashback',true);
82
				}		
85
				}		
83
				Cache::write($cachekey,$access,'day');
86
				Cache::write($cachekey,$access,'day');
84
			}
87
			}
85
		}
88
// 		}
86
		//Facebook configuration
89
		//Facebook configuration
87
		$this->set('fbappid', $facebookConfig['fbappid']);
90
		$this->set('fbappid', $facebookConfig['fbappid']);
88
		$this->set('apihost', Configure::read('apihost'));
91
		$this->set('apihost', Configure::read('apihost'));
89
	   	$sessionState = $this->Session->read('state');
92
	   	$sessionState = $this->Session->read('state');
90
		if(!isset($sessionState)){
93
		if(!isset($sessionState)){
Line 103... Line 106...
103
		$this->limit = Configure::read('dealsperpage');	
106
		$this->limit = Configure::read('dealsperpage');	
104
		$staticVersion = Configure::read('staticversion');
107
		$staticVersion = Configure::read('staticversion');
105
		$this->set('staticversion',$staticVersion);
108
		$this->set('staticversion',$staticVersion);
106
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));			
109
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));			
107
		$debugusers = Configure::read('debugusers');
110
		$debugusers = Configure::read('debugusers');
108
// 		$id = $this->isAuthorized();
-
 
109
// 		if($id = $this->isAuthorized()){
111
// 		if($id = $this->isAuthorized()){
110
			if(in_array($userId, $debugusers)){
112
			if(in_array($userId, $debugusers)){
111
				$this->Cookie->write('debuguser',1);
113
				$this->Cookie->write('debuguser',1);
112
			}else{
114
			}else{
113
				$this->Cookie->delete('debuguser');
115
				$this->Cookie->delete('debuguser');