Changeset 3849488 in github
- Timestamp:
- Jul 13, 2012 2:16:52 PM (10 months ago)
- Children:
- 7938312
- Parents:
- 88fb563
- Location:
- program/steps
- Files:
-
- 3 edited
-
addressbook/func.inc (modified) (1 diff)
-
addressbook/show.inc (modified) (3 diffs)
-
mail/show.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/addressbook/func.inc
r041c93c r3849488 710 710 unset($attrib['placeholder']); 711 711 712 if (preg_match('!^https?://!i', $record['photo'])) 712 $plugin = $RCMAIL->plugins->exec_hook('contact_photo', array('record' => $record, 'data' => $record['photo'])); 713 714 if ($plugin['url']) 715 $photo_img = $plugin['url']; 716 else if (preg_match('!^https?://!i', $record['photo'])) 713 717 $photo_img = $record['photo']; 714 718 else if ($record['photo']) -
program/steps/addressbook/show.inc
r041c93c r3849488 23 23 $cids = rcmail_get_cids(); 24 24 $source = key($cids); 25 $cid = array_shift($cids[$source]);25 $cid = $cids ? array_shift($cids[$source]) : null; 26 26 27 27 // Initialize addressbook source … … 40 40 // return raw photo of the given contact 41 41 if ($RCMAIL->action == 'photo') { 42 // search for contact first 43 if (!$record && ($email = get_input_value('_email', RCUBE_INPUT_GPC))) { 44 foreach ($RCMAIL->get_address_sources() as $s) { 45 $abook = $RCMAIL->get_address_book($s['id']); 46 $result = $abook->search(array('email'), $email, 1, true, true, 'photo'); 47 while ($result && ($record = $result->iterate())) { 48 if ($record['photo']) 49 break 2; 50 } 51 } 52 } 53 54 // read the referenced file 42 55 if (($file_id = get_input_value('_photo', RCUBE_INPUT_GPC)) && ($tempfile = $_SESSION['contacts']['files'][$file_id])) { 43 56 $tempfile = $RCMAIL->plugins->exec_hook('attachment_display', $tempfile); … … 55 68 } 56 69 70 // let plugins do fancy things with contact photos 71 $plugin = $RCMAIL->plugins->exec_hook('contact_photo', array('record' => $record, 'email' => $email, 'data' => $data)); 72 73 // redirect to url provided by a plugin 74 if ($plugin['url']) 75 $RCMAIL->output->redirect($plugin['url']); 76 else 77 $data = $plugin['data']; 78 79 // deliver alt image 80 if (!$data && ($alt_img = get_input_value('_alt', RCUBE_INPUT_GPC)) && is_file($alt_img)) 81 $data = file_get_contents($alt_img); 82 83 // cache for one day if requested by email 84 if (!$cid && $email) 85 $RCMAIL->output->future_expire_header(86400); 86 57 87 header('Content-Type: ' . rc_image_content_type($data)); 58 88 echo $data ? $data : file_get_contents('program/blank.gif'); -
program/steps/mail/show.inc
r8749e94 r3849488 267 267 } 268 268 269 function rcmail_message_contactphoto($attrib) 270 { 271 global $RCMAIL, $MESSAGE; 272 273 $placeholder = $attrib['placeholder'] ? $RCMAIL->config->get('skin_path') . $attrib['placeholder'] : null; 274 if ($MESSAGE->sender) 275 $photo_img = $RCMAIL->url(array('_task' => 'addressbook', '_action' => 'photo', '_email' => $MESSAGE->sender['mailto'], '_alt' => $placeholder)); 276 else 277 $photo_img = $placeholder ? $placeholder : 'program/blank.gif'; 278 279 return html::img(array('src' => $photo_img) + $attrib); 280 } 281 269 282 270 283 $OUTPUT->add_handlers(array( … … 272 285 'mailboxname' => 'rcmail_mailbox_name_display', 273 286 'messageobjects' => 'rcmail_message_objects', 287 'contactphoto' => 'rcmail_message_contactphoto', 274 288 )); 275 289
Note: See TracChangeset
for help on using the changeset viewer.
