Blame | Last modification | View Log | RSS feed
<?phpif (!defined('BASEPATH'))exit('No direct script access allowed');class Tracking {public $CI;public function tracking_info() {$this->CI = & get_instance();$method = $this->CI->router->method;$notRequired = array('changeCaptcha','getSearchList','getProductList','getSpecialProductList','anonymous','add','delete','update','insure','cartCount','coupon','couponClear','returnProduct','cancelOd','deliveryPb','paymentStat','orderStat','contact','refund','showAddress','modifyAddress','saveAddress','getDeliveryDetails','operator','rechargeAmount','topupSpecial');if(!in_array($method, $notRequired)){$url = $this->CI->config->item('curl_base_url').'tracking';$params = array();if (isset($_SERVER['HTTP_REFERER'])){$params['referer'] = $_SERVER['HTTP_REFERER'];}else{$params['referer'] = '';}if(isset($_GET['afid']) && !empty($_GET['afid'])){$params['afid'] = $_GET['afid'];}else{$params['afid'] = '';}if(isset($_GET['utm_source']) && !empty($_GET['utm_source'])){$params['utm_source'] = $_GET['utm_source'];}else{$params['utm_source'] = '';}$this->CI->mcurl->add_call('tracking','post',$url,$params);$response = $this->CI->mcurl->execute($url);$new['response'] = $response['tracking']['response'];$response = $this->CI->magento_model->product_list($new);if(isset($response[0]->response) && !empty($response[0]->response)){foreach ($response[0]->response as $key => $value) {if($value->maxAge != -1){$expires = time()+$value->maxAge;$newdata = (object) array( "name" => $value->name, "value" => $value->value, "expires"=>$expires,"path"=>$value->path,"secure"=>$value->secure);$cookieData = (object) array( "data" => $newdata);setcookie( "$value->name", json_encode( $cookieData ), $expires , "$value->path",'',$value->secure);}else{$newdata = (object) array( "name" => $value->name, "value" => $value->value, "expires"=>$value->maxAge,"path"=>$value->path,"secure"=>$value->secure);$cookieData = (object) array( "data" => $newdata);setcookie( "$value->name", json_encode( $cookieData ), $value->maxAge , "$value->path",'',$value->secure);}}}}}}?>