/[ludap]/ludap/www/xml.php
ViewVC logotype

Diff of /ludap/www/xml.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mose, Sun Sep 7 05:38:09 2003 UTC revision 1.4 by mose, Sat Sep 13 09:09:24 2003 UTC
# Line 34  require_once('../setup.php'); Line 34  require_once('../setup.php');
34  $S->display('header.tpl');  $S->display('header.tpl');
35  $S->display('topbar.tpl');  $S->display('topbar.tpl');
36  $S->display("xml_topnav.tpl");  $S->display("xml_topnav.tpl");
37  if ($xmlaction == 'importer') {  if ($xmlaction == 'importer xml') {
38          if ($xmlimport) {          if ($xmlimport) {
39                  $xfile = utf8_encode(implode('',file($xmlimport["tmp_name"])));                  $xfile = implode('',file($xmlimport["tmp_name"]));
40                    $xfile = str_replace('&','&',$xfile);
41                  $obj = domxml_xmltree($xfile);                  $obj = domxml_xmltree($xfile);
42                  $xmltree = $L->xml2array($obj);                  $xmltree = $L->xml2array($obj);
43                  array_shift($xmltree);                  array_shift($xmltree);
# Line 50  if ($xmlaction == 'importer') { Line 51  if ($xmlaction == 'importer') {
51                  }                  }
52          }          }
53  //echo'<pre>';print_r(get_defined_vars());echo'</pre>';  //echo'<pre>';print_r(get_defined_vars());echo'</pre>';
54            } elseif        ($xmlaction == 'importer csv') {
55            if ($xmlimport) {
56                    $fp = fopen($xmlimport["tmp_name"],'r');
57                    $headed = substr(fgets($fp,4096),1);
58                    $head = split('","',$headed);
59                    $nbhead = count($head) - 1;
60                    while (!feof($fp)) {
61                            $insert = array();
62                            $lined = substr(fgets($fp,4096),1);
63                            if (trim($lined)) {
64                                    $line = split('","',$lined);
65                                    for ($i=0;$i<$nbhead;$i++) {
66                                            $it = $head[$i];
67                                            if ($line[$i]) {
68                                                    $insert[$it] = $line[$i];
69                                            }
70                                    }
71                                    if ($insert['cn'] == "Abonné lettre") {
72                                            $insert['cn'] = $insert['mail'];
73                                    } elseif ($insert['cn'] == "Nouveau") {
74                                            $insert = false;
75                                    }
76                                    if ($insert) {
77                                            echo "<pre>";print_r($insert);echo "</pre>";    
78                                            $mes = $L->write_id($insert);
79                                            if (is_array($mes)) {
80                                                    echo implode("<br>",$mes)."<hr>";
81                                            } else {
82                                                    echo $mes."<hr>";
83                                            }
84                                    }
85                            }
86                    }
87            }
88  } elseif ($xmltype and $xmltype == 'ludap') {  } elseif ($xmltype and $xmltype == 'ludap') {
89          $info = $L->get_users_list(array_keys($L->schema_user),$search,20,0,20);          $info = $L->get_users_list(array_keys($L->schema_user),$search,20,0,20);
90          $S->assign('info', $info);          $S->assign('info', $info);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26