diff --git a/inc/config.php b/inc/config.php
index 766d824f..131ac46c 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -80,6 +80,10 @@
// Max body length
$config['max_body'] = 1800;
+ // Amount of post lines to show on the index page
+ $config['body_truncate'] = 15;
+ // Amount of characters to show on the index page
+ $config['body_truncate_char'] = 2500;
$config['threads_per_page'] = 10;
$config['max_pages'] = 10;
diff --git a/inc/display.php b/inc/display.php
index 34be2dcc..2f0c15a2 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -131,6 +131,52 @@
return sprintf($config['capcode'], $cap);
}
+ function truncate($body, $url) {
+ global $config;
+
+ $original_body = $body;
+
+ $lines = substr_count($body, '
');
+
+ // Limit line count
+ if($lines > $config['body_truncate']) {
+ if(preg_match('/(((.*?)
){' . $config['body_truncate'] . '})/', $body, $m))
+ $body = $m[0];
+ }
+
+ $body = substr($body, 0, $config['body_truncate_char']);
+
+ if($body != $original_body) {
+ // Remove any corrupt tags at the end
+ $body = preg_replace('/<([\w]+)?([^>]*)?$/', '', $body);
+
+ // Open tags
+ if(preg_match_all('/<([\w]+)[^>]*>/', $body, $open_tags)) {
+
+ $tags = Array();
+ for($x=0;$x
' . $this->body . '
' . ($index ? truncate($this->body, $this->link()) : $this->body) . '
' . $this->body . '
' . + $built .= '' . ($index ? truncate($this->body, $this->link()) : $this->body) . '
' . // Omitted posts ($this->omitted || $this->omitted_images? '' .