Subversion Repositories SmartDukaan

Rev

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

Rev 15525 Rev 15655
Line 24... Line 24...
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
25
		$this->Cookie->httpOnly = true;
25
		$this->Cookie->httpOnly = true;
26
    }
26
    }
27
    
27
    
28
	public function oneringcb() {
28
	public function oneringcb() {
-
 
29
		throw new NotFoundException(__('Unauthorized access'));
29
		$this->log(print_r($_REQUEST,1),'onering');
30
		$this->log(print_r($_REQUEST,1),'onering');
30
		error_log(print_r($_REQUEST,1),3,TMP.'logs/onering.log');
31
		error_log(print_r($_REQUEST,1),3,TMP.'logs/onering.log');
31
		$this->layout = "ajax";
32
		$this->layout = "ajax";
32
		$this->response->type('json');
33
		$this->response->type('json');
33
		$this->set(array(
34
		$this->set(array(
Line 36... Line 37...
36
		));
37
		));
37
		$this->render('/Elements/json');
38
		$this->render('/Elements/json');
38
	}
39
	}
39
 
40
 
40
	public function mywallet() {
41
	public function mywallet() {
-
 
42
		throw new NotFoundException(__('Unauthorized access'));
41
		$userId = $this->request->query('user_id');
43
		$userId = $this->request->query('user_id');
42
		$tokenValidated = $this->checkToken();
44
		$tokenValidated = $this->checkToken();
43
		if(isset($userId) && !empty($userId) && $tokenValidated){	
45
		if(isset($userId) && !empty($userId) && $tokenValidated){	
44
			$next = "/my-wallet";					
46
			$next = "/my-wallet";					
45
			$redirectUrl = $this->getAutoLoginUrl($userId,$next);
47
			$redirectUrl = $this->getAutoLoginUrl($userId,$next);
Line 49... Line 51...
49
			$this->redirect(array('controller'=>'special','action'=>'native','login'));
51
			$this->redirect(array('controller'=>'special','action'=>'native','login'));
50
		}
52
		}
51
	}
53
	}
52
 
54
 
53
	public function socialauth() {
55
	public function socialauth() {
-
 
56
		throw new NotFoundException(__('Unauthorized access'));
54
		$this->layout = "ajax";
57
		$this->layout = "ajax";
55
		$this->log(print_r($this->request->data,1),'socialauth');
58
		$this->log(print_r($this->request->data,1),'socialauth');
56
	}
59
	}
57
 
60
 
58
	public function mine() {
61
	public function mine() {
-
 
62
		throw new NotFoundException(__('Unauthorized access'));
59
		$this->response->type('json');
63
		$this->response->type('json');
60
		$this->layout = 'ajax';
64
		$this->layout = 'ajax';
61
		$userId = $this->request->query('user_id');
65
		$userId = $this->request->query('user_id');
62
		if(isset($userId) && !empty($userId)){
66
		if(isset($userId) && !empty($userId)){
63
			$this->loadModel('User');
67
			$this->loadModel('User');
Line 72... Line 76...
72
		)); 
76
		)); 
73
		$this->render('/Elements/json'); 
77
		$this->render('/Elements/json'); 
74
	}
78
	}
75
 
79
 
76
	function registertwitteruser(){
80
	function registertwitteruser(){
-
 
81
		throw new NotFoundException(__('Unauthorized access'));
77
		$this->twitterObj->setToken($_GET['oauth_token']);
82
		$this->twitterObj->setToken($_GET['oauth_token']);
78
		$token = $this->twitterObj->getAccessToken();
83
		$token = $this->twitterObj->getAccessToken();
79
		$this->twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
84
		$this->twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
80
		$twitterInfo= $this->twitterObj->get_accountVerify_credentials();
85
		$twitterInfo= $this->twitterObj->get_accountVerify_credentials();
81
		$data = array();
86
		$data = array();
Line 117... Line 122...
117
			exit();
122
			exit();
118
		}
123
		}
119
	}
124
	}
120
 
125
 
