\n"; $lignes = organize_line($fields); foreach($lignes as $champ=>$value) { switch($champ){ case '%T': //Titre principal $titre = $value; break; case '%B': //Autre info sur titre $titre_other = $value; break; case '%Q': //Autre info sur titre $titre_parallel = $value; break; case '%C': //Editeur $editeur_ville = $value; break; case '%Y': case '%A': //Autres auteurs $autres_auteurs = $value; break; case '%E': //Auteur secondaire $auteur_secondaire = $value; break; case '%@': //ISBN/ISSN $code = $value; if(isISBN($code)){ $infos_isbn=$code; } elseif(isISSN($code)){ $infos_issn=$code; } else $error = "wrong ISBN/ISSN \n"; break; case '%U': //URL $url = $value; break; case '%D': //Date de publication (YYYY/MM/DD) $dates = explode("/",$value); if($dates[0]) $year = $dates[0]; if($dates[1]) $month = $dates[1]; if($dates[2]) $day = $dates[2]; $publication_date = $year; if($year && $month && $day){ $date_sql = str_replace("/","-",$value); $mention_date = $value; } else if($year && $month && !$day){ $date_sql = $year."-".$month."-01"; $mention_date = $year."/".$month; } else if($year && !$month && !$day){ $date_sql = $year."-01-01"; $mention_date = $year; } break; case '%0': /*switch($value){ case 'Book': case 'Edited Book': case 'Electronic Book': $subtype='Book'; break; case 'Computer Program': $subtype='Computing Program'; break; case 'Conference Proceedings': case 'Conference Paper': $subtype='Conference Proceedings'; break; case 'Unpublished Work': $subtype='Preprint'; break; case 'Online Multimedia': $subtype='Interactive Multimedia'; break; case 'Journal Article': case 'Magazine Article': case 'Electronic Article': case 'Newspaper Article': $subtype='Article'; break; case 'Map': $subtype='Map'; break; case 'Report': $subtype='Report'; break; case 'Online Database': $subtype='Database'; break; case 'Thesis': $subtype='Thesis'; break; default : $subtype='Article'; break; } */ //Document type $subtype=$value; break; case '%Z': //Notes $notes = $value; break; case '%P': //End page $page = $value; break; case '%K': //Mots cles $keywords = $value; break; case '%+': //Collectivite $collectivite = $value; break; case '%N': //Numéro de bulletin $bull_num = $value; break; case '%V': //Volume $bull_vol = $value; break; case '%X': //Résumé $resume = $value; break; case '%J': //Titre du pério $perio_title = $value; break; case '%G': $langue = $value; break; case '%M': $id_endnote = $value; break; case '%I': $publisher = $value; break; default: $data .= ''; break; } } //Construction du fichier $data.= "n
a
a 2 1 i\n"; $data.="\n"; $data.=htmlspecialchars($id_endnote,ENT_QUOTES,$charset); $data.="\n"; if($infos_isbn){ $data.="\n"; $data.=" ".htmlspecialchars($infos_isbn,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($infos_issn){ $data.="\n"; $data.=" ".htmlspecialchars($infos_issn,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($langue){ $data.="\n"; $data.=" ".htmlspecialchars($langue,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($titre){ $data.="\n"; $data.=" ".htmlspecialchars($titre,ENT_QUOTES,$charset).""; if($titre_other) $data.=" ".htmlspecialchars($titre_other,ENT_QUOTES,$charset).""; if($titre_parallel) $data.=" ".htmlspecialchars($titre_parallel,ENT_QUOTES,$charset).""; $data.="\n"; } if($publisher){ $data.="\n"; $data.=" ".htmlspecialchars($publisher,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($page){ $data.="\n"; if($page) $data.=" ".htmlspecialchars($page,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($notes){ $note = explode('###',$notes); $doi =""; $pubmedid = ""; for($i=0;$i 9000){ $word =wordwrap($note[$i],9000,"####"); $words = explode("####",$word); for($j=0;$j\n"; $data.="\n"; } } else { $data.="\n"; $data.=" ".htmlspecialchars($note[$i],ENT_QUOTES,$charset)."\n"; $data.="\n"; } } } } if($resume){ $data.="\n"; $data.=" ".htmlspecialchars($resume,ENT_QUOTES,$charset)."\n"; $data.="\n"; } if($perio_title){ $data.="\n"; $data.=" ".htmlspecialchars($perio_title,ENT_QUOTES,$charset)."\n"; if($infos_issn) $data.=" ".htmlspecialchars($infos_issn,ENT_QUOTES,$charset)."\n"; $data.=" lnk:perio\n"; $data.="\n"; } if($bull_num || $bull_vol){ $data.="\n"; if($bull_num && $bull_vol) $data.=" "."vol. ".htmlspecialchars($bull_vol,ENT_QUOTES,$charset).", no. ".htmlspecialchars($bull_num,ENT_QUOTES,$charset)."\n"; else if($bull_num && !$bull_vol) $data.=" no. ".htmlspecialchars($bull_num,ENT_QUOTES,$charset)."\n"; else if(!$bull_num && $bull_vol) $data.=" vol. ".htmlspecialchars($bull_vol,ENT_QUOTES,$charset)."\n"; if($date_sql) $data.=" ".htmlspecialchars($date_sql,ENT_QUOTES,$charset)."\n"; if($mention_date) $data.=" ".htmlspecialchars($mention_date,ENT_QUOTES,$charset)."\n"; $data.=" lnk:bull\n"; $data.="\n"; } if($keywords){ $mots = explode('###',$keywords); for($i=0;$i\n"; $data.="\n"; } } if($collectivite){ $collectivites = explode("###",$collectivite); if((count($collectivites) == 1)) { $coll_elt = explode(", ",$collectivites[0],3); $coll_infos = explode(", ",$coll_elt[2],2); $coll_nom = $coll_infos[0]; $coll_pays = trim(substr($coll_infos[1],(strrpos($coll_infos[1],", ")+1))); $coll_lieu = trim(substr($coll_infos[1],0,-(strlen($coll_pays)+2))); $data.="\n"; $data.=" ".htmlspecialchars($coll_nom,ENT_QUOTES,$charset)."\n"; $data.=" ".htmlspecialchars($coll_lieu,ENT_QUOTES,$charset)."\n"; $data.=" ".htmlspecialchars($coll_pays,ENT_QUOTES,$charset)."\n"; $data.="\n"; } else { for($i=0;$i\n"; $data.=" ".htmlspecialchars($coll_lieu,ENT_QUOTES,$charset)."\n"; $data.=" ".htmlspecialchars($coll_pays,ENT_QUOTES,$charset)."\n"; $data.="\n"; } } } if($autres_auteurs){ $others = explode("###",$autres_auteurs); for($i=0;$i\n"; $data.=" ".htmlspecialchars($aut[1],ENT_QUOTES,$charset)."\n"; if($aut[2]) $data.=" ".htmlspecialchars($aut[2],ENT_QUOTES,$charset)."\n"; $data.="\n"; } } if($auteur_secondaire){ $secs = explode("###",$auteur_secondaire); for($i=0;$i\n"; $data.=" ".htmlspecialchars($aut[1],ENT_QUOTES,$charset)."\n"; if($aut[2]) $data.=" ".htmlspecialchars($aut[2],ENT_QUOTES,$charset)."\n"; $data.="\n"; } } if($url){ $data.="\n"; $data.=" ".htmlspecialchars($url,ENT_QUOTES,$charset).""; $data.="\n"; } if($subtype){ $data.="\n"; $data.=" ".htmlspecialchars($subtype,ENT_QUOTES,$charset)."\n"; $data.=" Sub-Type\n"; $data.=" subtype\n"; $data.="\n"; } $data .= "\n"; if (!$error) $r['VALID'] = true; else $r['VALID']=false; $r['ERROR'] = $error; $r['DATA'] = $data; return $r; } ?>