utm_source = request_variable('utm_source'); //ES. Bestshopping $this->utm_medium = request_variable('utm_medium'); //ES. PPS, PPC, EMAIL $this->utm_campaign = request_variable('utm_campaign'); //ES. BestShopping_Standard $this->utm_email = request_variable('utm_email'); $this->hash = request_variable('hash'); $email = request_cookie("email"); $this->tracker = request_cookie("asixonebk"); $this->referer = request_cookie("referhaitex"); $this->dev_uuid = request_variable('uuid'); //identificativo univoco dispositivo mobile $this->dev_model = request_variable('model'); //modello dispositivo mobile $this->dev_version = request_variable('version'); //versione Sistema Operativo dispositivo mobile if(vuotoonullo($this->referer)) { $this->referer = request_variable('HTTP_REFERER'); $this->referer = parse_url($this->referer, PHP_URL_HOST); setcookie("referhaitex", $this->referer, time()+(60*60*2), "/"); } if(!isset($this->tracker)){$this->tracker = "";} if (vuotoonullo($this->tracker)){ $this->tracker = rand(0,10000)."-".time(); $cookie_life = time() + 31536000; setcookie("asixonebk", $this->tracker, $cookie_life, "/"); } if(vuotoonullo($this->hash)){ $this->hash = request_cookie('hash'); } if(!vuotoonullo($this->dev_uuid)){ $this->hash =$this->dev_uuid; } if(!vuotoonullo($this->hash)){ $cookie_life = time() + 31536000; setcookie("hash", $this->hash, $cookie_life, "/"); } else{ $db = new DB(); $query = ''; if(vuotoonullo($this->utm_email)){ $query="select New_email, New_code from Newsletter where New_code=".$db->v($this->hash)." and New_centroCommerciale = ".$db->v($ps->server); } if(!vuotoonullo($email)){ $query="select New_email, New_code from Newsletter where New_email=".$db->v($email)." and New_centroCommerciale = ".$db->v($ps->server); } if($query!=''){ $db->query($query); $result_ute = $db->loop(); $this->utm_email = $result_ute['New_email']; if(vuotoonullo($this->hash)){ $this->hash = $result_ute['New_code'];} } else { $this->utm_email = ''; $this->hash = isset($result_ute)?$result_ute['New_code']:$this->hash;} unset($db); } if(!vuotoonullo($this->dev_model)){ setcookie("devModel", $this->dev_model, time()+(60*60*2), "/"); }else{ $this->dev_model = request_cookie('devModel'); } if(!vuotoonullo($this->dev_version)){ setcookie("devVersion", $this->dev_version, time()+(60*60*2), "/"); }else{ $this->dev_version = request_cookie('devVersion'); } if(!vuotoonullo($this->utm_source)){ $bool=setcookie("utmSource", $this->utm_source, time()+(60*60*2), "/"); if(!vuotoonullo($this->utm_medium)){ setcookie("utmMedium", $this->utm_medium, time()+(60*60*2), "/"); } if(!vuotoonullo($this->utm_campaign)){ setcookie("utmCampaign", $this->utm_campaign, time()+(60*60*2), "/");//, ".haistore.it" } /* if(!vuotoonullo($this->utm_email) && ($this->utm_source!="HSNL")){ setcookie("utmEmail", $this->utm_email, time()+(60*60*2), "/");//, ".haistore.it" $mymail = new HaistoreMail("","info@haistore.it"); $mymail->destinatario = "info@haistore.it"; $mymail->oggetto = "Conferma ".$this->utm_email; $mymail->testo = "Il cliente con email $this->utm_email ha appena cliccato sul link per la campagna $this->utm_source / $this->utm_medium / $this->utm_campaign"; $mymail->invia(); }*/ if($bool==false){echo "Problema cookies 126349";} }else{ $this->utm_source = request_cookie("utmSource"); // request_cookie('utm_source'); $this->utm_medium = request_cookie('utmMedium'); $this->utm_campaign = request_cookie('utmCampaign'); if($this->utm_email==""){ $this->utm_email = request_cookie('utm_email'); } } if(vuotoonullo($this->utm_source) && (!vuotoonullo($this->hash))){ $this->utm_source = ""; $this->utm_medium = "cookie"; $this->utm_campaign = "cookie"; } if(is_null($this->utm_email)){ $this->utm_email=""; } } ///////////////////////////////////////////////////////// function weblog($ps) { $idArticolo = ''; global $ps; global $lang; $l=$lang->l(); //$indirizzoIP=getenv("REMOTE_ADDR"); $azione=""; if($ps->sottoSito=="Haistore") { $azione="h"; }else{ $azione="s"; } if($ps->pagina=="ordina.php") { $azione="c"; //echo "CARRELLO".$logweb; } if($ps->pagina=="login.php") { $azione="l"; //echo "REGISTRAZIONE".$logweb; } if($ps->pagina=="registrazione.php") { $azione="r"; //echo "REGISTRAZIONE".$logweb; } global $ultimoId, $penultimoId; if(!vuotoonullo($ultimoId)){ $idArticolo=$ultimoId; } if(!vuotoonullo($penultimoId)){ $idArticolo=$penultimoId; } if(!vuotoonullo($ps->id)){ $idArticolo=$ps->id; } if(!vuotoonullo($ps->idArt)){ $idArticolo=$ps->idArt; } $piva = $ps->pIva; if($idArticolo=="" && $ps->keyword!=''){ $idArticolo = -1; $piva = $ps->keyword; } //echo "UltimoID: $ultimoId, PenultimoID: $penultimoId, IDArticolo: $idArticolo"; if($idArticolo!=""){ $db = new DB(); //$db->debug=1; if(!vuotoonullo($ps->pIva) && ($idArticolo>0) || $ps->keyword!='') { $db->opzioni=' IGNORE ';// $db->insert('Logweb'); $db->add('Lw_id', $idArticolo); $db->add('Lw_piva', $piva); $db->add('Lw_ip', $ps->indirizzoIP); $db->add('Lw_p', $azione); $db->add('Lw_source', $this->utm_source); $db->add('Lw_medium', $this->utm_medium); $db->add('Lw_campaign', $this->utm_campaign); $db->add('Lw_email', $this->utm_email); $db->add('Lw_cc', $ps->server); $db->add('Lw_tracker', $this->tracker); $db->add('Lw_hash', (isset($this->hash))?$this->hash:''); $db->add('Lw_dev_model',$this->dev_model); $db->add('Lw_dev_version',$this->dev_version); $db->add('Lw_referer', $this->referer); $sql = $db->insert_getSQL(); $db->query($sql); } unset($db); } //$e = new Exception(); //$trace = $e->getTraceAsString(); //echo $trace."\n- - - - -\n"; } } template_file = $filename; $this->debug = $debug; $this->parsed = false; if(file_exists($filename)) { $fp = fopen ($filename, "r"); $this->buffer = fread($fp, filesize($filename)); fclose($fp); $this->buffer = traduci_multilingua($this->buffer); $i=0; do { //$result = ereg("<\[foreach\]>(.+)<\[\/foreach\]>",$this->buffer,$token); //codice originale $result = preg_match("/<\[foreach\]>([^§]+)<\[\/foreach\]>/",$this->buffer,$token); if ($result) { $this->foreach[] = $token[1]; $this->buffer = preg_replace("/<\[foreach\]>([^§]+)<\[\/foreach\]>/","<[foreach$i]>",$this->buffer); } $i++; } while ($result); } } function setContent($name, $value, $pars = "") { //modifica effettuata da giovanni il 11/5/2011 perchč php mostrava warnings nel caso in cui la variabile corrispondente al placeholder non fosse settata //if(isset($this->content[$name])) { $this->content[$name][] = $value; $this->pars[$name][] = $pars; //} else {echo "<[$name]> non presente nel template $this->template_file \n
";} } function pre($var) { if ($this->debug == "DEBUG") { return ""; } } function post($var) { if ($this->debug == "DEBUG") { return ""; } } function parse() { $this->parsed = true; if ($this->debug == "DEBUG") { $pre = ""; $post = ""; } for($i=0;$iforeach);$i++) { $result = preg_match("/<\[([a-zA-Z0-9_]+)\]>/",$this->foreach[$i],$token); if ($result) { $go = isset($token[1]) ? $token[1] : ''; $iterations = 0; $array = array(); if(($go!='')&&(is_array($this->content))){ if(array_key_exists($go,$this->content)){ $array = $this->content[$go]; if(is_array($array)){ $iterations = count($array); } } } } for ($j=0;$j<$iterations;$j++) { $buffer = $this->foreach[$i]; do { $result = preg_match("/<\[([a-zA-Z0-9_]+)\]>/",$buffer,$token); if ($result) { $tok = $token[1]; $ok = array_key_exists($tok, $this->content); if($ok){ $xx1 = $this->content[$tok]; $xx2 = isset($xx1[$j])?$xx1[$j]:''; } else {$xx2 = '';} $buffer = preg_replace("/<\[$tok\]>/",$this->pre($tok).$xx2.$this->post($tok),$buffer); } /* nuovo */ $result_2 = preg_match("/<\[([a-zA-Z0-9_]+)::([a-zA-Z0-9_]+)[[:space:] ]*([[:alnum:] =\.\%\#\'\"\_-]*)\]>/",$buffer,$token); if ($result_2) { $buffer = preg_replace("/<\[$token[1]::$token[2][[:space:] ]*$token[3]\]>/", $this->pre($token[1]). $this->render($token[1], $this->content[$token[1]][$j], $token[2], $token[3]). $this->post($token[1]), $buffer); } /* nuovo */ } while ($result or $result_2); $ok = array_key_exists("foreach$i", $this->content); if(!$ok){ $this->content["foreach$i"] = array(''); } $this->content["foreach$i"][0] .= $buffer; } } do { $result = preg_match("/<\[([a-zA-Z0-9_]+)\]>/",$this->buffer,$token); if ($result) { $c = isset($this->content[$token[1]][0]) ? $this->content[$token[1]][0] : ''; $kkk = is_array($token[1])?'Array':$token[1]; $a = $this->pre($kkk).$c.$this->post($kkk); $b = isset($this->buffer) ? $this->buffer : ''; $this->buffer = preg_replace("/<\[$kkk\]>/",$a,$b); } } while ($result); do { $result = preg_match("/<\[([a-zA-Z0-9_]+)::([a-zA-Z0-9_]+)[[:space:] ]*([[:alnum:] =\.\%\#\'\"\_\-]*)\]>/",$this->buffer,$token); if ($result) { $this->buffer = preg_replace("/<\[$token[1]::$token[2][[:space:] ]*$token[3]\]>/", $this->pre($token[1]). $this->render($token[1], $this->content["$token[1]"][0], $token[2], $token[3]). $this->post($token[1]), $this->buffer); } } while ($result); } function close() { if (!$this->parsed) { $this->parse(); } echo $this->buffer; # gzdocout(); } function get() { if (!$this->parsed) { $this->parse(); } return $this->buffer; } function render($name,$data,$widget,$parameters,$value = "",$event = "") { $parameters = $parameters." ".$this->pars[$name][0]; switch($widget) { case "select2": case "Select2": /* $data is formatted like this $data[0][value] $data[0][text] */ $content = Render::Select($name,$data,$parameters,$value,$event); break; case "checkbox": case "CheckBox": case "checkBox": $content = Render::CheckBoxList($name,$data,$value,$event); break; case "radiobox": case "RadioBox": case "radioBox": $content = Render::RadioBox($name,$data,$value,$event); break; case "show_data": case "showdata": case "showData": case "Showdata": case "ShowData": case "inspect": case "Inspect": $content = Render::ShowData($name,$data,$parameters,$value,$event); break; default: $pars = TagAux::parsePars($parameters); if ($pars[library]) { $library = $pars[library]; require_once "include/tags/$library.inc.php"; } else { $library = "TagLibrary"; } echo $this->parameters[$widget][0]; eval("\$content = ".$library."::".$widget."(\$name,\$data,TagAux::parsePars(\$parameters));"); break; } return $content; } } /** * @ignore */ Class TagAux { function parsePars($parameters) { $buffer = $parameters; do { $result = preg_match("/^([[:alnum:] \_]+)/",$buffer,$token); if ($result) { $buffer = preg_replace("/^$token[1]/","",$buffer); $result2 = preg_match("/^=\"([[:alnum:]\.\-\_\%\# \_\-]*)\"/",$buffer,$token2); if ($result2) { $buffer = preg_replace("/^=\"$token2[1]\"[[:space:] ]*/","",$buffer); $par[$token[1]] = $token2[1]; } } } while ($result); return $par; } } /** * @ignore */ Class TagLibrary { function htmlInclude($nome,$data,$pars) { $url = $data; $content .= "\n"; $fp = fopen("$url","r"); if (!$fp) { $content .=" Error while opening $url "; } else { $content .= fread($fp,filesize("$url")); } fclose($fp); $content .= "\n"; return $content; } function help($message) { global $dateLibraryDeploy; if (!$dateLibraryDeploy) { $content .= "\n\n\n"; $content .= "\n"; $content .= "
\n"; } $content .= " "; return $content; } } set($lingua); $this->l=$lingua; } $cook = request_cookie('hslingua'); //if($cook!=''){$linguaC = $cook;} $linguaC = $cook; //vedo se il cookie non esiste lo creo if(($lingua!='') && ($lingua!=null)){ $this->set($lingua); $this->l = $lingua; //echo "COOKIE SETTATO"; } else { //echo "Valore del cookie ".$linguaC; if (($linguaC!='') && ($linguaC!=null)) { $this->set($linguaC); $this->l = $linguaC; //echo "COOKIE LETTO"; } } } public function set($lingua){ $lingua=strtoupper($lingua); if($lingua!="IT"){$lingua="EN";} $server=$_SERVER['SERVER_NAME']; setcookie("hslingua", $lingua, time()+(60*60*24*365), "/", $server, 0); $this->l = $lingua; } public function get(){ if($this->l=="IT") {$exit='';} else {$exit='_EN';} return $exit; } public function l(){ return $this->l; } } function traduci_categoria($sezione,$categoria,$sottocategoria,$sottosezione,$step){ //step=0 traduco tutta la combinazione delle categorie; step=1,2,3,4 estraggo solo la categoria di interesse $exit = ""; global $lang; global $trans; $l=$lang->l(); if($l!='IT'){ $db = new DB(); if($step==0){ $sql= "SELECT Col1_EN,Col2_EN,Col3_EN,Col4_EN FROM Categorie WHERE Col1=".$db->v($sezione); if($categoria!=''){$sql.=" AND Col2=".$db->v($categoria);} if($sottocategoria!=''){$sql.=" AND Col3=".$db->v($sottocategoria);} if($sottosezione!=''){$sql.=" AND Col4='".$db->v($sottosezione);} }else{ $sql= "SELECT Col1_EN,Col2_EN,Col3_EN,Col4_EN FROM Categorie"; if($step==1){$sql.=" WHERE Col1=".$db->v($sezione);} if($step==2){$sql.=" WHERE Col2=".$db->v($categoria);} if($step==3){$sql.=" WHERE Col3=".$db->v($sottocategoria);} if($step==4){$sql.=" WHERE Col4=".$db->v($sottosezione);} } $sql.=" LIMIT 0,1"; $db->query($sql); $righe_CatL = $db->numrows; $result_CatL = $db->loop(); switch ($step) { case 1: $exit=$result_CatL['Col1_EN']; break; case 2: $exit=$result_CatL['Col2_EN']; break; case 3: $exit=$result_CatL['Col3_EN']; break; case 4: $exit=$result_CatL['Col4_EN']; break; default: $exit=$result_CatL['Col1_EN'].";".$result_CatL['Col2_EN'].";".$result_CatL['Col3_EN'].";".$result_CatL['Col4_EN']; } unset($db); return ($exit); } } function traduci_feedback($lingua, $parola){ global $trans; switch ($parola) { case 'Ottimo': $parola=$trans['ottimo']; break; case 'Ottima': $parola=$trans['ottimo']; break; case 'Buono': $parola=$trans['buono']; break; case 'Buona': $parola=$trans['buono']; break; case 'Discreto': $parola=$trans['discreto']; break; case 'Discreta': $parola=$trans['discreto']; break; case 'Scarso': $parola=$trans['scarso']; break; case 'Scarsa': $parola=$trans['scarso']; break; case 'Si': $parola=$trans['si']; break; case 'Sicuramente Si': $parola=$trans['si']; break; case 'Comparatori': $parola=$trans['comparatori']; break; case 'Amici': $parola=$trans['amici']; break; case 'Non saprei': $parola=$trans['nonsaprei']; break; } return $parola; } function traduci_prodotto($pIva,$id_4d,$step) { $exit = ''; global $lang; global $trans; global $transAZ; $l=$lang->l(); if(($l!='IT')&(!vuotoonullo($pIva))){ $db = new DB(); $sql = "SELECT * FROM ProdottiLingua WHERE Prl_partitaIva=".$db->v($pIva)." AND Prl_id_4d=".$db->v($id_4d)." AND Prl_lingua=".$db->v($l); $db->query($sql); $righe_Prl = $db->numrows; $result_Prl = $db->loop(); switch ($step) { case 1: $exit = $result_Prl['Prl_descrizione']; break; case 2: $exit = $result_Prl['Prl_descrAvanzata']; break; default: $exit = $result_Prl['Prl_descrizione'].";".$result_Prl['Prl_descrAvanzata']; break; } } unset($db); return $exit; } function traduci_disponibilita($disp) { global $lang; global $trans; global $transAZ; global $trans; $l=$lang->l(); //if($l!='IT'){ switch ($disp) { case 'SU ORDINAZIONE': $disp = $trans['suordinazione']; break; case 'PRONTA CONSEGNA': $disp = $trans['prontaconsegna']; break; case '15 GIORNI': $disp = $trans['15giorni']; break; case 'NON DISPONIBILE': $disp = $trans['nondisponibile']; break; case '2 GIORNI LAVORATIVI': $disp = $trans['prontaconsegna']; break; case '5 GIORNI LAVORATIVI': $disp = $trans['prontaconsegna']; break; case '30 GIORNI': $disp = $trans['suordinazione']; break; default: break; // } } return $disp; } function traduci_mod_pagamento($traduci) { global $lang; global $trans; global $transAZ; $l=$lang->l(); switch ($traduci) { case 'Contrassegno': $traduci = $trans['contrassegno']; break; case 'Bonifico Bancario': $traduci = $trans['bonifico']; break; case 'Carta di Credito/PayPal': $traduci = $trans['ccpaypal']; break; } return $traduci; } global $lang; global $trans; global $transAZ; $lang=new lang();