finish basic item encoding, add plugin compatibility tag, notes on improving $global_perms for edge cases
This commit is contained in:
parent
5d4c9f5617
commit
9a726f0308
@ -504,6 +504,12 @@ function encode_item($item) {
|
|||||||
|
|
||||||
logger('encode_item: ' . print_r($item,true));
|
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_id'] = $item['uri'];
|
||||||
$x['message_top'] = $item['parent_uri'];
|
$x['message_top'] = $item['parent_uri'];
|
||||||
$x['message_parent'] = $item['thr_parent'];
|
$x['message_parent'] = $item['thr_parent'];
|
||||||
@ -527,9 +533,8 @@ function encode_item($item) {
|
|||||||
$x['target'] = json_decode($item['target'],true);
|
$x['target'] = json_decode($item['target'],true);
|
||||||
if($item['attach'])
|
if($item['attach'])
|
||||||
$x['attach'] = json_decode($item['attach'],true);
|
$x['attach'] = json_decode($item['attach'],true);
|
||||||
|
if($y = encode_item_flags($item))
|
||||||
$x['restrictions'] = array();
|
$x['flags'] = $y;
|
||||||
$x['flags'] = array();
|
|
||||||
if($item['term'])
|
if($item['term'])
|
||||||
$x['tags'] = encode_item_terms($item['term']);
|
$x['tags'] = encode_item_terms($item['term']);
|
||||||
|
|
||||||
@ -568,6 +573,22 @@ function termtype($t) {
|
|||||||
return(($types[$t]) ? $types[$t] : 'unknown');
|
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) {
|
function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
require_once('library/HTMLPurifier.auto.php');
|
require_once('library/HTMLPurifier.auto.php');
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
|
|
||||||
function get_perms() {
|
function get_perms() {
|
||||||
|
|
||||||
|
// thinking about making element[2] a bitmask instead of boolean so that we can provide a list of applicable selections
|
||||||
|
// for any given permission. Currently we use the boolean to disallow write access to "everybody", but we also want to be
|
||||||
|
// able to handle troublesome settings such as allowing channel_w_stream to anybody in the network. You can allow it, but
|
||||||
|
// there's no way to implement sending it.
|
||||||
|
|
||||||
$global_perms = array(
|
$global_perms = array(
|
||||||
// Read only permissions
|
// Read only permissions
|
||||||
'view_stream' => array('channel_r_stream', intval(PERMS_R_STREAM), true, t('Can view my "public" stream and posts'), ''),
|
'view_stream' => array('channel_r_stream', intval(PERMS_R_STREAM), true, t('Can view my "public" stream and posts'), ''),
|
||||||
|
@ -204,6 +204,7 @@ function call_hooks($name, &$data = null) {
|
|||||||
* * Version: 1.2.3
|
* * Version: 1.2.3
|
||||||
* * Author: John <profile url>
|
* * Author: John <profile url>
|
||||||
* * Author: Jane <email>
|
* * Author: Jane <email>
|
||||||
|
* * Compat: Red [(version)], Friendica [(version)]
|
||||||
* *
|
* *
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -213,7 +214,8 @@ function get_plugin_info($plugin){
|
|||||||
'name' => $plugin,
|
'name' => $plugin,
|
||||||
'description' => "",
|
'description' => "",
|
||||||
'author' => array(),
|
'author' => array(),
|
||||||
'version' => ""
|
'version' => "",
|
||||||
|
'compat' => ""
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!is_file("addon/$plugin/$plugin.php")) return $info;
|
if (!is_file("addon/$plugin/$plugin.php")) return $info;
|
||||||
@ -258,6 +260,7 @@ function get_plugin_info($plugin){
|
|||||||
* * Version: 1.2.3
|
* * Version: 1.2.3
|
||||||
* * Author: John <profile url>
|
* * Author: John <profile url>
|
||||||
* * Maintainer: Jane <profile url>
|
* * Maintainer: Jane <profile url>
|
||||||
|
* * Compat: Friendica [(version)], Red [(version)]
|
||||||
* *
|
* *
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -270,6 +273,7 @@ function get_theme_info($theme){
|
|||||||
'maintainer' => array(),
|
'maintainer' => array(),
|
||||||
'version' => "",
|
'version' => "",
|
||||||
'credits' => "",
|
'credits' => "",
|
||||||
|
'compat' => "",
|
||||||
'experimental' => false,
|
'experimental' => false,
|
||||||
'unsupported' => false
|
'unsupported' => false
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user