diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-08-19 19:40:18 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-08-19 19:40:18 +0200 |
commit | e50e68719155c7d35e30bb203a403854f789d5a1 (patch) | |
tree | a10630cec177c6629fb0da38d96deb7258062698 /include/items.php | |
parent | 07cd0c870f48ec838c23fa7c6966ceb1c41f06ab (diff) | |
parent | 4e3d295c909405da61d7ccd6c7bd99bd35c9feec (diff) | |
download | volse-hubzilla-e50e68719155c7d35e30bb203a403854f789d5a1.tar.gz volse-hubzilla-e50e68719155c7d35e30bb203a403854f789d5a1.tar.bz2 volse-hubzilla-e50e68719155c7d35e30bb203a403854f789d5a1.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php index c1b50da22..d8c551cea 100755 --- a/include/items.php +++ b/include/items.php @@ -495,6 +495,32 @@ function post_activity_item($arr) { return $ret; } + +function validate_item_elements($message,$arr) { + + $result = array('success' => false); + + if(! array_key_exists('created',$arr)) + $result['message'] = 'missing created, possible author/owner lookup failure'; + + if((! $arr['mid']) || (! $arr['parent_mid'])) + $result['message'] = 'missing message-id or parent message-id'; + + if(array_key_exists('flags',$message) && in_array('relay',$message['flags']) && $arr['mid'] === $arr['parent_mid']) + $result['message'] = 'relay set on top level post'; + + if(! $result['message']) + $result['success'] = true; + + return $result; + +} + + + + + + /** * @brief Generate an Atom feed. * @@ -866,7 +892,11 @@ function get_item_elements($x) { $arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : ''); + if(array_key_exists('diaspora_signature',$x) && is_array($x['diaspora_signature'])) + $x['diaspora_signature'] = json_encode($x['diaspora_signature']); + $arr['diaspora_meta'] = (($x['diaspora_signature']) ? $x['diaspora_signature'] : ''); + $arr['object'] = activity_sanitise($x['object']); $arr['target'] = activity_sanitise($x['target']); @@ -1581,12 +1611,10 @@ function get_mail_elements($x) { $arr['mail_obscured'] = 1; if($arr['body']) { $arr['body'] = str_rot47(base64url_encode($arr['body'])); - $arr['body'] = htmlspecialchars($arr['body'],ENT_COMPAT,'UTF-8',false); } if($arr['title']) { $arr['title'] = str_rot47(base64url_encode($arr['title'])); - $arr['title'] = htmlspecialchars($arr['title'],ENT_COMPAT,'UTF-8',false); } if($arr['created'] > datetime_convert()) $arr['created'] = datetime_convert(); @@ -3450,8 +3478,10 @@ function mail_store($arr) { return 0; } - if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false)) - $arr['body'] = escape_tags($arr['body']); + if(! $arr['mail_obscured']) { + if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false)) + $arr['body'] = escape_tags($arr['body']); + } if(array_key_exists('attach',$arr) && is_array($arr['attach'])) $arr['attach'] = json_encode($arr['attach']); |