コード例 #1
0
 public function get_sql_filter()
 {
     $sql_filter = "";
     $start = detectFormatDate($this->value['start']);
     $end = detectFormatDate($this->value['end']);
     if ($start && $start != "0000-00-00" || $end && $end != "0000-00-00") {
         if ($this->elem['field_join']) {
             $champ = $this->elem['field_join'];
         } elseif ($this->elem['field_alias']) {
             $champ = $this->elem['field_alias'];
         } else {
             $champ = $this->elem['field'];
         }
         if ($start != "0000-00-00" && $end != "0000-00-00") {
             $sql_filter = $champ . " between '" . $start . " 00:00:00' and '" . $end . " 23:59:59'";
         } else {
             if ($start != "0000-00-00") {
                 $sql_filter = $champ . " >= '" . $start . " 00:00:00'";
             } else {
                 $sql_filter = $champ . " <= '" . $end . " 23:59:59'";
             }
         }
         if ($this->elem['authorized_null']) {
             $sql_filter = "((" . $sql_filter . ") OR (" . $champ . " IS NULL))";
         }
     }
     return $sql_filter;
 }
コード例 #2
0
ファイル: pmb_h2o.inc.php プロジェクト: noble82/proyectos-ULS
 public static function day($date)
 {
     $cleandate = detectFormatDate($date);
     if ($cleandate != "0000-00-00") {
         return date("d", strtotime($cleandate));
     }
     return $date;
 }
コード例 #3
0
ファイル: metasMapper.php プロジェクト: noble82/proyectos-ULS
 public function get_notice_id()
 {
     global $pmb_keyword_sep;
     $notice_id = 0;
     $this->data = array();
     $this->data['tit1'] = $this->data['tit4'] = $this->data['authors'] = $this->data['co_authors'] = $this->data['code'] = $this->data['npages'] = $this->data['year'] = $this->data['index_l'] = $this->data['url'] = $this->data['thumbnail_content'] = $this->data['publisher'] = $this->data['n_resume'] = "";
     if ($this->mimetype == "application/epub+zip") {
         //pour les ebook, on gère ca directement ici !
         $this->data['tit1'] = $this->metas['title'][0];
         $this->data['authors'] = $this->metas['creator'];
         $this->data['co_authors'] = $this->metas['contributor'];
         if ($this->metas['identifier']['isbn']) {
             $this->data['code'] = \formatISBN($this->metas['identifier']['isbn'], 13);
         } else {
             if ($this->metas['identifier']['ean']) {
                 $this->data['code'] = \EANtoISBN($this->metas['identifier']['ean']);
                 $this->data['code'] = \formatISBN($code, 13);
             }
         }
         if ($this->metas['identifier']['uri']) {
             $this->data['url'] = \clean_string($this->metas['identifier']['uri']);
         }
         $this->data['publisher'] = $this->metas['publisher'][0];
         $this->data['year'] = $this->metas['date'][0]['value'];
         if (strlen($this->data['year']) && strlen($this->data['year']) != 4) {
             $this->data['year'] = \formatdate(detectFormatDate($this->data['year']));
         }
         $this->data['lang'] = $this->metas['language'];
         $this->data['n_resume'] = implode("\n", $this->metas['description']);
         $this->data['keywords'] = implode($pmb_keyword_sep, $this->metas['subject']);
         $this->data['thumbnail_content'] = $this->metas['thumbnail_content'];
     } else {
         foreach ($this->map['meta'] as $map_field => $map) {
             foreach ($this->metas as $meta_field => $meta_value) {
                 if ($map_field == $meta_field) {
                     if (method_exists($this, $map['function'])) {
                         $this->data[$map['field']] = $this->{$map}['function']($this->data[$map['field']], $meta_value, $map['params']);
                     } else {
                         $this->data[$map['field']] = $meta_value;
                     }
                     break;
                 }
             }
         }
     }
     if (!$this->data['tit1']) {
         $this->data['tit1'] = $this->name;
     }
     $notice_id = $this->create_notice();
     $notice_id = $this->dedoublonne($notice_id);
     return $notice_id;
 }
