- Timestamp:
- 08/04/11 10:38:25 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.dynamic_contacts.inc.php
r4634 r4901 79 79 { 80 80 foreach($this->contacts as $item => $valor) 81 $contact .= str_replace("#",";",$this->contacts[$item]['email']) . ','; 81 // 82 if (strstr($this->contacts[$item]['email'], '#')){ 83 $contact .= str_replace("#",";",$this->contacts[$item]['email']) . ','; 84 }else{ 85 $contact .= ';'.$this->contacts[$item]['email'] . ','; 86 } 87 82 88 //Retira ultima virgula. 83 89 $contact = substr($contact,0,(strlen($contact) - 1)); … … 106 112 { 107 113 // Trim all whitespaces and duplicated commas from full_email_address 108 $full_email_address = preg_replace('{(,)\1+}',',',ereg_replace( ' +', '', $full_email_address));114 //$full_email_address = preg_replace('{(,)\1+}',',',ereg_replace( ' +', '', $full_email_address)); 109 115 $parse_address = imap_rfc822_parse_adrlist($full_email_address, ""); 110 116 $new_contacts = array(); … … 118 124 if(!$this->contacts) // Used one time to insert the first contact in database 119 125 { 120 $this->db->insert_contact( $val->personal."#".$val->mailbox."@".$val->host);126 $this->db->insert_contact(ltrim(rtrim($val->personal))."#".$val->mailbox."@".$val->host); 121 127 // Just new contact added. 122 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host;128 $new_contacts[] = ltrim(rtrim($val->personal)).";".$val->mailbox."@".$val->host; 123 129 $this->contacts = $this->db->get_dynamic_contacts(); 124 130 } … … 129 135 foreach($this->contacts as $item => $valor) 130 136 { 131 if($this->contacts[$item]['email'] == $val->personal."#".$val->mailbox."@".$val->host) // check if email already exists137 if($this->contacts[$item]['email'] == ltrim(rtrim($val->personal))."#".$val->mailbox."@".$val->host) // check if email already exists 132 138 { 133 139 $this->contacts[$item]['timestamp'] = time(); //update timestamp of email … … 143 149 { 144 150 // Just new contact added. 145 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host;151 $new_contacts[] = ltrim(rtrim($val->personal)).";".$val->mailbox."@".$val->host; 146 152 if($this->number_of_contacts > count($this->contacts)) 147 153 { 148 154 $this->contacts[] = array( 'timestamp' => time(), 149 'email' => $val->personal."#".$val->mailbox."@".$val->host);155 'email' => ltrim(rtrim($val->personal))."#".$val->mailbox."@".$val->host); 150 156 } 151 157 if($this->number_of_contacts <= count($this->contacts)) 152 158 { 153 159 $this->contacts[$older_contact] = array( 'timestamp' => time(), 154 'email' => $val->personal."#".$val->mailbox."@".$val->host);160 'email' => ltrim(rtrim($val->personal))."#".$val->mailbox."@".$val->host); 155 161 } 156 162 }
Note: See TracChangeset
for help on using the changeset viewer.