Changeset 840b4db in github
- Timestamp:
- Jul 10, 2012 2:30:34 PM (11 months ago)
- Children:
- 1c079c1
- Parents:
- 2b21b97
- Location:
- program
- Files:
-
- 3 edited
-
include/rcmail.php (modified) (4 diffs)
-
steps/mail/addcontact.inc (modified) (1 diff)
-
steps/mail/func.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcmail.php
r7c8fd80 r840b4db 172 172 * Return instance of the internal address book class 173 173 * 174 * @param string Address book identifier 174 * @param string Address book identifier (-1 for default addressbook) 175 175 * @param boolean True if the address book needs to be writeable 176 176 * … … 181 181 $contacts = null; 182 182 $ldap_config = (array)$this->config->get('ldap_public'); 183 $abook_type = strtolower($this->config->get('address_book_type'));184 183 185 184 // 'sql' is the alias for '0' used by autocomplete 186 185 if ($id == 'sql') 187 $id = '0'; 186 $id = '0'; 187 else if ($id == -1) { 188 $id = $this->config->get('default_addressbook'); 189 $default = true; 190 } 188 191 189 192 // use existing instance 190 if (isset($this->address_books[$id]) && is_object($this->address_books[$id]) 191 && is_a($this->address_books[$id], 'rcube_addressbook') 192 && (!$writeable || !$this->address_books[$id]->readonly) 193 ) { 193 if (isset($this->address_books[$id]) && ($this->address_books[$id] instanceof rcube_addressbook)) { 194 194 $contacts = $this->address_books[$id]; 195 195 } … … 207 207 $contacts = $plugin['instance']; 208 208 } 209 // get first source from the list 210 else if (!$id) { 211 $source = reset($this->get_address_sources($writeable)); 212 if (!empty($source)) { 213 $contacts = $this->get_address_book($source['id']); 214 if ($contacts) 215 $id = $source['id']; 216 } 209 } 210 211 // Get first addressbook from the list if configured default doesn't exist 212 // This can happen when user deleted the addressbook (e.g. Kolab folder) 213 if (!$contacts && (!$id || $default)) { 214 $source = reset($this->get_address_sources($writeable)); 215 if (!empty($source)) { 216 $contacts = $this->get_address_book($source['id']); 217 if ($contacts) 218 $id = $source['id']; 217 219 } 218 220 } … … 224 226 'message' => "Addressbook source ($id) not found!"), 225 227 true, true); 228 } 229 230 if ($writeable && $contacts->readonly) { 231 return null; 226 232 } 227 233 -
program/steps/mail/addcontact.inc
r041c93c r840b4db 24 24 return; 25 25 26 $abook = $RCMAIL->config->get('default_addressbook'); 27 28 // Get configured addressbook 29 $CONTACTS = $RCMAIL->get_address_book($abook, true); 30 31 // Get first writeable addressbook if the configured doesn't exist 32 // This can happen when user deleted the addressbook (e.g. Kolab folder) 33 if ($abook == null || !is_object($CONTACTS)) { 34 $source = reset($RCMAIL->get_address_sources(true)); 35 $CONTACTS = $RCMAIL->get_address_book($source['id'], true); 36 } 26 // Get default addressbook 27 $CONTACTS = $RCMAIL->get_address_book(-1, true); 37 28 38 29 if (!empty($_POST['_address']) && is_object($CONTACTS)) -
program/steps/mail/func.inc
r8749e94 r840b4db 519 519 global $RCMAIL; 520 520 521 $show_images = $RCMAIL->config->get('show_images');522 521 if (!$message->is_safe 523 && !empty($show_images) 524 && $message->has_html_part()) 525 { 526 switch($show_images) { 527 case '1': // known senders only 528 $CONTACTS = new rcube_contacts($RCMAIL->db, $_SESSION['user_id']); 529 if ($CONTACTS->search('email', $message->sender['mailto'], true, false)->count) { 530 $message->set_safe(true); 522 && ($show_images = $RCMAIL->config->get('show_images')) 523 && $message->has_html_part() 524 ) { 525 switch ($show_images) { 526 case 1: // known senders only 527 // get default addressbook, like in addcontact.inc 528 $CONTACTS = $RCMAIL->get_address_book(-1, true); 529 530 if ($CONTACTS) { 531 $result = $CONTACTS->search('email', $message->sender['mailto'], 1, false); 532 if ($result->count) { 533 $message->set_safe(true); 534 } 531 535 } 532 break; 533 case '2': // always 536 break; 537 538 case 2: // always 534 539 $message->set_safe(true); 535 break;540 break; 536 541 } 537 542 }
Note: See TracChangeset
for help on using the changeset viewer.
