function cre_login($nom, $prenom, $dbh)
{
    $empr_login = substr($prenom, 0, 1) . $nom;
    $empr_login = strtolower($empr_login);
    $empr_login = clean_string($empr_login);
    $empr_login = convert_diacrit(strtolower($empr_login));
    $empr_login = preg_replace('/[^a-z0-9\\.]/', '', $empr_login);
    $pb = 1;
    $num_login = 1;
    while ($pb == 1) {
        $requete = "SELECT empr_login FROM empr WHERE empr_login='******' AND empr_nom <> '{$nom}' AND empr_prenom <> '{$prenom}' LIMIT 1 ";
        $res = mysql_query($requete, $dbh);
        $nbr_lignes = mysql_num_rows($res);
        if ($nbr_lignes) {
            $empr_login .= $num_login;
            $num_login++;
        } else {
            $pb = 0;
        }
    }
    return $empr_login;
}
Exemple #2
0
 /**
  * Retourne les catégories de la notice
  * @return categorie Tableau des catégories
  */
 public function get_categories()
 {
     if (!isset($this->categories)) {
         global $dbh, $opac_categories_affichage_ordre, $opac_categories_show_only_last;
         $this->categories = array();
         // Tableau qui va nous servir à trier alphabétiquement les catégories
         if (!$opac_categories_affichage_ordre) {
             $sort_array = array();
         }
         $query = "select distinct num_noeud from notices_categories where notcateg_notice = " . $this->id . " order by ordre_vedette, ordre_categorie";
         $result = pmb_mysql_query($query, $dbh);
         if ($result && pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 /* @var $object categorie */
                 $object = authorities_collection::get_authority('category', $row->num_noeud);
                 $format_label = $object->libelle;
                 // On ajoute les parents si nécessaire
                 if (!$opac_categories_show_only_last) {
                     $parent_id = $object->parent;
                     while ($parent_id && $parent_id != 1 && !in_array($parent_id, array($object->thes->num_noeud_racine, $object->thes->num_noeud_nonclasses, $object->thes->num_noeud_orphelins))) {
                         $parent = authorities_collection::get_authority('category', $parent_id);
                         $format_label = $parent->libelle . ':' . $format_label;
                         $parent_id = $parent->parent;
                     }
                 }
                 $categorie = array('object' => $object, 'format_label' => $format_label);
                 if (!$opac_categories_affichage_ordre) {
                     $sort_array[$object->thes->id_thesaurus][] = strtoupper(convert_diacrit($format_label));
                 }
                 $this->categories[$object->thes->id_thesaurus][] = $categorie;
             }
             // On tri par ordre alphabétique
             if (!$opac_categories_affichage_ordre) {
                 foreach ($this->categories as $thes_id => &$categories) {
                     array_multisort($sort_array[$thes_id], $categories);
                 }
             }
             // On tri par index de thésaurus
             ksort($this->categories);
         }
     }
     return $this->categories;
 }
 function is_same_lib($categ_libelle, $categ_id)
 {
     $r = new category($categ_id);
     if (pmb_strtolower(convert_diacrit($r->libelle)) == pmb_strtolower(convert_diacrit($categ_libelle))) {
         return true;
     } else {
         return false;
     }
 }
