Subversion Repositories SmartDukaan

Rev

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

Rev 17044 Rev 17639
Line 47... Line 47...
47
			case 'profittill.com':
47
			case 'profittill.com':
48
			case 'api.profittill.com':
48
			case 'api.profittill.com':
49
				Configure::load('live');
49
				Configure::load('live');
50
				break;
50
				break;
51
		}
51
		}
-
 
52
 
52
		$facebookConfig = Configure::read("Facebook");		
53
		$facebookConfig = Configure::read("Facebook");		
53
		$categories = Configure::read('Categories');
54
		$categories = Configure::read('Categories');
54
		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' ||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands'){
55
		if($this->params->params['controller'] == 'categories' || $this->params->params['controller'] == 'orders' ||  $this->params->params['controller'] == 'store_products' ||  $this->params->params['controller'] == 'brands'){
55
			//Check access for apps tab
56
			//Check access for apps tab
56
			$userId = $this->request->query('user_id');
57
			$userId = $this->request->query('user_id');
Line 117... Line 118...
117
			}
118
			}
118
			Cache::write($cachekey,$acls,'month');
119
			Cache::write($cachekey,$acls,'month');
119
		}
120
		}
120
		$this->acls = $acls;
121
		$this->acls = $acls;
121
		$this->set('acls',$acls);
122
		$this->set('acls',$acls);
-
 
123
 
122
    }
124
    }
123
	
125
	
124
	function checkAcl() {		
126
	function checkAcl() {		
125
    	if(!in_array($this->here,$this->acls[$this->Session->read('Auth.User.group_id')]['allowed'])){
127
    	if(!in_array($this->here,$this->acls[$this->Session->read('Auth.User.group_id')]['allowed'])){
126
    		$this->Session->setFlash(__('You are not authorized to access this page.'));
128
    		$this->Session->setFlash(__('You are not authorized to access this page.'));
Line 205... Line 207...
205
 
207
 
206
    public function getDealsApiUrl($page=1,$userId = null,$categoryId=0,$sort=null,$direction=null,$filter=null,$brands=null){
208
    public function getDealsApiUrl($page=1,$userId = null,$categoryId=0,$sort=null,$direction=null,$filter=null,$brands=null){
207
    	$this->log('categoryId '.$categoryId,'api');
209
    	$this->log('categoryId '.$categoryId,'api');
208
    	$this->log('page '.$page,'api');
210
    	$this->log('page '.$page,'api');
209
    	$offset = ($page - 1) * $this->limit;
211
    	$offset = ($page - 1) * $this->limit;
-
 
212
 
210
    	if(isset($sort) && !empty($sort) && $sort!=-1){
213
    	if(isset($sort) && !empty($sort) && $sort!=-1){
211
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&sort='.$sort.'&direction='.$direction.'&limit='.$this->limit.'&offset='.$offset;
214
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&sort='.$sort.'&direction='.$direction.'&limit='.$this->limit.'&offset='.$offset;
212
    	}else{
215
    	}else{
213
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&limit='.$this->limit.'&offset='.$offset;
216
    		$url = $this->apihost.'deals/'.$userId.'?categoryId='.$categoryId.'&limit='.$this->limit.'&offset='.$offset;
214
    	}    	
217
    	}    
-
 
218
 
-
 
219
    	$get_url = "'".$_SERVER['REQUEST_URI']."'";
-
 
220
    	$urlArray = explode('=',$_SERVER['REQUEST_URI']);
-
 
221
		$last = $urlArray[sizeof($urlArray)-1];
-
 
222
 
-
 
223
    	if(!isset($filter) && empty($filter)){
-
 
224
    		$get_url = "'".$_SERVER['REQUEST_URI']."'";
-
 
225
    		if (strpos($get_url,'filter=brand&brands') !== false)
-
 
226
    		{
-
 
227
    			$url .= "&filterData=brandFilter:".$last;
-
 
228
    			// echo $url;
-
 
229
    		}
-
 
230
 
-
 
231
    	}
-
 
232
 
215
    	if(isset($filter) && !empty($filter)){
233
    	if(isset($filter) && !empty($filter)){
216
    		$url .= "&filterData=brandFilter:".$brands;
234
    		$url .= "&filterData=brandFilter:".$brands;
217
    	}
235
    	}
218
    	return $url;
236
    	return $url;
219
    }
237
    }