aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-16 13:57:55 -0800
committerfriendica <info@friendica.com>2012-11-16 13:57:55 -0800
commit9a726f030844221f1eea9babcce915784b6ca1de (patch)
tree6483e758bd19dae3f9173b4397eff0fe498eada6 /include/items.php
parent5d4c9f5617ec8a99132a59d080f66989eba918f9 (diff)
downloadvolse-hubzilla-9a726f030844221f1eea9babcce915784b6ca1de.tar.gz
volse-hubzilla-9a726f030844221f1eea9babcce915784b6ca1de.tar.bz2
volse-hubzilla-9a726f030844221f1eea9babcce915784b6ca1de.zip
finish basic item encoding, add plugin compatibility tag, notes on improving $global_perms for edge cases
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php
index 355f48b91..c74732807 100755
--- a/include/items.php
+++ b/include/items.php
@@ -504,6 +504,12 @@ function encode_item($item) {
logger('encode_item: ' . print_r($item,true));
+ if($item['item_restrict'] & ITEM_DELETED) {
+ $x['message_id'] = $item['uri'];
+ $x['flags'] = array('deleted');
+ return $x;
+ }
+
$x['message_id'] = $item['uri'];
$x['message_top'] = $item['parent_uri'];
$x['message_parent'] = $item['thr_parent'];
@@ -527,9 +533,8 @@ function encode_item($item) {
$x['target'] = json_decode($item['target'],true);
if($item['attach'])
$x['attach'] = json_decode($item['attach'],true);
-
- $x['restrictions'] = array();
- $x['flags'] = array();
+ if($y = encode_item_flags($item))
+ $x['flags'] = $y;
if($item['term'])
$x['tags'] = encode_item_terms($item['term']);
@@ -568,6 +573,22 @@ function termtype($t) {
return(($types[$t]) ? $types[$t] : 'unknown');
}
+
+function encode_item_flags($item) {
+
+// most of item_flags and item_restrict are local settings which don't apply when transmitted.
+// We may need those for the case of syncing other hub locations which you are attached to.
+// ITEM_DELETED is handled in encode_item directly so we don't need to handle it here.
+
+ $ret = array();
+ if($item['flags'] & ITEM_THREAD_TOP)
+ $ret[] = 'thread_parent';
+ if($item['flags'] & ITEM_NSFW)
+ $ret[] = 'nsfw';
+
+ return $ret;
+}
+
function get_atom_elements($feed,$item) {
require_once('library/HTMLPurifier.auto.php');