function suppr_histo($id_suppr, $tableau_suppr) { if (!$tableau_suppr[$id_suppr]) { for ($i = 0; $i <= count($_SESSION["session_history"]) - 1; $i++) { if ($_SESSION["session_history"][$i]["NOTI"]["SEARCH_TYPE"] == "extended") { $bool = false; for ($j = 0; $j <= count($_SESSION["session_history"][$i]["NOTI"]["POST"]["search"]) - 1; $j++) { if ($_SESSION["session_history"][$i]["NOTI"]["POST"]["search"][$j] == "s_1") { if ($_SESSION["session_history"][$i]["NOTI"]["POST"]["field_" . $j . "_" . $_SESSION["session_history"][$i]["NOTI"]["POST"]["search"][$j]][0] == $id_suppr) { $tableau_suppr[$i] = 0; suppr_histo($i, $tableau_suppr); $bool = true; } } } if ($bool == false) { $tableau_suppr[$i] = 1; } } else { $tableau_suppr[$i] = 1; } } $tableau_suppr[$id_suppr] = 0; } else { $tableau_suppr[$id_suppr] = 0; } return $tableau_suppr; }
function suppr_histo($id_suppr, $tableau_suppr) { if (!$tableau_suppr[$id_suppr]) { for ($i = 1; $i <= $_SESSION["nb_queries"]; $i++) { if ($_SESSION["search_type" . $i] == "extended_search") { get_history($i); global $search; $bool = false; for ($j = 0; $j <= count($search); $j++) { if ($search[$j] == "s_1") { $field_ = "field_0_" . $search[$j]; global ${$field_}; $field = ${$field_}; if ($field[0] == $id_suppr) { $tableau_suppr[$i] = 0; suppr_histo($i, $tableau_suppr); $bool = true; } } } if ($bool == false) { $tableau_suppr[$i] = 1; } } else { $tableau_suppr[$i] = 1; } } $tableau_suppr[$id_suppr] = 0; } return $tableau_suppr; }
if ($i == $cases_a_suppr[$j]) { $bool = true; $j = count($cases_a_suppr); } else { $t[$i] = $i; } } if ($bool == true) { $t[$i] = -1; } } //parcours du tableau temporaire, et réécriture des variables de session for ($i = count($t); $i >= 1; $i--) { if ($t[$i] == "-1") { $t1 = array(); $t1 = suppr_histo($i, $t1); $t1 = reorg_tableau_suppr($t1); $_SESSION["nb_queries"] = count($t1); foreach ($t1 as $key => $value) { if ($key != $value) { $_SESSION["human_query" . (string) $value] = $_SESSION["human_query" . (string) $key]; $_SESSION["notice_view" . (string) $value] = $_SESSION["notice_view" . (string) $key]; $_SESSION["search_type" . (string) $value] = $_SESSION["search_type" . (string) $key]; $_SESSION["user_query" . (string) $value] = $_SESSION["user_query" . (string) $key]; $_SESSION["map_emprises_query" . (string) $value] = $_SESSION["map_emprises_query" . (string) $key]; $_SESSION["typdoc" . (string) $value] = $_SESSION["typdoc" . (string) $key]; $_SESSION["look_TITLE" . (string) $value] = $_SESSION["look_TITLE" . (string) $key]; $_SESSION["look_AUTHOR" . (string) $value] = $_SESSION["look_AUTHOR" . (string) $key]; $_SESSION["look_PUBLISHER" . (string) $value] = $_SESSION["look_PUBLISHER" . (string) $key]; $_SESSION["look_TITRE_UNIFORME" . (string) $value] = $_SESSION["look_TITRE_UNIFORME" . (string) $key]; $_SESSION["look_COLLECTION" . (string) $value] = $_SESSION["look_COLLECTION" . (string) $key];
if ($_POST["act"] == "export") { if (isset($_POST["sel"])) { $base_noheader = 1; } $base_nosession = 0; // ATTENTION : était à 1 pour permettre l'envoi du header et pas du ccokie avant, bug IE mais finalement, marche arrière... } require $base_path . "/includes/init.inc.php"; if ($act) { switch ($act) { case 'del': require_once $base_path . "/includes/history_functions.inc.php"; //parcours du tableau des recherches de l'historique cochées for ($i = 0; $i <= count($sel) - 1; $i++) { $t1 = array(); $t1 = suppr_histo($sel[$i] - 1, $t1); $t1 = reorg_tableau_suppr($t1); foreach ($t1 as $key => $value) { if ($key != $value) { $_SESSION["session_history"][$value] = $_SESSION["session_history"][$key]; if ($_SESSION["session_history"][$value]["NOTI"]["SEARCH_TYPE"] == "extended") { for ($j = 0; $j <= count($_SESSION["session_history"][$value]["NOTI"]["POST"]["search"]) - 1; $j++) { if ($_SESSION["session_history"][$value]["NOTI"]["POST"]["search"][$j] == "s_1") { $t2 = array(); $t2[0] = $t1[$_SESSION["session_history"][$key]["NOTI"]["POST"]["field_" . $j . "_" . $_SESSION["session_history"][$key]["NOTI"]["POST"]["search"][$j]][0]]; $_SESSION["session_history"][$value]["NOTI"]["POST"]["field_" . $j . "_" . $_SESSION["session_history"][$value]["NOTI"]["POST"]["search"][$j]][0] = $t2[0]; $_SESSION["session_history"][$value]["QUERY"]["POST"]["field_" . $j . "_" . $_SESSION["session_history"][$value]["QUERY"]["POST"]["search"][$j]][0] = $t2[0]; } } } $_SESSION["session_history"][$key] = array();