aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-09 19:54:48 -0800
committerfriendica <info@friendica.com>2015-02-09 19:54:48 -0800
commit55c3c54ef6fe3f3d80df01c94d334bdfbf395683 (patch)
treebb1ce74c55b95d2b9e383d2e9b0accc51b8ddd77
parentfce51876c9d2d8803acddaa9c5b4980eb82ec357 (diff)
downloadvolse-hubzilla-55c3c54ef6fe3f3d80df01c94d334bdfbf395683.tar.gz
volse-hubzilla-55c3c54ef6fe3f3d80df01c94d334bdfbf395683.tar.bz2
volse-hubzilla-55c3c54ef6fe3f3d80df01c94d334bdfbf395683.zip
apply max_import_size to Diaspora posts
-rwxr-xr-xinclude/diaspora.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 22574f9f8..4280d9d77 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -827,6 +827,12 @@ function diaspora_post($importer,$xml,$msg) {
$body = scale_external_images($body);
}
+ $maxlen = get_max_import_size();
+
+ if($maxlen && mb_strlen($body) > $maxlen) {
+ $body = mb_substr($body,0,$maxlen,'UTF-8');
+ logger('message length exceeds max_import_size: truncated');
+ }
//WTF? FIXME
// Add OEmbed and other information to the body
@@ -1040,6 +1046,14 @@ function diaspora_reshare($importer,$xml,$msg) {
//return;
}
+ $maxlen = get_max_import_size();
+
+ if($maxlen && mb_strlen($body) > $maxlen) {
+ $body = mb_substr($body,0,$maxlen,'UTF-8');
+ logger('message length exceeds max_import_size: truncated');
+ }
+
+
//if(! $body) {
// logger('diaspora_reshare: empty body: source= ' . $x);
// return;
@@ -1354,6 +1368,15 @@ function diaspora_comment($importer,$xml,$msg) {
$body = diaspora2bb($text);
+
+ $maxlen = get_max_import_size();
+
+ if($maxlen && mb_strlen($body) > $maxlen) {
+ $body = mb_substr($body,0,$maxlen,'UTF-8');
+ logger('message length exceeds max_import_size: truncated');
+ }
+
+
$datarray = array();
$tags = get_tags($body);
@@ -1540,6 +1563,15 @@ function diaspora_conversation($importer,$xml,$msg) {
$body = diaspora2bb($msg_text);
+
+ $maxlen = get_max_import_size();
+
+ if($maxlen && mb_strlen($body) > $maxlen) {
+ $body = mb_substr($body,0,$maxlen,'UTF-8');
+ logger('message length exceeds max_import_size: truncated');
+ }
+
+
$author_signed_data = $msg_guid . ';' . $msg_parent_guid . ';' . $msg_text . ';' . unxmlify($mesg->created_at) . ';' . $msg_diaspora_handle . ';' . $msg_conversation_guid;
$author_signature = base64_decode($msg_author_signature);
@@ -1677,6 +1709,17 @@ function diaspora_message($importer,$xml,$msg) {
$subject = $conversation['subject'];
$body = diaspora2bb($msg_text);
+
+
+ $maxlen = get_max_import_size();
+
+ if($maxlen && mb_strlen($body) > $maxlen) {
+ $body = mb_substr($body,0,$maxlen,'UTF-8');
+ logger('message length exceeds max_import_size: truncated');
+ }
+
+
+
$message_id = $msg_diaspora_handle . ':' . $msg_guid;
$author_signed_data = $msg_guid . ';' . $msg_parent_guid . ';' . $msg_text . ';' . unxmlify($xml->created_at) . ';' . $msg_diaspora_handle . ';' . $msg_conversation_guid;