| Line 5... |
Line 5... |
| 5 |
public $layoutName ='';
|
5 |
public $layoutName ='';
|
| 6 |
|
6 |
|
| 7 |
function __construct() {
|
7 |
function __construct() {
|
| 8 |
|
8 |
|
| 9 |
// Call the CI_controller constructor
|
9 |
// Call the CI_controller constructor
|
| 10 |
parent::__construct();
|
10 |
parent::__construct();
|
| 11 |
// $admin = $this->session->userdata('admin');
|
- |
|
| 12 |
// if(!isset($admin) || empty($admin)) {
|
- |
|
| 13 |
// redirect(base_url().'fosauthorize');
|
- |
|
| 14 |
// }
|
- |
|
| 15 |
$this->output->set_header("HTTP/1.0 200 OK");
|
11 |
$this->output->set_header("HTTP/1.0 200 OK");
|
| 16 |
$this->output->set_header("HTTP/1.1 200 OK");
|
12 |
$this->output->set_header("HTTP/1.1 200 OK");
|
| 17 |
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT');
|
13 |
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT');
|
| 18 |
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
|
14 |
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
|
| 19 |
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");
|
15 |
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");
|
| Line 160... |
Line 156... |
| 160 |
$this->session->unset_userdata('captcha');
|
156 |
$this->session->unset_userdata('captcha');
|
| 161 |
redirect(base_url().'home');
|
157 |
redirect(base_url().'home');
|
| 162 |
}
|
158 |
}
|
| 163 |
}
|
159 |
}
|
| 164 |
|
160 |
|
| 165 |
|
- |
|
| 166 |
//social login process
|
- |
|
| 167 |
public function session($provider)
|
- |
|
| 168 |
{
|
- |
|
| 169 |
// if (isset($_SERVER['HTTP_REFERER'])) {
|
- |
|
| 170 |
// if(strpos($_SERVER['HTTP_REFERER'],'session') == false) {
|
- |
|
| 171 |
// $location = $_SERVER['HTTP_REFERER'];
|
- |
|
| 172 |
// $this->session->set_userdata('location',$location);
|
- |
|
| 173 |
// }
|
- |
|
| 174 |
// }
|
- |
|
| 175 |
$type = $provider;
|
- |
|
| 176 |
$this->load->helper('url_helper');
|
- |
|
| 177 |
$social =$this->config->item('fos_social');
|
- |
|
| 178 |
|
- |
|
| 179 |
$this->load->spark('fos2/0.4.0');
|
- |
|
| 180 |
|
- |
|
| 181 |
$provider = $this->fos2->provider($provider, array(
|
- |
|
| 182 |
'id' => $social[$provider]['id'],
|
- |
|
| 183 |
'secret' => $social[$provider]['secretkey']
|
- |
|
| 184 |
|
- |
|
| 185 |
));
|
- |
|
| 186 |
|
- |
|
| 187 |
|
- |
|
| 188 |
if ( ! $this->input->get('code'))
|
- |
|
| 189 |
{
|
- |
|
| 190 |
if($this->input->get('error')) {
|
- |
|
| 191 |
redirect(base_url());
|
- |
|
| 192 |
}else{
|
- |
|
| 193 |
redirect($provider->fosauthorize());
|
- |
|
| 194 |
}
|
- |
|
| 195 |
// By sending no options it'll come back here
|
- |
|
| 196 |
}
|
- |
|
| 197 |
else
|
- |
|
| 198 |
{
|
- |
|
| 199 |
try
|
- |
|
| 200 |
{
|
- |
|
| 201 |
//manage login operation here and redirect to perspective link
|
- |
|
| 202 |
$token = $provider->access($_GET['code']);
|
- |
|
| 203 |
|
- |
|
| 204 |
$user = $provider->get_user_info($token);
|
- |
|
| 205 |
if(strcasecmp('facebook', $type) == 0){
|
- |
|
| 206 |
$_POST['isFacebookUser'] = 'true';
|
- |
|
| 207 |
$_POST['accessToken'] = $user['access_token'];
|
- |
|
| 208 |
$_POST['facebookId'] = $user['uid'];
|
- |
|
| 209 |
$_POST['email'] = $user['email'];
|
- |
|
| 210 |
if (preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$_POST['email'])) {
|
- |
|
| 211 |
$fosauthorized = $this->session->userdata('fosauthorized');
|
- |
|
| 212 |
if(isset($_POST) && !empty($_POST)){
|
- |
|
| 213 |
if(isset($fosauthorized) && !empty($fosauthorized)){
|
- |
|
| 214 |
$_POST['userId'] = $fosauthorized['Id'];
|
- |
|
| 215 |
$_POST['Id'] = $fosauthorized['cartId'];
|
- |
|
| 216 |
if($fosauthorized['isLoggedIn'] == 1){
|
- |
|
| 217 |
$_POST['isLoggedIn'] = 'true';
|
- |
|
| 218 |
}
|
- |
|
| 219 |
elseif(isset($fosauthorized['isLoggedIn']) && empty($fosauthorized['isLoggedIn'])) {
|
- |
|
| 220 |
$_POST['isLoggedIn'] = 'false';
|
- |
|
| 221 |
}
|
- |
|
| 222 |
}
|
- |
|
| 223 |
}
|
- |
|
| 224 |
$data['response']=$this->fos_model->getLogin($this->input->get(),$this->input->post(),$this->config->item('fos_login'));
|
- |
|
| 225 |
if(isset($data['response']['response']['login']['fosauthorized']))
|
- |
|
| 226 |
{
|
- |
|
| 227 |
$this->session->set_userdata('fosauthorized',$data['response']['response']['login']['fosauthorized']);
|
- |
|
| 228 |
$this->session->set_flashdata(array('msg'=>$data['response']['response']['login']['msg']));
|
- |
|
| 229 |
$location = $this->session->userdata('location');
|
- |
|
| 230 |
if(isset($location) && !empty($location)){
|
- |
|
| 231 |
$this->session->unset_userdata('location');
|
- |
|
| 232 |
redirect($location);
|
- |
|
| 233 |
}
|
- |
|
| 234 |
else{
|
- |
|
| 235 |
redirect(base_url().$data['response']['response']['login']['redirect']);
|
- |
|
| 236 |
}
|
- |
|
| 237 |
}
|
- |
|
| 238 |
else
|
- |
|
| 239 |
{
|
- |
|
| 240 |
$inputfile = base_url().'assets/css/auth.less';
|
- |
|
| 241 |
$outputfile = base_url().'assets/css/auth.less';
|
- |
|
| 242 |
$this->lessphp->object()->ccompile('assets/css/auth.less','assets/css/auth.css');
|
- |
|
| 243 |
$data['stylesheet'] = 'auth.css';
|
- |
|
| 244 |
$this->layout->view(strtolower(__CLASS__).'/fos_view',$data);
|
- |
|
| 245 |
}
|
- |
|
| 246 |
}else{
|
- |
|
| 247 |
$this->session->set_flashdata(array('msg'=>'Some problem occured.Please try again!'));
|
- |
|
| 248 |
redirect(base_url().'login');
|
- |
|
| 249 |
}
|
- |
|
| 250 |
}
|
- |
|
| 251 |
// Here you should use this information to A) look for a user B) help a new user sign up with existing data.
|
- |
|
| 252 |
// If you store it all in a cookie and redirect to a registration page this is crazy-simple.
|
- |
|
| 253 |
//echo "<pre>Tokens: ";
|
- |
|
| 254 |
//var_dump($token);
|
- |
|
| 255 |
|
- |
|
| 256 |
//echo "\n\nUser Info: ";
|
- |
|
| 257 |
//var_dump($user);
|
- |
|
| 258 |
}
|
- |
|
| 259 |
|
- |
|
| 260 |
catch (OAuth2_Exception $e)
|
- |
|
| 261 |
{
|
- |
|
| 262 |
show_error('That didnt work: '.$e);
|
- |
|
| 263 |
}
|
- |
|
| 264 |
|
- |
|
| 265 |
}
|
- |
|
| 266 |
}
|
- |
|
| 267 |
|
- |
|
| 268 |
function signupcounter() {
|
161 |
function signupcounter() {
|
| 269 |
$data = array();
|
162 |
$data = array();
|
| 270 |
if (isset($_SERVER['HTTP_REFERER'])) {
|
163 |
if (isset($_SERVER['HTTP_REFERER'])) {
|
| 271 |
if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
|
164 |
if ((strpos($_SERVER['HTTP_REFERER'],'login') == false) && (strpos($_SERVER['HTTP_REFERER'],'register') == false)) {
|
| 272 |
$redirect = $_SERVER['HTTP_REFERER'];
|
165 |
$redirect = $_SERVER['HTTP_REFERER'];
|
| Line 340... |
Line 233... |
| 340 |
$configdata = getCache($configdata,$cachemodule);
|
233 |
$configdata = getCache($configdata,$cachemodule);
|
| 341 |
//end of get cache
|
234 |
//end of get cache
|
| 342 |
$this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
235 |
$this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
| 343 |
$data['stylesheet'] = 'recharge.css';
|
236 |
$data['stylesheet'] = 'recharge.css';
|
| 344 |
$data['title'] = 'Thanks';
|
237 |
$data['title'] = 'Thanks';
|
| 345 |
$username = $this->session->userdata('username');
|
238 |
$username = $this->session->userdata('username');
|
| 346 |
if(!empty($username)){
|
239 |
if(!empty($username)){
|
| 347 |
$data['username'] = $username;
|
240 |
$data['username'] = $username;
|
| 348 |
}else{
|
241 |
}else{
|
| 349 |
$data['username'] = $_GET['username'];
|
242 |
$data['username'] = $_GET['username'];
|
| 350 |
}
|
243 |
}
|
| 351 |
$countercode = $this->session->userdata('countercode');
|
244 |
$countercode = $this->session->userdata('countercode');
|
| 352 |
if(!empty($countercode)){
|
245 |
if(!empty($countercode)){
|
| 353 |
$data['countercode'] = $countercode;
|
246 |
$data['countercode'] = $countercode;
|
| 354 |
}else{
|
247 |
}else{
|
| 355 |
$data['countercode'] = $_GET['countercode'];
|
248 |
$data['countercode'] = $_GET['countercode'];
|
| 356 |
}
|
249 |
}
|
| 357 |
$data['response']=$this->fos_model->getDashboard($this->input->get(),$this->input->post(),$this->config->item('fos_dashboard'));
|
250 |
$data['response']=$this->fos_model->getDashboard($this->input->get(),$this->input->post(),$this->config->item('fos_dashboard'));
|
| 358 |
$this->layout->view(strtolower(__CLASS__).'/thanks',$data);
|
251 |
$this->layout->view(strtolower(__CLASS__).'/thanks',$data);
|
| 359 |
}
|
252 |
}
|
| - |
|
253 |
|
| - |
|
254 |
function searchcounter() {
|
| - |
|
255 |
if(isset($_POST) && !empty($_POST)) {
|
| - |
|
256 |
// $_GET = $_POST;
|
| - |
|
257 |
// unset($_POST);
|
| - |
|
258 |
if(isset($fosauthorized) && !empty($fosauthorized)) {
|
| - |
|
259 |
$_POST['userId'] = $fosauthorized['Id'];
|
| - |
|
260 |
}
|
| - |
|
261 |
$configdata =array();
|
| - |
|
262 |
$configdata = $this->config->item('fos_searchcounter');
|
| - |
|
263 |
unset($configdata['response'][0]);
|
| - |
|
264 |
$data['response']=$this->fos_model->getSearch($this->input->get(),$this->input->post(),$configdata);
|
| - |
|
265 |
//set cache to output or renew cache
|
| - |
|
266 |
$this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
| - |
|
267 |
$data['stylesheet'] = 'recharge.css';
|
| - |
|
268 |
$data['title'] = 'Search Counter';
|
| - |
|
269 |
$this->layout->view(strtolower(__CLASS__).'/searchuser',$data);
|
| - |
|
270 |
}else{
|
| - |
|
271 |
$configdata = $this->config->item('fos_searchcounter');
|
| - |
|
272 |
$cachemodule = array('header','footer');
|
| - |
|
273 |
$configdata = getCache($configdata,$cachemodule);
|
| - |
|
274 |
//end of get cache
|
| - |
|
275 |
$this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
| - |
|
276 |
$data['stylesheet'] = 'recharge.css';
|
| - |
|
277 |
$data['title'] = 'Search Counter';
|
| - |
|
278 |
$data['response']=$this->fos_model->getSearch($this->input->get(),$this->input->post(),$this->config->item('fos_dashboard'));
|
| - |
|
279 |
$this->layout->view(strtolower(__CLASS__).'/searchuser',$data);
|
| - |
|
280 |
}
|
| - |
|
281 |
}
|
| - |
|
282 |
|
| - |
|
283 |
function loginas($userid,$cartId) {
|
| - |
|
284 |
$auth = array('Id'=>$userid,'isLoggedIn'=>1,'cartId'=>$cartId,'isPrivateDealUser'=>1);
|
| - |
|
285 |
$this->session->set_userdata('authorized',$auth);
|
| - |
|
286 |
redirect('/search');
|
| - |
|
287 |
}
|
| - |
|
288 |
|
| - |
|
289 |
function getusers($id) {
|
| - |
|
290 |
$configdata =array();
|
| - |
|
291 |
$configdata = $this->config->item('fos_getcounterusers');
|
| - |
|
292 |
unset($configdata['response'][0]);
|
| - |
|
293 |
$data['response']=$this->fos_model->getUser($this->input->get(),array('counter_id'=>$id),$configdata);
|
| - |
|
294 |
//set cache to output or renew cache
|
| - |
|
295 |
$this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
| - |
|
296 |
$data['stylesheet'] = 'recharge.css';
|
| - |
|
297 |
$data['title'] = 'Users list';
|
| - |
|
298 |
$this->layout->view(strtolower(__CLASS__).'/listuser',$data);
|
| - |
|
299 |
}
|
| 360 |
}
|
300 |
}
|
| - |
|
301 |
|