コード例 #4
0
function search_other_function_clause()
{
    //doit retourner une requete de selection d'identifiants de notices
    global $sig_choix, $sig_date_debut, $sig_date_fin;
    $r = '';
    //Récupération de la date
    $sig_date_debut_formate = detectFormatDate($sig_date_debut);
    $sig_date_fin_formate = detectFormatDate($sig_date_fin);
    if ($sig_choix == "exacte" && $sig_date_debut) {
        $r = "SELECT notice_id FROM notices WHERE date_parution='" . addslashes($sig_date_debut_formate) . "'";
    } elseif ($sig_date_debut && $sig_date_fin) {
        $r = "SELECT notice_id FROM notices WHERE date_parution >= '" . addslashes($sig_date_debut_formate) . "' AND date_parution <= '" . addslashes($sig_date_fin_formate) . "'";
    } elseif ($sig_date_debut) {
        $r = "SELECT notice_id FROM notices WHERE date_parution >= '" . addslashes($sig_date_debut_formate) . "'";
    } elseif ($sig_date_fin) {
        $r = "SELECT notice_id FROM notices WHERE date_parution <= '" . addslashes($sig_date_fin_formate) . "'";
    }
    return $r;
}
コード例 #5
0
function aff_format_date($param)
{
    //si c'est pas une date potable, on arrete là...
    if (!preg_match(getDatePattern(), $param[1]) && !preg_match(getDatePattern("short"), $param[1]) && !preg_match(getDatePattern("year"), $param[1])) {
        return $param[1];
    }
    $date = detectFormatDate($param[1]);
    $year = substr($date, 0, 4);
    $month = substr($date, 5, 2);
    $day = substr($date, 8, 2);
    return date($param[0], mktime(0, 0, 0, $month, $day, $year));
}
コード例 #6
0
ファイル: search.class.php プロジェクト: hogsim/PMB
 function make_search($prefixe = "")
 {
     global $search;
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_multi_search_operator;
     global $pmb_search_stemming_active;
     $this->error_message = "";
     $last_table = "";
     $field_keyName = $this->keyName;
     //Pour chaque champ
     for ($i = 0; $i < count($search); $i++) {
         //construction de la requete
         $s = explode("_", $search[$i]);
         //Recuperation de l'operateur
         $op = "op_" . $i . "_" . $search[$i];
         //Recuperation du contenu de la recherche
         $field_ = "field_" . $i . "_" . $search[$i];
         global ${$field_};
         $field = ${$field_};
         //Recuperation de l'operateur inter-champ
         $inter = "inter_" . $i . "_" . $search[$i];
         global ${$inter};
         global ${$op};
         //Recuperation des variables auxiliaires
         $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i];
         global ${$fieldvar_};
         $fieldvar = ${$fieldvar_};
         //Si c'est un champ fixe
         if ($s[0] == "f") {
             $ff = $this->fixedfields[$s[1]];
             //Choix du moteur
             if ($this->memory_engine_allowed && !$ff['MEMORYENGINEFORBIDDEN']) {
                 $this->current_engine = 'MEMORY';
             } else {
                 $this->current_engine = 'MyISAM';
             }
             //Calcul des variables
             $var_table = array();
             for ($j = 0; $j < count($ff["VAR"]); $j++) {
                 switch ($ff["VAR"][$j]["TYPE"]) {
                     case "input":
                         $var_table[$ff["VAR"][$j]["NAME"]] = @implode(",", $fieldvar[$ff["VAR"][$j]["NAME"]]);
                         break;
                     case "global":
                         $global_name = $ff["VAR"][$j]["NAME"];
                         global ${$global_name};
                         $var_table[$ff["VAR"][$j]["NAME"]] = ${$global_name};
                         break;
                     case "calculated":
                         $calc = $ff["VAR"][$j]["OPTIONS"]["CALC"][0];
                         switch ($calc["TYPE"]) {
                             case "value_from_query":
                                 $query_calc = $calc["QUERY"][0]["value"];
                                 @reset($var_table);
                                 while (list($var_name, $var_value) = @each($var_table)) {
                                     $query_calc = str_replace("!!" . $var_name . "!!", $var_value, $query_calc);
                                 }
                                 $r_calc = pmb_mysql_query($query_calc);
                                 $var_table[$ff["VAR"][$j]["NAME"]] = @pmb_mysql_result($r_calc, 0, 0);
                                 break;
                         }
                         break;
                 }
             }
             $q_index = $ff["QUERIES_INDEX"];
             //Recuperation de la requete associee au champ et a l'operateur
             $q = $ff["QUERIES"][$q_index[${$op}]];
             //Si c'est une requete conditionnelle, on sélectionne la bonne requete et on supprime les autres
             if ($q[0]["CONDITIONAL"]) {
                 $k_default = 0;
                 $q_temp = array();
                 $q_temp["OPERATOR"] = $q["OPERATOR"];
                 for ($k = 0; $k < count($q) - 1; $k++) {
                     if ($var_table[$q[$k]["CONDITIONAL"]["name"]] == $q[$k]["CONDITIONAL"]["value"]) {
                         break;
                     }
                     if ($q[$k]["CONDITIONAL"]["value"] == "default") {
                         $k_default = $k;
                     }
                 }
                 if ($k == count($q) - 1) {
                     $k = $k_default;
                 }
                 $q_temp[0] = $q[$k];
                 $q = $q_temp;
             }
             //Remplacement par les variables eventuelles pour chaque requete
             for ($k = 0; $k < count($q) - 1; $k++) {
                 reset($var_table);
                 while (list($var_name, $var_value) = each($var_table)) {
                     $q[$k]["MAIN"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MAIN"]);
                     $q[$k]["MULTIPLE_TERM"] = str_replace("!!" . $var_name . "!!", $var_value, $q[$k]["MULTIPLE_TERM"]);
                 }
             }
             $last_main_table = "";
             // pour les listes, si un opérateur permet une valeur vide, il en faut une...
             if ($this->op_empty[${$op}] && !is_array($field)) {
                 $field = array();
                 $field[0] = "";
             }
             // si sélection d'autorité et champ vide : on ne doit pas le prendre en compte
             if (${$op} == 'AUTHORITY') {
                 $suppr = false;
                 foreach ($field as $k => $v) {
                     if ($v == 0) {
                         unset($field[$k]);
                         $suppr = true;
                     }
                 }
                 if ($suppr) {
                     $field = array_values($field);
                 }
             }
             //Pour chaque valeur du champ
             for ($j = 0; $j < count($field); $j++) {
                 //Pour chaque requete
                 $field_origine = $field[$j];
                 for ($z = 0; $z < count($q) - 1; $z++) {
                     //Pour chaque valeur du cha
                     //Si le nettoyage de la saisie est demande
                     if ($q[$z]["KEEP_EMPTYWORD"]) {
                         $field[$j] = strip_empty_chars($field_origine);
                     } elseif ($q[$z]["REGDIACRIT"]) {
                         $field[$j] = strip_empty_words($field_origine);
                     } elseif ($q[$z]["DETECTDATE"]) {
                         $field[$j] = detectFormatDate($field_origine, $q[$z]["DETECTDATE"]);
                     }
                     $main = $q[$z]["MAIN"];
                     //Si il y a plusieurs termes possibles on construit la requete avec le terme !!multiple_term!!
                     if ($q[$z]["MULTIPLE_WORDS"]) {
                         $terms = explode(" ", $field[$j]);
                         //Pour chaque terme,
                         $multiple_terms = array();
                         for ($k = 0; $k < count($terms); $k++) {
                             $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                         }
                         $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                         $main = str_replace("!!multiple_term!!", $final_term, $main);
                         //Si la saisie est un ISBN
                     } else {
                         if ($q[$z]["ISBN"]) {
                             //Code brut
                             $terms[0] = $field[$j];
                             //EAN ?
                             if (isEAN($field[$j])) {
                                 //C'est un isbn ?
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             } else {
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             }
                             //Pour chaque terme,
                             $multiple_terms = array();
                             for ($k = 0; $k < count($terms); $k++) {
                                 $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                             }
                             $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                             $main = str_replace("!!multiple_term!!", $final_term, $main);
                         } else {
                             if ($q[$z]["BOOLEAN"]) {
                                 if ($q[$z]['STEMMING']) {
                                     $stemming = $pmb_search_stemming_active;
                                 } else {
                                     $stemming = 0;
                                 }
                                 $aq = new analyse_query($field[$j], 0, 0, 1, 0, $stemming);
                                 $aq1 = new analyse_query($field[$j], 0, 0, 1, 1, $stemming);
                                 if ($q[$z]["KEEP_EMPTY_WORDS_FOR_CHECK"]) {
                                     $err = $aq1->error;
                                 } else {
                                     $err = $aq->error;
                                 }
                                 if (!$err) {
                                     if (is_array($q[$z]["TABLE"])) {
                                         for ($z1 = 0; $z1 < count($q[$z]["TABLE"]); $z1++) {
                                             $is_fulltext = false;
                                             if ($q[$z]["FULLTEXT"][$z1]) {
                                                 $is_fulltext = true;
                                             }
                                             if (!$q[$z]["KEEP_EMPTY_WORDS"][$z1]) {
                                                 $members = $aq->get_query_members($q[$z]["TABLE"][$z1], $q[$z]["INDEX_L"][$z1], $q[$z]["INDEX_I"][$z1], $q[$z]["ID_FIELD"][$z1], $q[$z]["RESTRICT"][$z1], 0, 0, $is_fulltext);
                                             } else {
                                                 $members = $aq1->get_query_members($q[$z]["TABLE"][$z1], $q[$z]["INDEX_L"][$z1], $q[$z]["INDEX_I"][$z1], $q[$z]["ID_FIELD"][$z1], $q[$z]["RESTRICT"][$z1], 0, 0, $is_fulltext);
                                             }
                                             $main = str_replace("!!pert_term_" . ($z1 + 1) . "!!", $members["select"], $main);
                                             $main = str_replace("!!where_term_" . ($z1 + 1) . "!!", $members["where"], $main);
                                         }
                                     } else {
                                         $is_fulltext = false;
                                         if ($q[$z]["FULLTEXT"]) {
                                             $is_fulltext = true;
                                         }
                                         if ($q[$z]["KEEP_EMPTY_WORDS"]) {
                                             $members = $aq1->get_query_members($q[$z]["TABLE"], $q[$z]["INDEX_L"], $q[$z]["INDEX_I"], $q[$z]["ID_FIELD"], $q[$z]["RESTRICT"], 0, 0, $is_fulltext);
                                         } else {
                                             $members = $aq->get_query_members($q[$z]["TABLE"], $q[$z]["INDEX_L"], $q[$z]["INDEX_I"], $q[$z]["ID_FIELD"], $q[$z]["RESTRICT"], 0, 0, $is_fulltext);
                                         }
                                         $main = str_replace("!!pert_term!!", $members["select"], $main);
                                         $main = str_replace("!!where_term!!", $members["where"], $main);
                                     }
                                 } else {
                                     $main = "select notice_id from notices where notice_id=0";
                                     $this->error_message = sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message);
                                 }
                             } else {
                                 if ($q[$z]["WORD"]) {
                                     if ($q[$z]['CLASS'] == "searcher_all_fields") {
                                         //Pour savoir si la recherche tous champs inclut les docnum ou pas
                                         global $mutli_crit_indexation_docnum_allfields;
                                         if ($var_table["is_num"]) {
                                             $mutli_crit_indexation_docnum_allfields = 1;
                                         } else {
                                             $mutli_crit_indexation_docnum_allfields = -1;
                                         }
                                     }
                                     //recherche par terme...
                                     if ($q[$z]["FIELDS"]) {
                                         $searcher = new $q[$z]['CLASS']($field[$j], $q[$z]["FIELDS"]);
                                     } else {
                                         $searcher = new $q[$z]['CLASS']($field[$j]);
                                     }
                                     $main = $searcher->get_full_query();
                                     //   							print "<br><br>".$main;
                                 } else {
                                     $main = str_replace("!!p!!", addslashes($field[$j]), $main);
                                 }
                             }
                         }
                     }
                     //Y-a-t-il une close repeat ?
                     if ($q[$z]["REPEAT"]) {
                         //Si oui, on repete !!
                         $onvals = $q[$z]["REPEAT"]["ON"];
                         global ${$onvals};
                         $onvalst = explode($q[$z]["REPEAT"]["SEPARATOR"], ${$onvals});
                         $mains = array();
                         for ($ir = 0; $ir < count($onvalst); $ir++) {
                             $mains[] = str_replace("!!" . $q[$z]["REPEAT"]["NAME"] . "!!", $onvalst[$ir], $main);
                         }
                         $main = implode(" " . $q[$z]["REPEAT"]["OPERATOR"] . " ", $mains);
                         $main = "select * from (" . $main . ") as sbquery" . ($q[$z]["REPEAT"]["ORDERTERM"] ? " order by " . $q[$z]["REPEAT"]["ORDERTERM"] : "");
                     }
                     if ($z < count($q) - 2) {
                         pmb_mysql_query($main);
                     }
                 }
                 if ($fieldvar["operator_between_multiple_authorities"]) {
                     $operator = $fieldvar["operator_between_multiple_authorities"][0];
                 } elseif ($q["DEFAULT_OPERATOR"]) {
                     $operator = $q["DEFAULT_OPERATOR"];
                 } else {
                     $operator = $pmb_multi_search_operator ? $pmb_multi_search_operator : "or";
                 }
                 if (count($field) > 1) {
                     if ($operator == "or") {
                         //Ou logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "insert ignore into " . $prefixe . "mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             } else {
                                 $requete = "insert ignore into mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             }
                             pmb_mysql_query($requete, $dbh);
                             //pmb_mysql_query("drop table mf_".$j,$dbh);
                             pmb_mysql_query("drop table " . $last_main_table, $dbh);
                         }
                         //else pmb_mysql_query("drop table mf_".$j,$dbh);
                         if ($prefixe) {
                             $last_main_table = $prefixe . "mf_" . $j;
                         } else {
                             $last_main_table = "mf_" . $j;
                         }
                     } elseif ($operator == "and") {
                         //ET logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "create temporary table " . $prefixe . "and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select " . $prefixe . "mf_" . $j . ".* from " . $prefixe . "mf_" . $j . " where " . $last_tables . ".notice_id=" . $prefixe . "mf_" . $j . ".notice_id)";
                             } else {
                                 $requete = "create temporary table and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select mf_" . $j . ".* from mf_" . $j . " where " . $last_tables . ".notice_id=mf_" . $j . ".notice_id)";
                             }
                             pmb_mysql_query($requete, $dbh);
                             pmb_mysql_query("drop table " . $last_tables, $dbh);
                         }
                         if ($prefixe) {
                             $last_tables = $prefixe . "mf_" . $j;
                         } else {
                             $last_tables = "mf_" . $j;
                         }
                         if ($prefixe) {
                             $last_main_table = $prefixe . "and_result_" . $j;
                         } else {
                             $last_main_table = "and_result_" . $j;
                         }
                     }
                 }
                 //else print $main;
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif (array_key_exists($s[0], $this->pp)) {
             $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"];
             $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])];
             $q_index = $df["QUERIES_INDEX"];
             $q = $df["QUERIES"][$q_index[${$op}]];
             //Choix du moteur
             if ($this->memory_engine_allowed && !$df['MEMORYENGINEFORBIDDEN']) {
                 $this->current_engine = 'MEMORY';
             } else {
                 $this->current_engine = 'MyISAM';
             }
             //Pour chaque valeur du champ
             $last_main_table = "";
             if (count($field) == 0) {
                 $field[0] = "";
             }
             for ($j = 0; $j < count($field); $j++) {
                 if ($q["KEEP_EMPTYWORD"]) {
                     $field[$j] = strip_empty_chars($field[$j]);
                 } elseif ($q["REGDIACRIT"]) {
                     $field[$j] = strip_empty_words($field[$j]);
                 }
                 $main = $q["MAIN"];
                 //Si il y a plusieurs termes possibles
                 if ($q["MULTIPLE_WORDS"]) {
                     $terms = explode(" ", $field[$j]);
                     //Pour chaque terme
                     $multiple_terms = array();
                     for ($k = 0; $k < count($terms); $k++) {
                         $mt = str_replace("!!p!!", addslashes($terms[$k]), $q["MULTIPLE_TERM"]);
                         $mt = str_replace("!!field!!", $s[1], $mt);
                         $multiple_terms[] = $mt;
                     }
                     $final_term = implode(" " . $q["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                     $main = str_replace("!!multiple_term!!", $final_term, $main);
                 } else {
                     $main = str_replace("!!p!!", addslashes($field[$j]), $main);
                 }
                 $main = str_replace("!!field!!", $s[1], $main);
                 if ($q["WORD"]) {
                     //recherche par terme...
                     $searcher = new $q['CLASS']($field[$j], $s[1]);
                     $main = $searcher->get_full_query();
                 }
                 //Choix de l'operateur dans la liste
                 if ($q["DEFAULT_OPERATOR"]) {
                     $operator = $q["DEFAULT_OPERATOR"];
                 } else {
                     $operator = $pmb_multi_search_operator ? $pmb_multi_search_operator : "or";
                 }
                 if (count($field) > 1) {
                     if ($operator == "or") {
                         //Ou logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "insert ignore into " . $prefixe . "mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             } else {
                                 $requete = "insert ignore into mf_" . $j . " select " . $last_main_table . ".* from " . $last_main_table;
                             }
                             pmb_mysql_query($requete, $dbh);
                             //pmb_mysql_query("drop table mf_".$j,$dbh);
                             pmb_mysql_query("drop table " . $last_main_table, $dbh);
                         }
                         //else pmb_mysql_query("drop table mf_".$j,$dbh);
                         if ($prefixe) {
                             $last_main_table = $prefixe . "mf_" . $j;
                         } else {
                             $last_main_table = "mf_" . $j;
                         }
                     } elseif ($operator == "and") {
                         //ET logique si plusieurs valeurs
                         if ($prefixe) {
                             $requete = "create temporary table " . $prefixe . "mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table " . $prefixe . "mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         } else {
                             $requete = "create temporary table mf_" . $j . " ENGINE=" . $this->current_engine . " " . $main;
                             @pmb_mysql_query($requete, $dbh);
                             $requete = "alter table mf_" . $j . " add idiot int(1)";
                             @pmb_mysql_query($requete);
                             $requete = "alter table mf_" . $j . " add unique({$field_keyName})";
                             @pmb_mysql_query($requete);
                         }
                         if ($last_main_table) {
                             if ($prefixe) {
                                 $requete = "create temporary table " . $prefixe . "and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select " . $prefixe . "mf_" . $j . ".* from " . $prefixe . "mf_" . $j . " where " . $last_tables . ".notice_id=" . $prefixe . "mf_" . $j . ".notice_id)";
                             } else {
                                 $requete = "create temporary table and_result_" . $j . " ENGINE=" . $this->current_engine . " select " . $last_tables . ".* from " . $last_tables . " where exists ( select mf_" . $j . ".* from mf_" . $j . " where " . $last_tables . ".notice_id=mf_" . $j . ".notice_id)";
                             }
                             pmb_mysql_query($requete, $dbh);
                             pmb_mysql_query("drop table " . $last_tables, $dbh);
                         }
                         if ($prefixe) {
                             $last_tables = $prefixe . "mf_" . $j;
                         } else {
                             $last_tables = "mf_" . $j;
                         }
                         if ($prefixe) {
                             $last_main_table = $prefixe . "and_result_" . $j;
                         } else {
                             $last_main_table = "and_result_" . $j;
                         }
                     }
                 }
                 //else print $main;
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif ($s[0] == "s") {
             //instancier la classe de traitement du champ special
             $type = $this->specialfields[$s[1]]["TYPE"];
             for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) {
                 if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) {
                     $sf = $this->specialfields[$s[1]];
                     require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php";
                     $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $i, $sf, $this);
                     $last_main_table = $specialclass->make_search();
                     break;
                 }
             }
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         } elseif ($s[0] == "authperso") {
             $aq = new analyse_query($field[0], 0, 0, 1, 1, $opac_stemming_active);
             $members = $aq->get_query_members("authperso_authorities", "authperso_infos_global", "authperso_index_infos_global", "id_authperso_authority");
             $clause = "where " . $members["where"] . " and notice_id=notice_authperso_notice_num and notice_authperso_authority_num=id_authperso_authority and authperso_authority_authperso_num=" . $s[1];
             $main = "select distinct notice_id FROM notices,notices_authperso,authperso_authorities {$clause} ";
             if ($last_main_table) {
                 $main = "select * from " . $last_main_table;
             }
         }
         if ($prefixe) {
             $table = $prefixe . "t_" . $i . "_" . $search[$i];
             $requete = "create temporary table " . $prefixe . "t_" . $i . "_" . $search[$i] . " ENGINE=" . $this->current_engine . " " . $main;
             pmb_mysql_query($requete, $dbh);
             $requete = "alter table " . $prefixe . "t_" . $i . "_" . $search[$i] . " add idiot int(1)";
             @pmb_mysql_query($requete);
             $requete = "alter table " . $prefixe . "t_" . $i . "_" . $search[$i] . " add unique({$field_keyName})";
             pmb_mysql_query($requete);
         } else {
             $table = "t_" . $i . "_" . $search[$i];
             $requete = "create temporary table t_" . $i . "_" . $search[$i] . " ENGINE=" . $this->current_engine . " " . $main;
             pmb_mysql_query($requete, $dbh);
             $requete = "alter table t_" . $i . "_" . $search[$i] . " add idiot int(1)";
             @pmb_mysql_query($requete);
             $requete = "alter table t_" . $i . "_" . $search[$i] . " add unique({$field_keyName})";
             pmb_mysql_query($requete);
         }
         if ($last_main_table) {
             $requete = "drop table " . $last_main_table;
             pmb_mysql_query($requete);
         }
         if ($prefixe) {
             $requete = "create temporary table " . $prefixe . "t" . $i . " ENGINE=" . $this->current_engine . " ";
         } else {
             $requete = "create temporary table t" . $i . " ENGINE=" . $this->current_engine . " ";
         }
         $isfirst_criteria = false;
         switch (${$inter}) {
             case "and":
                 $requete .= "select " . $table . ".* from {$last_table},{$table} where " . $table . ".{$field_keyName}=" . $last_table . ".{$field_keyName} and {$table}.idiot is null and {$last_table}.idiot is null";
                 @pmb_mysql_query($requete, $dbh);
                 break;
             case "or":
                 //Si la table précédente est vide, c'est comme au premier jour !
                 $requete_c = "select count(*) from " . $last_table;
                 if (!@pmb_mysql_result(pmb_mysql_query($requete_c), 0, 0)) {
                     $isfirst_criteria = true;
                 } else {
                     $requete .= "select * from " . $table;
                     @pmb_mysql_query($requete, $dbh);
                     if ($prefixe) {
                         $requete = "alter table " . $prefixe . "t" . $i . " add idiot int(1)";
                         @pmb_mysql_query($requete);
                         $requete = "alter table " . $prefixe . "t" . $i . " add unique({$field_keyName})";
                         @pmb_mysql_query($requete);
                     } else {
                         $requete = "alter table t" . $i . " add idiot int(1)";
                         @pmb_mysql_query($requete);
                         $requete = "alter table t" . $i . " add unique({$field_keyName})";
                         @pmb_mysql_query($requete);
                     }
                     if ($prefixe) {
                         $requete = "insert into " . $prefixe . "t" . $i . " ({$field_keyName},idiot) select distinct " . $last_table . "." . $field_keyName . "," . $last_table . ".idiot from " . $last_table . " left join " . $table . " on " . $last_table . ".{$field_keyName}=" . $table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                     } else {
                         $requete = "insert into t" . $i . " ({$field_keyName},idiot) select distinct " . $last_table . "." . $field_keyName . "," . $last_table . ".idiot from " . $last_table . " left join " . $table . " on " . $last_table . ".{$field_keyName}=" . $table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                         //print $requete;
                     }
                     @pmb_mysql_query($requete, $dbh);
                 }
                 break;
             case "ex":
                 //$requete_not="create temporary table ".$table."_b select notices.notice_id from notices left join ".$table." on notices.notice_id=".$table.".notice_id where ".$table.".notice_id is null";
                 //@pmb_mysql_query($requete_not);
                 //$requete_not="alter table ".$table."_b add idiot int(1), add unique(notice_id)";
                 //@pmb_mysql_query($requete_not);
                 $requete .= "select " . $last_table . ".* from {$last_table} left join " . $table . " on " . $table . ".{$field_keyName}=" . $last_table . ".{$field_keyName} where " . $table . ".{$field_keyName} is null";
                 @pmb_mysql_query($requete);
                 //$requete="drop table ".$table."_b";
                 //@pmb_mysql_query($requete);
                 if ($prefixe) {
                     $requete = "alter table " . $prefixe . "t" . $i . " add idiot int(1)";
                     @pmb_mysql_query($requete);
                     $requete = "alter table " . $prefixe . "t" . $i . " add unique({$field_keyName})";
                     @pmb_mysql_query($requete);
                 } else {
                     $requete = "alter table t" . $i . " add idiot int(1)";
                     @pmb_mysql_query($requete);
                     $requete = "alter table t" . $i . " add unique({$field_keyName})";
                     @pmb_mysql_query($requete);
                 }
                 break;
             default:
                 $isfirst_criteria = true;
                 @pmb_mysql_query($requete, $dbh);
                 $requete = "alter table {$table} add idiot int(1)";
                 @pmb_mysql_query($requete);
                 $requete = "alter table {$table} add unique({$field_keyName})";
                 @pmb_mysql_query($requete);
                 break;
         }
         if (!$isfirst_criteria) {
             pmb_mysql_query("drop table if exists {$last_table}", $dbh);
             pmb_mysql_query("drop table if exists {$table}", $dbh);
             if ($prefixe) {
                 $last_table = $prefixe . "t" . $i;
             } else {
                 $last_table = "t" . $i;
             }
         } else {
             pmb_mysql_query("drop table if exists {$last_table}", $dbh);
             $last_table = $table;
         }
     }
     return $last_table;
 }