Exemple #4
0
             }
         }
     }
     print "</div><hr />";
     if ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "1") {
         asort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "1" && $options[METHOD_SORT_ASC][0][value] == "1") {
         ksort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         arsort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         krsort($marclist_type->table);
     }
     reset($marclist_type->table);
     foreach ($marclist_type->table as $code => $libelle) {
         if (preg_match("/^{$letter}/i", convert_diacrit($libelle)) || $letter == 'Fav' && $marclist_type->tablefav[$code]) {
             $marclist_tab[$code] = $libelle;
         }
     }
     $has_searchable = false;
     $has_paginated = false;
     break;
 default:
     if ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "1") {
         asort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "1" && $options[METHOD_SORT_ASC][0][value] == "1") {
         ksort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         arsort($marclist_type->table);
     } elseif ($options[METHOD_SORT_VALUE][0][value] == "2" && $options[METHOD_SORT_ASC][0][value] == "2") {
         krsort($marclist_type->table);
 function make_proc()
 {
     global $msg;
     global $current_module;
     global $base_path;
     // récupération des champs à afficher
     if (count($this->print_field) == 0) {
         return "erreur";
     }
     // gestion de l'erreur a améliorer
     $champs = array();
     for ($i = 0; $i < count($this->print_field); $i++) {
         if (substr($this->print_field[$i], 0, 1) == "f") {
             if ($this->list_fields[substr($this->print_field[$i], 2)]["TABLE"] == "notices") {
                 $latable = "notices";
             } else {
                 $latable = "ta_" . $i;
             }
             $champs[] = $latable . "." . $this->list_fields[substr($this->print_field[$i], 2)]["CHAMP"] . " AS '" . addslashes($this->list_fields[substr($this->print_field[0], 2)]["TITLE"]) . "'";
         } else {
             $champs[] = "ncva_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->print_field[$i], 2)]["DATATYPE"] . " AS '" . addslashes($this->pp->t_fields[substr($this->print_field[$i], 2)]["TITRE"]) . "'";
         }
     }
     $liste_champs = implode(", ", $champs);
     // récupération des tables
     $tables = array();
     $param = array("print_field" => "a", "fixed_params" => "f", "dynamic_params" => "d");
     foreach ($param as $key => $value) {
         for ($i = 0; $i < count($this->{$key}); $i++) {
             if (substr($this->{$key}[$i], 0, 1) == "f") {
                 // champs du fichier de configuration
                 // table principale
                 if ($this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"] == "notices") {
                     $tables[] = "notices";
                 } else {
                     $tables[] = $this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"] . " AS t" . $value . "_" . $i;
                 }
                 // jointures
                 for ($j = 0; $j < count($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"]); $j++) {
                     for ($k = 0; $k < count($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"]); $k++) {
                         if ($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] == "notices") {
                             $tables[] = "notices";
                         } else {
                             if ($this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] != $this->list_fields[substr($this->{$key}[$i], 2)]["TABLE"]) {
                                 $tables[] = $this->list_fields[substr($this->{$key}[$i], 2)]["JOINTURE"][$j]["TABLE"][$k]["NAME"] . " AS t" . $value . "_j_" . $i;
                             }
                         }
                     }
                 }
             } else {
                 // champs perso
                 $tables[] = "notices_custom_values AS ncv" . $value . "_" . $i;
             }
         }
     }
     // éliminer les doublons
     $tables = array_unique($tables);
     $liste_tables = implode(", ", $tables);
     // construction des clauses
     $where = "";
     // jointures pour les champs a afficher
     $jointure = array();
     for ($i = 0; $i < count($this->print_field); $i++) {
         if (substr($this->print_field[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->print_field[$i], 2)]["TABLE"]) {
                     $tleft = "ta_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "ta_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->print_field[$i], 2)]["TABLE"]) {
                     $tright = "ta_" . $i;
                 }
                 if ($this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "ta_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->print_field[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
         } else {
             // champs perso
             $jointure[] = "ncva_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncva_" . $i . ".notices_custom_champ = " . substr($this->print_field[$i], 2);
         }
     }
     // conditions fixes
     for ($i = 0; $i < count($this->fixed_params); $i++) {
         if (substr($this->fixed_params[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tleft = "tf_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "tf_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"]) {
                     $tright = "tf_" . $i;
                 }
                 if ($this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "tf_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
             if ($this->list_fields[substr($this->fixed_params[$i], 2)]["TABLE"] == "notices") {
                 $tf = "notices";
             } else {
                 $tf = "tf_" . $i;
             }
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($argu[$j])) . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 default:
                     $jointure[] = $tf . "." . $this->list_fields[substr($this->fixed_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_param[$i]]["DEB"] . pmb_strtolower(convert_diacrit($this->val_param[$i])) . $this->operateur[$this->op_param[$i]]["FIN"];
             }
         } else {
             // champs perso
             $jointure[] = "ncvf_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncvf_" . $i . ".notices_custom_champ = " . substr($this->fixed_params[$i], 2);
             switch ($this->op_param[$i]) {
                 case "CONTAINS_ALL":
                     $op = " AND ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 case "CONTAINS_AT_LEAST":
                     $op = " OR ";
                     $argu = explode(" ", $this->val_param[$i]);
                     for ($j = 0; $j < count($argu); $j++) {
                         $argu[$j] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $argu[$j] . $this->operateur[$this->op_param[$i]]["FIN"];
                     }
                     $jointure[] = " (" . implode($op, $argu) . ") ";
                     break;
                 default:
                     $jointure[] = "ncvf_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->fixed_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_param[$i]]["DEB"] . $this->val_param[$i] . $this->operateur[$this->op_param[$i]]["FIN"];
             }
         }
     }
     // conditions dynamiques
     for ($i = 0; $i < count($this->dynamic_params); $i++) {
         if (substr($this->dynamic_params[$i], 0, 1) == "f") {
             for ($j = 0; $j < count($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"]); $j++) {
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == $this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"]) {
                     $tleft = "td_" . $i;
                 } else {
                     if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["NAME"] == "notices") {
                         $tleft = "notices";
                     } else {
                         $tleft = "td_j_" . $i;
                     }
                 }
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == $this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"]) {
                     $tright = "td_" . $i;
                 }
                 if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["NAME"] == "notices") {
                     $tright = "notices";
                 } else {
                     $tright = "td_j_" . $i;
                 }
                 $jointure[] = $tleft . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][0]["ID"][0]["value"] . "=" . $tright . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["JOINTURE"][$j]["TABLE"][1]["ID"][0]["value"];
             }
             if ($this->list_fields[substr($this->dynamic_params[$i], 2)]["TABLE"] == "notices") {
                 $td = "notices";
             } else {
                 $td = "td_" . $i;
             }
             $jointure[] = $td . "." . $this->list_fields[substr($this->dynamic_params[$i], 2)]["INDEX"] . $this->operateur[$this->op_var[$i]]["DEB"] . "!!d_" . $i . "!!" . $this->operateur[$this->op_var[$i]]["FIN"];
         } else {
             // champs perso
             $jointure[] = "ncvd_" . $i . ".notices_custom_origine = notices.notice_id";
             $jointure[] = "ncvd_" . $i . ".notices_custom_champ = " . substr($this->dynamic_params[$i], 2);
             $jointure[] = "ncvd_" . $i . ".notices_custom_" . $this->pp->t_fields[substr($this->dynamic_params[$i], 2)]["DATATYPE"] . $this->operateur[$this->op_var[$i]]["DEB"] . "!!d_" . $i . "!!" . $this->operateur[$this->op_var[$i]]["FIN"];
         }
     }
     $where .= implode(" AND ", $jointure);
     $requete = html_entity_decode("SELECT " . $liste_champs . " FROM " . $liste_tables . " WHERE " . $where);
     $param_var = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
     $param_var .= "<FIELDS>\n";
     for ($i = 0; $i < count($this->dynamic_params); $i++) {
         // A améliorer, pour l'instant tout est mis en type text !!!
         $param_var .= "<FIELD NAME=\"d_" . $i . "\" MANDATORY=\"yes\">\n";
         $param_var .= " <ALIAS><![CDATA[" . $this->val_var[$i] . "]]></ALIAS>\n";
         $param_var .= " <TYPE>text</TYPE>\n";
         $param_var .= " <OPTIONS FOR=\"text\">\n";
         $param_var .= " <SIZE>20</SIZE>\n";
         $param_var .= " <MAXSIZE>20</MAXSIZE>\n";
         $param_var .= " </OPTIONS>\n";
         $param_var .= " </FIELD>\n";
     }
     $param_var .= "</FIELDS>";
     // insertion de la procédure dans la base de données
     $dbh = connection_mysql();
     $req = "INSERT INTO procs (name, requete, comment, autorisations, parameters) VALUES ('" . $this->nom_proc . "', '" . addslashes($requete) . "', '" . $this->comment . "', '" . implode(" ", $this->userautorisation) . "', '" . addslashes($param_var) . "')";
     $result = pmb_mysql_query($req, $dbh);
     // on n'utilse pas le template prévu pour cette étape
     $create_proc_form = "\n<form class='form-{$current_module}' name='search_form' action='!!url!!' method='post'>\n\t<h3>" . $msg["create_proc"] . " (!!etape!!/5)</h3>\n\t<div class='form-contenu'>\n\t\t!!resultat!!\n\t</div>\n\t<div class='row'>\n\t\t<input type='submit' class='bouton' value='" . $msg["re_proc"] . "' onClick=\"this.form.etape.value=1; this.form.action='!!url_next!!'; this.form.page.value=''; \"/>\n\t</div>\n</form>";
     if ($result) {
         $resultat = $msg["proc_ok"];
     } else {
         $resultat = $msg["proc_fail"];
     }
     $create_proc_form = str_replace("!!resultat!!", $resultat, $create_proc_form);
     return $create_proc_form;
 }
Exemple #6
0
 function bold($str, $needle)
 {
     //cherche si un des mots de $needle existe dans $str et le met en gras
     $str_propre = strtolower(convert_diacrit($str));
     $mot = strtolower(convert_diacrit($needle));
     if (!(($pos = strpos($str_propre, $mot)) === false)) {
         $size = strlen("<span class='tagQuery'>") + strlen($needle) + $pos;
         $str = substr_replace($str, "<span class='tagQuery'>", $pos, 0);
         $str = substr_replace($str, "</span>", $size, 0);
     }
     return $str;
 }
