From 9ab12929d769fc7878377862dfba1e4f5c9493e6 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 9 Aug 2014 23:38:33 -0700 Subject: implement max_import_size --- include/items.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index b1d94bf5e..05ff1b078 100755 --- a/include/items.php +++ b/include/items.php @@ -671,10 +671,16 @@ function title_is_body($title, $body) { function get_item_elements($x) { - $arr = array(); $arr['body'] = (($x['body']) ? htmlspecialchars($x['body'],ENT_COMPAT,'UTF-8',false) : ''); + $maxlen = get_max_import_size(); + + if($maxlen && mb_strlen($arr['body']) > $maxlen) { + $arr['body'] = mb_substr($arr['body'],0,$maxlen,'UTF-8'); + logger('get_item_elements: message length exceeds max_import_size: truncated'); + } + $arr['created'] = datetime_convert('UTC','UTC',$x['created']); $arr['edited'] = datetime_convert('UTC','UTC',$x['edited']); -- cgit v1.2.3