121
    public function checkfbuser($accessToken=null){
126
    public function checkfbuser($accessToken=null){
-
 
127
		throw new NotFoundException(__('Unauthorized access'));
122
		$sessionState = $this->Session->read('state');
128
		$sessionState = $this->Session->read('state');
123
		if($sessionState != $_GET['state']) {
129
		if($sessionState != $_GET['state']) {
124
			$this->redirect(array('controller'=>'users','action'=>'login'));
130
			$this->redirect(array('controller'=>'users','action'=>'login'));
125
		}
131
		}
126
		else {
132
		else {
Line 181... Line 187...
181
		    }
187
		    }
182
		}
188
		}
183
    }
189
    }
184
 
190
 
185
	public function uploadavatar(){
191
	public function uploadavatar(){
-
 
192
		throw new NotFoundException(__('Unauthorized access'));
186
		$this->log(print_r($_FILES,1),'debug');
193
		$this->log(print_r($_FILES,1),'debug');
187
		$path = "img/avatars/";
194
		$path = "img/avatars/";
188
		$valid_formats = array("jpg", "png", "gif", "bmp");
195
		$valid_formats = array("jpg", "png", "gif", "bmp");
189
		if ($this->request->is('post')) {
196
		if ($this->request->is('post')) {
190
			$name = $_FILES['photoimg']['name'];
197
			$name = $_FILES['photoimg']['name'];
Line 218... Line 225...
218
			exit;
225
			exit;
219
		}
226
		}
220
	}
227
	}
221
 
228
 
