' . lang("Created by") . ': | '
. ''
. $phpgw->common->grab_owner_name($fields["owner"]);
}
else
{
$create .= '';
}
$t->set_var("lang_home",lang("Home"));
$t->set_var("lang_business",lang("Business"));
$t->set_var("lang_personal",lang("Personal"));
$t->set_var("lang_lastname",lang("Last Name"));
$t->set_var("lastname",$lastname);
$t->set_var("lang_firstname",lang("First Name"));
$t->set_var("firstname",$firstname);
$t->set_var("lang_middle",lang("Middle Name"));
$t->set_var("middle",$middle);
$t->set_var("lang_prefix",lang("Prefix"));
$t->set_var("prefix",$prefix);
$t->set_var("lang_suffix",lang("Suffix"));
$t->set_var("suffix",$suffix);
$t->set_var("lang_birthday",lang("Birthday"));
$t->set_var("birthday",$birthday);
$t->set_var("lang_company",lang("Company Name"));
$t->set_var("company",$company);
$t->set_var("lang_department",lang("Department"));
$t->set_var("department",$department);
$t->set_var("lang_title",lang("Title"));
$t->set_var("title",$title);
$t->set_var("lang_email",lang("Business Email"));
$t->set_var("email",$email);
$t->set_var("lang_email_type",lang("Business EMail Type"));
$t->set_var("email_type",$email_type);
$t->set_var("lang_url",lang("URL"));
$t->set_var("url",$url);
$t->set_var("lang_timezone",lang("time zone offset"));
$t->set_var("timezone",$time_zone);
$t->set_var("lang_fax",lang("Business Fax"));
$t->set_var("fax",$fax);
$t->set_var("lang_wphone",lang("Business Phone"));
$t->set_var("wphone",$wphone);
$t->set_var("lang_pager",lang("Pager"));
$t->set_var("pager",$pager);
$t->set_var("lang_mphone",lang("Cell Phone"));
$t->set_var("mphone",$mphone);
$t->set_var("lang_msgphone",lang("Message Phone"));
$t->set_var("msgphone",$msgphone);
$t->set_var("lang_isdnphone",lang("ISDN Phone"));
$t->set_var("isdnphone",$isdnphone);
$t->set_var("lang_carphone",lang("Car Phone"));
$t->set_var("carphone",$carphone);
$t->set_var("lang_vidphone",lang("Video Phone"));
$t->set_var("vidphone",$vidphone);
$t->set_var("lang_ophone",lang("Other Number"));
$t->set_var("ophone",$ophone);
$t->set_var("lang_bstreet",lang("Business Street"));
$t->set_var("bstreet",$bstreet);
$t->set_var("lang_address2",lang("Address Line 2"));
$t->set_var("address2",$address2);
$t->set_var("lang_address3",lang("Address Line 3"));
$t->set_var("address3",$address3);
$t->set_var("lang_bcity",lang("Business City"));
$t->set_var("bcity",$bcity);
$t->set_var("lang_bstate",lang("Business State"));
$t->set_var("bstate",$bstate);
$t->set_var("lang_bzip",lang("Business Zip Code"));
$t->set_var("bzip",$bzip);
$t->set_var("lang_bcountry",lang("Business Country"));
$t->set_var("bcountry",$bcountry);
$t->set_var("lang_badrtype",lang("Address Type"));
$t->set_var("badrtype",$badrtype);
$t->set_var("lang_hphone",lang("Home Phone"));
$t->set_var("hphone",$hphone);
$t->set_var("lang_hemail",lang("Home Email"));
$t->set_var("hemail",$hemail);
$t->set_var("lang_hemail_type",lang("Home EMail Type"));
$t->set_var("hemail_type",$hemail_type);
$t->set_var("lang_hstreet",lang("Home Street"));
$t->set_var("hstreet",$hstreet);
$t->set_var("lang_hcity",lang("Home City"));
$t->set_var("hcity",$hcity);
$t->set_var("lang_hstate",lang("Home State"));
$t->set_var("hstate",$hstate);
$t->set_var("lang_hzip",lang("Home Zip Code"));
$t->set_var("hzip",$hzip);
$t->set_var("lang_hcountry",lang("Home Country"));
$t->set_var("hcountry",$hcountry);
$t->set_var("lang_hadrtype",lang("Address Type"));
$t->set_var("hadrtype",$hadrtype);
$t->set_var("create",$create);
$t->set_var("lang_notes",lang("notes"));
$t->set_var("notes",$notes);
$t->set_var("lang_label",lang("label"));
$t->set_var("label",$label);
$t->set_var("lang_pubkey",lang("Public Key"));
$t->set_var("pubkey",$pubkey);
$t->set_var("access_check",$access_check);
$t->set_var('lang_private',lang('Private'));
$t->set_var('lang_cats',lang('Category'));
$t->set_var('cats_link',$cats_link);
if ($customfields) {
$t->set_var('lang_custom',lang('Custom Fields').':');
$t->set_var("custom",$custom);
} else {
$t->set_var("lang_custom",'');
$t->set_var("custom",'');
}
$t->parse("out","form");
$t->pparse("out","form");
} //end form function
function parsevcard($filename,$access='')
{
global $phpgw;
global $phpgw_info;
$vcard = fopen($filename, "r");
// Make sure we have a file to read.
if (!$vcard) {
fclose($vcard);
return FALSE;
}
// Keep running through this to support vcards
// with multiple entries.
while (!feof($vcard)) {
if(!empty($varray))
unset($varray);
// Make sure our file is a vcard.
// I should deal with empty line at the
// begining of the file. Those will fail here.
$vline = fgets($vcard,20);
$vline = strtolower($vline);
if(strcmp("begin:vcard", substr($vline, 0, strlen("begin:vcard")) ) != 0) {
fclose($vcard);
return FALSE;
}
// Write the vcard into an array.
// You can have multiple vcards in one file.
// I only deal with halve of that. :)
// It will only return values from the 1st vcard.
$varray[0] = "begin";
$varray[1] = "vcard";
$i=2;
while(!feof($vcard) && strcmp("end:vcard", strtolower(substr($vline, 0, strlen("end:vcard"))) ) !=0 ) {
$vline = fgets($vcard,4096);
// Check for folded lines and escaped colons '\:'
$la = explode(":", $vline);
if (count($la) > 1) {
$varray[$i] = strtolower($la[0]);
$i++;
for($j=1;$j<=count($la);$j++) {
$varray[$i] .= $la[$j];
}
$i++;
} else { // This is the continuation of a folded line.
$varray[$i-1] .= $la[0];
}
}
// Add this entry to the addressbook before moving on to the next one.
fillab($varray);
} // while(!feof($vcard))
fclose($vcard);
return TRUE;
}
function fillab($varray,$access='') {
global $phpgw;
global $phpgw_info;
$i=0;
// while($i < count($varray)) {
// echo ' '.$varray[$i].' %% '.$varray[$i+1];
// $i++;$i++;
// }
// exit;
// incremented by 2
while($i < count($varray)) {
$k = explode(";",$varray[$i]); // Key
$v = explode(";",$varray[$i+1]); // Values
for($h=0;$hkh="'.$k[$h].'",v0="'.$v[0].'",v1="'.$v[1].'",v2="'.$v[2].'",v3="'.$v[3].'",v4="'.$v[4].'",v5="'.$v[5].'",v6="'.$v[6].'",v7="'.$v[7].'"';
switch($k[$h]) {
case "fn":
$fn = $v[0];
break;
case "n":
$lastname = $v[0];
$firstname = $v[1];
break;
case "bday":
$bday = $v[0];
break;
case "url":
$url = $v[0];
// Fix the result of exploding on ':' above
if (substr($url,0,5) == 'http/') {
$url = ereg_replace('http//','http://',$url);
} elseif (substr($url,0,6) == 'https/') {
$url = ereg_replace('https//','https://',$url);
} elseif (substr($url,0,7) != 'http://') {
$url = 'http://' . $url;
}
break;
case "label":
$label = $v[0];
break;
case "adr": // This one is real ugly. Still! :(
if(!$street) {
$street = $v[2];
$address2 = $v[1] . " " . $v[0];
$city = $v[3];
$state = $v[4];
$zip = $v[5];
$country = $v[6];
if (strstr($k[$h+1],"intl")) { $adronetype .= "INTL;"; }
if (strstr($k[$h+1],"dom")) { $adronetype .= "DOM;"; }
} else {
$hstreet = $v[2];
$hcity = $v[3];
$hstate = $v[4];
$hzip = $v[5];
$hcountry = $v[6];
if (strstr($k[$h+1],"intl")) { $adrtwotype .= "INTL;"; }
if (strstr($k[$h+1],"dom")) { $adrtwotype .= "DOM;"; }
}
break;
case "tel":
switch ($k[$h+1]) {
case "work":
$wphone = $v[0];
break;
case "home":
$hphone = $v[0];
break;
case "cell":
$mphone = $v[0];
break;
case "pager":
$pager = $v[0];
break;
case "fax":
$fax = $v[0];
break;
case "msg":
$msgphone = $v[0];
break;
case "bbs":
$bbsphone = $v[0];
break;
case "modem":
$modem = $v[0];
break;
case "car":
$carphone = $v[0];
break;
case "isdn":
$isdn = $v[0];
break;
case "video":
$vidphone = $v[0];
break;
case "pref":
switch ($k[$h+2]) {
case "work":
$tel_prefer .= "work;";
$wphone = $v[0];
break;
case "home":
$tel_prefer .= "home;";
$hphone = $v[0];
break;
case "cell":
$tel_prefer .= "cell;";
$mphone = $v[0];
break;
case "pager":
$tel_prefer .= "pager;";
$pager = $v[0];
break;
case "fax":
$tel_prefer .= "fax;";
$fax = $v[0];
break;
case "msg":
$tel_prefer .= "msg;";
$msgphone = $v[0];
break;
case "bbs":
$tel_prefer .= "bbs;";
$bbsphone = $v[0];
break;
case "modem":
$tel_prefer .= "modem;";
$modem = $v[0];
break;
case "car":
$tel_prefer .= "car;";
$carphone = $v[0];
break;
case "isdn":
$tel_prefer .= "isdn;";
$isdn = $v[0];
break;
case "video":
$tel_prefer .= "video;";
$vidphone = $v[0];
break;
}
default:
$whphone = $v[0];
break;
}
break;
case "email":
if (empty($email)) { $email = $v[0]; }
else { $hemail = $v[0]; }
switch ($k[$h+1]) {
case "compuserve":
if (!$adronetype) { $emailtype="CompuServe"; }
else { $hemailtype="CompuServe"; }
break;
case "aol":
if (!$adronetype) { $emailtype="AOL"; }
else { $hemailtype="AOL"; }
break;
case "prodigy":
if (!$adronetype) { $emailtype="Prodigy"; }
else { $hemailtype="Prodigy"; }
break;
case "eworld":
if (!$adronetype) { $emailtype="eWorld"; }
else { $hemailtype="eWorld"; }
break;
case "applelink":
if (!$adronetype) { $emailtype="AppleLink"; }
else { $hemailtype="AppleLink"; }
break;
case "appletalk":
if (!$adronetype) { $emailtype="AppleTalk"; }
else { $hemailtype="AppleTalk"; }
break;
case "powershare":
if (!$adronetype) { $emailtype="PowerShare"; }
else { $hemailtype="PowerShare"; }
break;
case "ibmmail":
if (!$adronetype) { $emailtype="IBMMail"; }
else { $hemailtype="IBMMail"; }
break;
case "attmail":
if (!$adronetype) { $emailtype="ATTMail"; }
else { $hemailtype="ATTMail"; }
break;
case "mcimail":
if (!$adronetype) { $emailtype="MCIMail"; }
else { $hemailtype="MCIMail"; }
break;
case "x.400":
if (!$adronetype) { $emailtype="X.400"; }
else { $hemailtype="X.400"; }
break;
case "tlx":
if (!$adronetype) { $emailtype="TLX"; }
else { $hemailtype="TLX"; }
break;
default:
if (!$adronetype) { $emailtype="INTERNET"; }
else { $hemailtype="INTERNET"; }
break;
}
break;
case "title":
$title = $v[0];
break;
case "org":
$company = $v[0];
if(count($v) > 1) {
$notes .= $v[0] . "\n";
for($j=1;$jtel_prefer: '.$fields["tel_prefer"];
echo ' owner: '.$fields["owner"];
echo ' firstname: '.$fields["n_given"];
echo ' lastname: '.$fields["n_family"];
echo ' full name: '.$fields["fn"];
echo ' title: '.$fields["title"];
echo ' email: '.$fields["email"];
echo ' work#: '.$fields["tel_work"];
echo ' home#: '.$fields["tel_home"];
echo ' fax#: '.$fields["tel_fax"];
echo ' pager#: '.$fields["tel_pager"];
echo ' cell#: '.$fields["tel_cell"];
echo ' msg#: '.$fields["tel_msg"];
echo ' car#: '.$fields["tel_car"];
echo ' modem# '.$fields["tel_modem"];
echo ' bbs#: '.$fields["tel_bbs"];
echo ' isdn#: '.$fields["tel_isdn"];
echo ' video#: '.$fields["tel_video"];
echo ' street: '.$fields["adr_one_street"];
echo ' addr2: '.$fields["address2"];
echo ' city: '.$fields["adr_one_locality"];
echo ' state: '.$fields["adr_one_region"];
echo ' zip: '.$fields["adr_one_postalcode"];
echo ' adronetype: '.$fields["adr_one_type"];
echo ' bday: '.$fields["bday"];
echo ' url: '.$fields["url"];
echo ' note: '.$fields["note"];
echo ' company: '.$fields["org_name"];
exit;
*/
$this = CreateObject("phpgwapi.contacts");
$this->add($phpgw_info["user"]["account_id"],$fields);
}
?>
|