Changeset 485
- Timestamp:
- 09/26/08 11:10:54 (16 years ago)
- Location:
- trunk/expressoMail1_2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.dynamic_contacts.inc.php
r413 r485 45 45 $this->db = new db_functions(); 46 46 $this->contacts = $this->db->get_dynamic_contacts(); 47 $this->number_of_contacts = $_SESSION['phpgw_info'][' server']['expressomail']['expressoMail_Number_of_dynamic_contacts'];47 $this->number_of_contacts = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts']; 48 48 $this->functions = new functions(); 49 49 } … … 113 113 function add_dynamic_contacts($full_email_address) 114 114 { 115 // Trim all whitespaces and duplicated commas from full_email_address 116 $full_email_address = preg_replace('{(,)\1+}',',',ereg_replace( ' +', '', $full_email_address)); 115 117 $parse_address = imap_rfc822_parse_adrlist($full_email_address, ""); 118 $new_contacts = array(); 116 119 foreach ($parse_address as $val) 117 120 { … … 120 123 if ($this->contact_exist_in_ContactCenter($val->mailbox."@".$val->host)) 121 124 continue; 122 125 123 126 if(!$this->contacts) // Used one time to insert the first contact in database 124 127 { 125 128 $this->db->insert_contact($val->mailbox."@".$val->host); 129 // Just new contact added. 130 $new_contacts[] = $val->mailbox."@".$val->host; 126 131 $this->contacts = $this->db->get_dynamic_contacts(); 127 132 } … … 138 143 } 139 144 if($this->contacts[$item]['timestamp'] < $older_contact_time) //search for oldest email 140 141 142 143 145 { 146 $older_contact = $item; 147 $older_contact_time = $this->contacts[$item]['timestamp']; 148 } 144 149 } 145 150 if ($new_contact_flag == true) //new contact! 146 151 { 152 // Just new contact added. 153 $new_contacts[] = $val->mailbox."@".$val->host; 147 154 if($this->number_of_contacts > count($this->contacts)) 148 155 { … … 159 166 } 160 167 $this->db->update_contacts($this->contacts); 168 return implode(",;",$new_contacts); 161 169 } 162 170 -
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r469 r485 1308 1308 error_log("$now - $userip - $sent [$subject] - $userid => $addrs\r\n", 3, "/home/expressolivre/mail_senders.log"); 1309 1309 } 1310 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 1310 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] && 1311 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 1311 1312 $contacts = new dynamic_contacts(); 1312 $contacts->add_dynamic_contacts($toaddress.$ccaddress.$ccoaddress); 1313 } 1314 return true; 1313 $new_contacts = $contacts->add_dynamic_contacts($toaddress.",".$ccaddress.",".$ccoaddress); 1314 return array("success" => true, "new_contacts" => $new_contacts); 1315 } 1316 return array("success" => true); 1315 1317 } 1316 1318 } -
trunk/expressoMail1_2/index.php
r413 r485 59 59 $boemailadmin = CreateObject('emailadmin.bo'); 60 60 $emailadmin_profile = $boemailadmin->getProfileList(); 61 // Loading Admin Config Module 62 $c = CreateObject('phpgwapi.config','expressoMail1_2'); 63 $c->read_repository(); 64 $current_config = $c->config_data; 65 61 66 $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); 62 67 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; … … 64 69 $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null; 65 70 $_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email']; 71 66 72 $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] = array( 67 73 'voip_enabled' => $voip_enabled, … … 83 89 'use_shortcuts' => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts'] : "0", 84 90 'auto_save_draft' => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['auto_save_draft'] : "0", 85 'use_dynamic_contacts' => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] : "0" 91 'use_dynamic_contacts' => $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts'] : "0", 92 'number_of_contacts' => $current_config['expressoMail_Number_of_dynamic_contacts'] ? $current_config['expressoMail_Number_of_dynamic_contacts'] : "0" 86 93 87 94 ); … … 115 122 $GLOBALS['phpgw']->common->phpgw_footer(); 116 123 117 // Loading Admin Config Module118 $c = CreateObject('phpgwapi.config','expressoMail1_2');119 $c->read_repository();120 $current_config = $c->config_data;121 124 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] = $current_config['expressoMail_enable_log_messages']; 122 125 // Begin Set Anti-Spam options. … … 127 130 // End Set Anti-Spam options. 128 131 129 // Dynamic contact. 130 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_Number_of_dynamic_contacts'] = $current_config['expressoMail_Number_of_dynamic_contacts']; 131 132 // Set Imap Folder names options 132 // Set Imap Folder names options 133 133 134 134 $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'] = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'] : lang("Trash"); -
trunk/expressoMail1_2/js/main.js
r413 r485 841 841 842 842 function send_message_return(data, ID){ 843 if(data && data == true ){843 if(data && data.success == true ){ 844 844 // if send ok, set a flag as answered or forwarded 845 845 var msg_number_replied = Element('msg_reply_from_'+ID); … … 856 856 write_msg(get_lang('Your message was sent and save.')); 857 857 wfolders.alert = false; 858 init();859 858 }else{ 860 859 write_msg(get_lang('Your message was sent.')); 861 init(); 860 } 861 // If new dynamic contacts were added, update the autocomplete .... 862 if(data.new_contacts){ 863 var ar_contacts = data.new_contacts.split(',;'); 864 for(var j in ar_contacts){ 865 // If the dynamic contact don't exist, update the autocomplete.... 866 if((contacts+",").indexOf(";"+ar_contacts[j]+",") == -1) 867 contacts += ",;" + ar_contacts[j]; 868 } 862 869 } 863 870 if ((! newMessageTab.toPreserve[ID]) && (newMessageTab.imapUid[ID] != 0)) -
trunk/expressoMail1_2/js/preferences.js
r413 r485 75 75 "<tr><td> - " + get_lang("Use dynamic contacts?") + "</td>"+ 76 76 "<td><input type='checkBox' id='use_dynamic_contacts' name='use_dynamic_contacts'></td></tr>"+ 77 "<tr><td> - " + get_lang("Auto save draft") + "?</td>"+ 78 "<td><input type='checkBox' id='auto_save_draft' name='auto_save_draft'></td></tr>"+ 77 79 "<tr><td> - " + get_lang("Use shortcuts?") + "</td>"+ 78 80 "<td><input type='checkBox' id='use_shortcuts' name='use_shortcuts'></td></tr>"+ 79 "<tr><td> - " + get_lang("Auto save draft") + "?</td>"+80 "<td><input type='checkBox' id='auto_save_draft' name='auto_save_draft'></td></tr>"+81 81 "<tr><td nowrap> - " + get_lang('Insert signature automatically in new messages?') + "</td>"+ 82 82 "<td><input type='checkBox' id='use_signature' name='use_signature'></td>"+ … … 153 153 txt_signature.value = preferences.signature; 154 154 155 if ((_this.number_of_contacts < 1) || isNaN(_this.number_of_contacts)) 156 { 155 if ((preferences.number_of_contacts < 1) || isNaN(preferences.number_of_contacts)){ 157 156 Element("use_dynamic_contacts").checked = false; 158 157 Element("use_dynamic_contacts").disabled = 'disabled'; … … 184 183 else if(preferences.auto_save_draft != Element("auto_save_draft").checked) 185 184 reload_page = true; 186 else if(preferences.use_dynamic_contacts != Element("use_dynamic_contacts").checked) 187 { 185 else if(preferences.use_dynamic_contacts != Element("use_dynamic_contacts").checked) { 188 186 reload_page = true; 189 187 _this.delete_dynamic_contacts(); … … 287 285 } 288 286 win.open(); 289 } 290 287 } 291 288 Preferences.prototype.delete_dynamic_contacts = function(){ 292 289 var handler = function(data){} … … 295 292 cExecute(args,handler,params); 296 293 } 297 Preferences.prototype.get_number_of_contacts = function(){298 var _this = this;299 var handler = function(data){300 _this.number_of_contacts = data;301 }302 var args = "$this.dynamic_contacts.get_number_of_contacts";303 var params = "";304 cExecute(args,handler,params);305 }306 294 // Cria o objeto 307 295 var prefe; 308 296 prefe = new Preferences(); 309 prefe.get_number_of_contacts();
Note: See TracChangeset
for help on using the changeset viewer.