1 | <?php |
---|
2 | // +-------------------------------------------------+ |
---|
3 | // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) |
---|
4 | // +-------------------------------------------------+ |
---|
5 | // $Id: input_iso_2709.inc.php,v 1.9 2015-04-03 11:16:25 jpermanne Exp $ |
---|
6 | |
---|
7 | if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access"); |
---|
8 | |
---|
9 | function _get_n_notices_($fi,$file_in,$input_params,$origine="") { |
---|
10 | //pmb_mysql_query("delete from import_marc"); |
---|
11 | global $charset; |
---|
12 | global $output_params; |
---|
13 | $index=array(); |
---|
14 | $n=1; |
---|
15 | eval("\$car=chr(".$input_params['ENDCHAR'].");"); |
---|
16 | $i=false; |
---|
17 | $notice=""; |
---|
18 | $notices=""; |
---|
19 | while (!feof($fi)) { |
---|
20 | $notices.=fread($fi,4096); |
---|
21 | $i=strpos($notices,$car); |
---|
22 | while ($i!==false) { |
---|
23 | $notice=substr($notices,0,$i+1); |
---|
24 | $t=array(); |
---|
25 | $t['POS']=$n_; |
---|
26 | $t['LENGHT']=$i+1; |
---|
27 | $requete="insert into import_marc (no_notice, notice, origine) values($n,'".addslashes($notice)."','$origine')"; |
---|
28 | pmb_mysql_query($requete); |
---|
29 | $index[]=$t; |
---|
30 | if($n==1){ |
---|
31 | $iso=new iso2709_record($notice); |
---|
32 | $output_params["CHARSET"]=$iso->is_utf8?"utf-8":$charset; |
---|
33 | } |
---|
34 | $n++; |
---|
35 | $notices=substr($notices,$i+1); |
---|
36 | $i=strpos($notices,$car); |
---|
37 | } |
---|
38 | } |
---|
39 | if ($notices!="") { |
---|
40 | $notice=$notices; |
---|
41 | $t=array(); |
---|
42 | $t['POS']=$n_; |
---|
43 | $t['LENGHT']=$i+1; |
---|
44 | $requete="insert into import_marc (no_notice, notice, origine) values($n,'".addslashes($notice)."','$origine')"; |
---|
45 | pmb_mysql_query($requete); |
---|
46 | $index[]=$t; |
---|
47 | $n++; |
---|
48 | } |
---|
49 | return $index; |
---|
50 | } |
---|