コード例 #7
0
ファイル: misc.inc.php プロジェクト: hogsim/PMB
function detectFormatDate($date_a_convertir, $compl = "01")
{
    global $msg;
    if (preg_match("#\\d{4}-\\d{2}-\\d{2}#", $date_a_convertir)) {
        $date = $date_a_convertir;
    } else {
        if (preg_match(getDatePattern(), $date_a_convertir)) {
            $date = extraitdate($date_a_convertir);
        } elseif (preg_match(getDatePattern("short"), $date_a_convertir)) {
            $format = str_replace("%", "", $msg["format_date_short"]);
            $format = str_replace("-", "", $format);
            $format = str_replace("/", "", $format);
            $format = str_replace("\\", "", $format);
            $format = str_replace(".", "", $format);
            $format = str_replace(" ", "", $format);
            $format = str_replace($msg["format_date_input_separator"], "", $format);
            list($date[substr($format, 0, 1)], $date[substr($format, 1, 1)], $date[substr($format, 2, 1)]) = sscanf($date_a_convertir, $msg["format_date_short_input"]);
            if ($date['Y'] && $date['m']) {
                if ($compl == "min") {
                    $date = sprintf("%04d-%02d-%02s", $date['Y'], $date['m'], "01");
                } elseif ($compl == "max") {
                    $date = sprintf("%04d-%02d-%02s", $date['Y'], $date['m'], date("t", mktime(0, 0, 0, $date['m'], 1, $date['Y'])));
                } else {
                    $date = sprintf("%04d-%02d-%02s", $date['Y'], $date['m'], $compl);
                }
            } else {
                $date = "0000-00-00";
            }
        } elseif (preg_match(getDatePattern("year"), $date_a_convertir, $matches)) {
            if ($compl == "min") {
                $date = $matches[0] . "-01-01";
            } elseif ($compl == "max") {
                $date = $matches[0] . "-12-31";
            } else {
                $date = $matches[0] . "-" . $compl . "-" . $compl;
            }
        } else {
            $format = str_replace("%", ".", $msg["format_date"]);
            $format = str_replace("-", "", $format);
            $format = str_replace("/", "", $format);
            $format = str_replace("\\", "", $format);
            $format = str_replace(".", "", $format);
            $format = str_replace(" ", "", $format);
            $pattern = array();
            for ($i = 0; $i < strlen($format); $i++) {
                switch ($format[$i]) {
                    case "m":
                    case "d":
                        $pattern[$i] = '\\d{1,2}';
                        break;
                    case "Y":
                        $pattern[$i] = '(\\d{2})';
                        break;
                }
            }
            if (preg_match("#" . implode($pattern, ".") . "#", $date_a_convertir, $matches)) {
                if (substr(date("Y"), 2, 2) < $matches['1']) {
                    $correct_year = substr(date("Y"), 0, 2) * 1 - 1 . $matches[1];
                } else {
                    $correct_year = substr(date("Y"), 0, 2) . $matches[1];
                }
                if (substr($format, -1) == "Y") {
                    $date = detectFormatDate(substr($date_a_convertir, 0, -2) . $correct_year, $compl);
                }
            } else {
                $date = "0000-00-00";
            }
        }
    }
    return $date;
}
コード例 #8
0
 static function get_date_parution($annee)
 {
     return detectFormatDate($annee);
 }
