add public forum identification to libzot. No attempt is made to identify other types of forums or weird custom channel permissions. If the channel is auto-accept and taggable, it's a public forum.

This commit is contained in:
friendica 2014-11-10 15:21:04 -08:00
parent 0b4575a40b
commit 6209465233
3 changed files with 23 additions and 2 deletions

View File

@ -414,6 +414,7 @@ define ( 'XCHAN_FLAGS_ORPHAN', 0x0002);
define ( 'XCHAN_FLAGS_CENSORED', 0x0004);
define ( 'XCHAN_FLAGS_SELFCENSORED', 0x0008);
define ( 'XCHAN_FLAGS_SYSTEM', 0x0010);
define ( 'XCHAN_FLAGS_PUBFORUM', 0x0020);
define ( 'XCHAN_FLAGS_DELETED', 0x1000);
/*
* Traficlights for Administration of HubLoc

View File

@ -699,10 +699,14 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
$dirmode = get_config('system','directory_mode');
if((($arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE))
&& ($arr['site']['url'] != z_root()))
if((($arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) && ($arr['site']['url'] != z_root()))
$arr['searchable'] = false;
$public_forum = (($r[0]['xchan_flags'] & XCHAN_FLAGS_PUBFORUM) ? true : false);
$pubforum_changed = ((intval($public_forum) != intval($arr['public_forum'])) ? true : false);
if($pubforum_changed)
$new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_PUBFORUM;
$hidden = (1 - intval($arr['searchable']));
// Be careful - XCHAN_FLAGS_HIDDEN should evaluate to 1

View File

@ -108,6 +108,21 @@ function zfinger_init(&$a) {
if($deleted || $censored)
$searchable = false;
$public_forum = false;
$role = get_pconfig($e['channel_id'],'system','permissions_role');
if($role === 'forum') {
$public_forum = true;
}
else {
// check if it has characteristics of a public forum based on custom permissions.
$t = q("select abook_my_perms from abook where abook_channel = %d and (abook_flags & %d) limit 1",
intval($e['channel_id']),
intval(ABOOK_FLAG_SELF)
);
if($t && ($t[0]['abook_my_perms'] & PERMS_W_TAGWALL))
$public_forum = true;
}
// This is for birthdays and keywords, but must check access permissions
@ -174,6 +189,7 @@ function zfinger_init(&$a) {
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
$ret['adult_content'] = $adult_channel;
$ret['public_forum'] = $public_forum;
if($deleted)
$ret['deleted'] = $deleted;