Subversion Repositories SmartDukaan

Rev

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

Rev 14584 Rev 14890
Line 69... Line 69...
69
		}	
69
		}	
70
		$this->apihost = Configure::read('pythonapihost');
70
		$this->apihost = Configure::read('pythonapihost');
71
		$this->limit = Configure::read('dealsperpage');	
71
		$this->limit = Configure::read('dealsperpage');	
72
		$staticVersion = Configure::read('staticversion');
72
		$staticVersion = Configure::read('staticversion');
73
		$this->set('staticversion',$staticVersion);
73
		$this->set('staticversion',$staticVersion);
74
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));
74
		$this->set('requiremobileverification',Configure::read('requiremobileverification'));		
75
    }
75
    }
76
	
76
	
77
    function isAuthorized() {
77
    function isAuthorized() {
78
        return $this->Auth->user('id');
78
        return $this->Auth->user('id');
79
    }
79
    }
Line 100... Line 100...
100
				$this->redirect('/users/verifymobile');
100
				$this->redirect('/users/verifymobile');
101
			}
101
			}
102
		}
102
		}
103
    }
103
    }
104
 
104
 
-
 
105
    function checkToken() {
-
 
106
		$headers =  $this->getallheaders();
-
 
107
        $this->log(print_r($headers,1),'headers');
-
 
108
        if(isset($headers['Token'] && !empty($headers['Token']))) {
-
 
109
        	$this->loadModel('SocialProfile');
-
 
110
        	$options = array('conditions'=>'access_token'=>$headers['Token'],'fields'=>array('user_id'),'recursive'=>-1);
-
 
111
        	$user = $this->SocialProfile->find('first',$options);
-
 
112
        	// debug($user);
-
 
113
        	$userId = $this->request->query('user_id');
-
 
114
			if(isset($userId) && !empty($userId)){
-
 
115
				if($userId == $user['SocialProfile']['user_id']){
-
 
116
					return true;
-
 
117
				}
-
 
118
			}
-
 
119
        } else {
-
 
120
        	return true;
-
 
121
        }
-
 
122
        return false;
-
 
123
    }
-
 
124
 
105
    function getallheaders() { 
125
    function getallheaders() { 
106
	   $headers = ''; 
126
	   $headers = ''; 
107
       foreach ($_SERVER as $name => $value) 
127
       foreach ($_SERVER as $name => $value) 
108
       { 
128
       { 
109
	   if (substr($name, 0, 5) == 'HTTP_') 
129
	   if (substr($name, 0, 5) == 'HTTP_')