mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +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
|
// This array is used by vcard->in to aid in parsing the multiple
|
||||||
// attributes that are possible with vcard.
|
// 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:
|
// You MUST use this in conjunction with the vcard->in function:
|
||||||
//
|
//
|
||||||
// $this->contacts = CreateObject("phpgwapi.contacts");
|
// $contacts = CreateObject("phpgwapi.contacts");
|
||||||
// $this->vcard = CreateObject("phpgwapi.vcard");
|
// $vcard = CreateObject("phpgwapi.vcard");
|
||||||
// $myimport = $this->vcard->import;
|
// $myimport = $vcard->import;
|
||||||
|
// $buffer = array();
|
||||||
//
|
//
|
||||||
// while ( list($fname,$fvalue) = each($myimport) ) {
|
// $fp=fopen($filename,"r");
|
||||||
// if ( strstr(strtolower($name), $myimport[$fname]) ) {
|
// while ($data = fgets($fp,8000)) {
|
||||||
// $buffer = $this->import_new_attrib($buffer,$name,$value);
|
// list($name,$value,$extra) = split(':', $data);
|
||||||
// $value = trim($value);
|
// if (substr($value,0,5) == "http") {
|
||||||
// $value = ereg_replace("=0D=0A","\n",$value);
|
// $value = $value . ":".$extra;
|
||||||
// $buffer += array($name => $value);
|
// }
|
||||||
|
// 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:
|
// Then, to convert the vcard array to a contacts class array:
|
||||||
//
|
//
|
||||||
// for ($i=1;$i<=count($buffer);$i++) {
|
//$entry = $vcard->in($buffer);
|
||||||
// $entry = $this->vcard->in($buffer[$i]);
|
//$contacts->add($phpgw_info["user"]["account_id"],$entry);
|
||||||
// $this->contacts->add($phpgw_info["user"]["account_id"],$entry);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
var $import = array(
|
var $import = array(
|
||||||
"n" => "n",
|
"n" => "n",
|
||||||
|
@ -51,7 +51,34 @@
|
|||||||
// This has to be non-interactive in case of a multi-entry vcard.
|
// This has to be non-interactive in case of a multi-entry vcard.
|
||||||
$filename = $uploaddir . $newfilename;
|
$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.
|
// Delete the temp file.
|
||||||
unlink($filename);
|
unlink($filename);
|
||||||
unlink($filename . ".info");
|
unlink($filename . ".info");
|
||||||
|
Loading…
Reference in New Issue
Block a user