From 3d06057c2060a0e8779676ffaf0bd13541cc197d Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sun, 11 Mar 2001 06:58:57 +0000 Subject: [PATCH] Formatting and some adjustment to start making actual imports work again --- addressbook/conv/Debug LDAP | 422 +++++++++++++------------ addressbook/conv/Debug SQL | 319 ++++++++++--------- addressbook/conv/Import to Addressbook | 260 ++++++++------- 3 files changed, 501 insertions(+), 500 deletions(-) diff --git a/addressbook/conv/Debug LDAP b/addressbook/conv/Debug LDAP index 87e2be0296..da163df541 100644 --- a/addressbook/conv/Debug LDAP +++ b/addressbook/conv/Debug LDAP @@ -1,7 +1,7 @@ "", - "First Name" => "givenName", - "Middle Name" => "", - "Last Name" => "sn", - "Suffix" => "", - "Company" => "o", //objectclass: organization - "Department" => "ou", //objectclass: organizationalPerson - "Job Title" => "title", //objectclass: organizationalPerson - "Business Street" => "postalAddress", - "Business Street 2" => "", - "Business Street 3" => "", - "Business City" => "l", - "Business State" => "st", - "Business Postal Code" => "postalCode", - "Business Country" => "co", - "Home Street" => "homePostalAddress", - "Home City" => "+\n", - "Home State" => "+, ", - "Home Postal Code" => "+ ", - "Home Country" => "+\n", - "Home Street 2" => "", - "Home Street 3" => "", - "Other Street" => "", - "Other City" => "+\n", - "Other State" => "+, ", - "Other Postal Code" => "+ ", - "Other Country" => "+\n", - "Assistant's Phone" => "", - "Business Fax" => "facsimileTelephoneNumber", - "Business Phone" => "telephoneNumber", - "Business Phone 2" => "", - "Callback" => "", - "Car Phone" => "", - "Company Main Phone" => "", - "Home Fax" => "", - "Home Phone" => "homePhone", - "Home Phone 2" => "homePhone", //This will make another homePhone entry - "ISDN" => "", - "Mobile Phone" => "mobile", //newPilotPerson - "Other Fax" => "", - "Other Phone" => "", - "Pager" => "pager", - "Primary Phone" => "", - "Radio Phone" => "", - "TTY/TDD Phone" => "", - "Telex" => "telexNumber", //organization - "Account" => "", - "Anniversary" => "", - "Assistant's Name" => "secretary", //newPilotPerson - "Billing Information" => "", - "Birthday" => "", - "Categories" => "#businessCategory", - "Children" => "", - "Directory Server" => "", - "E-mail Address" => "mail", - "E-mail Display Name" => "", - "E-mail 2 Address" => "otherMailbox", - "E-mail 2 Display Name" => "", - "E-mail 3 Address" => "otherMailbox", //add another... - "E-mail 3 Display Name" => "", - "Gender" => "", - "Government ID Number" => "", - "Hobby" => "", - "Initials" => "", - "Internet Free Busy" => "", - "Keywords" => "", - "Language" => "", - "Location" => "", - "Manager's Name" => "", - "Mileage" => "", - "Notes" => "comment", - "Office Location" => "physicalDeliveryOfficeName", - "Organizational ID Number" => "", - "PO Box" => "postOfficeBox", - "Priority" => "", - "Private Profession" => "", - "Referred By" => "", - "Sensitivity" => "", - "Spouse" => "", - "User 1" => "", - "User 2" => "", - "User 3" => "", - "User 4" => "", - "Web Page" => ""); + var $import = array( + "Title" => "", + "First Name" => "givenName", + "Middle Name" => "", + "Last Name" => "sn", + "Suffix" => "", + "Company" => "o", //objectclass: organization + "Department" => "ou", //objectclass: organizationalPerson + "Job Title" => "title", //objectclass: organizationalPerson + "Business Street" => "postalAddress", + "Business Street 2" => "", + "Business Street 3" => "", + "Business City" => "l", + "Business State" => "st", + "Business Postal Code" => "postalCode", + "Business Country" => "co", + "Home Street" => "homePostalAddress", + "Home City" => "+\n", + "Home State" => "+, ", + "Home Postal Code" => "+ ", + "Home Country" => "+\n", + "Home Street 2" => "", + "Home Street 3" => "", + "Other Street" => "", + "Other City" => "+\n", + "Other State" => "+, ", + "Other Postal Code" => "+ ", + "Other Country" => "+\n", + "Assistant's Phone" => "", + "Business Fax" => "facsimileTelephoneNumber", + "Business Phone" => "telephoneNumber", + "Business Phone 2" => "", + "Callback" => "", + "Car Phone" => "", + "Company Main Phone" => "", + "Home Fax" => "", + "Home Phone" => "homePhone", + "Home Phone 2" => "homePhone", //This will make another homePhone entry + "ISDN" => "", + "Mobile Phone" => "mobile", //newPilotPerson + "Other Fax" => "", + "Other Phone" => "", + "Pager" => "pager", + "Primary Phone" => "", + "Radio Phone" => "", + "TTY/TDD Phone" => "", + "Telex" => "telexNumber", //organization + "Account" => "", + "Anniversary" => "", + "Assistant's Name" => "secretary", //newPilotPerson + "Billing Information" => "", + "Birthday" => "", + "Categories" => "#businessCategory", + "Children" => "", + "Directory Server" => "", + "E-mail Address" => "mail", + "E-mail Display Name" => "", + "E-mail 2 Address" => "otherMailbox", + "E-mail 2 Display Name" => "", + "E-mail 3 Address" => "otherMailbox", //add another... + "E-mail 3 Display Name" => "", + "Gender" => "", + "Government ID Number" => "", + "Hobby" => "", + "Initials" => "", + "Internet Free Busy" => "", + "Keywords" => "", + "Language" => "", + "Location" => "", + "Manager's Name" => "", + "Mileage" => "", + "Notes" => "comment", + "Office Location" => "physicalDeliveryOfficeName", + "Organizational ID Number" => "", + "PO Box" => "postOfficeBox", + "Priority" => "", + "Private Profession" => "", + "Referred By" => "", + "Sensitivity" => "", + "Spouse" => "", + "User 1" => "", + "User 2" => "", + "User 3" => "", + "User 4" => "", + "Web Page" => "" + ); -function outlook_start_file($buffer,$basedn="",$context="") { - # Here are some tests for correct basedn and Contacts context. - # If none of these are correct, ldap_add will fail, but at least - # we can give them a fighting chance. - if (!empty($basedn) && empty($context)) { - # Oops, no context, try a default - $context = "ou=Contacts,".$basedn; - } elseif (empty($basedn) && !empty($context)) { - # Oops, no basedn, try this one - $work = split(",",$context); - array_shift($work); - for ($i=0;$ibasedn= $basedn; - $this->contactsdn= $context; + $this->basedn= $basedn; + $this->contactsdn= $context; + $buffer=""; + return $buffer; + } - return $buffer; -} + function import_end_file($buffer) { + return $buffer; + } -function outlook_end_file($buffer) { - return $buffer; -} + function import_start_record($buffer) { + global $phpgw_info; -function outlook_start_record($buffer) { - global $phpgw_info; - - $top="\nobjectClass: person + $top="\nobjectClass: person objectClass: organizationalPerson objectClass: inetOrgPerson -objectClass: outlookPerson"; +objectClass: importPerson"; - $this->o=""; - $this->sn=""; - $this->givenName=""; + $this->o=""; + $this->sn=""; + $this->givenName=""; - $this->currentrecord = $top; - return $buffer; -} + $this->currentrecord = $top; + return $buffer; + } -function outlook_end_record($buffer,$private="") { - if (trim($this->sn) != "") { - $this->currentrecord = "cn: ".$this->givenName." ".$this->sn.$this->currentrecord; - } else if (trim($this->o) != "") { - $this->currentrecord = "cn: ".$this->o.$this->currentrecord; - } else if (trim($this->givenName)) { - $this->currentrecord = "cn: ".$this->givenName.$this->currentrecord; - } else { - $this->currentrecord = "cn: (unnamed)".$this->currentrecord; - } + function import_end_record($buffer,$private="") { + if (trim($this->sn) != "") { + $this->currentrecord = "cn: ".$this->givenName." ".$this->sn.$this->currentrecord; + } else if (trim($this->o) != "") { + $this->currentrecord = "cn: ".$this->o.$this->currentrecord; + } else if (trim($this->givenName)) { + $this->currentrecord = "cn: ".$this->givenName.$this->currentrecord; + } else { + $this->currentrecord = "cn: (unnamed)".$this->currentrecord; + } - $time = gettimeofday(); - $uid = ($this->sn?$this->sn:$this->o); - if (strpos($uid, ",")) { - $uid = str_replace(",", "\,", $uid); - $uid = "\"".$uid."\""; - } - $uid = time().$time["usec"].":".$uid; - $this->currentrecord = "dn: uid=$uid,".$this->contactsdn."\nuid: $uid"."\n".$this->currentrecord; + $time = gettimeofday(); + $uid = ($this->sn?$this->sn:$this->o); + if (strpos($uid, ",")) { + $uid = str_replace(",", "\,", $uid); + $uid = "\"".$uid."\""; + } + $uid = time().$time["usec"].":".$uid; + $this->currentrecord = "dn: uid=$uid,".$this->contactsdn."\nuid: $uid"."\n".$this->currentrecord; - while ($pos = strpos($this->currentrecord, "|br x=y/|")) { - $startline = strrpos(substr($this->currentrecord,0,$pos), "\n"); - if ($startline == "") {$startline = 0;} - $startattrib = strpos($this->currentrecord, ":", $startline) + 1; - $endline = strpos($this->currentrecord, "\n", $startattrib); - if ($endline == "") { $endline = strlen($this->currentrecord); } - $attrib = str_replace("|br x=y/|", "\r\n", substr($this->currentrecord, $startattrib + 1, $endline - $startattrib - 1)); - $this->currentrecord = substr($this->currentrecord, 0, $startattrib).": ".base64_encode($attrib).substr($this->currentrecord, $endline); - } - return $buffer.$this->currentrecord."\n\n"; -} + while ($pos = strpos($this->currentrecord, "|br x=y/|")) { + $startline = strrpos(substr($this->currentrecord,0,$pos), "\n"); + if ($startline == "") {$startline = 0;} + $startattrib = strpos($this->currentrecord, ":", $startline) + 1; + $endline = strpos($this->currentrecord, "\n", $startattrib); + if ($endline == "") { $endline = strlen($this->currentrecord); } + $attrib = str_replace("|br x=y/|", "\r\n", substr($this->currentrecord, $startattrib + 1, $endline - $startattrib - 1)); + $this->currentrecord = substr($this->currentrecord, 0, $startattrib).": ".base64_encode($attrib).substr($this->currentrecord, $endline); + } + return $buffer.$this->currentrecord."\n\n"; + } -function outlook_new_attrib($buffer,$name,$value) { - if ($name == "sn") { - $this->sn = $value; - } - if ($name == "o") { - $this->o = $value; - } - if ($name == "givenName") { - $this->givenName = $value; - } + function import_new_attrib($buffer,$name,$value) { + if ($name == "sn") { + $this->sn = $value; + } + if ($name == "o") { + $this->o = $value; + } + if ($name == "givenName") { + $this->givenName = $value; + } - $value = str_replace("\n","|br x=y/|",$value); - $name = str_replace("\n","|br x=y/|",$name); - $value = str_replace("\r","",$value); - $name = str_replace("\r","",$name); + $value = str_replace("\n","|br x=y/|",$value); + $name = str_replace("\n","|br x=y/|",$name); + $value = str_replace("\r","",$value); + $name = str_replace("\r","",$name); - switch (substr($name,0,1)) { - case '+': - $this->currentrecord .= substr($name,1).$value; - return $buffer; - break; - case '#': - $data = explode(";",$value); - $num = count($data); - $return = ""; - for ( $i=0; $i<$num; $i++ ) { - $return .= "\n".substr($name,1).": $data[$i]"; - } - $this->currentrecord .= $return; - return $buffer; - break; - default: - if ($name == "otherMailbox") { - $this->currentrecord .= "\n$name: smtp\$$value"; - } else { - $this->currentrecord .= "\n$name: $value"; - } - return $buffer; - } -} -} + switch (substr($name,0,1)) { + case '+': + $this->currentrecord .= substr($name,1).$value; + return $buffer; + break; + case '#': + $data = explode(";",$value); + $num = count($data); + $return = ""; + for ( $i=0; $i<$num; $i++ ) { + $return .= "\n".substr($name,1).": $data[$i]"; + } + $this->currentrecord .= $return; + return $buffer; + break; + default: + if ($name == "otherMailbox") { + $this->currentrecord .= "\n$name: smtp\$$value"; + } else { + $this->currentrecord .= "\n$name: $value"; + } + return $buffer; + } // end switch + } + } ?> diff --git a/addressbook/conv/Debug SQL b/addressbook/conv/Debug SQL index d46daf3077..1f03bad42f 100644 --- a/addressbook/conv/Debug SQL +++ b/addressbook/conv/Debug SQL @@ -1,7 +1,7 @@ "title", - "First Name" => "n_given", - "Middle Name" => "n_middle", - "Last Name" => "n_family", - "Suffix" => "n_suffix", - "Company" => "org_name", //objectclass: organization - "Department" => "org_unit", //objectclass: organizationalPerson - "Job Title" => "title", //objectclass: organizationalPerson - "Business Street" => "address2", - "Business Street 2" => "", - "Business Street 3" => "", - "Business City" => "", - "Business State" => "", - "Business Postal Code" => "", - "Business Country" => "", - "Home Street" => "adr_street", - "Home City" => "adr_locality", - "Home State" => "adr_region", - "Home Postal Code" => "adr_postalcode", - "Home Country" => "adr_countryname", - "Home Street 2" => "", - "Home Street 3" => "", - "Other Street" => "", - "Other City" => "", - "Other State" => "", - "Other Postal Code" => "", - "Other Country" => "", - "Assistant's Phone" => "", - "Business Fax" => "c_tel", - "Business Phone" => "b_tel", - "Business Phone 2" => "ophone", - "Callback" => "", - "Car Phone" => "", - "Company Main Phone" => "", - "Home Fax" => "", - "Home Phone" => "a.tel", - "Home Phone 2" => "", //This will make another homePhone entry - "ISDN" => "", - "Mobile Phone" => "mphone", //newPilotPerson - "Other Fax" => "", - "Other Phone" => "", - "Pager" => "pager", - "Primary Phone" => "", - "Radio Phone" => "", - "TTY/TDD Phone" => "", - "Telex" => "", //organization - "Account" => "", - "Anniversary" => "", - "Assistant's Name" => "", //newPilotPerson - "Billing Information" => "", - "Birthday" => "bday", - "Categories" => "", - "Children" => "", - "Directory Server" => "", - "E-mail Address" => "d_email", - "E-mail Display Name" => "", - "E-mail 2 Address" => "", - "E-mail 2 Display Name" => "", - "E-mail 3 Address" => "", //add another... - "E-mail 3 Display Name" => "", - "Gender" => "", - "Government ID Number" => "", - "Hobby" => "", - "Initials" => "", - "Internet Free Busy" => "", - "Keywords" => "", - "Language" => "", - "Location" => "", - "Manager's Name" => "", - "Mileage" => "", - "Notes" => "ab_notes", - "Office Location" => "", - "Organizational ID Number" => "", - "PO Box" => "postOfficeBox", - "Priority" => "", - "Private Profession" => "", - "Referred By" => "", - "Sensitivity" => "", - "Spouse" => "", - "User 1" => "", - "User 2" => "", - "User 3" => "", - "User 4" => "", - "Web Page" => ""); + var $import = array( + "Title" => "title", + "First Name" => "n_given", + "Middle Name" => "n_middle", + "Last Name" => "n_family", + "Suffix" => "n_suffix", + "Company" => "org_name", //objectclass: organization + "Department" => "org_unit", //objectclass: organizationalPerson + "Job Title" => "title", //objectclass: organizationalPerson + "Business Street" => "address2", + "Business Street 2" => "", + "Business Street 3" => "", + "Business City" => "", + "Business State" => "", + "Business Postal Code" => "", + "Business Country" => "", + "Home Street" => "adr_street", + "Home City" => "adr_locality", + "Home State" => "adr_region", + "Home Postal Code" => "adr_postalcode", + "Home Country" => "adr_countryname", + "Home Street 2" => "", + "Home Street 3" => "", + "Other Street" => "", + "Other City" => "", + "Other State" => "", + "Other Postal Code" => "", + "Other Country" => "", + "Assistant's Phone" => "", + "Business Fax" => "c_tel", + "Business Phone" => "b_tel", + "Business Phone 2" => "ophone", + "Callback" => "", + "Car Phone" => "", + "Company Main Phone" => "", + "Home Fax" => "", + "Home Phone" => "a.tel", + "Home Phone 2" => "", //This will make another homePhone entry + "ISDN" => "", + "Mobile Phone" => "mphone", //newPilotPerson + "Other Fax" => "", + "Other Phone" => "", + "Pager" => "pager", + "Primary Phone" => "", + "Radio Phone" => "", + "TTY/TDD Phone" => "", + "Telex" => "", //organization + "Account" => "", + "Anniversary" => "", + "Assistant's Name" => "", //newPilotPerson + "Billing Information" => "", + "Birthday" => "bday", + "Categories" => "", + "Children" => "", + "Directory Server" => "", + "E-mail Address" => "d_email", + "E-mail Display Name" => "", + "E-mail 2 Address" => "", + "E-mail 2 Display Name" => "", + "E-mail 3 Address" => "", //add another... + "E-mail 3 Display Name" => "", + "Gender" => "", + "Government ID Number" => "", + "Hobby" => "", + "Initials" => "", + "Internet Free Busy" => "", + "Keywords" => "", + "Language" => "", + "Location" => "", + "Manager's Name" => "", + "Mileage" => "", + "Notes" => "note", + "Office Location" => "", + "Organizational ID Number" => "", + "PO Box" => "postOfficeBox", + "Priority" => "", + "Private Profession" => "", + "Referred By" => "", + "Sensitivity" => "", + "Spouse" => "", + "User 1" => "", + "User 2" => "", + "User 3" => "", + "User 4" => "", + "Web Page" => "" + ); -function outlook_start_file($buffer,$j="",$k="") { - return $buffer; -} + function import_start_file($buffer,$j="",$k="") { + $buffer=""; + return $buffer; + } -function outlook_end_file($buffer) { - return $buffer; -} + function import_end_file($buffer) { + return $buffer; + } -function outlook_start_record($buffer) { - $top=""; + function import_start_record($buffer) { + $top=""; - $this->currentrecord = $top; - return $buffer; -} + $this->currentrecord = $top; + return $buffer; + } -function outlook_end_record($buffer,$private="private") { - global $phpgw_info; - $row=0; - $i=0; - $lines = split("##",$this->currentrecord); - - # Commence the ugly parsing of csv into sql - for ($i=0;$i2) { - $thisname=$name.","; - $thisvalu="'".$value."',"; - } else { - $thisname=$name.") "; - $thisvalu="'".$value."');"; - } - } else { - $thisname=""; - $thisvalu=""; - } - $namelist = $namelist."\nINSERT INTO phpgw_addressbook (owner,".$thisname; - $valulist = $valulist."VALUES ('".$phpgw_info["user"]["account_id"]."',".$thisvalu; - } elseif ($row==count($lines)-1) { - if (!empty($name) && !empty($value)) { - $thisname=$name.") "; - $thisvalu="'".$value."');"; - } else { - $thisname=""; - $thisvalu=""; - } - $namelist = $namelist.$thisname; - $valulist = $valulist.$thisvalu; - } else { - if (!empty($name) && !empty($value)) { - $thisname=$name.","; - $thisvalu="'".$value."',"; - } else { - $thisname=","; - $thisvalu=","; - } - $namelist = $namelist.$thisname; - $valulist = $valulist.$thisvalu; - } - } - - return $buffer.$namelist.$valulist; -} + function import_end_record($buffer,$private="private") { + global $phpgw_info; + $row=0; + $i=0; + $lines = split("##",$this->currentrecord); -function outlook_new_attrib($buffer,$name,$value) { - $value = str_replace("\n","
",$value); - $value = str_replace("\r","",$value); - if ($value=="") { $value="NULL"; } - $this->currentrecord .= $name."%%".$value."##"; - - return $buffer; -} -} + # Commence the ugly parsing of csv into sql + for ($i=0;$i2) { + $thisname=$name.","; + $thisvalu="'".$value."',"; + } else { + $thisname=$name.") "; + $thisvalu="'".$value."');"; + } + } else { + $thisname=""; + $thisvalu=""; + } + $namelist = $namelist."\nINSERT INTO phpgw_addressbook (owner,".$thisname; + $valulist = $valulist."VALUES ('".$phpgw_info["user"]["account_id"]."',".$thisvalu; + } elseif ($row==count($lines)-1) { + if (!empty($name) && !empty($value)) { + $thisname=$name.") "; + $thisvalu="'".$value."');"; + } else { + $thisname=""; + $thisvalu=""; + } + $namelist = $namelist.$thisname; + $valulist = $valulist.$thisvalu; + } else { + if (!empty($name) && !empty($value)) { + $thisname=$name.","; + $thisvalu="'".$value."',"; + } else { + $thisname=","; + $thisvalu=","; + } + $namelist = $namelist.$thisname; + $valulist = $valulist.$thisvalu; + } + } + + return $buffer.$namelist.$valulist; + } + + function import_new_attrib($buffer,$name,$value) { + $value = str_replace("\n","
",$value); + $value = str_replace("\r","",$value); + if ($value=="") { $value="NULL"; } + $this->currentrecord .= $name."%%".$value."##"; + + return $buffer; + } + } ?> diff --git a/addressbook/conv/Import to Addressbook b/addressbook/conv/Import to Addressbook index 8ae7661404..9e698ac290 100644 --- a/addressbook/conv/Import to Addressbook +++ b/addressbook/conv/Import to Addressbook @@ -1,7 +1,7 @@ "title", - "First Name" => "n_given", - "Middle Name" => "n_middle", - "Last Name" => "n_family", - "Suffix" => "n_suffix", - "Company" => "org_name", //objectclass: organization - "Department" => "org_unit", //objectclass: organizationalPerson - "Job Title" => "title", //objectclass: organizationalPerson - "Business Street" => "address2", - "Business Street 2" => "", - "Business Street 3" => "", - "Business City" => "", - "Business State" => "", - "Business Postal Code" => "", - "Business Country" => "", - "Home Street" => "adr_street", - "Home City" => "adr_locality", - "Home State" => "adr_region", - "Home Postal Code" => "adr_postalcode", - "Home Country" => "adr_countryname", - "Home Street 2" => "", - "Home Street 3" => "", - "Other Street" => "", - "Other City" => "", - "Other State" => "", - "Other Postal Code" => "", - "Other Country" => "", - "Assistant's Phone" => "", - "Business Fax" => "c_tel", - "Business Phone" => "b_tel", - "Business Phone 2" => "ophone", - "Callback" => "", - "Car Phone" => "", - "Company Main Phone" => "", - "Home Fax" => "", - "Home Phone" => "a_tel", - "Home Phone 2" => "", //This will make another homePhone entry - "ISDN" => "", - "Mobile Phone" => "mphone", //newPilotPerson - "Other Fax" => "", - "Other Phone" => "", - "Pager" => "pager", - "Primary Phone" => "", - "Radio Phone" => "", - "TTY/TDD Phone" => "", - "Telex" => "", //organization - "Account" => "", - "Anniversary" => "", - "Assistant's Name" => "", //newPilotPerson - "Billing Information" => "", - "Birthday" => "bday", - "Categories" => "", - "Children" => "", - "Directory Server" => "", - "E-mail Address" => "d_email", - "E-mail Display Name" => "", - "E-mail 2 Address" => "", - "E-mail 2 Display Name" => "", - "E-mail 3 Address" => "", //add another... - "E-mail 3 Display Name" => "", - "Gender" => "", - "Government ID Number" => "", - "Hobby" => "", - "Initials" => "", - "Internet Free Busy" => "", - "Keywords" => "", - "Language" => "", - "Location" => "", - "Manager's Name" => "", - "Mileage" => "", - "Notes" => "note", - "Office Location" => "", - "Organizational ID Number" => "", - "PO Box" => "", - "Priority" => "", - "Private Profession" => "", - "Referred By" => "", - "Sensitivity" => "", - "Spouse" => "", - "User 1" => "", - "User 2" => "", - "User 3" => "", - "User 4" => "", - "Web Page" => ""); + var $import = array( + "Title" => "title", + "First Name" => "n_given", + "Middle Name" => "n_middle", + "Last Name" => "n_family", + "Suffix" => "n_suffix", + "Company" => "org_name", //objectclass: organization + "Department" => "org_unit", //objectclass: organizationalPerson + "Job Title" => "title", //objectclass: organizationalPerson + "Business Street" => "address2", + "Business Street 2" => "", + "Business Street 3" => "", + "Business City" => "", + "Business State" => "", + "Business Postal Code" => "", + "Business Country" => "", + "Home Street" => "adr_street", + "Home City" => "adr_locality", + "Home State" => "adr_region", + "Home Postal Code" => "adr_postalcode", + "Home Country" => "adr_countryname", + "Home Street 2" => "", + "Home Street 3" => "", + "Other Street" => "", + "Other City" => "", + "Other State" => "", + "Other Postal Code" => "", + "Other Country" => "", + "Assistant's Phone" => "", + "Business Fax" => "c_tel", + "Business Phone" => "b_tel", + "Business Phone 2" => "ophone", + "Callback" => "", + "Car Phone" => "", + "Company Main Phone" => "", + "Home Fax" => "", + "Home Phone" => "a_tel", + "Home Phone 2" => "", //This will make another homePhone entry + "ISDN" => "", + "Mobile Phone" => "mphone", //newPilotPerson + "Other Fax" => "", + "Other Phone" => "", + "Pager" => "pager", + "Primary Phone" => "", + "Radio Phone" => "", + "TTY/TDD Phone" => "", + "Telex" => "", //organization + "Account" => "", + "Anniversary" => "", + "Assistant's Name" => "", //newPilotPerson + "Billing Information" => "", + "Birthday" => "bday", + "Categories" => "", + "Children" => "", + "Directory Server" => "", + "E-mail Address" => "d_email", + "E-mail Display Name" => "", + "E-mail 2 Address" => "", + "E-mail 2 Display Name" => "", + "E-mail 3 Address" => "", //add another... + "E-mail 3 Display Name" => "", + "Gender" => "", + "Government ID Number" => "", + "Hobby" => "", + "Initials" => "", + "Internet Free Busy" => "", + "Keywords" => "", + "Language" => "", + "Location" => "", + "Manager's Name" => "", + "Mileage" => "", + "Notes" => "note", + "Office Location" => "", + "Organizational ID Number" => "", + "PO Box" => "", + "Priority" => "", + "Private Profession" => "", + "Referred By" => "", + "Sensitivity" => "", + "Spouse" => "", + "User 1" => "", + "User 2" => "", + "User 3" => "", + "User 4" => "", + "Web Page" => "" + ); -function outlook_start_file($buffer,$j="",$k="") { - return $buffer; -} + function import_start_file($buffer,$j="",$k="") { + return $buffer; + } -function outlook_end_file($buffer) { - global $phpgw,$phpgw_info; - - $lines = split("\n",$buffer); - $contacts = CreateObject("phpgwapi.contacts"); - - for ($i=0;$iadd($phpgw_info["user"]["account_id"],$entry); - } + function import_end_file($buffer) { + global $phpgw,$phpgw_info; + + //$contacts = CreateObject("phpgwapi.contacts"); + echo '
'; + while ( list($name,$value) = each($buffer) ) { + echo '
'.$name.' => '.$value; + $i++; + //$contacts->add($phpgw_info["user"]["account_id"],$entry); + } - return "Successfully imported $i records into your addressbook."; -} + return "Successfully imported $i records into your addressbook."; + } -function outlook_start_record($buffer) { - $top=""; + function import_start_record($buffer) { + $top=array(); + $this->currentrecord = $top; + return $buffer; + } - $this->currentrecord = $top; - return $buffer; -} + function import_end_record($buffer,$private="private") { + global $phpgw_info; + $namelist=array(); + while ( list($name, $value) = each($this->currentrecord)) { + $namelist = $namelist + array($name => $value); + echo '
'.$name.' => '.$value; + } + echo '
'; + $buffer = $buffer + $namelist; + return $buffer; + } -function outlook_end_record($buffer,$private="private") { - global $phpgw_info; - $row=0; - $i=0; - $lines = split("##",$this->currentrecord); - - for ($i=0;$i $value); - echo $name.' '.$value; - } - - return $buffer.$namelist; -} + function import_new_attrib($buffer,$name,$value) { + $value = str_replace("\n","
",$value); + $value = str_replace("\r","",$value); + $this->currentrecord += array($name => $value); -function outlook_new_attrib($buffer,$name,$value) { - $value = str_replace("\n","
",$value); - $value = str_replace("\r","",$value); - if ($value=="") { $value="NULL"; } - $this->currentrecord .= $name."%%".addslashes($value)."##"; - - return $buffer; -} -} + return $buffer; + } + } ?>