Fix invalid path to "add contact" icon when using assets_path setting

This and a few other icons
pull/6771/head
Aleksander Machniak 6 years ago
parent 8cc0848d03
commit f8ca8d1b63

@ -29,6 +29,7 @@ CHANGELOG Roundcube Webmail
- Enigma: Fix bug where revoked users/keys were not greyed out in key info - Enigma: Fix bug where revoked users/keys were not greyed out in key info
- Enigma: Fix error message when trying to encrypt with a revoked key (#6607) - Enigma: Fix error message when trying to encrypt with a revoked key (#6607)
- Enigma: Fix "decryption oracle" bug [CVE-2019-10740] (#6638) - Enigma: Fix "decryption oracle" bug [CVE-2019-10740] (#6638)
- Fix invalid path to "add contact" icon when using assets_path setting
- Fix invalid path to blocked.gif when using assets_path setting (#6752) - Fix invalid path to blocked.gif when using assets_path setting (#6752)
- Fix so advanced search dialog is not automatically displayed on searchonly addressbooks (#6679) - Fix so advanced search dialog is not automatically displayed on searchonly addressbooks (#6679)
- Fix so an error is logged when more than one attachment plugin has been enabled, initialize the first one (#6735) - Fix so an error is logged when more than one attachment plugin has been enabled, initialize the first one (#6735)

@ -872,12 +872,21 @@ EOF;
/** /**
* Modify path by adding URL prefix if configured * Modify path by adding URL prefix if configured
*
* @param string $path Asset path
* @param bool $abs_url Pass to self::abs_url() first
*
* @return string Asset path
*/ */
public function asset_url($path) public function asset_url($path, $abs_url = false)
{ {
// iframe content can't be in a different domain // iframe content can't be in a different domain
// @TODO: check if assests are on a different domain // @TODO: check if assests are on a different domain
if ($abs_url) {
$path = $this->abs_url($path, true);
}
if (!$this->assets_path || in_array($path[0], array('?', '/', '.')) || strpos($path, '://')) { if (!$this->assets_path || in_array($path[0], array('?', '/', '.')) || strpos($path, '://')) {
return $path; return $path;
} }

@ -910,12 +910,16 @@ function rcmail_contact_photo($attrib)
{ {
global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL; global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL;
if ($result = $CONTACTS->get_result()) if ($result = $CONTACTS->get_result()) {
$record = $result->first(); $record = $result->first();
}
$photo_img = $attrib['placeholder'] ? $RCMAIL->output->abs_url($attrib['placeholder'], true) : 'program/resources/blank.gif'; if ($record['_type'] == 'group' && $attrib['placeholdergroup']) {
if ($record['_type'] == 'group' && $attrib['placeholdergroup'])
$photo_img = $RCMAIL->output->abs_url($attrib['placeholdergroup'], true); $photo_img = $RCMAIL->output->abs_url($attrib['placeholdergroup'], true);
}
else {
$photo_img = $attrib['placeholder'] ? $RCMAIL->output->abs_url($attrib['placeholder'], true) : 'program/resources/blank.gif';
}
$RCMAIL->output->set_env('photo_placeholder', $RCMAIL->output->asset_url($photo_img)); $RCMAIL->output->set_env('photo_placeholder', $RCMAIL->output->asset_url($photo_img));

@ -1208,7 +1208,7 @@ function rcmail_compose_attachment_list($attrib)
if (is_array($COMPOSE['attachments'])) { if (is_array($COMPOSE['attachments'])) {
if ($attrib['deleteicon']) { if ($attrib['deleteicon']) {
$button = html::img(array( $button = html::img(array(
'src' => $RCMAIL->output->abs_url($attrib['deleteicon'], true), 'src' => $RCMAIL->output->asset_url($attrib['deleteicon'], true),
'alt' => $RCMAIL->gettext('delete') 'alt' => $RCMAIL->gettext('delete')
)); ));
} }
@ -1255,13 +1255,13 @@ function rcmail_compose_attachment_list($attrib)
} }
if ($attrib['deleteicon']) if ($attrib['deleteicon'])
$COMPOSE['deleteicon'] = $RCMAIL->output->abs_url($attrib['deleteicon'], true); $COMPOSE['deleteicon'] = $RCMAIL->output->asset_url($attrib['deleteicon'], true);
else if (rcube_utils::get_boolean($attrib['textbuttons'])) else if (rcube_utils::get_boolean($attrib['textbuttons']))
$COMPOSE['textbuttons'] = true; $COMPOSE['textbuttons'] = true;
if ($attrib['cancelicon']) if ($attrib['cancelicon'])
$OUTPUT->set_env('cancelicon', $RCMAIL->output->abs_url($attrib['cancelicon'], true)); $OUTPUT->set_env('cancelicon', $RCMAIL->output->asset_url($attrib['cancelicon'], true));
if ($attrib['loadingicon']) if ($attrib['loadingicon'])
$OUTPUT->set_env('loadingicon', $RCMAIL->output->abs_url($attrib['loadingicon'], true)); $OUTPUT->set_env('loadingicon', $RCMAIL->output->asset_url($attrib['loadingicon'], true));
$OUTPUT->set_env('attachments', $jslist); $OUTPUT->set_env('attachments', $jslist);
$OUTPUT->add_gui_object('attachmentlist', $attrib['id']); $OUTPUT->add_gui_object('attachmentlist', $attrib['id']);

@ -664,7 +664,7 @@ function rcmail_options_menu_link($attrib = array())
$inner = $title = $RCMAIL->gettext($attrib['label'] ?: 'listoptions'); $inner = $title = $RCMAIL->gettext($attrib['label'] ?: 'listoptions');
if (is_string($attrib['optionsmenuicon']) && $attrib['optionsmenuicon'] != 'true') { if (is_string($attrib['optionsmenuicon']) && $attrib['optionsmenuicon'] != 'true') {
$inner = html::img(array('src' => $RCMAIL->output->abs_url($attrib['optionsmenuicon'], true), 'alt' => $title)); $inner = html::img(array('src' => $RCMAIL->output->asset_url($attrib['optionsmenuicon'], true), 'alt' => $title));
} }
else if ($attrib['innerclass']) { else if ($attrib['innerclass']) {
$inner = html::span($attrib['innerclass'], $inner); $inner = html::span($attrib['innerclass'], $inner);
@ -1335,7 +1335,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
if ($addicon && $_SESSION['writeable_abook']) { if ($addicon && $_SESSION['writeable_abook']) {
$label = $RCMAIL->gettext('addtoaddressbook'); $label = $RCMAIL->gettext('addtoaddressbook');
$icon = html::img(array( $icon = html::img(array(
'src' => $RCMAIL->output->abs_url($addicon, true), 'src' => $RCMAIL->output->asset_url($addicon, true),
'alt' => $label, 'alt' => $label,
'class' => 'noselect', 'class' => 'noselect',
)); ));

Loading…
Cancel
Save