Fix up object calls

This commit is contained in:
Miles Lott 2001-03-20 22:55:03 +00:00
parent cfba770497
commit df6f72c92a
2 changed files with 26 additions and 18 deletions

View File

@ -104,7 +104,7 @@
if ( ($download == "on") || ($o->type == 'pdb') ) { if ( ($download == "on") || ($o->type == 'pdb') ) {
header("Content-disposition: attachment; filename=\"".$tsvfilename."\""); header("Content-disposition: attachment; filename=\"".$tsvfilename."\"");
header("Content-type: application/octetstream"); header("Content-type: application/octetstream");
header("Content-length: ".strlen($buffer); header("Content-length: ".strlen($buffer));
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Expires: 0"); header("Expires: 0");
echo $buffer; echo $buffer;

View File

@ -73,31 +73,31 @@
if ($private=="") { $private="public"; } if ($private=="") { $private="public"; }
$row=0; $row=0;
$buffer=array(); $buffer=array();
$o = new import_conv; $this = new import_conv;
$buffer = $o->import_start_file($buffer,$basedn,$context); $buffer = $this->import_start_file($buffer,$basedn,$context);
$fp=fopen($tsvfile,"r"); $fp=fopen($tsvfile,"r");
if ($o->type == 'csv') { if ($this->type == 'csv') {
while ($data = fgetcsv($fp,8000,",")) { while ($data = fgetcsv($fp,8000,",")) {
$num = count($data); $num = count($data);
$row++; $row++;
if ($row == 1) { if ($row == 1) {
$header = $data; $header = $data;
} else { } else {
$buffer = $o->import_start_record($buffer); $buffer = $this->import_start_record($buffer);
for ($c=0; $c<$num; $c++ ) { for ($c=0; $c<$num; $c++ ) {
//Send name/value pairs along with the buffer //Send name/value pairs along with the buffer
if ($o->import[$header[$c]]!="" && $data[$c]!="") { if ($this->import[$header[$c]]!="" && $data[$c]!="") {
$buffer = $o->import_new_attrib($buffer, $o->import[$header[$c]],$data[$c]); $buffer = $this->import_new_attrib($buffer, $this->import[$header[$c]],$data[$c]);
} }
} }
$buffer = $o->import_end_record($buffer,$private); $buffer = $this->import_end_record($buffer,$private);
} }
} }
} elseif ($o->type == 'ldif') { } elseif ($this->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') {
$buffer = $o->import_start_record($buffer); $buffer = $this->import_start_record($buffer);
} }
if ($name && $value) { if ($name && $value) {
$test = split(',mail=',$value); $test = split(',mail=',$value);
@ -110,26 +110,34 @@
$value = $value . ':' . $url; $value = $value . ':' . $url;
} }
//echo '<br>'.$j.': '.$name.' => '.$value; //echo '<br>'.$j.': '.$name.' => '.$value;
if ($o->import[$name] != "" && $value != "") { if ($this->import[$name] != "" && $value != "") {
$buffer = $o->import_new_attrib($buffer, $o->import[$name],$value); $buffer = $this->import_new_attrib($buffer, $this->import[$name],$value);
} }
} else { } else {
$buffer = $o->import_end_record($buffer,$private); $buffer = $this->import_end_record($buffer,$private);
} }
} }
} else { } else {
$buffer = $o->import_start_record($buffer);
while ($data = fgets($fp,8000)) { while ($data = fgets($fp,8000)) {
list($name,$value) = split(':', $data); list($name,$value) = split(':', $data);
if ($o->import[$name] != "" && $value != "") { if (strtolower(substr($name,0,5)) == 'begin') {
$buffer = $o->import_new_attrib($buffer, $o->import[$name],$value); $buffer = $this->import_start_record($buffer);
}
if ($name && $value) {
reset($this->import);
while ( list($fname,$fvalue) = each($this->import) ) {
if ( strstr(strtolower($name), $this->import[$fname]) ) {
$buffer = $this->import_new_attrib($buffer,$name,$value);
}
}
} else {
$buffer = $this->import_end_record($buffer,$private);
} }
} }
$buffer = $o->import_end_record($buffer,$private);
} }
fclose($fp); fclose($fp);
$buffer = $o->import_end_file($buffer); $buffer = $this->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" ) {