222
    function checkemail() {
229
    function checkemail() {
-
 
230
		throw new NotFoundException(__('Unauthorized access'));
223
        $this->User->recursive = -1;
231
        $this->User->recursive = -1;
224
        $this->layout = 'ajax';
232
        $this->layout = 'ajax';
225
        if (!empty($this->params['url']['data']['User']['email'])) {
233
        if (!empty($this->params['url']['data']['User']['email'])) {
226
            $username = $this->params['url']['data']['User']['email'];
234
            $username = $this->params['url']['data']['User']['email'];
227
        } elseif (!empty($this->params['url']['data']['Doctor']['email'])) {
235
        } elseif (!empty($this->params['url']['data']['Doctor']['email'])) {
Line 250... Line 258...
250
 * @throws NotFoundException
258
 * @throws NotFoundException
251
 * @param string $id
259
 * @param string $id
252
 * @return void
260
 * @return void
253
 */
261
 */
254
	public function view($id = null) {
262
	public function view($id = null) {
-
 
263
		throw new NotFoundException(__('Unauthorized access'));
255
		$this->response->type('json');
264
		$this->response->type('json');
256
		$this->layout = 'ajax';
265
		$this->layout = 'ajax';
257
		$callback = $this->request->query('callback');
266
		$callback = $this->request->query('callback');
258
		$this->User->id = $id;
267
		$this->User->id = $id;
259
		if (!$this->User->exists()) {
268
		if (!$this->User->exists()) {
Line 275... Line 284...
275
 * @param string $id
284
 * @param string $id
276
 * @return void
285
 * @return void
277
 */
286
 */
278
 
287
 
279
    public function edit($id = null) {
288
    public function edit($id = null) {
-
 
289
		throw new NotFoundException(__('Unauthorized access'));
280
		$this->log(print_r($this->request->data,1),'mydetails');
290
		$this->log(print_r($this->request->data,1),'mydetails');
281
		$this->response->type('json');
291
		$this->response->type('json');
282
		$this->layout = 'ajax';
292
		$this->layout = 'ajax';
283
		$this->User->recursive = -1;
293
		$this->User->recursive = -1;
284
		$updateRequired = true;
294
		$updateRequired = true;
Line 327... Line 337...
327
 *
337
 *
328
 * @return void
338
 * @return void
329
 */
339
 */
330
 
340
 
331
	public function admin_pushnotifications(){
341
	public function admin_pushnotifications(){
-
 
342
		throw new NotFoundException(__('Unauthorized access'));
332
		if ($this->request->is('post')) {
343
		if ($this->request->is('post')) {
333
			$sql = $this->request->data['User']['sql'];
344
			$sql = $this->request->data['User']['sql'];
334
			if(!empty($sql)){
345
			if(!empty($sql)){
335
				$users = $this->User->query($sql);
346
				$users = $this->User->query($sql);
336
				$this->set(compact('users'));
347
				$this->set(compact('users'));
337
			}
348
			}
338
		}
349
		}
339
	}
350
	}
340
 
351
 
341
	public function generateAffiliateUrl($url,$user_id,$store){
352
	public function generateAffiliateUrl($url,$user_id,$store){
-
 
353
		throw new NotFoundException(__('Unauthorized access'));
342
		//Get StoreProduct Info		
354
		//Get StoreProduct Info		
343
		$storeId = $store['Store']['id'];
355
		$storeId = $store['Store']['id'];
344
		$prefix = "SHA".$storeId;
356
		$prefix = "SHA".$storeId;
345
		$tag = $prefix.time();
357
		$tag = $prefix.time();
346
		if($storeId == 2){				
358
		if($storeId == 2){				
Line 374... Line 386...
374
		$this->Click->save($data);
386
		$this->Click->save($data);
375
		return $url;
387
		return $url;
376
	}
388
	}
377
 
389
 
378
	public function admin_push(){
390
	public function admin_push(){
-
 
391
		throw new NotFoundException(__('Unauthorized access'));
379
		if ($this->request->is('post')) {
392
		if ($this->request->is('post')) {
380
			if(empty($this->request->data['userIds'])){
393
			if(empty($this->request->data['userIds'])){
381
				$this->Session->setFlash(__('Please choose a few users'));
394
				$this->Session->setFlash(__('Please choose a few users'));
382
				$this->redirect(array('action' => 'admin_pushnotifications'));
395
				$this->redirect(array('action' => 'admin_pushnotifications'));
383
			}else{
396
			}else{
Line 411... Line 424...
411
			}
424
			}
412
		}
425
		}
413
	}
426
	}
414
 
427
 
415
	private function send_push_notification($registatoin_ids, $message, $user_id) {
428
	private function send_push_notification($registatoin_ids, $message, $user_id) {
-
 
429
		throw new NotFoundException(__('Unauthorized access'));
416
		$msg = array(
430
		$msg = array(
417
		    'message'       => $message['message'],
431
		    'message'       => $message['message'],
418
		    'cid'       	=> $message['cid'],
432
		    'cid'       	=> $message['cid'],
419
		    'title'         => $message['title'],
433
		    'title'         => $message['title'],
420
		    'type'      	=> $message['type'],
434
		    'type'      	=> $message['type'],
Line 465... Line 479...
465
		curl_close($ch);
479
		curl_close($ch);
466
		$this->log("For $user_id ".$registatoin_ids[0]." ".print_r($result,1),'pushnotifications');
480
		$this->log("For $user_id ".$registatoin_ids[0]." ".print_r($result,1),'pushnotifications');
467
	}
481
	}
468
 
482
 
469
	public function admin_index() {		
483
	public function admin_index() {		
-
 
484
		throw new NotFoundException(__('Unauthorized access'));
470
		$this->User->recursive = 0;
485
		$this->User->recursive = 0;
471
		$options = array('limit'=>100,'order'=>array('id'=>'desc'));
486
		$options = array('limit'=>100,'order'=>array('id'=>'desc'));
472
		$this->Paginator->settings = $options;
487
		$this->Paginator->settings = $options;
473
		$users = $this->Paginator->paginate();
488
		$users = $this->Paginator->paginate();
474
		$groups = $this->User->Group->find('list');
489
		$groups = $this->User->Group->find('list');
Line 494... Line 509...
494
 * admin_add method
509
 * admin_add method
495
 *
510
 *
496
 * @return void
511
 * @return void
497
 */
512
 */
498
	public function admin_add() {
513
	public function admin_add() {
-
 
514
		throw new NotFoundException(__('Unauthorized access'));
499
		if ($this->request->is('post')) {
515
		if ($this->request->is('post')) {
500
			$this->User->create();
516
			$this->User->create();
501
			if ($this->User->save($this->request->data)) {
517
			if ($this->User->save($this->request->data)) {
502
				$this->Session->setFlash(__('The user has been saved'));
518
				$this->Session->setFlash(__('The user has been saved'));
503
				$this->redirect(array('action' => 'index'));
519
				$this->redirect(array('action' => 'index'));
Line 515... Line 531...
515
 * @throws NotFoundException
531
 * @throws NotFoundException
516
 * @param string $id
532
 * @param string $id
517
 * @return void
533
 * @return void
518
 */
534
 */
519
	public function admin_edit($id = null) {
535
	public function admin_edit($id = null) {
-
 
536
		throw new NotFoundException(__('Unauthorized access'));
520
		$this->User->id = $id;
537
		$this->User->id = $id;
521
		if (!$this->User->exists()) {
538
		if (!$this->User->exists()) {
522
			throw new NotFoundException(__('Invalid user'));
539
			throw new NotFoundException(__('Invalid user'));
523
		}
540
		}
524
		if ($this->request->is('post') || $this->request->is('put')) {
541
		if ($this->request->is('post') || $this->request->is('put')) {
Line 542... Line 559...
542
 * @throws NotFoundException
559
 * @throws NotFoundException
543
 * @param string $id
560
 * @param string $id
544
 * @return void
561
 * @return void
545
 */
562
 */
546
	public function admin_delete($id = null) {
563
	public function admin_delete($id = null) {
-
 
564
		throw new NotFoundException(__('Unauthorized access'));
547
		if (!$this->request->is('post')) {
565
		if (!$this->request->is('post')) {
548
			throw new MethodNotAllowedException();
566
			throw new MethodNotAllowedException();
549
		}
567
		}
550
		$this->User->id = $id;
568
		$this->User->id = $id;
551
		if (!$this->User->exists()) {
569
		if (!$this->User->exists()) {
Line 568... Line 586...
568
 
586
 
569
/**
587
/**
570
* user authentication funtions
588
* user authentication funtions
571
*/
589
*/
572
	public function register() {
590
	public function register() {
-
 
591
		throw new NotFoundException(__('Unauthorized access'));
573
		$referrer = $this->request->query('referrer');
592
		$referrer = $this->request->query('referrer');
574
		$this->log('referrer = '.$referrer);
593
		$this->log('referrer = '.$referrer);
575
		$this->Cookie->write('referrer',$referrer);
594
		$this->Cookie->write('referrer',$referrer);
576
		$this->layout = 'auth';
595
		$this->layout = 'auth';
577
		$this->set('title_for_layout','Register your free letushaggle.com account');
596
		$this->set('title_for_layout','Register your free letushaggle.com account');
578
		$this->SignMeUp->register();
597
		$this->SignMeUp->register();
579
	}
598
	}
580
 
599
 
581
	public function activate() {
600
	public function activate() {
-
 
601
		throw new NotFoundException(__('Unauthorized access'));
582
		$this->layout = 'auth';
602
		$this->layout = 'auth';
583
		$this->set('title_for_layout','Activate your copublish.in account');
603
		$this->set('title_for_layout','Activate your copublish.in account');
584
		$this->SignMeUp->activate();
604
		$this->SignMeUp->activate();
585
	}
605
	}
586
 
606
 
587
	public function forgotten_password() {
607
	public function forgotten_password() {
-
 
608
		throw new NotFoundException(__('Unauthorized access'));
588
		$this->layout = 'auth';
609
		$this->layout = 'auth';
589
		$this->set('title_for_layout','Reset your copublish.in password');
610
		$this->set('title_for_layout','Reset your copublish.in password');
590
		$this->SignMeUp->forgottenPassword();
611
		$this->SignMeUp->forgottenPassword();
591
	}	
612
	}	
592
 
613
 
Line 626... Line 647...
626
		$this->Session->setFlash(__('You have been logged out now'),'success_message');
647
		$this->Session->setFlash(__('You have been logged out now'),'success_message');
627
		$this->redirect($this->Auth->logout());
648
		$this->redirect($this->Auth->logout());
628
	}
649
	}
629
 
650
 
630
	public function updatetimezone() {
651
	public function updatetimezone() {
-
 
652
		throw new NotFoundException(__('Unauthorized access'));
631
		$this->layout = 'ajax';		
653
		$this->layout = 'ajax';		
632
		$timezone = $_GET['tz'];
654
		$timezone = $_GET['tz'];
633
		Configure::load('constant');
655
		Configure::load('constant');
634
		$timeZones = Configure::read("timeZones");
656
		$timeZones = Configure::read("timeZones");
635
		$query = "UPDATE users SET user_timezone = $timezone WHERE id = ".$this->Auth->User('id');
657
		$query = "UPDATE users SET user_timezone = $timezone WHERE id = ".$this->Auth->User('id');
Line 640... Line 662...
640
		}
662
		}
641
		$this->set('result',$result);
663
		$this->set('result',$result);
642
	}
664
	}
643
 
665
 
644
	public function verifymobile() {
666
	public function verifymobile() {
-
 
667
		throw new NotFoundException(__('Unauthorized access'));
645
		$this->layout = 'innerpages';
668
		$this->layout = 'innerpages';
646
	}
669
	}
647
 
670
 
648
	public function getdial2verifynumber() {
671
	public function getdial2verifynumber() {
-
 
672
		throw new NotFoundException(__('Unauthorized access'));
649
		$TelNumber=substr($this->request->data("phone_number"),-10);
673
		$TelNumber=substr($this->request->data("phone_number"),-10);
650
 
674
 
651
	  // Replace with your Dial2Verify API Passkey generated using ( http://kb.dial2verify.in/?q=5 )
675
	  // Replace with your Dial2Verify API Passkey generated using ( http://kb.dial2verify.in/?q=5 )
652
	    $API_KEY = Configure::read("dial2verifyapikey");
676
	    $API_KEY = Configure::read("dial2verifyapikey");
653
  
677
  
Line 659... Line 683...
659
		$this->layout = 'ajax';
683
		$this->layout = 'ajax';
660
	    echo($json);die;
684
	    echo($json);die;
661
	}
685
	}
662
 
686
 
663
	public function getdial2verifystatus() { 
687
	public function getdial2verifystatus() { 
664
 
-
 
-
 
688
		throw new NotFoundException(__('Unauthorized access'));
665
		$SID=$_REQUEST["SID"];
689
		$SID=$_REQUEST["SID"];
666
    
690
    
667
	    $json = array();
691
	    $json = array();
668
		$VerificationCall="http://engine.dial2verify.in/Integ/UserLayer/DataFeed_APIV2.dvf?SID=$SID";
692
		$VerificationCall="http://engine.dial2verify.in/Integ/UserLayer/DataFeed_APIV2.dvf?SID=$SID";
669
 
693
 
Line 680... Line 704...
680
		$this->layout = 'ajax';
704
		$this->layout = 'ajax';
681
	    echo(json_encode($json));die;
705
	    echo(json_encode($json));die;
682
	}
706
	}
683
 
707
 
684
	public function skipmobileverification() {
708
	public function skipmobileverification() {
-
 
709
		throw new NotFoundException(__('Unauthorized access'));
685
		$this->Session->write('skipmobileverification',1);
710
		$this->Session->write('skipmobileverification',1);
686
		$this->redirect(array('controller'=>'store_products','action'=>'mine',"?" => array( "user_id" => $this->Auth->User('id'))));
711
		$this->redirect(array('controller'=>'store_products','action'=>'mine',"?" => array( "user_id" => $this->Auth->User('id'))));
687
	}
712
	}
688
 
713
 
689
	public function reauthenticate($userId) {
714
	public function reauthenticate($userId) {
-
 
715
		throw new NotFoundException(__('Unauthorized access'));
690
		$user = $this->User->read(null,$userId);
716
		$user = $this->User->read(null,$userId);
691
		$this->Auth->login($user['User']);
717
		$this->Auth->login($user['User']);
692
		$json = array('success'=>true);
718
		$json = array('success'=>true);
693
		$this->response->type('json');
719
		$this->response->type('json');
694
		$this->layout = 'ajax';
720
		$this->layout = 'ajax';