fix the forum detection in include/zot

This commit is contained in:
redmatrix 2016-07-19 22:57:23 -07:00
parent ae6256f95a
commit a3e5307b93
3 changed files with 18 additions and 7 deletions

View File

@ -528,11 +528,11 @@ class Item extends \Zotlabs\Web\Controller {
if((! $parent) && (get_pconfig($profile_uid,'system','tagifonlyrecip')) && (substr_count($str_contact_allow,'<') == 1) && ($str_group_allow == '') && ($str_contact_deny == '') && ($str_group_deny == '')) {
$x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
$x = q("select abook_id, abconfig.v from abook left join abconfig on abook_xchan = abconfig.xchan and abook_channel = abconfig.chan and cat= 'their_perms' and abconfig.k = 'tag_deliver' and abconfig.v = 1 and abook_xchan = '%s' and abook_channel = %d limit 1",
dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)),
intval($profile_uid)
);
if($x && ($x[0]['abook_their_perms'] & PERMS_W_TAGWALL))
if($x)
$body .= "\n\n@group+" . $x[0]['abook_id'] . "\n";
}

View File

@ -282,7 +282,8 @@ require_once('include/api_auth.php');
intval($uinfo[0]['xchan_hash'])
);
$countitms = $r[0]['count'];
$following = (($uinfo[0]['abook_myperms'] & PERMS_R_STREAM) ? true : false );
$following = ((get_abconfig($uinfo[0]['abook_channel'],$uinfo[0]['abook_xchan'],'my_perms','view_stream')) ? true : false );
}

View File

@ -3782,11 +3782,21 @@ function zotinfo($arr) {
}
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_self = 1 limit 1",
intval($e['channel_id'])
$t = q("select * from abconfig where abconfig.cat = 'my_perms' and abconfig.chan = %d and abconfig.xchan = '%s' and abconfig.k in ('tag_deliver', 'send_stream') ",
intval($e['channel_id']),
intval($e['channel_hash'])
);
if(($t) && (($t[0]['abook_my_perms'] & PERMS_W_TAGWALL) && (! ($t[0]['abook_my_perms'] & PERMS_W_STREAM))))
$public_forum = true;
$ch = 0;
if($t) {
foreach($t as $tt) {
if($tt['k'] == 'tag_deliver' && $tt['v'] == 1)
$ch ++;
if($tt['k'] == 'send_stream' && $tt['v'] == 0)
$ch ++;
}
if($ch == 2)
$public_forum = true;
}
}