diff --git a/inc/display.php b/inc/display.php
index 465b0e1f..fb1a3379 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -131,20 +131,23 @@
return sprintf($config['capcode'], $cap);
}
- function truncate($body, $url) {
+ function truncate($body, $url, $max_lines = false, $max_chars = false) {
global $config;
-
+ if($max_lines === false)
+ $max_lines = $config['body_truncate'];
+ if($max_chars === false)
+ $max_chars = $config['body_truncate_char'];
$original_body = $body;
$lines = substr_count($body, '
');
// Limit line count
- if($lines > $config['body_truncate']) {
- if(preg_match('/(((.*?)
){' . $config['body_truncate'] . '})/', $body, $m))
+ if($lines > $max_lines) {
+ if(preg_match('/(((.*?)
){' . $max_lines . '})/', $body, $m))
$body = $m[0];
}
- $body = substr($body, 0, $config['body_truncate_char']);
+ $body = substr($body, 0, $max_chars);
if($body != $original_body) {
// Remove any corrupt tags at the end
@@ -347,8 +350,8 @@
// Thumbnail
'';
- } elseif($this->file == 'deleted') {
- $built .= '';
+ } elseif($this->file == 'deleted') {
+ $built .= '';
}
$built .= $this->postControls();
@@ -442,7 +445,11 @@
if($this->mod['type'] >= $config['mod']['bandelete'])
$built .= ' ' . $config['mod']['link_bandelete'] . '';
- // Stickies
+ // Delete file (keep post)
+ if(!empty($this->file) && $this->file != 'deleted' && $this->mod['type'] >= $config['mod']['deletefile'])
+ $built .= ' ' . $config['mod']['link_deletefile'] . '';
+
+ // Sticky
if($this->mod['type'] >= $config['mod']['sticky'])
if($this->sticky)
$built .= ' ' . $config['mod']['link_desticky'] . '';
@@ -456,7 +463,6 @@
else
$built .= ' ' . $config['mod']['link_lock'] . '';
-
$built .= '';
}
return $built;
@@ -470,7 +476,7 @@
$built =
// Actual embedding
$this->embed;
- } else {
+ } elseif(!empty($this->file) && $this->file != 'deleted') {
// Image, not embedded shit
$built =
// File link
@@ -490,6 +496,8 @@
$built .= ', ' . $this->filename . ')
'; diff --git a/mod.php b/mod.php index 5f655bcb..a2ebff26 100644 --- a/mod.php +++ b/mod.php @@ -1172,7 +1172,7 @@ $po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod); } - $po->body .= + $append_html = '