Subversion Repositories SmartDukaan

Rev

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

Rev 14891 Rev 14894
Line 103... Line 103...
103
    }
103
    }
104
 
104
 
105
    function checkToken() {
105
    function checkToken() {
106
		$headers =  $this->getallheaders();
106
		$headers =  $this->getallheaders();
107
        $this->log(print_r($headers,1),'headers');
107
        $this->log(print_r($headers,1),'headers');
-
 
108
        $token = $this->Cookie->read('token');
-
 
109
        $this->log("Token : $token",'headers');
108
        if(isset($headers['Token']) && !empty($headers['Token'])) {
110
        // if(isset($headers['Token']) && !empty($headers['Token'])) {
-
 
111
        if(isset($token) && !empty($token)) {
109
        	$this->loadModel('SocialProfile');
112
        	$this->loadModel('SocialProfile');
110
        	$options = array('conditions'=>array('access_token'=>$headers['Token'],'fields'=>array('user_id'),'recursive'=>-1));
113
        	$options = array('conditions'=>array('access_token'=>$token,'fields'=>array('user_id'),'recursive'=>-1));
111
        	$user = $this->SocialProfile->find('first',$options);
114
        	$user = $this->SocialProfile->find('first',$options);
112
        	$userId = $this->request->query('user_id');
115
        	$userId = $this->request->query('user_id');
113
			if(isset($userId) && !empty($userId)){
116
			if(isset($userId) && !empty($userId)){
114
				if($userId == $user['SocialProfile']['user_id']){
117
				if($userId == $user['SocialProfile']['user_id']){
115
					return true;
118
					return true;