Exemple #7
0
 function cleanString($string)
 {
     $string = str_replace("%", "", $string);
     $string = convert_diacrit($string);
     $string = strip_empty_words($string);
     return $string;
 }
 function search($user_query)
 {
     global $charset;
     $matches = array();
     if (!file_exists($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")) {
         exec("pdftotext -bbox -enc UTF-8 " . $this->doc->driver->get_cached_filename($this->doc->id) . " " . $this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     }
     ini_set("zend.ze1_compatibility_mode", "0");
     $dom = new DOMDocument('1.0', 'UTF-8');
     file_put_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox", str_replace(array(chr("0x01"), chr("0x02"), chr("0x1f"), chr("0x1e")), "", file_get_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")));
     $dom->load($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     // On nettoie la recherche
     $user_query = strip_empty_words(strtolower(convert_diacrit($user_query)));
     $terms = explode(" ", $user_query);
     $pages = $dom->getElementsByTagName("page");
     $height = 0;
     $width = 0;
     //on parcourt les pages
     for ($i = 0; $i < $pages->length; $i++) {
         $current_page = $pages->item($i);
         $height = $current_page->getAttribute("height");
         $width = $current_page->getAttribute("width");
         $h_ratio = $this->getHeight($i + 1) / $height;
         $w_ratio = $this->getWidth($i + 1) / $width;
         $words = $current_page->getElementsByTagName("word");
         //on parcourt les mots du fichier
         for ($j = 0; $j < $words->length; $j++) {
             //on parcourt les termes de la recherche
             $current_word = $words->item($j);
             if ($charset == "iso-8859-1") {
                 $current_word_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_word->nodeValue);
             } else {
                 $current_word_value = $current_word->nodeValue;
             }
             foreach ($terms as $term) {
                 if (strpos(strtolower(convert_diacrit($current_word_value)), $term) !== false) {
                     //trouvé
                     //texte à afficher en aperçu
                     $text = "...";
                     for ($k = $j - 3; $k <= $j + 3; $k++) {
                         if ($j == $k) {
                             $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                         }
                         if ($charset == "iso-8859-1") {
                             $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset) . " ";
                         } else {
                             $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                         }
                         if ($j == $k) {
                             $text .= "</span>";
                         }
                         $text .= " ";
                     }
                     $text .= "... ";
                     $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $current_word->getAttribute("xMax") * $w_ratio, 'b' => $current_word->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                 } else {
                     if (strpos($term, strtolower(convert_diacrit($current_word_value))) === 0) {
                         // On regarde si le terme n'est pas découpé dans le document
                         // Le mot correspond au début du terme, on va regarder les mots suivants
                         $offset = 0;
                         $word_index = $j;
                         $word_index_value = $current_word_value;
                         do {
                             $offset += strlen(strtolower(convert_diacrit($word_index_value)));
                             $word_index++;
                             if ($charset == "iso-8859-1") {
                                 $word_index_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($word_index)->nodeValue);
                             } else {
                                 $word_index_value = $words->item($word_index)->nodeValue;
                             }
                         } while (strpos($term, strtolower(convert_diacrit($word_index_value)), $offset) === $offset);
                         if ($offset >= strlen($term)) {
                             // le terme à été trouvé
                             //texte à afficher en aperçu
                             $word_index--;
                             $text = "...";
                             for ($k = $j - 3; $k <= $word_index + 3; $k++) {
                                 if ($j == $k) {
                                     $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                                 }
                                 if ($charset == "iso-8859-1") {
                                     $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset);
                                 } else {
                                     $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                                 }
                                 if ($k == $word_index) {
                                     $text .= "</span>";
                                 }
                                 $text .= " ";
                             }
                             $text .= "... ";
                             $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $words->item($word_index)->getAttribute("xMax") * $w_ratio, 'b' => $words->item($word_index)->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                         }
                     } else {
                         //perdu
                         continue;
                     }
                 }
             }
         }
     }
     return array('matches' => $matches);
 }
                    $VALUE[count($ITEM) - 1] = max(array_map("tonum", $VALUE)) * 1 + 1;
                    $ORDRE[count($ITEM) - 1] = "";
                }
            } else {
                $ITEM[count($ITEM)] = "";
                $VALUE[count($ITEM) - 1] = "";
                $ORDRE[count($ITEM) - 1] = "";
            }
        }
        if ($first == 4) {
            //Tri des options
            if ($ITEM) {
                $ITEM_REVERSE = $ITEM;
                reset($ITEM_REVERSE);
                while (list($key, $val) = each($ITEM_REVERSE)) {
                    $ITEM_REVERSE[$key] = convert_diacrit($ITEM_REVERSE[$key]);
                }
                /*asort($ITEM_REVERSE);*/
                reset($ITEM_REVERSE);
                natcasesort($ITEM_REVERSE);
                reset($ITEM_REVERSE);
                $n_o = 0;
                while (list($key, $val) = each($ITEM_REVERSE)) {
                    $ORDRE[$key] = $n_o;
                    $n_o++;
                }
            }
        }
    }
    ?>
	<form class='form-<?php 
