aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-09 23:38:33 -0700
committerfriendica <info@friendica.com>2014-08-09 23:38:33 -0700
commit9ab12929d769fc7878377862dfba1e4f5c9493e6 (patch)
tree9c7330f7807ac1cc52c6d684186c5b2a677fc3b8
parent091138cbd3a2d813ae574808d02be69022144a3b (diff)
downloadvolse-hubzilla-9ab12929d769fc7878377862dfba1e4f5c9493e6.tar.gz
volse-hubzilla-9ab12929d769fc7878377862dfba1e4f5c9493e6.tar.bz2
volse-hubzilla-9ab12929d769fc7878377862dfba1e4f5c9493e6.zip
implement max_import_size
-rwxr-xr-xinclude/items.php8
1 files changed, 7 insertions, 1 deletions
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']);