Subversion Repositories SmartDukaan

Rev

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

Rev 13565 Rev 13567
Line 32... Line 32...
32
		//Set api keys according to domain
32
		//Set api keys according to domain
33
		// get host name from URL
33
		// get host name from URL
34
		preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
34
		preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
35
		$host = $matches[1];
35
		$host = $matches[1];
36
		switch($host){			
36
		switch($host){			
37
			case 'localhost':
37
			case 'localdtr':
38
			case 'localhost/hotbhojpuri':
-
 
39
				Configure::load('dev');
38
				Configure::load('dev');
40
				break;
39
				break;
41
			default:
40
			default:
42
			case 'www.instafollow.in':
41
			case 'www.profittill.com':
43
			case 'instafollow.in':
42
			case 'profittill.com':
44
				Configure::load('live');
43
				Configure::load('live');
45
				break;
44
				break;
46
		}
45
		}
47
		Configure::load('live');
46
		// Configure::load('live');
48
		$facebookConfig = Configure::read("Facebook");		
47
		$facebookConfig = Configure::read("Facebook");				
49
/*		
-
 
50
		//Twitter configuration
-
 
51
		$twitterConfig = Configure::read("Twitter");
-
 
52
		$this->set('consumer_key', $twitterConfig['consumer_key']);
-
 
53
		$this->set('consumer_secret', $twitterConfig['consumer_secret']);
-
 
54
		$this->twitterObj = new EpiTwitter($twitterConfig['consumer_key'], $twitterConfig['consumer_secret']);
-
 
55
		$this->twitterObj->useApiVersion('1.1');
-
 
56
		$this->set('twitterObj',$this->twitterObj);	
-
 
57
*/	
-
 
58
		//Facebook configuration
48
		//Facebook configuration
59
		$this->set('fbappid', $facebookConfig['fbappid']);
49
		$this->set('fbappid', $facebookConfig['fbappid']);
60
	   	$sessionState = $this->Session->read('state');
50
	   	$sessionState = $this->Session->read('state');
61
		if(!isset($sessionState)){
51
		if(!isset($sessionState)){
62
			$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
52
			$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
Line 68... Line 58...
68
		$this->set('description','Why spend money when you can get something for free');
58
		$this->set('description','Why spend money when you can get something for free');
69
		if(isset($this->params['admin'])) {
59
		if(isset($this->params['admin'])) {
70
    		$this->layout = 'admin';
60
    		$this->layout = 'admin';
71
    	}		
61
    	}		
72
    }
62
    }
73
 
-
 
74
	function generateucadcode($ip,$ua){
-
 
75
		$url = "http://slot.union.ucweb.com/?pub=Darshit@SnapChum&format_type=json&ip=$ip&ua=$ua";
-
 
76
		$ch = curl_init();
-
 
77
 
-
 
78
	    // Now set some options (most are optional)
-
 
79
	 
-
 
80
	    // Set URL to download
-
 
81
	    curl_setopt($ch, CURLOPT_URL, $url);
-
 
82
	 
-
 
83
	    // Include header in result? (0 = yes, 1 = no)
-
 
84
	    curl_setopt($ch, CURLOPT_HEADER, 0);
-
 
85
	 
-
 
86
	    // Should cURL return or print out the data? (true = return, false = print)
-
 
87
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
 
88
	 
-
 
89
	    // Timeout in seconds
-
 
90
	    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
-
 
91
	 
-
 
92
	    // Download the given URL, and return output
-
 
93
	    $output = curl_exec($ch);
-
 
94
	 
-
 
95
	    // Close the cURL resource, and free system resources
-
 
96
	    curl_close($ch);
-
 
97
	 
-
 
98
	    return $output;
-
 
99
	}
-
 
100
	
63
	
101
    function isAuthorized() {
64
    function isAuthorized() {
102
        return $this->Auth->user('id');
65
        return $this->Auth->user('id');
103
    }
66
    }
104
 
67