コード例 #9
0
 public function save()
 {
     global $include_path;
     global $dbh;
     if ($this->id) {
         $query = "update ";
         $where = " where id_faq_question = " . $this->id;
     } else {
         $query = "insert into ";
         $where = "";
     }
     $query .= "faq_questions set ";
     $query .= "faq_question_num_type = " . $this->num_type . ",";
     $query .= "faq_question_num_theme = " . $this->num_theme . ",";
     $query .= "faq_question_num_demande = " . $this->num_demande . ",";
     $query .= "faq_question_question = '" . addslashes($this->question) . "',";
     $query .= "faq_question_question_date = '" . addslashes($this->question_date) . "',";
     $query .= "faq_question_question_userdate = '" . addslashes(detectFormatDate($this->question_userdate)) . "',";
     $query .= "faq_question_answer = '" . addslashes($this->answer) . "',";
     $query .= "faq_question_answer_userdate = '" . addslashes($this->answer_userdate) . "',";
     $query .= "faq_question_answer_date = '" . addslashes(detectFormatDate($this->answer_userdate)) . "',";
     $query .= "faq_question_statut = " . $this->statut . "";
     $result = pmb_mysql_query($query . $where, $dbh);
     if (!$this->id) {
         $this->id = pmb_mysql_insert_id($dbh);
     }
     if ($result) {
         $query = "delete from faq_questions_categories where num_faq_question = " . $this->id;
         $result = pmb_mysql_query($query, $dbh);
         if ($result) {
             $query = "insert into faq_questions_categories (num_faq_question,num_categ,categ_order) values ";
             $insert = "";
             for ($i = 0; $i < count($this->descriptors); $i++) {
                 if ($insert) {
                     $insert .= ", ";
                 }
                 $insert .= "(" . $this->id . "," . $this->descriptors[$i] . "," . $i . ")";
             }
             if ($insert) {
                 $result = pmb_mysql_query($query . $insert, $dbh);
             }
         }
     }
     if ($result) {
         $xmlpath = $include_path . "/indexation/faq/question.xml";
         $index = new indexation($xmlpath, "faq_questions");
         $index->maj($this->id);
     }
     return $result;
 }
