forked from extern/egroupware
Add csv type and check for it
This commit is contained in:
parent
b6b282ab36
commit
e6cea5377d
@ -93,7 +93,7 @@
|
|||||||
$buffer = $o->import_end_record($buffer,$private);
|
$buffer = $o->import_end_record($buffer,$private);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} elseif ($o->type == 'ldif') {
|
||||||
while ($data = fgets($fp,8000)) {
|
while ($data = fgets($fp,8000)) {
|
||||||
list($name,$value,$url) = split(':', $data);
|
list($name,$value,$url) = split(':', $data);
|
||||||
if (substr($name,0,2) == 'dn') {
|
if (substr($name,0,2) == 'dn') {
|
||||||
@ -117,15 +117,25 @@
|
|||||||
$buffer = $o->import_end_record($buffer,$private);
|
$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);
|
fclose($fp);
|
||||||
|
|
||||||
$buffer = $o->import_end_file($buffer);
|
$buffer = $o->import_end_file($buffer);
|
||||||
|
|
||||||
if ($download == "") {
|
if ($download == "") {
|
||||||
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" ) {
|
if($conv_type=="Debug LDAP" || $conv_type=="Debug SQL" ) {
|
||||||
header("Content-disposition: attachment; filename=\"conversion.txt\"");
|
header("Content-disposition: attachment; filename=\"conversion.txt\"");
|
||||||
header("Content-type: application/octetstream");
|
header("Content-type: application/octetstream");
|
||||||
|
header("Content-length: ".strlen($buffer));
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
header("Expires: 0");
|
header("Expires: 0");
|
||||||
echo $buffer;
|
echo $buffer;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class import_conv
|
class import_conv
|
||||||
{
|
{
|
||||||
var $type = '';
|
var $type = 'csv';
|
||||||
var $basedn;
|
var $basedn;
|
||||||
var $contactsdn;
|
var $contactsdn;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class import_conv
|
class import_conv
|
||||||
{
|
{
|
||||||
var $type = '';
|
var $type = 'csv';
|
||||||
var $currentrecord; //used for buffering to allow uid lines to go first
|
var $currentrecord; //used for buffering to allow uid lines to go first
|
||||||
|
|
||||||
var $import = array(
|
var $import = array(
|
||||||
|
@ -83,17 +83,13 @@
|
|||||||
global $phpgw,$phpgw_info;
|
global $phpgw,$phpgw_info;
|
||||||
|
|
||||||
$contacts = CreateObject("phpgwapi.contacts");
|
$contacts = CreateObject("phpgwapi.contacts");
|
||||||
//echo '<br>';
|
echo '<br>';
|
||||||
for ($i=1;$i<=count($buffer);$i++) {
|
for ($i=1;$i<=count($buffer);$i++) {
|
||||||
while ( list($name,$value) = @each($buffer[$i]) ) {
|
while ( list($name,$value) = @each($buffer[$i]) ) {
|
||||||
echo '<br>'.$i.': '.$name.' => '.$value;
|
echo '<br>'.$i.': '.$name.' => '.$value;
|
||||||
$entry[$i][$name] = $value;
|
$entry[$i][$name] = $value;
|
||||||
}
|
}
|
||||||
$entry[$i]['email_type'] = 'INTERNET';
|
echo '<br>';
|
||||||
$entry[$i]['email_home_type'] = 'INTERNET';
|
|
||||||
$entry[$i]['adr_one_type'] = 'intl';
|
|
||||||
$entry[$i]['adr_two_type'] = 'intl';
|
|
||||||
//echo '<br>';
|
|
||||||
//$contacts->add($phpgw_info["user"]["account_id"],$entry[$i]);
|
//$contacts->add($phpgw_info["user"]["account_id"],$entry[$i]);
|
||||||
}
|
}
|
||||||
$num = $i - 1;
|
$num = $i - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user