diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-05-19 11:04:34 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-05-19 11:04:34 +0200 |
commit | 0bc2a4f603a87e13d495eb7c245b85507aac6e44 (patch) | |
tree | c96d3eadfe5fd34914ce944aac4a9843d2f97cf1 /include/text.php | |
parent | 6abbadf6c80c52b77e58fb729e25fdd5cb27a8ac (diff) | |
download | volse-hubzilla-0bc2a4f603a87e13d495eb7c245b85507aac6e44.tar.gz volse-hubzilla-0bc2a4f603a87e13d495eb7c245b85507aac6e44.tar.bz2 volse-hubzilla-0bc2a4f603a87e13d495eb7c245b85507aac6e44.zip |
fix issues with attachment labels
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index ef3c8871c..aafba2168 100644 --- a/include/text.php +++ b/include/text.php @@ -1415,15 +1415,21 @@ function unobscure_mail(&$item) { function theme_attachments(&$item) { $arr = json_decode($item['attach'],true); + if(is_array($arr) && count($arr)) { $attaches = array(); foreach($arr as $r) { $icon = getIconFromType($r['type']); - $label = (($r['title']) ? urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8')) : t('Unknown Attachment')); + + if($r['title']) + $label = urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8')); + + if(! $label && $r['href']) + $label = basename($r['href']); //some feeds provide an attachment where title an empty space - if($label == ' ') + if(! $label || $label == ' ') $label = t('Unknown Attachment'); $title = t('Size') . ' ' . (($r['length']) ? userReadableSize($r['length']) : t('unknown')); |