Exemple #10
0
function test_title_query($query, $operator = TRUE, $force_regexp = FALSE)
{
    // Armelle : a priori utilise uniquement dans édition des périodique. Changer la-bas.
    // fonction d'analyse d'une recherche sur titre
    // la fonction retourne un tableau :
    $query_result = array('type' => 0, 'restr' => '', 'order' => '', 'nbr_rows' => 0);
    // FORCAGE ER 12/05/2004 : le match against avec la troncature* ne fonctionne pas...
    $force_regexp = TRUE;
    // $query_result['type'] = type de la requête :
    // 0 : rien (problème)
    // 1: match/against
    // 2: regexp
    // 3: regexp pure sans traitement
    // $query_result['restr'] = critères de restriction
    // $query_result['order'] = critères de tri
    // $query_result['indice'] = façon d'obtenir un indice de pertinence
    // $query_result['nbr_rows'] = nombre de lignes qui matchent
    // si operator TRUE La recherche est booléenne AND
    // si operator FALSE La recherche est booléenne OR
    // si force_regexp : la recherche est forcée en mode regexp
    $stopwords = FALSE;
    global $dbh;
    // initialisation opérateur
    $operator ? $dopt = 'AND' : ($dopt = 'OR');
    $query = strtolower($query);
    // espaces en début et fin
    $query = preg_replace('/^\\s+|\\s+$/', '', $query);
    // espaces en double
    $query = preg_replace('/\\s+/', ' ', $query);
    // traitement des caractères accentués
    $query = convert_diacrit($query);
    // contrôle de la requete
    if (!$query) {
        return $query_result;
    }
    // déterminer si la requête est une regexp
    // si c'est le cas, on utilise la saisie utilisateur sans modification
    // (on part du principe qu'il sait ce qu'il fait)
    if (preg_match('/\\^|\\$|\\[|\\]|\\.|\\*|\\{|\\}|\\|/', $query)) {
        // regexp pure : pas de modif de la saisie utilisateur
        $query_result['type'] = 3;
        $query_result['restr'] = "index_serie REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit1 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit2 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit3 REGEXP '{$query}'";
        $query_result['restr'] .= " OR tit4 REGEXP '{$query}'";
        $query_result['order'] = "index_serie ASC, tnvol ASC, tit1 ASC";
    } else {
        // nettoyage de la chaîne
        $query = preg_replace("/[\\(\\)\\,\\;\\'\\!\\-\\+]/", ' ', $query);
        // on supprime les mots vides
        $query = strip_empty_words($query);
        // contrôle de la requete
        if (!$query) {
            return $query_result;
        }
        // la saisie est splitée en un tableau
        $tab = preg_split('/\\s+/', $query);
        // on cherche à détecter les mots de moins de 4 caractères (stop words)
        // si il y des mots remplissant cette condition, c'est la méthode regexp qui sera employée
        foreach ($tab as $dummykey => $word) {
            if (strlen($word) < 4) {
                $stopwords = TRUE;
                break;
            }
        }
        if ($stopwords || $force_regexp) {
            // méthode REGEXP
            $query_result['type'] = 2;
            // constitution du membre restricteur
            // premier mot
            $query_result['restr'] = "(index_sew REGEXP '{$tab[0]} ) '";
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_result['restr'] .= " {$dopt} (index_sew REGEXP '{$tab[$i]}' )";
            }
            // contitution de la clause de tri
            $query_result['order'] = "index_serie ASC, tnvol ASC, tit1 ASC";
        } else {
            // méthode FULLTEXT
            $query_result['type'] = 1;
            // membre restricteur
            $query_result['restr'] = "MATCH (index_wew) AGAINST ('*{$tab[0]}*')";
            for ($i = 1; $i < sizeof($tab); $i++) {
                $query_result['restr'] .= " {$dopt} MATCH";
                $query_result['restr'] .= " (index_wew)";
                $query_result['restr'] .= " AGAINST ('*{$tab[$i]}*')";
            }
            // membre de tri
            $query_result['order'] = "index_serie DESC, tnvol ASC, index_sew ASC";
        }
    }
    // récupération du nombre de lignes
    $rws = "SELECT count(1) FROM notices WHERE {$query_result['restr']}";
    $result = @mysql_query($rws, $dbh);
    $query_result['nbr_rows'] = @mysql_result($result, 0, 0);
    return $query_result;
}
Exemple #11
0
function import_lecteurs($type_import)
{
    global $dbh;
    global $text, $n, $t_xml;
    global $deflt2docs_location;
    //La structure du fichier xml doit être la suivante :
    /*    
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <inm:Results productTitle="Superdoc Premium" productVersion="9.00" xmlns:inm="http://www.inmagic.com/webpublisher/query">
    <inm:Recordset setCount="3">
    <inm:Record setEntry="0">
    <inm:Date-de-creation>10/01/2007</inm:Date-de-creation>
    <inm:ID>103</inm:ID>
    <inm:Centre>CDI LYC. MENDES FRANCE</inm:Centre>
    <inm:Numero-Emprunteur>00001987</inm:Numero-Emprunteur>
    <inm:Nom>SOULIER</inm:Nom>
    <inm:Prenom>ALAIN</inm:Prenom>
    <inm:Nom-Prenom>SOULIER ALAIN</inm:Nom-Prenom>
    <inm:Civilite />
    <inm:Service>C.D.I.</inm:Service>
    <inm:Telephone />
    <inm:Fax />
    <inm:Mel />
    <inm:Adresse />
    <inm:Code-Postal />
    <inm:Ville />
    <inm:Pays />
    <inm:Notes />
    <inm:Exclusion-du-pret />
    <inm:Groupe />
    <inm:Droits />
    <inm:DateFinDroits />
    <inm:DroitEmprunteur>CDI LYC. MENDES FRANCE : Professeur</inm:DroitEmprunteur>
    </inm:Record>...
    */
    //Upload du fichier
    if (!$_FILES['import_lec']['tmp_name']) {
        print "Cliquez sur Pr&eacute;c&eacute;dent et choisissez un fichier";
        exit;
    } elseif (!move_uploaded_file($_FILES['import_lec']['tmp_name'], "./temp/" . basename($_FILES['import_lec']['tmp_name']))) {
        print "Le fichier n'a pas pu être t&eacute;l&eacute;charg&eacute;. Voici plus d'informations :<br />";
        print_r($_FILES) . "<p>";
        exit;
    }
    $fichier = @fopen("./temp/" . basename($_FILES['import_lec']['tmp_name']), "r");
    if ($fichier) {
        print "<br /><br />";
        print "T&eacute;l&eacute;chargement du fichier effectu&eacute;.<br /><hr />";
        if ($type_import == 'maj_complete') {
            print "Suppression des groupes et lecteurs sans prêts.<br /><br />";
            //Vide la table empr_groupe
            mysql_query("DELETE FROM empr_groupe", $dbh);
            //Supprime les lecteurs qui n'ont pas de prêts en cours
            $req_select_verif_pret = "SELECT id_empr FROM empr left join pret on id_empr=pret_idempr WHERE pret_idempr is null ";
            $select_verif_pret = mysql_query($req_select_verif_pret, $dbh);
            while ($verif_pret = mysql_fetch_array($select_verif_pret)) {
                //pour tous les lecteurs qui n'ont pas de pret en cours
                emprunteur::del_empr($verif_pret["id_empr"]);
            }
        }
        print "Traitement du fichier en cours.<br />";
        $nb_ok = 0;
        $tab_err = array();
        //definition header et footer
        $header = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><inm:results>";
        $footer = "</inm:results>";
        while (!feof($fichier)) {
            $buffer = "";
            $deb = FALSE;
            $i = 0;
            while ($i < 200 && !feof($fichier)) {
                $line = fgets($fichier, 4096);
                if (strpos($line, "<inm:Recordset") === FALSE && strpos($line, "<inm:Record") !== FALSE) {
                    $deb = TRUE;
                }
                if ($deb) {
                    $buffer .= trim($line);
                }
                if (strpos($line, "</inm:Record>") !== FALSE) {
                    $deb = FALSE;
                    $i++;
                }
            }
            if ($buffer) {
                $buffer = $header . $buffer . $footer;
                //print "<hr />";print htmlentities($buffer,ENT_QUOTES,$charset);print "<br />";
                //parse buffer
                $text = '';
                $t_xml = array();
                $n = 0;
                $encoding = "UTF-8";
                $parser = xml_parser_create($encoding);
                xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $encoding);
                xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
                xml_set_element_handler($parser, "debutBalise", "finBalise");
                xml_set_character_data_handler($parser, "texte");
                if (!xml_parse($parser, $buffer, TRUE)) {
                    die(sprintf("erreur XML %s à la ligne: %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)));
                }
                xml_parser_free($parser);
                //traitement des enregistrements
                for ($i = 1; $i <= count($t_xml); $i++) {
                    //il faut au minimum un nom ou un prénom
                    $t_xml[$i]['INM:NOM'][0] = trim($t_xml[$i]['INM:NOM'][0]);
                    $t_xml[$i]['INM:PRENOM'][0] = trim($t_xml[$i]['INM:PRENOM'][0]);
                    if ($t_xml[$i]['INM:NOM'][0] != '' || $t_xml[$i]['INM:PRENOM'][0] != '') {
                        $e_data = array();
                        //print "Enregistrement n° ".$t_xml[$i]['INM:ID'][0]."<br />";
                        //localisation
                        $e_data['location'] = $deflt2docs_location;
                        //nom + prenom
                        if ($t_xml[$i]['INM:NOM'][0] != '') {
                            $e_data['nom'] = $t_xml[$i]['INM:NOM'][0];
                            $e_data['prenom'] = $t_xml[$i]['INM:PRENOM'][0];
                        } else {
                            $e_data['nom'] = $t_xml[$i]['INM:NOM'][0];
                            $e_data['prenom'] = '';
                        }
                        //cb emprunteur
                        $t_xml[$i]['INM:NUMERO-EMPRUNTEUR'][0] = trim($t_xml[$i]['INM:NUMERO-EMPRUNTEUR'][0]);
                        if ($t_xml[$i]['INM:NUMERO-EMPRUNTEUR'][0] != '') {
                            $e_data['cb'] = trim($t_xml[$i]['INM:NUMERO-EMPRUNTEUR'][0]);
                        } else {
                            $q = "select (count(*)+1) from empr";
                            $r = mysql_query($q, $dbh);
                            $x = mysql_result($r, 0, 0);
                            $e_data['cb'] = 'PMB_' . $x;
                        }
                        //civilité
                        $t_xml[$i]['INM:CIVILITE'][0] = substr(strtolower(trim($t_xml[$i]['INM:CIVILITE'][0])), 0, 2);
                        switch ($t_xml[$i]['INM:CIVILITE'][0]) {
                            case 'm.':
                            case 'mr':
                            case 'mo':
                                $e_data['sexe'] = 1;
                                break;
                            case 'ma':
                            case 'me':
                            case 'ml':
                                $e_data['sexe'] = 2;
                                break;
                            default:
                                $e_data['sexe'] = 0;
                                break;
                        }
                        //tel
                        $e_data['tel1'] = trim($t_xml[$i]['INM:TELEPHONE'][0]);
                        //mail
                        $e_data['mail'] = trim($t_xml[$i]['INM:MEL'][0]);
                        //adresse
                        $e_data['adr1'] = trim($t_xml[$i]['INM:ADRESSE'][0]);
                        //cp
                        $e_data['cp'] = trim($t_xml[$i]['INM:CP'][0]);
                        //ville
                        $e_data['ville'] = trim($t_xml[$i]['INM:VILLE'][0]);
                        //pays
                        $e_data['pays'] = trim($t_xml[$i]['INM:PAYS'][0]);
                        //notes
                        $e_data['msg'] = trim($t_xml[$i]['INM:NOTES'][0]);
                        //categorie
                        $t_xml[$i]['INM:DROITEMPRUNTEUR'][0] = strtolower($t_xml[$i]['INM:DROITEMPRUNTEUR'][0]);
                        $t_xml[$i]['INM:DROITEMPRUNTEUR'][0] = convert_diacrit($t_xml[$i]['INM:DROITEMPRUNTEUR'][0]);
                        if (strpos($t_xml[$i]['INM:DROITEMPRUNTEUR'][0], "eleve") !== FALSE) {
                            $e_data['categ'] = 1;
                        } elseif (strpos($t_xml[$i]['INM:DROITEMPRUNTEUR'][0], "professeur") !== FALSE) {
                            $e_data['categ'] = 2;
                        } else {
                            $e_data['categ'] = 3;
                        }
                        //code statistique
                        $e_data['codestat'] = 1;
                        //statut
                        if (strtolower(trim($t_xml[$i]['INM:EXCLUSION-DU-PRET'][0])) == 'yes') {
                            $e_data['statut'] = 2;
                        } else {
                            $e_data['statut'] = 1;
                        }
                        //date creation lecteur
                        $t_xml[$i]['INM:DATE-DE-CREATION'][0] = trim($t_xml[$i]['INM:DATE-DE-CREATION'][0]);
                        $e_data['date_creation'] = substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 6, 4) . '-' . substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 3, 2) . '-' . substr($t_xml[$i]['INM:DATE-DE-CREATION'][0], 0, 2);
                        //date adhesion
                        $e_data['date_adhesion'] = today();
                        //date fin adhesion
                        $qda = "select duree_adhesion from empr_categ where id_categ_empr='" . $e_data['categ'] . "' ";
                        $rda = mysql_query($qda, $dbh);
                        if (mysql_num_rows($rda)) {
                            $da = mysql_result($rda, 0, 0);
                        } else {
                            $da = 365;
                        }
                        $qd = "select date_add('" . $e_data['date_adhesion'] . "', INTERVAL " . $da . " DAY) ";
                        $rd = mysql_query($qd, $dbh);
                        if (mysql_num_rows($rd)) {
                            $de = mysql_result($rd, 0, 0);
                        }
                        $e_data['date_expiration'] = $de;
                        //login
                        $e_data['login'] = emprunteur::do_login($e_data['nom'], $e_data['prenom']);
                        //import lecteur
                        $e = new emprunteur();
                        $e_id = 0;
                        $e_id = $e->import($e_data);
                        if ($e_id) {
                            $nb_ok++;
                            //groupe et champ perso service
                            $t_xml[$i]['INM:SERVICE'][0] = trim($t_xml[$i]['INM:SERVICE'][0]);
                            if ($t_xml[$i]['INM:SERVICE'][0]) {
                                //groupe
                                $qg = "select groupe_id from groupe where libelle_groupe='" . addslashes($t_xml[$i]['INM:SERVICE'][0]) . "' limit 1 ";
                                $rg = mysql_query($qg, $dbh);
                                if (mysql_num_rows($rg)) {
                                    $g_id = mysql_result($rg, 0, 0);
                                } else {
                                    $qg = "insert into groupe set libelle_groupe='" . addslashes($t_xml[$i]['INM:SERVICE'][0]) . "' ";
                                    mysql_query($qg, $dbh);
                                    $g_id = mysql_insert_id($dbh);
                                }
                                $qeg = "insert into empr_groupe (empr_id,groupe_id) values ({$e_id},{$g_id}) ";
                                mysql_query($qeg, $dbh);
                                //champ perso service
                                $qn = "select idchamp from empr_custom where name='service' ";
                                $rn = mysql_query($qn, $dbh);
                                if (mysql_num_rows($rn)) {
                                    $idc = mysql_result($rn, 0, 0);
                                    $requete = "select max(empr_custom_list_value*1) from empr_custom_lists where empr_custom_champ={$idc} ";
                                    $resultat = mysql_query($requete, $dbh);
                                    $max = @mysql_result($resultat, 0, 0);
                                    $n = $max + 1;
                                    $requete = "select empr_custom_list_value from empr_custom_lists where empr_custom_list_lib='" . addslashes($t_xml[$i]['INM:SERVICE'][0]) . "' and empr_custom_champ={$idc} ";
                                    $resultat = mysql_query($requete, $dbh);
                                    if (mysql_num_rows($resultat)) {
                                        $value = mysql_result($resultat, 0, 0);
                                    } else {
                                        $requete = "insert into empr_custom_lists (empr_custom_champ,empr_custom_list_value,empr_custom_list_lib) values({$idc},{$n},'" . addslashes($t_xml[$i]['INM:SERVICE'][0]) . "')";
                                        mysql_query($requete, $dbh);
                                        $value = $n;
                                        $n++;
                                    }
                                    $requete = "insert into empr_custom_values (empr_custom_champ,empr_custom_origine,empr_custom_integer) values({$idc},{$e_id},{$value})";
                                    mysql_query($requete, $dbh);
                                }
                            }
                        } else {
                            $tab_err[] = $t_xml[$i]['INM:ID'][0];
                        }
                    } else {
                        $tab_err[] = $t_xml[$i]['INM:ID'][0];
                    }
                }
            }
        }
        fclose($fichier);
        unlink("./temp/" . basename($_FILES['import_lec']['tmp_name']));
        print "Traitement du fichier termin&eacute;.";
        print "<br /><hr />";
        print "Nombre de lecteurs import&eacute;s : " . $nb_ok . "<br />";
        print "Nombre d'erreurs de traitement : " . count($tab_err) . "<br /><hr />";
        if (count($tab_err)) {
            for ($i = 0; $i < count($tab_err); $i++) {
                print "Erreur &agrave; l&apos;enregistrement n° " . $tab_err[$i] . "<br />";
            }
            print "<hr /><br />";
        }
    } else {
        print "Le fichier n&apos;a pu &ecirc;tre lu .";
    }
}
 /**
  *
  * On renvoi un id de groupement en fonction de ses éléments
  *
  * @param String $name
  * @param String $code_champ
  * @param String $code_ss_champ
  */
 public static function gen_groupby_id($name, $code_champ, $code_ss_champ)
 {
     $id = $name . "_" . $code_champ . "_" . $code_ss_champ;
     $id = convert_diacrit($id) . md5($id);
     $id = str_replace("'", "", $id);
     return $id;
 }
 public function search($user_query)
 {
     $matches = array();
     //pour chaque page
     $terms = explode(" ", strtolower(convert_diacrit($user_query)));
     $pages = $this->refnum->getElementsByTagName("vueObjet");
     foreach ($pages as $page) {
         //on va chercher la couche OCR
         $img = $page->getElementsByTagName("image")->item(0);
         $image = $img->getAttribute("nomImage");
         $ocr = str_replace("T", "X", $image);
         $num_page = str_replace("T", "", $image);
         if ($this->file_exists($this->get_file_path("X/" . $ocr . ".xml.gz"))) {
             ob_start();
             readgzfile($this->get_file($this->get_file_path("X/" . $ocr . ".xml.gz")));
             $file = ob_get_clean();
             $xml = new domDocument("1.0", "iso-8859-1");
             $xml->loadXML($file);
             //on va avoir besoin de la résolution d'origine pour calculer le ratio...
             $page = $xml->getElementsByTagName("Page")->item(0);
             $original_width = $page->getAttribute('WIDTH');
             $original_height = $page->getAttribute('HEIGHT');
             $height = $this->getHeight($num_page);
             $width = $this->getWidth($num_page);
             $h_ratio = $height / $original_height;
             $w_ratio = $width / $original_width;
             $strings = $xml->getElementsByTagName('String');
             foreach ($strings as $string) {
                 foreach ($terms as $term) {
                     if (strtolower(convert_diacrit(utf8_decode($string->getAttribute("CONTENT")))) == $term) {
                         $matches[] = array("text" => $this->get_paragraphe($string), 'par' => array(array('page' => $num_page * 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $string->getAttribute("HPOS") * $w_ratio, 'r' => ($string->getAttribute("HPOS") + $string->getAttribute("WIDTH")) * $w_ratio, 'b' => ($string->getAttribute("VPOS") + $string->getAttribute("HEIGHT")) * $h_ratio, 't' => $string->getAttribute("VPOS") * $h_ratio, 'page' => $num_page * 1)))));
                     }
                 }
             }
         }
     }
     return array('matches' => $matches);
 }
        $options = array_to_xml($param, "OPTIONS");
        if ($first == 2) {
            for ($i = 0; $i < count($ITEMS); $i++) {
                if (count($checked) == 0 || count($checked) > 0 && !in_array($ITEMS[$i]['value'], $checked)) {
                    if ($ITEMS[$i]['value'] && $ITEMS[$i]['label']) {
                        $array = array('value' => $ITEMS[$i]['value'], 'label' => $ITEMS[$i]['label'], 'order' => $ITEMS[$i]['order'] ? $ITEMS[$i]['order'] : 0);
                        $items[] = $array;
                    }
                }
            }
        }
        if ($first == 3) {
            //Tri des options
            $options = array();
            for ($i = 0; $i < count($ITEMS); $i++) {
                $options[$i] = convert_diacrit($ITEMS[$i]['label']);
            }
            asort($options);
            foreach ($options as $i => $option) {
                $array = array('value' => $ITEMS[$i]['value'], 'label' => $ITEMS[$i]['label'], 'order' => $i);
                $items[] = $array;
            }
        }
    }
    //Formulaire
    ?>
 
	
	<form class='form-<?php 
    echo $current_module;
    ?>
 function search($user_query)
 {
     global $charset;
     $matches = array();
     if (!file_exists($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox")) {
         exec("pdftotext -bbox " . $this->doc->driver->get_cached_filename($this->doc->id) . ".pdf " . $this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
         //bbox ne gère pas les entités html présentent dans le titre
         $contents = file_get_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
         if (preg_match("/\\<title\\>(.*)\\<\\/title\\>/", $contents, $match) && $match[1]) {
             file_put_contents($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox", str_replace($match[1], htmlentities($match[1], ENT_QUOTES, $charset), $contents));
         }
     }
     $dom = new DOMDocument();
     $dom->load($this->doc->driver->get_cached_filename($this->doc->id) . ".bbox");
     // On nettoie la recherche
     $user_query = strip_empty_words(strtolower(convert_diacrit($user_query)));
     $terms = explode(" ", $user_query);
     $pages = $dom->getElementsByTagName("page");
     $height = 0;
     $width = 0;
     //on parcourt les pages
     for ($i = 0; $i < $pages->length; $i++) {
         $current_page = $pages->item($i);
         $height = $current_page->getAttribute("height");
         $width = $current_page->getAttribute("width");
         $h_ratio = $this->getHeight($i + 1) / $height;
         $w_ratio = $this->getWidth($i + 1) / $width;
         $words = $current_page->getElementsByTagName("word");
         //on parcourt les mots du fichier
         for ($j = 0; $j < $words->length; $j++) {
             //on parcourt les termes de la recherche
             $current_word = $words->item($j);
             if ($charset == "iso-8859-1") {
                 $current_word_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $current_word->nodeValue);
             } else {
                 $current_word_value = $current_word->nodeValue;
             }
             foreach ($terms as $term) {
                 if (strpos(strtolower(convert_diacrit($current_word_value)), $term) !== false) {
                     //trouvé
                     //texte à afficher en aperçu
                     $text = "...";
                     for ($k = $j - 3; $k <= $j + 3; $k++) {
                         if ($j == $k) {
                             $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                         }
                         if ($charset == "iso-8859-1") {
                             $text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT", $words->item($k)->nodeValue), ENT_QUOTES, $charset) . " ";
                         } else {
                             $text .= htmlentities($words->item($k)->nodeValue, ENT_QUOTES, $charset);
                         }
                         if ($j == $k) {
                             $text .= "</span>";
                         }
                         $text .= " ";
                     }
                     $text .= "... ";
                     $matches[] = array("text" => $text, 'par' => array(array('page' => $i + 1, 'page_height' => $height, 'b' => $height, 't' => 0, 'page_width' => $width, 'r' => $width, 'l' => 0, 'boxes' => array(array('l' => $current_word->getAttribute("xMin") * $w_ratio, 'r' => $current_word->getAttribute("xMax") * $w_ratio, 'b' => $current_word->getAttribute("yMax") * $h_ratio, 't' => $current_word->getAttribute("yMin") * $h_ratio, 'page' => $i + 1)))));
                     // 					} else if (strpos($term, strtolower(convert_diacrit($current_word_value))) === 0) {
                     // 						// On regarde si le terme n'est pas découpé dans le document
                     // 						// Le mot correspond au début du terme, on va regarder les mots suivants
                     // 						$offset = 0;
                     // 						$word_index = $j;
                     // 						$word_index_value = $current_word_value;
                     // 						do {
                     // 							$offset += strlen(strtolower(convert_diacrit($word_index_value)));
                     // 							$word_index++;
                     // 							if ($charset == "iso-8859-1") $word_index_value = iconv("UTF-8", "ISO-8859-1//TRANSLIT",$words->item($word_index)->nodeValue);
                     // 							else $word_index_value = $words->item($word_index)->nodeValue;
                     // 						} while (strpos($term, strtolower(convert_diacrit($word_index_value)), $offset) === $offset);
                     // 						if ($offset >= strlen($term)) {
                     // 							// le terme à été trouvé
                     // 							//texte à afficher en aperçu
                     // 							$word_index--;
                     // 							$text = "...";
                     // 							for ($k=$j-3 ; $k<=$word_index+3 ; $k++){
                     // 								if ($j == $k) $text .= "<span style='background-color:#CCCCFF;font-size:100%;font-style:normal;color:#000000;'>";
                     // 								if ($charset == "iso-8859-1") {
                     // 									$text .= htmlentities(iconv("UTF-8", "ISO-8859-1//TRANSLIT",$words->item($k)->nodeValue),ENT_QUOTES,$charset);
                     // 								} else {
                     // 									$text .= htmlentities($words->item($k)->nodeValue,ENT_QUOTES,$charset);
                     // 								}
                     // 								if ($k == $word_index) $text .= "</span>";
                     // 								$text .= " ";
                     // 							}
                     // 							$text .= "... ";
                     // 							$matches[] = array(
                     // 								"text"=> $text,
                     // 								'par' => array(
                     // 									array(
                     // 										'page' => ($i+1),
                     // 										'page_height' => $height,
                     // 										'b' => $height,
                     // 										't' => 0,
                     // 										'page_width' => $width,
                     // 										'r' => $width,
                     // 										'l' =>  0,
                     // 										'boxes' => array(
                     // 											array(
                     // 												'l' => $current_word->getAttribute("xMin")*$w_ratio,
                     // 												'r' => $words->item($word_index)->getAttribute("xMax")*$w_ratio,
                     // 												'b' => $words->item($word_index)->getAttribute("yMax")*$h_ratio,
                     // 												't' => $current_word->getAttribute("yMin")*$h_ratio,
                     // 												'page' => ($i+1)
                     // 											)
                     // 										)
                     // 									)
                     // 								)
                     // 							);
                     // 						}
                 } else {
                     //perdu
                     continue;
                 }
             }
         }
     }
     return array('matches' => $matches);
 }
$amusic_form = $s_music_form->table;
foreach ($amusic_form as $key => $val) {
    $alphabet[] = strtoupper(convert_diacrit(pmb_substr($val, 0, 1)));
}
$alphabet = array_unique($alphabet);
print $sel_header;
print $jscript;
// affichage d'un sommaire par lettres
print "<div class='row'>";
foreach ($alphabet as $dummykey => $char) {
    $present = pmb_preg_grep("/^{$char}/i", $s_music_form->table);
    if (sizeof($present) && strcasecmp($letter, $char)) {
        print "<a href='{$baseurl}&letter={$char}'>{$char}</a> ";
    } else {
        if (!strcasecmp($letter, $char)) {
            print "<font size='+1'><strong><u>{$char}</u></strong></font> ";
        }
    }
}
print "</div><hr />";
foreach ($s_music_form->table as $index => $value) {
    if (preg_match("/^{$letter}/i", convert_diacrit($value)) || $letter == 'Fav' && $s_music_form->tablefav[$index]) {
        $display[] = "\t\n\t\t<div class='row'>\n\t\t\t<div class='colonne2' style='width: 80%;'>\n\t\t\t\t<a href='#' onClick=\"top.set_parent('{$index}', '" . htmlentities(addslashes($value), ENT_QUOTES, $charset) . "')\">{$value}</a>\n\t\t\t</div>\n\t\t\t<div class='colonne2'  style='width: 20%;'>\n\t\t\t\t{$index}\n\t\t\t</div>\n\t\t</div>\n\t\t";
    }
}
print "<div class='row'>";
foreach ($display as $dummykey => $link) {
    print $link;
}
print "</div>";
print $sel_footer;
Exemple #17
0
     if (!$nb_per_page) {
         $nb_per_page = $nb_per_page_select;
     }
     //parcours du tableau de mots, découpage en colonne et détermination des valeurs par rapport à la pagination et la lettre
     foreach ($words_for_syn as $key => $valeur_syn) {
         if ($valeur_syn != "") {
             if ($letter != 'My') {
                 if (preg_match("/^{$letter}/i", convert_diacrit(pmb_strtolower($valeur_syn)))) {
                     if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) {
                         $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">";
                         $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n";
                     }
                     $compt++;
                 }
             } else {
                 if (pmb_substr($valeur_syn, 0, 1) == '0' || !array_search(convert_diacrit(pmb_strtolower(pmb_substr($valeur_syn, 0, 1))), $alphabet)) {
                     if ($compt >= ($page - 1) * $nb_per_page && $compt < $page * $nb_per_page) {
                         $affichage_mots .= "<a href='#' onClick=\"set_parent('" . $key . "','" . htmlentities(addslashes($valeur_syn), ENT_QUOTES, $charset) . "')\">";
                         $affichage_mots .= htmlentities($valeur_syn, ENT_QUOTES, $charset) . "</a><br />\n";
                     }
                 }
                 $compt++;
             }
         }
     }
     $affichage_mots .= "</div>";
     $affichage_mots .= "<div class='row'>&nbsp;</div><hr />\n";
     //affichage de la pagination
     $affichage_mots .= aff_pagination($baseurl . "&user_input={$user_input}&letter=" . $letter, $compt, $nb_per_page, $page);
     $affichage_mots .= "<div class='row'>&nbsp;</div>\n";
 }
 function make_simple_search($query)
 {
     $r = array();
     for ($i = 0; $i < count($query) - 1; $i++) {
         $q = array();
         if ($query[$i]["INTER"] && $i > 0) {
             $q["INTER"] = $query[$i]["INTER"];
         }
         if ($query[$i]["SUB"]) {
             $q["SUB"] = $this->make_simple_search($query[$i]["SUB"]);
         } else {
             $expr = array();
             for ($j = 0; $j < count($query[$i]["VALUE"]); $j++) {
                 $query[$i]["VALUE"][$j] = convert_diacrit($query[$i]["VALUE"][$j]);
             }
             $req = "";
             for ($j = 0; $j < count($query[$i]["FIELDS"]); $j++) {
                 for ($k = 0; $k < count($query[$i]["VALUE"]); $k++) {
                     $param = "";
                     $param[$query[$i]["FIELDS"][$j]] = $query[$i]["VALUE"][$k];
                     $expr[] = $param;
                 }
             }
             if (count($expr) > 1) {
                 $sub = array();
                 for ($j = 0; $j < count($expr); $j++) {
                     $q1 = array();
                     if ($j > 0) {
                         $q1["INTER"] = "or";
                     }
                     $q1["PARAM"] = $expr[$j];
                     $sub[] = $q1;
                 }
                 $q["SUB"] = $sub;
             } else {
                 $q["PARAM"] = $expr[0];
             }
         }
         $r[] = $q;
     }
     return $r;
 }
         $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login']}</p>";
         $nberrors++;
     }
     $requete = "SELECT id_empr, empr_login FROM empr WHERE empr_login='******' and id_empr!='{$id}' ";
     $res = pmb_mysql_query($requete, $dbh);
     $nbr_lignes = pmb_mysql_num_rows($res);
     if ($nbr_lignes) {
         $error_message .= "<p>{$form_empr_login} : {$msg['empr_form_login_existant']}</p>";
         $nberrors++;
     }
 } else {
     $form_empr_login = pmb_substr($form_prenom, 0, 1) . $form_nom;
     $form_empr_login = str_replace(CHR(32), "", $form_empr_login);
     $form_empr_login = pmb_strtolower($form_empr_login);
     $form_empr_login = clean_string($form_empr_login);
     $form_empr_login = convert_diacrit(pmb_strtolower($form_empr_login));
     $form_empr_login = pmb_alphabetic('^a-z0-9\\.\\_\\-\\@', '', $form_empr_login);
     $form_empr_login_original = $form_empr_login;
     $pb = 1;
     $num_login = 1;
     while ($pb == 1) {
         $requete = "SELECT empr_login FROM empr WHERE empr_login='******' LIMIT 1 ";
         $res = pmb_mysql_query($requete, $dbh);
         $nbr_lignes = pmb_mysql_num_rows($res);
         if ($nbr_lignes) {
             $form_empr_login = $form_empr_login_original . $num_login;
             $num_login++;
         } else {
             $pb = 0;
         }
     }
function strip_empty_chars_thesaurus($string)
{
    // traitement des diacritiques
    $string = convert_diacrit($string);
    // Mis en commentaire : qu'en est-il des caractères non latins ???
    // SUPPRIME DU COMMENTAIRE : ER : 12/05/2004 : ça fait tout merder...
    // RECH_14 : Attention : ici suppression des éventuels "
    //          les " ne sont plus supprimés
    $string = stripslashes($string);
    $string = pmb_alphabetic('^a-z0-9\\s', ' ', pmb_strtolower($string));
    // espaces en début et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    return $string;
}
 public function render_file($sub, $elem)
 {
     global $class_path;
     $datas = $this->datasource->get_datas($this->state_fields_list, $this->state_fields_params);
     switch ($sub) {
         case "tab":
             $view_class = "editions_state_view";
             break;
         case "tcd":
             $view_class = "editions_state_view_tcd";
             break;
         case "group":
             $view_class = "editions_state_view_group";
             break;
         case "graph":
             $view_class = "editions_state_view_graph";
             break;
     }
     require_once $class_path . "/" . $view_class . ".class.php";
     $view = new $view_class($datas, $this->id);
     $file_name = convert_diacrit(str_replace(" ", "_", $this->name));
     switch ($elem) {
         case "xls":
             $view->render_xls_file($file_name);
             break;
         default:
             return $html;
             break;
     }
 }
Exemple #22
0
 function pmb_ksort(&$table)
 {
     $table_final = array();
     if ($this->field_type == 'list') {
         if (is_array($table)) {
             reset($table);
             $tmp = array();
             $requete = "select ordre, notices_custom_list_lib from notices_custom_lists";
             $requete .= " where notices_custom_champ=" . $this->field_id;
             $res = pmb_mysql_query($requete);
             while ($row = pmb_mysql_fetch_object($res)) {
                 $this->group_pperso_order[$row->notices_custom_list_lib] = $row->ordre;
             }
             uksort($table, array(&$this, "cmp_pperso"));
         }
     } else {
         if (is_array($table)) {
             reset($table);
             $tmp = array();
             foreach ($table as $key => $value) {
                 $tmp[] = strtoupper(convert_diacrit($key));
                 $tmp_key[] = $key;
                 $tmp_contens[] = $value;
             }
             asort($tmp);
             foreach ($tmp as $key => $value) {
                 $table_final[$tmp_key[$key]] = $tmp_contens[$key];
             }
             $table = $table_final;
         }
     }
 }
Exemple #23
0
function strip_empty_words($string, $lg = 0)
{
    // on inclut le tableau des mots-vides pour la langue par defaut si elle n'est pas precisee
    // c'est normalement la langue de catalogage...
    // sinon on inclut le tableau des mots vides pour la langue precisee
    // si apres nettoyage des mots vide la chaine est vide alors on garde la chaine telle quelle (sans les accents)
    global $pmb_indexation_lang;
    //	global $lang;
    global $include_path;
    if (!$lg || $lg == $pmb_indexation_lang) {
        global $empty_word;
    } else {
        include "{$include_path}/marc_tables/{$lg}/empty_words";
    }
    //echo "<pre>";
    //print_r($empty_word);
    //echo "</pre>";
    // nettoyage de l'entree
    // traitement des diacritiques
    $string = convert_diacrit($string);
    // Mis en commentaire : qu'en est-il des caracteres non latins ???
    // SUPPRIME DU COMMENTAIRE : ER : 12/05/2004 : ça fait tout merder...
    // RECH_14 : Attention : ici suppression des eventuels "
    //          les " ne sont plus supprimes
    $string = stripslashes($string);
    $string = pmb_alphabetic('^a-z0-9\\s', ' ', pmb_strtolower($string));
    // remplacement espace  insécable 0xA0:	&nbsp;  	Non-breaking space
    $string = clean_nbsp($string);
    // espaces en debut et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    // espaces en double
    $string = pmb_preg_replace('/\\s+/', ' ', $string);
    $string_avant_mots_vides = $string;
    // suppression des mots vides
    if (is_array($empty_word)) {
        foreach ($empty_word as $dummykey => $word) {
            $word = convert_diacrit($word);
            $string = pmb_preg_replace("/^{$word}\$|^{$word}\\s|\\s{$word}\\s|\\s{$word}\$/i", ' ', $string);
            // RECH_14 : suppression des mots vides colles à des guillemets
            if (pmb_preg_match("/\"{$word}\\s/i", $string)) {
                $string = pmb_preg_replace("/\"{$word}\\s/i", '"', $string);
            }
            if (pmb_preg_match("/\\s{$word}\"/i", $string)) {
                $string = pmb_preg_replace("/\\s{$word}\"/i", '"', $string);
            }
        }
    }
    // re nettoyage des espaces generes
    // espaces en debut et fin
    $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
    // espaces en double
    $string = pmb_preg_replace('/\\s+/', ' ', $string);
    if (!$string) {
        $string = $string_avant_mots_vides;
        // re nettoyage des espaces generes
        // espaces en debut et fin
        $string = pmb_preg_replace('/^\\s+|\\s+$/', '', $string);
        // espaces en double
        $string = pmb_preg_replace('/\\s+/', ' ', $string);
    }
    return $string;
}
 function store_in_tree($t, $search_linked_words)
 {
     // Mot ou expression ?
     if (!$t->sub && $t->word) {
         //C'est un mot
         // Synonyme activé && ce n'est pas une expression commence par '_xx*' ?
         if ($search_linked_words && !$this->start_with) {
             // Oui, Synonyme activé
             // C'est un littéral ?
             if ($t->literal) {
                 // Oui, c'est un littéral
                 // Recherche de synonymes
                 $synonymes = $this->get_synonymes($t->word);
                 $mots = $t->word;
                 // Y-a-t'il des synonymes ?
                 if ($synonymes) {
                     // Oui il y a des synonymes
                     // Pour chaque synonyme et le terme ajout à $t->sub
                     $op_sub = "";
                     foreach ($synonymes as $synonyme => $ponderation) {
                         $t->sub[] = new term($synonyme, 0, 0, 0, $op_sub, "", $ponderation);
                         $this->calcul_term($t->sub[count($t->sub) - 1], $synonyme, 0, $ponderation);
                         $op_sub = "or";
                     }
                     // Ajout du term force litéral à 1
                     $t->word = "";
                     $t->sub[] = new term($mots, 1, 0, 0, $op_sub, "", $t->pound);
                     $this->calcul_term($t->sub[count($t->sub) - 1], $mots, 1, $t->pound);
                     $op_sub = "or";
                 }
             } else {
                 // Non, ce n'est pas un littéral
                 // Recherche de synonymes
                 $synonymes = $this->get_synonymes($t->word);
                 $mots = $t->word;
                 $t->word = "";
                 // Y-a-t'il des synonymes ?
                 if ($synonymes) {
                     // Oui il y a des synonymes
                     foreach ($synonymes as $synonyme => $ponderation) {
                         $liste_mots[$synonyme] = $ponderation;
                     }
                 }
                 // Suite et, Non, il n'y a pas de synonyme
                 // Nettoyage des caractères
                 $mot_clean = convert_diacrit($mots);
                 $mot_clean = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot_clean));
                 // Nettoyage des mots vides
                 $mot_clean_vide = $this->nettoyage_mot_vide($mot_clean);
                 // Pour chaque mot nettoyer
                 if (count($mot_clean_vide)) {
                     foreach ($mot_clean_vide as $word) {
                         // Recherche de synonymes
                         $synonymes_clean = $this->get_synonymes($word);
                         // Pour chaque synonyme et le terme ajout à $t->sub
                         if (count($synonymes_clean)) {
                             foreach ($synonymes_clean as $synonyme => $ponderation) {
                                 $liste_mots[$synonyme] = $ponderation;
                             }
                         }
                     }
                 }
                 // ajout des mots nettoyés
                 if (count($mot_clean_vide)) {
                     foreach ($mot_clean_vide as $word) {
                         $liste_mots[$word] = $t->pound;
                     }
                 }
                 if (!count($t->sub)) {
                     $op_sub = '';
                 } else {
                     $op_sub = "or";
                 }
                 if (count($liste_mots) > 1) {
                     $t->word = "";
                     // Plusieurs mots
                     foreach ($liste_mots as $word => $ponderation) {
                         $t->sub[] = new term($word, 0, 0, 0, $op_sub, "", $ponderation);
                         $this->calcul_term($t->sub[count($t->sub) - 1], $word, 0, $ponderation);
                         $op_sub = "or";
                     }
                     //$t->sub=$terms;
                 } elseif (count($liste_mots) == 1) {
                     // Un seul mot
                     foreach ($liste_mots as $word => $ponderation) {
                         $t->word = $word;
                     }
                 } else {
                     return;
                 }
             }
         } else {
             // Non, Synonyme désactivé
             // C'est un littéral ?
             if ($t->literal) {
                 // Oui, c'est un littéral
                 // plus rien à faire
             } else {
                 // Non, ce n'est pas un littéral
                 // Nettoyage des caractères
                 $mot_clean = convert_diacrit($t->word);
                 $mot_clean = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot_clean));
                 // Nettoyage des mots vides
                 $mot_clean_vide = $this->nettoyage_mot_vide($mot_clean);
                 // Combien de mots reste-t-il ?
                 if (count($mot_clean_vide) > 1) {
                     $t->word = "";
                     // Plusieurs mots
                     if (!count($t->sub)) {
                         $op_sub = '';
                     } else {
                         $op_sub = "or";
                     }
                     foreach ($mot_clean_vide as $word) {
                         $terms[] = new term($word, 0, 0, 0, $op_sub, "", $ponderation);
                         $op_sub = "or";
                     }
                     $t->sub = $terms;
                 } elseif (count($mot_clean_vide) == 1) {
                     // Un seul mot
                     $t->word = $mot_clean_vide[0];
                 } else {
                     return;
                 }
             }
         }
     } elseif ($t->sub && !$t->word) {
         // C'est une expression :
         // Vider opérateur
         if (!count($this->tree)) {
             $t->operator = "";
         }
     } else {
         //	Ce n'est ni un mot, ni une exrssion: c'est rien
         return;
     }
     // Inscription dans l'arbre
     $this->tree[] = $t;
     //print "<pre>";print_r($this->tree);print"</pre>";
 }