コード例 #10
0
ファイル: metasMapper.class.php プロジェクト: hogsim/PMB
 public function get_notice_id($metas, $mimetype = "", $name = "")
 {
     global $pmb_keyword_sep;
     $this->metas = $metas;
     $this->mimetype = $mimetype;
     $this->name = $name;
     $notice_id = 0;
     $this->data = array();
     $this->data['tit1'] = $this->data['tit4'] = $this->data['authors'] = $this->data['co_authors'] = $this->data['code'] = $this->data['npages'] = $this->data['year'] = $this->data['index_l'] = $this->data['url'] = $this->data['thumbnail_content'] = $this->data['publisher'] = $this->data['n_resume'] = "";
     if ($this->mimetype == "application/epub+zip") {
         //pour les ebook, on gère ca directement ici !
         $this->data['tit1'] = $this->metas['title'][0];
         $this->data['authors'] = $this->metas['creator'];
         $this->data['co_authors'] = $this->metas['contributor'];
         if ($this->metas['identifier']['isbn']) {
             $this->data['code'] = \formatISBN($this->metas['identifier']['isbn'], 13);
         } else {
             if ($this->metas['identifier']['ean']) {
                 $this->data['code'] = \EANtoISBN($this->metas['identifier']['ean']);
                 $this->data['code'] = \formatISBN($code, 13);
             }
         }
         if ($this->metas['identifier']['uri']) {
             $this->data['url'] = \clean_string($this->metas['identifier']['uri']);
         }
         $this->data['publisher'] = $this->metas['publisher'][0];
         $this->data['year'] = $this->metas['date'][0]['value'];
         if (strlen($this->data['year']) && strlen($this->data['year']) != 4) {
             $this->data['year'] = \formatdate(detectFormatDate($this->data['year']));
         }
         $this->data['lang'] = $this->metas['language'];
         $this->data['n_resume'] = implode("\n", $this->metas['description']);
         $this->data['keywords'] = implode($pmb_keyword_sep, $this->metas['subject']);
         $this->data['thumbnail_content'] = $this->metas['thumbnail_content'];
     } else {
         $this->exec_map();
     }
     if (!$this->data['tit1']) {
         $this->data['tit1'] = $this->name;
     }
     $notice_id = $this->create_notice();
     $notice_id = $this->dedoublonne($notice_id);
     // Indexation
     \notice::majNoticesTotal($notice_id);
     return $notice_id;
 }
