diff --git a/addressbook/import/Import_from_Netscape b/addressbook/import/Import_from_Netscape deleted file mode 100644 index caaec773fe..0000000000 --- a/addressbook/import/Import_from_Netscape +++ /dev/null @@ -1,112 +0,0 @@ - 'FullName','FirstName' => '+, '); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $currentrecord = array(); //used for buffering to allow uid lines to go first - var $id; - var $type = 'ldif'; - - var $import = array( - 'title' => 'title', - 'givenname' => 'n_given', - 'sn' => 'n_family', - 'cn' => 'fn', - 'o' => 'org_name', - 'ou' => 'org_unit', - 'streetaddress' => 'adr_one_street', - 'locality' => 'adr_one_locality', - 'st' => 'adr_one_region', - 'postalcode' => 'adr_one_postalcode', - 'countryname' => 'adr_one_countryname', - 'telephonenumber' => 'tel_work', - 'homephone' => 'tel_home', - 'facsimiletelephonenumber' => 'tel_fax', - 'xmozillaanyphone' => 'ophone', - 'cellphone' => 'tel_cell', - 'description' => 'note', - 'pagerphone' => 'tel_pager', - 'mail' => 'email', - 'homeurl' => 'url', - 'xmozillauseconferenceserver' => '', - 'xmozillanickname' => '', - 'xmozillausehtmlmail' => '', - 'modifytimestamp' => '', - 'objectclass' => '' - ); - - function import_start_file($buffer) - { - return $buffer; - } - - function import_start_record($buffer) - { - $top=array(); - ++$this->id; - $this->currentrecord = $top; - return $buffer; - } - - function import_new_attrib($buffer,$name,$value) - { - // chop leading space from value - $value = trim($value); - $value = str_replace('\r','',$value); - //echo '
'.$name.' => '.$value; - $this->currentrecord += array($name => $value); - - return $buffer; - } - - function import_end_record($buffer) - { - global $phpgw_info; - $buffer[$this->id]=''; - while ( list($name, $value) = each($this->currentrecord)) - { - $buffer[$this->id][$name] = $value; - //echo '
'.$this->id.': '.$name.' => '.$value; - } - return $buffer; - } - - function import_end_file($buffer,$access='private',$cat_id=0) - { - global $phpgw,$phpgw_info; - - $contacts = CreateObject('phpgwapi.contacts'); - //echo '
'; - for ($i=1;$i<=count($buffer);$i++) - { - while ( list($name,$value) = @each($buffer[$i]) ) - { - //echo '
'.$i.': '.$name.' => '.$value; - $entry[$i][$name] = $value; - } - $entry[$i]['email_type'] = 'INTERNET'; - $entry[$i]['email_home_type'] = 'INTERNET'; - $entry[$i]['adr_one_type'] = 'intl'; - $entry[$i]['adr_two_type'] = 'intl'; - //echo '
'; - $contacts->add($phpgw_info['user']['account_id'],$entry[$i],$access,$cat_id); - } - $num = $i - 1; - return lang('Successfully imported x records into your addressbook.',$num); - } - } -?> diff --git a/addressbook/import/Import_from_Outlook b/addressbook/import/Import_from_Outlook deleted file mode 100644 index 990ef0a8e9..0000000000 --- a/addressbook/import/Import_from_Outlook +++ /dev/null @@ -1,178 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array('LastName' => 'FullName','FirstName' => '+, '); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $currentrecord = array(); //used for buffering to allow uid lines to go first - var $id; - var $type = 'csv'; - - 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' => 'adr_one_street', - 'Business Street 2' => 'address2', - 'Business Street 3' => 'address3', - 'Business City' => 'adr_one_locality', - 'Business State' => 'adr_one_region', - 'Business Postal Code' => 'adr_one_postalcode', - 'Business Country' => 'adr_one_countryname', - 'Home Street' => 'adr_two_street', - 'Home City' => 'adr_two_locality', - 'Home State' => 'adr_two_region', - 'Home Postal Code' => 'adr_two_postalcode', - 'Home Country' => 'adr_two_countryname', - 'Home Street 2' => '', - 'Home Street 3' => '', - 'Other Street' => '', - 'Other City' => '', - 'Other State' => '', - 'Other Postal Code' => '', - 'Other Country' => '', - "Assistant's Phone" => 'tel_msg', - 'Business Fax' => 'tel_fax', - 'Business Phone' => 'tel_work', - 'Business Phone 2' => 'ophone', - 'Callback' => '', - 'Car Phone' => 'tel_car', - 'Company Main Phone' => '', - 'Home Fax' => '', - 'Home Phone' => 'tel_home', - 'Home Phone 2' => '', //This will make another homePhone entry - 'ISDN' => 'tel_isdn', - 'Mobile Phone' => 'tel_cell', //newPilotPerson - 'Other Fax' => '', - 'Other Phone' => '', - 'Pager' => 'tel_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' => 'email', - 'E-mail Display Name' => '', - 'E-mail 2 Address' => 'email_home', - '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' => 'url' - ); - - function import_start_file($buffer) - { - return $buffer; - } - - function import_start_record($buffer) - { - $top=array(); - ++$this->id; - $this->currentrecord = $top; - return $buffer; - } - - function import_new_attrib($buffer,$name,$value) - { - $value = trim($value); - $value = str_replace('\n','
',$value); - $value = str_replace('\r','',$value); - $this->currentrecord += array($name => $value); - - return $buffer; - } - - function import_end_record($buffer) - { - global $phpgw_info; - $buffer[$this->id]=''; - while ( list($name, $value) = each($this->currentrecord)) - { - $buffer[$this->id][$name] = $value; - //echo '
'.$name.' => '.$value; - } - return $buffer; - } - - function import_end_file($buffer,$access='private',$cat_id=0) - { - global $phpgw,$phpgw_info; - - $contacts = CreateObject('phpgwapi.contacts'); - //echo '
'; - for ($i=1;$i<=count($buffer);$i++) - { - while ( list($name,$value) = @each($buffer[$i]) ) - { - //echo '
'.$i.': '.$name.' => '.$value; - $entry[$i][$name] = $value; - } - $entry[$i]['email_type'] = 'INTERNET'; - $entry[$i]['email_home_type'] = 'INTERNET'; - $entry[$i]['adr_one_type'] = 'intl'; - $entry[$i]['adr_two_type'] = 'intl'; - //echo '
'; - $contacts->add($phpgw_info['user']['account_id'],$entry[$i],$access,$cat_id); - } - $num = $i - 1; - return lang('Successfully imported x records into your addressbook.',$num); - } - } -?> diff --git a/addressbook/import/Import_from_VCard b/addressbook/import/Import_from_VCard deleted file mode 100644 index fe6ad3cbd5..0000000000 --- a/addressbook/import/Import_from_VCard +++ /dev/null @@ -1,95 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array('LastName' => 'FullName','FirstName' => '+, '); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $currentrecord = array(); //used for buffering to allow uid lines to go first - var $id; - var $type = 'vcard'; - - // These will hold the class objects - var $contacts = ''; - var $vcard = ''; - - // This will be populated via the vcard->import var - var $import = array(); - - function import_start_file($buffer) - { - $this->id = 0; - $this->contacts = CreateObject('phpgwapi.contacts'); - $this->vcard = CreateObject('phpgwapi.vcard'); - $this->import = $this->vcard->import; - return $buffer; - } - - function import_start_record($buffer) - { - ++$this->id; - $this->currentrecord = array(); - return $buffer; - } - - function import_new_attrib($buffer,$name,$value) - { - $value = trim($value); - $value = ereg_replace('=0D=0A','\n',$value); - //echo '
'.$this->id.': '.$name.' => '.$value; - $this->currentrecord += array($name => $value); - - return $buffer; - } - - function import_end_record($buffer) - { - global $phpgw_info; - $buffer[$this->id]=''; - while ( list($name, $value) = each($this->currentrecord)) - { - $buffer[$this->id][$name] = $value; - //$buffer[$this->id]['private'] = $private; - //echo '
'.$name.' => '.$value; - } - return $buffer; - } - - function import_end_file($buffer,$access='private',$cat_id=0) - { - global $phpgw,$phpgw_info; - - for ($i=1;$i<=count($buffer);$i++) - { - // Send the entire array to the vcard class in function. - // It will parse the vcard fields and clean the array of extra - // bogus values that get stuffed in. - $entry = $this->vcard->in($buffer[$i]); - // Now actually add the new entry - $this->contacts->add($phpgw_info['user']['account_id'],$entry,$access,$cat_id); - } - $num = $i - 1; - return lang('Successfully imported x records into your addressbook.',$num); - } - } -?> diff --git a/addressbook/import/debug/Debug_Netscape_to_LDAP b/addressbook/import/debug/Debug_Netscape_to_LDAP deleted file mode 100644 index 959812267f..0000000000 --- a/addressbook/import/debug/Debug_Netscape_to_LDAP +++ /dev/null @@ -1,197 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array("LastName" => "FullName","FirstName" => "+, "); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $basedn; - var $contactsdn; - - var $sn; //these two vars will be used in - var $o; //building a dn field. - var $givenName; //this is used in building a cn field - var $currentrecord; //used for buffering to allow uid lines to go first - var $type = 'ldif'; - - var $import = array( - "title" => "title", - "givenname" => "givenname", - "sn" => "sn", - "cn" => "cn", - "o" => "o", - "ou" => "ou", - "streetaddress" => "streetaddress", - "locality" => "locality", - "st" => "st", - "postalcode" => "postalcode", - "countryname" => "countryname", - "telephonenumber" => "telephonenumber", - "homephone" => "homephone", - "facsimiletelephonenumber" => "facsimiletelephonenumber", - "xmozillaanyphone" => "xmozillaanyphone", - "cellphone" => "cellphone", - "description" => "description", - "pagerphone" => "pagerphone", - "mail" => "mail", - "homeurl" => "homeurl", - "xmozillauseconferenceserver" => "xmozillauseconferenceserver", - "xmozillanickname" => "xmozillanickname", - "xmozillausehtmlmail" => "xmozillausehtmlmail", - "modifytimestamp" => "modifytimestamp", - "objectclass" => "objectclass" - ); - - function import_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; - $buffer=""; - return $buffer; - } - - function import_end_file($buffer) { - return $buffer; - } - - function import_start_record($buffer) { - global $phpgw_info; - - $top="\nobjectClass: person -objectClass: organizationalPerson -objectClass: inetOrgPerson -objectClass: importPerson"; - - $this->o=""; - $this->sn=""; - $this->givenName=""; - - $this->currentrecord = $top; - return $buffer; - } - - 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; - - 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 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 = trim($value); - $value = str_replace("\n","",$value); - $name = str_replace("\n","",$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; - } // end switch - } - } -?> diff --git a/addressbook/import/debug/Debug_Netscape_to_SQL b/addressbook/import/debug/Debug_Netscape_to_SQL deleted file mode 100644 index e18518e3a7..0000000000 --- a/addressbook/import/debug/Debug_Netscape_to_SQL +++ /dev/null @@ -1,136 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array("LastName" => "FullName","FirstName" => "+, "); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $currentrecord; //used for buffering to allow uid lines to go first - var $type = 'ldif'; - - var $import = array( - "title" => "title", - "givenname" => "n_given", - "sn" => "n_family", - "cn" => "fn", - "o" => "org_name", - "ou" => "org_unit", - "streetaddress" => "adr_one_street", - "locality" => "adr_one_locality", - "st" => "adr_one_region", - "postalcode" => "adr_one_postalcode", - "countryname" => "adr_one_countryname", - "telephonenumber" => "tel_work", - "homephone" => "tel_home", - "facsimiletelephonenumber" => "tel_fax", - "xmozillaanyphone" => "tel_msg", - "cellphone" => "tel_cell", - "description" => "note", - "pagerphone" => "tel_pager", - "mail" => "email", - "homeurl" => "url", - "xmozillauseconferenceserver" => "", - "xmozillanickname" => "", - "xmozillausehtmlmail" => "", - "modifytimestamp" => "", - "objectclass" => "" - ); - - function import_start_file($buffer,$j="",$k="") { - $buffer=""; - return $buffer; - } - - function import_end_file($buffer) { - return $buffer; - } - - function import_start_record($buffer) { - $top=""; - - $this->currentrecord = $top; - return $buffer; - } - - function import_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_new_attrib($buffer,$name,$value) { - $value = trim($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/import/debug/Debug_Outlook_to_LDAP b/addressbook/import/debug/Debug_Outlook_to_LDAP deleted file mode 100644 index 400ea5e6e0..0000000000 --- a/addressbook/import/debug/Debug_Outlook_to_LDAP +++ /dev/null @@ -1,255 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array("LastName" => "FullName","FirstName" => "+, "); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $type = 'csv'; - var $basedn; - var $contactsdn; - - var $sn; //these two vars will be used in - var $o; //building a dn field. - var $givenName; //this is used in building a cn field - var $currentrecord; //used for buffering to allow uid lines to go first - - 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 import_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; - $buffer=""; - return $buffer; - } - - function import_end_file($buffer) { - return $buffer; - } - - function import_start_record($buffer) { - global $phpgw_info; - - $top="\nobjectClass: person -objectClass: organizationalPerson -objectClass: inetOrgPerson -objectClass: importPerson"; - - $this->o=""; - $this->sn=""; - $this->givenName=""; - - $this->currentrecord = $top; - return $buffer; - } - - 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; - - 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 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); - - 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/import/debug/Debug_Outlook_to_SQL b/addressbook/import/debug/Debug_Outlook_to_SQL deleted file mode 100644 index 69f6bb86cf..0000000000 --- a/addressbook/import/debug/Debug_Outlook_to_SQL +++ /dev/null @@ -1,194 +0,0 @@ -First NameMiddle NameLast Name... -// PatrickWalsh... -// -// Where the first line explains each optional field. This is what -// will be looked up in the key. -// -// The array need not be in any order and any fields not defined will -// not be transferred. If the val='+', the value will be appended to -// the previous field and any text after the '+' will be appended -// before the value. For example, the following would add a comma and -// a space between LastName and FirstName and store it in FullName: -// -// array("LastName" => "FullName","FirstName" => "+, "); -// -// Also start with a '#' symbol and a comma separated list will be -// turned into a number of the same entries. - - class import_conv - { - var $type = 'csv'; - var $currentrecord; //used for buffering to allow uid lines to go first - - 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" => "adr_one_street", - "Business Street 2" => "address2", - "Business Street 3" => "address3", - "Business City" => "adr_one_locality", - "Business State" => "adr_one_region", - "Business Postal Code" => "adr_one_postalcode", - "Business Country" => "adr_one_countryname", - "Home Street" => "adr_two_street", - "Home City" => "adr_two_locality", - "Home State" => "adr_two_region", - "Home Postal Code" => "adr_two_postalcode", - "Home Country" => "adr_two_countryname", - "Home Street 2" => "", - "Home Street 3" => "", - "Other Street" => "", - "Other City" => "", - "Other State" => "", - "Other Postal Code" => "", - "Other Country" => "", - "Assistant's Phone" => "tel_msg", - "Business Fax" => "tel_fax", - "Business Phone" => "tel_work", - "Business Phone 2" => "ophone", - "Callback" => "", - "Car Phone" => "tel_car", - "Company Main Phone" => "", - "Home Fax" => "", - "Home Phone" => "tel_home", - "Home Phone 2" => "", //This will make another homePhone entry - "ISDN" => "tel_isdn", - "Mobile Phone" => "tel_cell", //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" => "email", - "E-mail Display Name" => "", - "E-mail 2 Address" => "email_home", - "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 import_start_file($buffer,$j="",$k="") { - $buffer=""; - return $buffer; - } - - function import_end_file($buffer) { - return $buffer; - } - - function import_start_record($buffer) { - $top=""; - - $this->currentrecord = $top; - return $buffer; - } - - function import_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_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; - } - } -?>