Exemple #25
0
 static function gen_table_empty_word()
 {
     //ajout des mots pour remplir  $empty_word[]
     global $empty_word;
     mysql_query("delete from empty_words_calculs");
     $temp = "";
     $rqt_words_created = "select mot from mots,linked_mots where id_mot=num_mot and (type_lien=3 or type_lien=2)";
     $query_words_created = mysql_query($rqt_words_created);
     while ($result_words_created = mysql_fetch_object($query_words_created)) {
         $mot = convert_diacrit($result_words_created->mot);
         $words = pmb_alphabetic('^a-z0-9\\s\\*', ' ', pmb_strtolower($mot));
         $words = explode(" ", $words);
         //Variable de stockage des mots restants après supression des mots vides
         //Pour chaque mot
         for ($i = 0; $i < count($words); $i++) {
             $words[$i] = trim($words[$i]);
             //Vérification que ce n'est pas un mot vide
             if (in_array($words[$i], $empty_word) === false) {
                 //Si ce n'est pas un mot vide, on stoque
                 if ($words[$i]) {
                     $temp .= "\$empty_word[] = \"" . $words[$i] . "\";";
                 }
             }
         }
     }
     if ($temp) {
         //insertion dans la base de la date du jour, du code php et du nombre actuel de notices dans la base
         @mysql_query("insert into empty_words_calculs (date_calcul,php_empty_words,archive_calcul) values ('" . today() . "','" . $temp . "',1)");
     }
 }