From 910cca06291365d5b8f425dcf0217a452327dea5 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 6 Jun 2017 17:55:14 +0000 Subject: [PATCH 1/4] Attached pictures in OStatus posts are now displayed --- include/text.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/include/text.php b/include/text.php index c9babba940..2a8b84c65f 100644 --- a/include/text.php +++ b/include/text.php @@ -1397,9 +1397,9 @@ function prepare_body(&$item,$attach = false, $preview = false) { )); } - $filetype = strtolower(substr( $mime, 0, strpos($mime,'/') )); + $filetype = strtolower(substr($mime, 0, strpos($mime,'/'))); if($filetype) { - $filesubtype = strtolower(substr( $mime, strpos($mime,'/') + 1 )); + $filesubtype = strtolower(substr($mime, strpos($mime,'/') + 1)); $filesubtype = str_replace('.', '-', $filesubtype); } else { @@ -1407,23 +1407,15 @@ function prepare_body(&$item,$attach = false, $preview = false) { $filesubtype = 'unkn'; } - $icon = '
'; - /*$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/'))); - switch($icontype) { - case 'video': - case 'audio': - case 'image': - case 'text': - $icon = '
'; - break; - default: - $icon = '
'; - break; - }*/ - $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1])); $title .= ' ' . $mtch[2] . ' ' . t('bytes'); + if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) { + $icon = ''; + } else { + $icon = '
'; + } + $as .= '' . $icon . ''; } } From b49a36f9499c561399d7d4af447f4727e0bf5074 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Jul 2017 04:02:12 +0000 Subject: [PATCH 2/4] The attached image has now a class --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 43cdad8ba6..57881e9293 100644 --- a/include/text.php +++ b/include/text.php @@ -1424,7 +1424,7 @@ function prepare_body(&$item, $attach = false, $preview = false) { $title .= ' ' . $mtch[2] . ' ' . t('bytes'); if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) { - $icon = ''; + $icon = ''; } else { $icon = '
'; } From 1c8e74edce43443bfef1b0a5791ad9d5577b075d Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Jul 2017 19:38:15 +0000 Subject: [PATCH 3/4] Attachments now look fine. --- include/text.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index 57881e9293..83588731fc 100644 --- a/include/text.php +++ b/include/text.php @@ -1425,11 +1425,12 @@ function prepare_body(&$item, $attach = false, $preview = false) { if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) { $icon = ''; + $s .= '
' . $icon . ''; } else { $icon = '
'; + $as .= '' . $icon . ''; } - $as .= '' . $icon . ''; } } } From a5baba84afe1f5865ea946ef20ecdd7cd1adf63f Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Jul 2017 19:49:58 +0000 Subject: [PATCH 4/4] Only show the attachment elements if there are one. --- include/text.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/text.php b/include/text.php index 83588731fc..71a2564405 100644 --- a/include/text.php +++ b/include/text.php @@ -1374,7 +1374,6 @@ function prepare_body(&$item, $attach = false, $preview = false) { $vhead = false; $arr = explode('[/attach],', $item['attach']); if (count($arr)) { - $as .= '
'; foreach ($arr as $r) { $matches = false; $icon = ''; @@ -1434,9 +1433,10 @@ function prepare_body(&$item, $attach = false, $preview = false) { } } } - $as .= '
'; } - $s = $s . $as; + if ($as != '') { + $s .= '
'.$as.'
'; + } // map if (strpos($s, '
') !== false && x($item, 'coord')) {