From: Mikael Nordfeldth <mmn@hethane.se>
Date: Mon, 25 Jan 2016 15:54:40 +0000 (+0100)
Subject: Show plain text files on attachment page.
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b15434375c91c4e5a90f183423d490f6bef2527b;p=quix0rs-gnu-social.git

Show plain text files on attachment page.
---

diff --git a/lib/attachmentlistitem.php b/lib/attachmentlistitem.php
index 8adc07e6db..28ce9900b8 100644
--- a/lib/attachmentlistitem.php
+++ b/lib/attachmentlistitem.php
@@ -169,6 +169,8 @@ class AttachmentListItem extends Widget
                 default:
                     unset($thumb);  // there's no need carrying this along
                     switch ($this->attachment->mimetype) {
+                    case 'text/plain':
+                        $this->element('div', ['class'=>'e-content plaintext'], file_get_contents($this->attachment->getPath()));
                     case 'text/html':
                         if (!empty($this->attachment->filename)
                                 && (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
diff --git a/theme/base/css/display.css b/theme/base/css/display.css
index e6ac8b4d47..61696e6f11 100644
--- a/theme/base/css/display.css
+++ b/theme/base/css/display.css
@@ -1503,6 +1503,13 @@ font-size:150%;
     font-style: normal;
 }
 
+div.e-content.plaintext {
+    border: dashed 1px gray;
+    font-family: monospace;
+    padding: 1em;
+    white-space: pre-line;
+}
+
 span.rtl {
     display: block;
     direction: rtl;