| Line 22... |
Line 22... |
| 22 |
var $keywords = array('instagram followers','instagram button','instagram follow back','instagram tool','instagram automation','free istagram followers','instagram stats','instagram follow button');
|
22 |
var $keywords = array('instagram followers','instagram button','instagram follow back','instagram tool','instagram automation','free istagram followers','instagram stats','instagram follow button');
|
| 23 |
|
23 |
|
| 24 |
function beforeFilter() {
|
24 |
function beforeFilter() {
|
| 25 |
$this->Auth->autoRedirect = false;
|
25 |
$this->Auth->autoRedirect = false;
|
| 26 |
$this->set('logged_user', $this->Auth->user());
|
26 |
$this->set('logged_user', $this->Auth->user());
|
| 27 |
/*
|
27 |
|
| 28 |
App::import('Vendor','NewEpiCurl',array('file' =>'NewEpiCurl.php'));
|
- |
|
| 29 |
App::import('Vendor','NewEpiOAuth',array('file' =>'NewEpiOAuth.php'));
|
- |
|
| 30 |
App::import('Vendor','NewEpiTwitter',array('file' =>'NewEpiTwitter.php'));
|
- |
|
| 31 |
*/
|
- |
|
| 32 |
//Set api keys according to domain
|
28 |
//Set config settings according to domain
|
| 33 |
// get host name from URL
|
29 |
// get host name from URL
|
| 34 |
preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
|
30 |
preg_match('@^(?:http://)?([^/]+)@i',$_SERVER['HTTP_HOST'], $matches);
|
| 35 |
$host = $matches[1];
|
31 |
$host = $matches[1];
|
| 36 |
switch($host){
|
32 |
switch($host){
|
| 37 |
case 'localdtr':
|
33 |
case 'localdtr':
|
| Line 41... |
Line 37... |
| 41 |
case 'www.profittill.com':
|
37 |
case 'www.profittill.com':
|
| 42 |
case 'profittill.com':
|
38 |
case 'profittill.com':
|
| 43 |
Configure::load('live');
|
39 |
Configure::load('live');
|
| 44 |
break;
|
40 |
break;
|
| 45 |
}
|
41 |
}
|
| 46 |
// Configure::load('live');
|
42 |
$facebookConfig = Configure::read("Facebook");
|
| 47 |
$facebookConfig = Configure::read("Facebook");
|
43 |
$categories = Configure::read('Categories');
|
| 48 |
//Facebook configuration
|
44 |
//Facebook configuration
|
| 49 |
$this->set('fbappid', $facebookConfig['fbappid']);
|
45 |
$this->set('fbappid', $facebookConfig['fbappid']);
|
| - |
|
46 |
$this->set('apihost', Configure::read('apihost'));
|
| - |
|
47 |
|
| 50 |
$sessionState = $this->Session->read('state');
|
48 |
$sessionState = $this->Session->read('state');
|
| 51 |
if(!isset($sessionState)){
|
49 |
if(!isset($sessionState)){
|
| 52 |
$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
|
50 |
$this->Session->write('state' , md5(uniqid(rand(), TRUE))); // CSRF protection
|
| 53 |
}
|
51 |
}
|
| 54 |
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
|
52 |
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
|
| 55 |
. $facebookConfig['fbappid'] . "&redirect_uri=" . urlencode($facebookConfig['base_url'].'/users/checkfbuser/') . "&state="
|
53 |
. $facebookConfig['fbappid'] . "&redirect_uri=" . urlencode($facebookConfig['base_url'].'/users/checkfbuser/') . "&state="
|
| 56 |
. $this->Session->read('state').'&scope=publish_stream,email,user_birthday,publish_actions,user_location';
|
54 |
. $this->Session->read('state').'&scope=publish_stream,email,user_birthday,publish_actions,user_location';
|
| 57 |
$this->set('dialog_url', $dialog_url);
|
55 |
$this->set('dialog_url', $dialog_url);
|
| 58 |
$this->set('description','Why spend money when you can get something for free');
|
56 |
$this->set('description','Why spend money when you can get something for free');
|
| - |
|
57 |
$this->set('categories',$categories);
|
| 59 |
if(isset($this->params['admin'])) {
|
58 |
if(isset($this->params['admin'])) {
|
| 60 |
$this->layout = 'admin';
|
59 |
$this->layout = 'admin';
|
| 61 |
}
|
60 |
}
|
| 62 |
}
|
61 |
}
|
| 63 |
|
62 |
|
| Line 68... |
Line 67... |
| 68 |
function isFbAuthorized() {
|
67 |
function isFbAuthorized() {
|
| 69 |
return $this->Session->read('facebook_id');
|
68 |
return $this->Session->read('facebook_id');
|
| 70 |
}
|
69 |
}
|
| 71 |
|
70 |
|
| 72 |
function afterFilter() {
|
71 |
function afterFilter() {
|
| 73 |
$result['ucadcode'] = $this->ucadcode;
|
72 |
$result['ucadcode'] = $this->ucadcode;
|
| 74 |
}
|
73 |
}
|
| 75 |
|
74 |
|
| 76 |
function beforeRender() {
|
75 |
function beforeRender() {
|
| 77 |
// $this->set('base_url', 'http://' . $_SERVER['SERVER_NAME'] . Router::url('/'));
|
76 |
$this->set('base_url', 'http://' . $_SERVER['SERVER_NAME'] . Router::url('/'));
|
| 78 |
$this->set('base_url', 'http://api.profittill.com/');
|
77 |
// $this->set('base_url', 'http://api.profittill.com/');
|
| 79 |
}
|
78 |
}
|
| 80 |
}
|
79 |
}
|
| 81 |
|
80 |
|
| 82 |
if (!function_exists('getallheaders'))
|
81 |
if (!function_exists('getallheaders'))
|
| 83 |
{
|
82 |
{
|