Subversion Repositories SmartDukaan

Rev

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

Rev 21011 Rev 21046
Line 306... Line 306...
306
 
306
 
307
	        	}
307
	        	}
308
	        	if(!empty($this->request->data['referrer'])) {
308
	        	if(!empty($this->request->data['referrer'])) {
309
	        		$referrer = $this->request->data['referrer'];
309
	        		$referrer = $this->request->data['referrer'];
310
	        		$this->log(print_r($referrer,1),'activations');
310
	        		$this->log(print_r($referrer,1),'activations');
311
	        		$this->loadModel('ActivationCode');
311
	        		$this->loadModel('UserAccount');
312
	        		$opt['conditions'] = array('code' => strtoupper($referrer) , 'status'=> 0 );
312
					$options = array('conditions'=>array('user_id'=>$userId,'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'account_key');
313
	        		$exists = $this->ActivationCode->find('first',$opt);
313
					$userAccount = $this->UserAccount->find('first',$options);
314
// 	        		$exists = $this->ActivationCode->findByCode(strtoupper($referrer));
314
					$suserId = $userAccount['UserAccount']['account_key'];
315
	        		$this->log(print_r($exists,1),'activations');
315
	        		$url = Configure::read('saholicapihost').'/register!activateRsa?userId=$userId&activationCode=$referrer';
316
	        		if(empty($exists)){
316
	        		$response = $this->make_request ( $url, null );
317
	        			$result = array('success'=>false,'message'=>'Invalid referral code');
317
	        		if(json_encode($response)['map']['result']=='true'){
318
	        			// unset($this->request->data['referrer']);
318
	        			$this->request->data['activated'] = 1;
319
	        			$updateRequired = false;
-
 
320
	        		} else {
319
	        		} else {
-
 
320
		        		$this->loadModel('ActivationCode');
-
 
321
		        		$opt['conditions'] = array('code' => strtoupper($referrer) , 'status'=> 0 );
-
 
322
		        		$exists = $this->ActivationCode->find('first',$opt);
-
 
323
	// 	        		$exists = $this->ActivationCode->findByCode(strtoupper($referrer));
-
 
324
		        		$this->log(print_r($exists,1),'activations');
-
 
325
		        		if(empty($exists)){
-
 
326
		        			$result = array('success'=>false,'message'=>'Invalid referral code');
-
 
327
		        			// unset($this->request->data['referrer']);
-
 
328
		        			$updateRequired = false;
-
 
329
		        		} else {
321
	        			$this->request->data['activated'] = 1;        		
330
		        			$this->request->data['activated'] = 1;        		
-
 
331
		        		}
322
	        		}		        		
332
	        		}		        		
323
	        	}	        		
333
	        	}	        		
324
	        	
334
	        	
325
 
335
 
326
	        	if($updateRequired){
336
	        	if($updateRequired){