PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/DEV/DISPLAY/redirect.v5.php

https://github.com/chrisbst35/LI_LEMONDE
PHP | 542 lines | 339 code | 95 blank | 108 comment | 89 complexity | 37124039df8162fafcd0f9b064a13f19 MD5 | raw file
  1. <?php
  2. include($_SERVER['DOCUMENT_ROOT'] . '/../LIB/common.functions.php');
  3. include_once(URL_LIB . '/session.settings.php');
  4. include_once(URL_LIB . '/rates.settings.php');
  5. include_once(URL_LIB . '/encoding.functions.php');
  6. include_once(URL_LIB . '/rw.encode.php');
  7. include_once(URL_LIB . "/db.functions.php");
  8. //echo "<pre>redirect.v5.php : GET = "; print_r($_GET); echo "</pre>"; //exit;
  9. //////////////////////// PROCESS FREE T9 //////////////////////////////////
  10. /* On verifie les loc_id Postés par le moteur dans le cas d'un T9 ouvert
  11. On attend deux chaines numériques séparés par un underscore "_" */
  12. $flag_ambigu = false;
  13. $flag_some_found = false;
  14. $loc_not_found = 0;
  15. $cnt = 1;
  16. $req_loc = array();
  17. $check_search = array();
  18. # Utilise COOKIE aulieu de SESSION
  19. $cookieExpires = mktime(0, 0, 0, 1, 1, 1970); # For delete cookie
  20. setcookie("AMBIGUITE_LOC_NAME", "", $cookieExpires);
  21. unset($_COOKIE["AMBIGUITE_LOC_NAME"]);
  22. setcookie("AMBIGUITE_CRITERIONS", "", $cookieExpires);
  23. unset($_COOKIE["AMBIGUITE_CRITERIONS"]);
  24. /*
  25. $tab_query_string = explode("&", $_SERVER["QUERY_STRING"]);
  26. $tab_result_query = array();
  27. for ($cpt=0; $cpt < count($tab_query_string); $cpt++)
  28. {
  29. $tab_result_query[$cpt] = explode("=",$tab_query_string[$cpt]);
  30. $tab_new_query[$tab_result_query[$cpt][0]] = $tab_result_query[$cpt][1];
  31. }
  32. */
  33. $tab_new_query = $_GET;
  34. /*
  35. // Ajouter villa si l'utilisateur a saisi maison
  36. if(is_array($_GET['ck_property_type']))
  37. {
  38. if (($_GET['univers']==1 || $_GET['univers']==2) && in_array('2', $_GET['ck_property_type']) && !in_array('7', $_GET['ck_property_type'])) {
  39. $tab_new_query['ck_property_type'][] = '7';
  40. }
  41. }
  42. */
  43. // Colocation - Checkboxes types de bien Maison / Villa et Immeubles / Appart cochées
  44. //echo "<br>Avant : "; print_r($_GET['ck_property_type']);
  45. if (
  46. ($_global['univers'] == '8') &&
  47. (isset($_GET['ck_property_type'][0]) && !empty($_GET['ck_property_type'][0])) &&
  48. (isset($_GET['ck_property_type'][1]) && !empty($_GET['ck_property_type'][1]))) {
  49. $ck_property_type_unique = $_GET['ck_property_type'][0] . ',' . $_GET['ck_property_type'][1];
  50. $_GET['ck_property_type'] = array($ck_property_type_unique);
  51. }
  52. //echo "<br>Apres : "; print_r($_GET['ck_property_type']);
  53. // Page Vente ou Location
  54. $array_page_ambg = array(
  55. 1 => "ambiguous_vente_fr.php",
  56. 2 => "ambiguous_location_fr.php",
  57. 8 => "ambiguous_colocation_fr.php"
  58. );
  59. $array_special_cp = array('2a', '2b', '971', '972', '973', '974', '975', '976', '984', '986', '987', '988');
  60. for ($cntfields = 1; $cntfields <= SEARCH_FIELDS_NUMBER; $cntfields++) {
  61. // cas particulier de la ville Y, seule ville à 1 caractère
  62. if ($_REQUEST["loc_name" . $cntfields] == 'y') {
  63. $_GET["loc_name" . $cntfields] = $_REQUEST["loc_name" . $cntfields] = $tab_new_query["loc_name" . $cntfields] = 'Y (80190)';
  64. $_GET["loc_key" . $cntfields] = $_REQUEST["loc_key" . $cntfields] = $tab_new_query["loc_key" . $cntfields] = '36006_2';
  65. }
  66. if (empty($_REQUEST["loc_key" . $cntfields]))
  67. continue;
  68. $current_lockey = strtolower(trim($_REQUEST["loc_key" . $cntfields]));
  69. $current_locname = string_cleaner($_REQUEST["loc_name" . $cntfields]);
  70. // Si c'est un doublon, on ne le prend pas en compte
  71. if (in_array($current_lockey, $check_search))
  72. continue;
  73. // Ajouter au tableau des doublons
  74. $check_search[$cnt] = $current_lockey;
  75. $req_loc[$cnt]["loc_name"] = string_cleaner($current_locname);
  76. $req_loc[$cnt]["loc_key"] = 0;
  77. $req_loc[$cnt]["level"] = 0;
  78. $req_loc[$cnt]["ambigue"] = 0;
  79. $req_loc[$cnt]["loc_get"] = $current_lockey;
  80. // La clé de localité n'a pas le bon format
  81. if (isWrongLocKey($current_lockey)) {
  82. require_once(URL_LIB . "/db.functions.php");
  83. // Si c'est un code postal spécial (domtom ou corse), c'est ok
  84. if (in_array($current_lockey, $array_special_cp)) {
  85. // On récupère les infos de la localité
  86. $res_search = find_locname_by_czip($current_lockey, 1);
  87. $flag_some_found = true;
  88. $result = $res_search['res'][0];
  89. $lct_name = strtoupper(strtolower($result['lct_name_fr']));
  90. $lct_zip = $result['lct_post_code'];
  91. $lockey = $result['lct_id'] . "_" . $result['lct_level'];
  92. $req_loc[$cnt]["loc_key"] = $result['lct_id'];
  93. $req_loc[$cnt]["level"] = $result['lct_level'];
  94. $req_loc[$cnt]["loc_get"] = $lockey;
  95. $req_loc[$cnt]["loc_name"] = $lct_name . " (" . $lct_zip . ")"; //(strtolower($lct_name));
  96. $tab_new_query["loc_name" . $cnt] = urlencode($lct_name . "-" . $lct_zip);
  97. $tab_new_query["loc_key" . $cnt] = $lockey;
  98. ++$cnt;
  99. // Passer au champ suivant
  100. continue;
  101. }
  102. // On vérifie si la saisie est un code postal
  103. if (preg_match('`^[0-9]{2,5}$`', $current_lockey)) {
  104. if (strlen($current_lockey) == 2) {
  105. $mode_departement = 1;
  106. $current_lockey .= '000';
  107. } else {
  108. $mode_departement = 0;
  109. // Remplir à droite avec des 0 pour obtenir 5 caractères
  110. $current_lockey = str_pad($current_lockey, 5, 0);
  111. }
  112. $res_search = find_locname_by_czip($current_lockey, 1);
  113. //var_dump($res_search);
  114. $res_nb_results = $res_search['count'][0]['count'];
  115. if ($res_nb_results >= 1) {
  116. //Modification par Soflou pour gérer les villes dont le CP est égal XX000
  117. //
  118. //On vérifie si on a un level 2 (ville)
  119. $count_ville = 0;
  120. for ($cnt_res = 0; $cnt_res < $nb_results; $cnt_res++) {
  121. if ($res_search['res'][$cnt_res]['lct_level'] == 2)
  122. $count_ville++;
  123. }
  124. //Si une seule ville trouvée on affiche les resultats pour cette ville
  125. if ($count_ville == 1 && !$mode_departement == 1) {
  126. $last_id = count($res_search['res']) - 1;
  127. $res_ville = $res_search['res'][$last_id];
  128. // Remplacer les resultats par le dernier
  129. $res_search['res'] = array(0 => $res_ville);
  130. $res_nb_results = 1;
  131. }
  132. //On force pour gérer le département
  133. if ($res_search['res'][0]['lct_level'] == 1 && $count_ville == 0) {
  134. $res_nb_results = 1;
  135. }
  136. }
  137. // Gérer les différents cas du nombre de résultats
  138. switch ($res_nb_results) {
  139. case 0: //Aucun résultat
  140. // "No ZIP relationship"
  141. $loc_not_found++;
  142. $req_loc[$cnt]["loc_key"] = ""; //$val_zip_code;
  143. $req_loc[$cnt]["loc_get"] = ""; //$val_zip_code;
  144. $req_loc[$cnt]["level"] = 0;
  145. $req_loc[$cnt]["loc_get"] = "";
  146. $tab_new_query["loc_key" . $cnt] = "";
  147. break;
  148. case 1: //Un résultat unique
  149. $flag_some_found = true;
  150. $result = $res_search['res'][0];
  151. $lct_name = strtoupper(strtolower($result['lct_name_fr']));
  152. $lct_zip = $result['lct_post_code'];
  153. if ($result['lct_level'] == 1) { // Dépt
  154. if (string_begins_with($lct_zip, '97') || string_begins_with($lct_zip, '98')) { // Dom-Tom
  155. $lct_zip = substr($lct_zip, 0, 3);
  156. } else {
  157. $lct_zip = substr($lct_zip, 0, 2);
  158. }
  159. }
  160. $lockey = $result['lct_id'] . "_" . $result['lct_level'];
  161. $req_loc[$cnt]["loc_key"] = $result['lct_id'];
  162. $req_loc[$cnt]["level"] = $result['lct_level'];
  163. $req_loc[$cnt]["loc_get"] = $lockey;
  164. $req_loc[$cnt]["loc_name"] = $lct_name . " (" . $lct_zip . ")";
  165. $tab_new_query["loc_name" . $cnt] = urlencode($lct_name . "-" . $lct_zip);
  166. $tab_new_query["loc_key" . $cnt] = $lockey;
  167. break;
  168. default: //Multi résultat
  169. $flag_some_found = true;
  170. if ($mode_departement == 1) {
  171. $result = $res_search['res'][0];
  172. $lct_name = strtoupper(strtolower($result['lct_name_fr']));
  173. $lct_zip = substr($result['lct_post_code'], 0, 2);
  174. $lgc_id = ($result['lgc_id'] == 0 ? $result['lct_id'] : $result['lgc_id']);
  175. $lockey = $lgc_id . "_1";
  176. $req_loc[$cnt]["level"] = 1;
  177. } else {
  178. $result = $res_search['res'][1];
  179. $lct_name = "TOUTES-COMMUNES";
  180. $lct_zip = ($result['lct_post_code'] == '75000' ? '75' : $result['lct_post_code']);
  181. $lgc_id = empty($result['lgc_id']) ? $result['lct_id'] : $result['lgc_id'];
  182. $lockey = $lgc_id . "_98";
  183. $req_loc[$cnt]["level"] = "98";
  184. }
  185. $req_loc[$cnt]["loc_key"] = $lgc_id;
  186. $req_loc[$cnt]["loc_get"] = $lockey;
  187. $req_loc[$cnt]["loc_name"] = $lct_name . " (" . $lct_zip . ")"; //(strtolower($lct_name));
  188. $tab_new_query["loc_name" . $cnt] = urlencode($lct_name . "-" . $lct_zip);
  189. $tab_new_query["loc_key" . $cnt] = $lockey;
  190. break;
  191. }
  192. if ($cnt <> $cntfields) {
  193. $_GET["loc_name" . $cntfields] = LABEL_DEFAULT_LOCALITY;
  194. $_GET["loc_key" . $cntfields] = "";
  195. }
  196. }
  197. // Sinon, on vérifie si la saisie est bien une localité
  198. else {
  199. //saisie mode text
  200. // Supprimer la chaine de la localité par défaut
  201. // => Beaucoup d'url sont en erreur car la localité contenait cette chaine
  202. // => C'est dû à la durée avant effacement du t9 en entrant dans le champ pour modification
  203. $current_locname = str_ireplace(LABEL_DEFAULT_LOCALITY, '', $current_locname);
  204. // Gérer le cas où il y a le code postal dans la localité (entre parentheses)
  205. // On récupère la chaine qui se trouve avant la paranthese ouvrante.
  206. if (($pos = strpos($current_locname, '(')) > 3)
  207. $current_locname = substr($current_locname, 0, $pos);
  208. // Chercher par une requete du type " ='LOCNAME' "
  209. $res_search = find_locname_by_name($current_locname, 0);
  210. $liste_villes = $res_search['res'];
  211. $count_list_ville_total = $res_search['count'];
  212. $flag_count_over = in_array(strtoupper($current_locname), $no_freeT9_cities);
  213. // "Rien trouvé..."
  214. if (count($liste_villes) == 0) {
  215. // Chercher par une requete du type " LIKE 'LOCNAME' "
  216. $res_search = find_locname_by_name($current_locname, 1);
  217. $liste_villes = $res_search['res'];
  218. $count_list_ville_total = $res_search['count'];
  219. }
  220. $count_total_ville = $count_list_ville_total[0]['count'];
  221. $res_nb_results = count($liste_villes);
  222. if ($res_nb_results == 0) {
  223. //Si la localité n'existe pas on forme l'URL avec les parametre recu
  224. //J'ai détaché le fait que ca peut etre ambigue ou non trouvé
  225. $loc_not_found++;
  226. //$flag_ambigu=true;
  227. $locname = strtoupper(strtolower($current_locname));
  228. $req_loc[$cnt]["loc_name"] = $locname;
  229. $req_loc[$cnt]["loc_key"] = "0";
  230. $req_loc[$cnt]["level"] = "0";
  231. $req_loc[$cnt]["loc_get"] = "";
  232. $tab_new_query["loc_name" . $cnt] = $locname . "-";
  233. $tab_new_query["loc_key" . $cnt] = "";
  234. } elseif ($res_nb_results > 1) {
  235. //Rajout d'une fonction d'agrégation des codes postaux
  236. //On peut avoir des regroupement de code postaux pour une même ville
  237. $tab_grp_zip = array();
  238. $lgn_sav = $liste_villes[0]['lgn_id'];
  239. $cnt_lgn = 0;
  240. if ($lgn_sav <> 0) {
  241. for ($cnt_zip = 0; $cnt_zip < $res_nb_results; $cnt_zip++) {
  242. if ($liste_villes[$cnt_zip]['lgn_id'] == $lgn_sav)
  243. ++$cnt_lgn;
  244. }
  245. }
  246. // si $cnt_lgn = count(list_ville) alors regroupement sinon ambiguité
  247. if ($cnt_lgn == $res_nb_results) {
  248. $flag_some_found = true;
  249. $locname = strtoupper(strtolower($liste_villes[0]['lct_name_fr']));
  250. //Simili cas unique regroupement cpostaux
  251. $lct_id = $liste_villes[0]['lgn_id'];
  252. $req_loc[$cnt]["loc_name"] = $locname . " (" . LABEL_LGN_ALL . ")";
  253. $req_loc[$cnt]["loc_key"] = $lct_id;
  254. $req_loc[$cnt]["level"] = 99;
  255. $req_loc[$cnt]["loc_get"] = $_GET["loc_key" . $cnt];
  256. $tab_new_query["loc_name" . $cnt] = urlencode($locname . "-" . str_replace(" ", "-", LABEL_LGN_ALL));
  257. $tab_new_query["loc_key" . $cnt] = $lct_id . "_99";
  258. if ($cnt <> $cntfields) {
  259. $_GET["loc_name" . $cntfields] = LABEL_DEFAULT_LOCALITY;
  260. $_GET["loc_key" . $cntfields] = "";
  261. }
  262. } else {
  263. /////sinon ambiguité de niveau 1
  264. //Si la localité n'existe pas on forme l'URL avec les parametre recu
  265. //J'ai détaché le fait que ca peut etre ambigue ou non trouvé
  266. $loc_not_found++;
  267. //$flag_ambigu=true;
  268. $locname = strtoupper(strtolower($current_locname));
  269. $req_loc[$cnt]["loc_name"] = $locname;
  270. $req_loc[$cnt]["loc_key"] = "0";
  271. $req_loc[$cnt]["level"] = "0";
  272. $req_loc[$cnt]["ambigue"] = 1;
  273. $tab_new_query["loc_name" . $cnt] = urlencode($locname) . "-";
  274. $tab_new_query["loc_key" . $cnt] = ""; //urlencode("0_0");
  275. $flag_ambigu = true;
  276. }
  277. } elseif ($res_nb_results > 19999999) {
  278. // 1 - Ambiguité simple
  279. // 2 - Trop de résultats
  280. if ($flag_count_over) {
  281. $req_loc[$cnt]["ambigue"] = 1;
  282. //Trop de résultats normalement = 2
  283. $flag_ambigu = true;
  284. } else {
  285. //On peut avoir des regroupement de code pôstaux pour une même ville
  286. $tab_grp_zip = array();
  287. $lgn_sav = $liste_villes[0]['lgn_id'];
  288. $cnt_lgn = 0;
  289. if ($lgn_sav <> 0) {
  290. for ($cnt_zip = 0; $cnt_zip < $res_nb_results; $cnt_zip++) {
  291. if ($liste_villes[$cnt_zip]['lgn_id'] == $lgn_sav)
  292. ++$cnt_lgn;
  293. }
  294. }
  295. // si $cnt_lgn = count(list_ville) alors regroupement sinon ambiguité
  296. if ($cnt_lgn == $res_nb_results) {
  297. $flag_some_found = true;
  298. $locname = strtoupper(strtolower($liste_villes[0][1]));
  299. $lockey = $liste_villes[0]['lgn_id'] . "_99";
  300. //Simili cas unique regroupement cpostaux
  301. $lct_post_code = $liste_villes[0][3];
  302. if ($lct_level == 1) { // Dépt
  303. if (string_begins_with($lct_post_code, '97') || string_begins_with($lct_post_code, '98')) { // Dom-Tom
  304. $lct_post_code = substr($lct_post_code, 0, 3);
  305. } else {
  306. $lct_post_code = substr($lct_post_code, 0, 2);
  307. }
  308. }
  309. $req_loc[$cnt]["loc_name"] = $locname . " (" . $lct_post_code . ")";
  310. $req_loc[$cnt]["loc_key"] = $liste_villes[0]['lgn_id'];
  311. $req_loc[$cnt]["level"] = 99; //$liste_villes[0][2];
  312. $req_loc[$cnt]["loc_get"] = $lockey;
  313. $tab_new_query["loc_name" . $cnt] = urlencode($locname . "_TOUS-CODES-POSTAUX");
  314. $tab_new_query["loc_key" . $cnt] = $lockey;
  315. if ($cnt <> $cntfields) {
  316. $_GET["loc_name" . $cntfields] = LABEL_DEFAULT_LOCALITY;
  317. $_GET["loc_key" . $cntfields] = "";
  318. }
  319. } else {
  320. /////sinon ambiguité de niveau 1
  321. $req_loc[$cnt]["ambigue"] = 1;
  322. $flag_ambigu = true;
  323. }
  324. }
  325. } else {
  326. ////////////////////////
  327. //Résultat Unique
  328. ////////////////////////
  329. $flag_some_found = true;
  330. $locname = strtoupper(strtolower($liste_villes[0][1]));
  331. $lct_id = $liste_villes[0][0];
  332. $lct_level = $liste_villes[0][2];
  333. $lockey = $lct_id . '_' . $lct_level;
  334. $lct_post_code = $liste_villes[0][3];
  335. if ($lct_level == 1) { // Dépt
  336. if (string_begins_with($lct_post_code, '97') || string_begins_with($lct_post_code, '98')) { // Dom-Tom
  337. $lct_post_code = substr($lct_post_code, 0, 3);
  338. } else {
  339. $lct_post_code = substr($lct_post_code, 0, 2);
  340. }
  341. }
  342. $req_loc[$cnt]["loc_name"] = $locname . " (" . $lct_post_code . ")";
  343. $req_loc[$cnt]["loc_key"] = $lct_id;
  344. $req_loc[$cnt]["level"] = $lct_level;
  345. $req_loc[$cnt]["loc_get"] = $lockey;
  346. $tab_new_query["loc_name" . $cnt] = urlencode($locname . "-" . $lct_post_code);
  347. $tab_new_query["loc_key" . $cnt] = $lockey;
  348. if ($cnt <> $cntfields) {
  349. $_GET["loc_name" . $cntfields] = LABEL_DEFAULT_LOCALITY;
  350. $_GET["loc_key" . $cntfields] = "";
  351. }
  352. }
  353. }
  354. } else {
  355. $flag_some_found = true;
  356. //Value from Closed-T9
  357. $tab_lockey = explode("_", $current_lockey);
  358. $req_loc[$cnt]["loc_key"] = $tab_lockey[0];
  359. $req_loc[$cnt]["level"] = $tab_lockey[1];
  360. }
  361. $cnt++;
  362. }
  363. if ($_REQUEST['dbg'] == 'flo') {
  364. echo '<pre>$_GET :<br />';
  365. var_export($_GET);
  366. echo '</pre><pre>$tab_new_query (utilise si OK) :<br />';
  367. var_export($tab_new_query);
  368. echo '</pre><pre>$req_loc (utilise si NOK) :<br />';
  369. var_export($req_loc);
  370. echo '</pre>';
  371. if ($flag_ambigu == true || $loc_not_found > 0)
  372. echo '<p style="color:red">Ambiguite ou localite non trouvee => Page ambiguite</p>';
  373. else
  374. echo '<p style="color:green">Aucune ambiguite => Page de resultats</p>';
  375. die();
  376. }
  377. if ($flag_ambigu == true || $loc_not_found > 0) {
  378. //On rajoute les critères
  379. /*
  380. if(isset($_GET['ck_property_group']) && is_array($_GET['ck_property_group']) ) {
  381. $property_types = $_GET['ck_property_group'];
  382. $property_type = str_repeat('0',40 );
  383. foreach($property_types as $type_id) $property_type[$type_id-1] = '1';
  384. $req_criterion['property_type'] = $property_type;
  385. }
  386. */
  387. $req_criterion['price'] = $_GET['price'];
  388. $req_criterion['price_min'] = $_GET['price_min'];
  389. $req_criterion['price_max'] = $_GET['price_max'];
  390. $req_criterion['area'] = $_GET['area'];
  391. $req_criterion['area_min'] = $_GET['area_min'];
  392. $req_criterion['area_max'] = $_GET['area_max'];
  393. $req_criterion['ck_nb_rooms'] = $_GET['ck_nb_rooms'];
  394. $req_criterion['ck_property_type'] = $_GET['ck_property_type'];
  395. setcookie("AMBIGUITE_LOC_NAME", serialize($req_loc));
  396. $_COOKIE["AMBIGUITE_LOC_NAME"] = serialize($req_loc);
  397. setcookie("AMBIGUITE_CRITERIONS", serialize($req_criterion));
  398. $_COOKIE["AMBIGUITE_CRITERIONS"] = serialize($req_criterion);
  399. //On ne redirige vers pas d'ambiguité que si aucun resultat direct
  400. if ($flag_some_found == false) {
  401. redirection(URL_SITE . $array_page_ambg[$_GET["univers"]]);
  402. }
  403. }
  404. /* FIN VERIF du T9 ouvert */
  405. switch ($_global['site']) {
  406. case "be":
  407. /* NE PAS EFFACER */
  408. $page = explode('/', $page);
  409. $page = $page[count($page) - 1];
  410. //list($trash, $page) = explode('/', $page);
  411. break;
  412. default:
  413. list($trash, $page) = explode('/', $page);
  414. break;
  415. }
  416. list($page) = explode('_', $page, 2);
  417. // On check si ca existe ou pas encore
  418. // Par défault si l'univers est location, on trie par date
  419. $saved_searches = fetchcookie(SEARCH_HISTORY_COOKIE_NAME);
  420. $saved_search = unserialize($saved_searches[0]);
  421. /*if ((!$saved_search || ($saved_search && ($saved_search['univers'] != $_global['univers']))) && $_global['univers'] == '2') {
  422. $tab_new_query['ordre'] = 'update_date';
  423. $tab_new_query['hi_order'] = '1';
  424. $tab_new_query['ck_property_type'] = '0000000000000000000000000000000000000000';
  425. } else if ((!$saved_search || ($saved_search && ($saved_search['univers'] != $_global['univers']))) && $_global['univers'] == '1') {
  426. $tab_new_query['ck_property_type'] = '1100001000000000000000000000000000000000';
  427. }*/
  428. if ($_REQUEST['nb_results'] != $saved_search['nb_results']) {
  429. $saved_search['nb_results'] = $_REQUEST['nb_results'];
  430. }
  431. $saved_searches[0] = serialize($saved_search);
  432. $expires = time() + (86400 * COOKIE_DURATION);
  433. $site_domain = $_SERVER['HTTP_HOST']; //substr(URL_SITE_FR,7,strlen(URL_SITE_FR)-8);
  434. storecookie(SEARCH_HISTORY_COOKIE_NAME,$saved_searches,$expires);
  435. //echo "<pre>redirect.v5.php : tab_new_query = "; print_r($tab_new_query); echo "</pre>"; //exit;
  436. // Générer la nouvelle url seo correspondant à la recherche
  437. //$url_seo = to_nat($tab_new_query, $page, $_global['dns']);
  438. //echo "[url_seo = $url_seo]"; exit;
  439. // Génère l'url de la page résultats annonces à partir du moteur de recherche
  440. // (url courte ou longue selon les crièteres de recherche)
  441. //echo "[GET = <pre>".print_r($_GET, true)."</pre>]"; //exit;
  442. $url = uriToFinalFromSearchEngine($_GET);
  443. // echo "[url = $url]"; exit;
  444. header("Location: " . $url, true, 301);
  445. exit;
  446. ?>