Subversion Repositories SmartDukaan

Rev

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

Rev 19990 Rev 20107
Line 17... Line 17...
17
	public $acls;
17
	public $acls;
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');
Line 50... Line 50...
50
				break;
50
				break;
51
		}
51
		}
52
 
52
 
53
		$facebookConfig = Configure::read("Facebook");		
53
		$facebookConfig = Configure::read("Facebook");		
54
		$categories = Configure::read('Categories');
54
		$categories = Configure::read('Categories');
55
		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' ||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands'){
-
 
56
			//Check access for apps tab
55
		$userId = $this->isAuthorized();
-
 
56
		if(!$userId){
57
			$userId = $this->request->query('user_id');
57
			$userId = $this->request->query('user_id');
-
 
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
		
-
 
66
		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' 
-
 
67
	||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands'){
-
 
68
			//Check access for apps tab	
58
			if($this->isAuthorized()) {
69
// 			if($this->isAuthorized()) {
59
				$userId = $this->Auth->user('id');
70
// 				$userId = $this->Auth->user('id');
60
			}
71
// 			}
61
			$cachekey = 'appacls-'.$userId;			
72
			$cachekey = 'appacls-'.$userId;			
62
			$access = Cache::read($cachekey,'day');
73
			$access = Cache::read($cachekey,'day');
63
			if(empty($access)) {
74
			if(empty($access)) {
64
				$this->loadModel('Appacl');
75
				$this->loadModel('Appacl');
65
				$this->Appacl->recursive = -1;
76
				$this->Appacl->recursive = -1;
Line 73... Line 84...
73
			}
84
			}
74
		}
85
		}
75
		//Facebook configuration
86
		//Facebook configuration
76
		$this->set('fbappid', $facebookConfig['fbappid']);
87
		$this->set('fbappid', $facebookConfig['fbappid']);
77
		$this->set('apihost', Configure::read('apihost'));
88
		$this->set('apihost', Configure::read('apihost'));
78
		
-
 
79
	   	$sessionState = $this->Session->read('state');
89
	   	$sessionState = $this->Session->read('state');
80
		if(!isset($sessionState)){
90
		if(!isset($sessionState)){
81
			$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
91
			$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
82
		}
92
		}
83
	 	$dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" 
93
	 	$dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" 
Line 93... Line 103...
93
		$this->limit = Configure::read('dealsperpage');	
103
		$this->limit = Configure::read('dealsperpage');	
94
		$staticVersion = Configure::read('staticversion');
104
		$staticVersion = Configure::read('staticversion');
95
		$this->set('staticversion',$staticVersion);
105
		$this->set('staticversion',$staticVersion);
96
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));			
106
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));			
97
		$debugusers = Configure::read('debugusers');
107
		$debugusers = Configure::read('debugusers');
-
 
108
// 		$id = $this->isAuthorized();
98
		if($id = $this->isAuthorized()){
109
// 		if($id = $this->isAuthorized()){
99
			if(in_array($id, $debugusers)){
110
			if(in_array($userId, $debugusers)){
100
				$this->Cookie->write('debuguser',1);
111
				$this->Cookie->write('debuguser',1);
101
			}else{
112
			}else{
102
				$this->Cookie->delete('debuguser');
113
				$this->Cookie->delete('debuguser');
103
			}
114
			}
104
		}
115
// 		}
105
		//acl
116
		//acl
106
		$cachekey = 'acls';
117
		$cachekey = 'acls';
107
		$acls = Cache::read($cachekey,'month');
118
		$acls = Cache::read($cachekey,'month');
108
		if(empty($acls)) {
119
		if(empty($acls)) {
109
			$acls = array();
120
			$acls = array();