From 3d86bc9bc32975f398233df46626fb7246abe710 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 4 Jun 2011 20:18:03 +1000 Subject: bug fix causing reported post controls to be truncated/omitted --- inc/display.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'inc/display.php') 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 . ')

' . // Thumbnail ''; + } elseif($this->file == 'deleted') { + $built = ''; } $built .= '

'; -- cgit v1.3