mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 08:39:07 +01:00
Make vcardin use vcard class, alter class comments to reflect how it uses it
This commit is contained in:
parent
49bcdc323f
commit
7d8a40f222
@ -31,27 +31,37 @@
|
||||
{
|
||||
// This array is used by vcard->in to aid in parsing the multiple
|
||||
// attributes that are possible with vcard.
|
||||
// Import is messier than export and needs to be changed.
|
||||
// You MUST use this in conjunction with the vcard->in function:
|
||||
//
|
||||
// $this->contacts = CreateObject("phpgwapi.contacts");
|
||||
// $this->vcard = CreateObject("phpgwapi.vcard");
|
||||
// $myimport = $this->vcard->import;
|
||||
// $contacts = CreateObject("phpgwapi.contacts");
|
||||
// $vcard = CreateObject("phpgwapi.vcard");
|
||||
// $myimport = $vcard->import;
|
||||
// $buffer = array();
|
||||
//
|
||||
// while ( list($fname,$fvalue) = each($myimport) ) {
|
||||
// if ( strstr(strtolower($name), $myimport[$fname]) ) {
|
||||
// $buffer = $this->import_new_attrib($buffer,$name,$value);
|
||||
// $value = trim($value);
|
||||
// $value = ereg_replace("=0D=0A","\n",$value);
|
||||
// $buffer += array($name => $value);
|
||||
// $fp=fopen($filename,"r");
|
||||
// while ($data = fgets($fp,8000)) {
|
||||
// list($name,$value,$extra) = split(':', $data);
|
||||
// if (substr($value,0,5) == "http") {
|
||||
// $value = $value . ":".$extra;
|
||||
// }
|
||||
// if ($name && $value) {
|
||||
// reset($vcard->import);
|
||||
// while ( list($fname,$fvalue) = each($vcard->import) ) {
|
||||
// if ( strstr(strtolower($name), $vcard->import[$fname]) ) {
|
||||
// $value = trim($value);
|
||||
// $value = ereg_replace("=0D=0A","\n",$value);
|
||||
// $buffer += array($name => $value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fclose($fp);
|
||||
//
|
||||
// Then, to convert the vcard array to a contacts class array:
|
||||
//
|
||||
// for ($i=1;$i<=count($buffer);$i++) {
|
||||
// $entry = $this->vcard->in($buffer[$i]);
|
||||
// $this->contacts->add($phpgw_info["user"]["account_id"],$entry);
|
||||
// }
|
||||
//$entry = $vcard->in($buffer);
|
||||
//$contacts->add($phpgw_info["user"]["account_id"],$entry);
|
||||
//
|
||||
var $import = array(
|
||||
"n" => "n",
|
||||
|
@ -51,7 +51,34 @@
|
||||
// This has to be non-interactive in case of a multi-entry vcard.
|
||||
$filename = $uploaddir . $newfilename;
|
||||
|
||||
parsevcard($filename,$access);
|
||||
$contacts = CreateObject("phpgwapi.contacts");
|
||||
$vcard = CreateObject("phpgwapi.vcard");
|
||||
$myimport = $vcard->import;
|
||||
$buffer = array();
|
||||
|
||||
$fp=fopen($filename,"r");
|
||||
while ($data = fgets($fp,8000)) {
|
||||
list($name,$value,$extra) = split(':', $data);
|
||||
if (substr($value,0,5) == "http") {
|
||||
$value = $value . ":".$extra;
|
||||
}
|
||||
if ($name && $value) {
|
||||
reset($vcard->import);
|
||||
while ( list($fname,$fvalue) = each($vcard->import) ) {
|
||||
if ( strstr(strtolower($name), $vcard->import[$fname]) ) {
|
||||
$value = trim($value);
|
||||
$value = ereg_replace("=0D=0A","\n",$value);
|
||||
$buffer += array($name => $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
$entry = $vcard->in($buffer);
|
||||
$contacts->add($phpgw_info["user"]["account_id"],$entry);
|
||||
|
||||
//parsevcard($filename,$access);
|
||||
// Delete the temp file.
|
||||
unlink($filename);
|
||||
unlink($filename . ".info");
|
||||
|
Loading…
Reference in New Issue
Block a user