コード例 #11
0
ファイル: Collection.php プロジェクト: bouchra012/PMB
 function get_notice_by_meta($name, $filename)
 {
     global $pmb_keyword_sep;
     global $pmb_type_audit;
     global $webdav_current_user_name, $webdav_current_user_id;
     \create_tableau_mimetype();
     $mimetype = \trouve_mimetype($filename, extension_fichier($name));
     $notice_id = 0;
     $title = $cplt = $code = $pages = $year = $keywords = $url = $thumbnail_content = "";
     //on commence avec la gymnatisque des métas...
     if ($mimetype == "application/epub+zip") {
         //pour les ebook, on gère ca directement ici !
         $epub = new \epubData(realpath($filename));
         $title = $epub->metas['title'][0];
         $authors = $epub->metas['creator'];
         $co_authors = $epub->metas['contributor'];
         if ($epub->metas['identifier']['isbn']) {
             $code = \formatISBN($epub->metas['identifier']['isbn'], 13);
         } else {
             if ($epub->metas['identifier']['ean']) {
                 $code = \EANtoISBN($epub->metas['identifier']['ean']);
                 $code = \formatISBN($code, 13);
             }
         }
         if ($epub->metas['identifier']['uri']) {
             $url = \clean_string($epub->metas['identifier']['uri']);
         }
         $publisher = $epub->metas['publisher'][0];
         $year = $epub->metas['date'][0]['value'];
         if (strlen($year) && strlen($year) != 4) {
             $year = \formatdate(detectFormatDate($year));
         }
         $lang = $epub->metas['language'];
         $resume = implode("\n", $epub->metas['description']);
         $keywords = implode($pmb_keyword_sep, $epub->metas['subject']);
         //jouons à et si on trouvait a vignette...
         $img = imagecreatefromstring($epub->getCoverContent());
         $file = tempnam(sys_get_temp_dir(), "vign");
         imagepng($img, $file);
         $thumbnail_content = file_get_contents($file);
         unlink($file);
     } else {
         $metas = \extract_metas(realpath($filename), $mimetype);
         if ($metas['Title'] && $metas['Author'] && $metas['Subject']) {
             $title = $metas['Title'];
             $author = $metas['Author'];
             $cplt = $metas['Subject'];
         } else {
             // métas non fiable, on regarde avec le titre...
             $title = $name;
         }
         //date de création...
         if ($metas["CreateDate"]) {
             $year = substr($metas["CreateDate"], 0, 4);
         }
         //pages
         if ($metas['PageCount']) {
             $pages = $metas['PageCount'];
         }
         //keywords
         if ($metas['Keywords']) {
             foreach ($metas['Keywords'] as $keyword) {
                 if ($keywords != "") {
                     $keywords .= $pmb_keyword_sep;
                 }
                 $keywords .= $keyword;
             }
         }
     }
     $query = "select notice_id from notices where tit1 = '" . addslashes($title) . "'";
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $notice_id = mysql_result($result, 0, 0);
     }
     if (!$notice_id) {
         //en cas d'une leture moyenne des infos, on s'assure d'avoir au moins un titre....
         if (!$title) {
             $title = $name;
         }
         if ($publisher) {
             $ed_1 = \editeur::import(array('name' => $publisher));
         } else {
             $ed_1 = 0;
         }
         $ind_wew = $title . " " . $cplt;
         $ind_sew = \strip_empty_words($ind_wew);
         $query = "insert into notices set \n\t\t\t\ttit1 = '" . addslashes($title) . "'," . ($code ? "code='" . $code . "'," : "") . "ed1_id = '" . $ed_1 . "'," . ($cplt ? "tit4 = '" . addslashes($cplt) . "'," : "") . ($pages ? "npages = '" . addslashes($pages) . "'," : "") . ($keywords ? "index_l = '" . addslashes($keywords) . "'," : "") . "\n\t\t\t\tyear = '" . $year . "',\n\t\t\t\tniveau_biblio='m', \n\t\t\t\tniveau_hierar='0',\n\t\t\t\tstatut = '" . $this->config['default_statut'] . "',\n\t\t\t\tindex_wew = '" . $ind_wew . "',\n\t\t\t\tindex_sew = '" . $ind_sew . "',\n\t\t\t\tn_resume = '" . addslashes($resume) . "',\n\t\t\t\tlien = '" . addslashes($url) . "',\n\t\t\t\tindex_n_resume = '" . \strip_empty_words($resume) . "'," . ($thumbnail_content ? "thumbnail_url = 'data:image/png;base64," . base64_encode($thumbnail_content) . "'," : "") . "create_date = sysdate(), \n\t\t\t\tupdate_date = sysdate()";
         mysql_query($query);
         $notice_id = mysql_insert_id();
         $sign = new \notice_doublon();
         mysql_query("update notices set signature = '" . $sign->gen_signature($notice_id) . "' where notice_id = " . $notice_id);
         //traitement audit
         if ($pmb_type_audit) {
             $query = "INSERT INTO audit SET ";
             $query .= "type_obj='1', ";
             $query .= "object_id='{$notice_id}', ";
             $query .= "user_id='{$webdav_current_user_id}', ";
             $query .= "user_name='{$webdav_current_user_name}', ";
             $query .= "type_modif=1 ";
             $result = @mysql_query($query);
         }
         if (count($authors)) {
             $i = 0;
             foreach ($authors as $author) {
                 $aut = array();
                 if ($author['file-as']) {
                     $infos = explode(",", $author['file-as']);
                     $aut = array('name' => $infos[0], 'rejete' => $infos[1], 'type' => 70);
                 }
                 if (!$aut['name']) {
                     $aut = array('name' => $author['value'], 'type' => 70);
                 }
                 $aut_id = \auteur::import($aut);
                 if ($aut_id) {
                     $query = "insert into responsability set \n\t\t\t\t\t\t\tresponsability_author = '" . $aut_id . "',\n\t\t\t\t\t\t\tresponsability_notice = '" . $notice_id . "',\n\t\t\t\t\t\t\tresponsability_type = '0'";
                     mysql_query($query);
                     $i++;
                 }
             }
         }
         if (count($co_authors)) {
             foreach ($co_authors as $author) {
                 $aut = array();
                 if ($author['file-as']) {
                     $infos = explode(",", $author['file-as']);
                     $aut = array('name' => $infos[0], 'rejete' => $infos[1], 'type' => 70);
                 }
                 if (!$aut['name']) {
                     $aut = array('name' => $author['value'], 'type' => 70);
                 }
                 $aut_id = \auteur::import($aut);
                 if ($aut_id) {
                     $query = "insert into responsability set \n\t\t\t\t\t\t\tresponsability_author = '" . $aut_id . "',\n\t\t\t\t\t\t\tresponsability_notice = '" . $notice_id . "',\n\t\t\t\t\t\t\tresponsability_type = '0',\n\t\t\t\t\t\t\trepsonsability_ordre = '" . $i . "'";
                     mysql_query($query);
                     $i++;
                 }
             }
         }
     }
     return $notice_id;
 }