Add csv type and check for it

This commit is contained in:
Miles Lott 2001-03-20 18:14:46 +00:00
parent b6b282ab36
commit e6cea5377d
4 changed files with 16 additions and 10 deletions

View File

@ -93,7 +93,7 @@
$buffer = $o->import_end_record($buffer,$private);
}
}
} else {
} elseif ($o->type == 'ldif') {
while ($data = fgets($fp,8000)) {
list($name,$value,$url) = split(':', $data);
if (substr($name,0,2) == 'dn') {
@ -117,15 +117,25 @@
$buffer = $o->import_end_record($buffer,$private);
}
}
} else {
$buffer = $o->import_start_record($buffer);
while ($data = fgets($fp,8000)) {
list($name,$value) = split(':', $data);
if ($o->import[$name] != "" && $value != "") {
$buffer = $o->import_new_attrib($buffer, $o->import[$name],$value);
}
}
$buffer = $o->import_end_record($buffer,$private);
}
fclose($fp);
$buffer = $o->import_end_file($buffer);
if ($download == "") {
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" ) {
header("Content-disposition: attachment; filename=\"conversion.txt\"");
header("Content-type: application/octetstream");
header("Content-length: ".strlen($buffer));
header("Pragma: no-cache");
header("Expires: 0");
echo $buffer;

View File

@ -25,7 +25,7 @@
class import_conv
{
var $type = '';
var $type = 'csv';
var $basedn;
var $contactsdn;

View File

@ -25,7 +25,7 @@
class import_conv
{
var $type = '';
var $type = 'csv';
var $currentrecord; //used for buffering to allow uid lines to go first
var $import = array(

View File

@ -83,17 +83,13 @@
global $phpgw,$phpgw_info;
$contacts = CreateObject("phpgwapi.contacts");
//echo '<br>';
echo '<br>';
for ($i=1;$i<=count($buffer);$i++) {
while ( list($name,$value) = @each($buffer[$i]) ) {
echo '<br>'.$i.': '.$name.' => '.$value;
$entry[$i][$name] = $value;
}
$entry[$i]['email_type'] = 'INTERNET';
$entry[$i]['email_home_type'] = 'INTERNET';
$entry[$i]['adr_one_type'] = 'intl';
$entry[$i]['adr_two_type'] = 'intl';
//echo '<br>';
echo '<br>';
//$contacts->add($phpgw_info["user"]["account_id"],$entry[$i]);
}
$num = $i - 1;