mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-21 12:35:17 +00:00
Merge branch 'dev'
This commit is contained in:
commit
da6b6df901
15 changed files with 46 additions and 191 deletions
|
@ -2280,18 +2280,20 @@ class Activity {
|
|||
if (! $n) {
|
||||
break;
|
||||
}
|
||||
$a = new ActivityStreams($n);
|
||||
// set client flag to convert objects to implied activities
|
||||
$a = new ActivityStreams($n,null,true);
|
||||
if ($a->type === 'Announce' && is_array($a->obj)
|
||||
&& array_key_exists('object',$a->obj) && array_key_exists('actor',$a->obj)) {
|
||||
// This is a relayed/forwarded Activity (as opposed to a shared/boosted object)
|
||||
// Reparse the encapsulated Activity and use that instead
|
||||
logger('relayed activity',LOGGER_DEBUG);
|
||||
$a = new ActivityStreams($a->obj);
|
||||
$a = new ActivityStreams($a->obj,null,true);
|
||||
}
|
||||
|
||||
logger($a->debug());
|
||||
|
||||
if (! $a->is_valid()) {
|
||||
logger('not a valid activity');
|
||||
break;
|
||||
}
|
||||
if (is_array($a->actor) && array_key_exists('id',$a->actor)) {
|
||||
|
@ -2300,7 +2302,7 @@ class Activity {
|
|||
|
||||
$item = null;
|
||||
|
||||
switch($a->type) {
|
||||
switch ($a->type) {
|
||||
case 'Create':
|
||||
case 'Update':
|
||||
case 'Like':
|
||||
|
|
|
@ -1050,7 +1050,7 @@ class Libzot {
|
|||
}
|
||||
|
||||
if (! is_array($x)) {
|
||||
btlogger('failed communication - no useful response: ' . $x);
|
||||
logger('no useful response: ' . $x);
|
||||
}
|
||||
|
||||
if ($x) {
|
||||
|
|
|
@ -122,7 +122,7 @@ class Display extends Controller {
|
|||
// \App::$poi = $x[0];
|
||||
}
|
||||
|
||||
//if the item is to be moderated redirect to /moderate
|
||||
// if the item is to be moderated redirect to /moderate
|
||||
if($target_item['item_blocked'] == ITEM_MODERATED) {
|
||||
goaway(z_root() . '/moderate/' . $target_item['id']);
|
||||
}
|
||||
|
@ -283,42 +283,21 @@ class Display extends Controller {
|
|||
}
|
||||
|
||||
if($r === null) {
|
||||
|
||||
// in case somebody turned off public access to sys channel content using permissions
|
||||
// make that content unsearchable by ensuring the owner uid can't match
|
||||
|
||||
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
|
||||
$sysid = 0;
|
||||
|
||||
$r = q("SELECT item.id as item_id from item
|
||||
WHERE mid = '%s'
|
||||
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
OR uid = %d )
|
||||
$sql_extra )
|
||||
$item_normal
|
||||
limit 1",
|
||||
dbesc($target_item['parent_mid']),
|
||||
intval($sysid)
|
||||
$r = q("SELECT item.id as item_id from item WHERE mid = '%s' $sql_extra $item_normal limit 1",
|
||||
dbesc($target_item['parent_mid'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
elseif($update && !$load) {
|
||||
elseif ($update && !$load) {
|
||||
$r = null;
|
||||
|
||||
require_once('include/channel.php');
|
||||
$sys = get_sys_channel();
|
||||
$sysid = $sys['channel_id'];
|
||||
|
||||
if(local_channel()) {
|
||||
$r = q("SELECT item.parent AS item_id from item
|
||||
WHERE uid = %d
|
||||
and parent_mid = '%s'
|
||||
$item_normal_update
|
||||
$simple_update
|
||||
limit 1",
|
||||
if (local_channel()) {
|
||||
$r = q("SELECT item.parent AS item_id from item WHERE uid = %d and parent_mid = '%s' $item_normal_update $simple_update limit 1",
|
||||
intval(local_channel()),
|
||||
dbesc($target_item['parent_mid'])
|
||||
);
|
||||
|
@ -328,22 +307,8 @@ class Display extends Controller {
|
|||
}
|
||||
|
||||
if(! $r) {
|
||||
// in case somebody turned off public access to sys channel content using permissions
|
||||
// make that content unsearchable by ensuring the owner_xchan can't match
|
||||
if(! perm_is_allowed($sysid,$observer_hash,'view_stream'))
|
||||
$sysid = 0;
|
||||
$r = q("SELECT item.parent AS item_id from item
|
||||
WHERE parent_mid = '%s'
|
||||
AND (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and uid in ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
OR uid = %d )
|
||||
$sql_extra )
|
||||
$item_normal_update
|
||||
$simple_update
|
||||
limit 1",
|
||||
dbesc($target_item['parent_mid']),
|
||||
intval($sysid)
|
||||
$r = q("SELECT item.parent AS item_id from item WHERE parent_mid = '%s' $sql_extra $item_normal_update $simple_update limit 1",
|
||||
dbesc($target_item['parent_mid'])
|
||||
);
|
||||
}
|
||||
$_SESSION['loadtime'] = datetime_convert();
|
||||
|
@ -370,7 +335,6 @@ class Display extends Controller {
|
|||
$items = array();
|
||||
}
|
||||
|
||||
|
||||
switch($module_format) {
|
||||
|
||||
case 'html':
|
||||
|
|
|
@ -181,10 +181,10 @@ class Manage extends Controller {
|
|||
'$msg_selected' => t('Current Channel'),
|
||||
'$selected' => local_channel(),
|
||||
'$desc' => t('Switch to one of your channels by selecting it.'),
|
||||
'$msg_default' => t('Default Channel'),
|
||||
'$msg_default' => t('Default Login Channel'),
|
||||
'$msg_make_default' => t('Make Default'),
|
||||
'$msg_include' => t('Add to menu'),
|
||||
'$msg_no_include' => t('Remove from menu'),
|
||||
'$msg_no_include' => t('Add to menu'),
|
||||
'$create' => $create,
|
||||
'$all_channels' => $channels,
|
||||
'$mail_format' => t('%d new messages'),
|
||||
|
|
|
@ -89,11 +89,6 @@ class Pubstream extends Controller {
|
|||
$o .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(! $update && !$load) {
|
||||
|
||||
nav_set_selected(t('Public Stream'));
|
||||
|
@ -162,7 +157,7 @@ class Pubstream extends Controller {
|
|||
require_once('include/security.php');
|
||||
|
||||
if($site_firehose) {
|
||||
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
|
||||
$uids = " and item_private = 0 and item_wall = 1 ";
|
||||
}
|
||||
else {
|
||||
$sys = get_sys_channel();
|
||||
|
|
|
@ -164,35 +164,22 @@ class Search extends \Zotlabs\Web\Controller {
|
|||
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
|
||||
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
|
||||
|
||||
// in case somebody turned off public access to sys channel content with permissions
|
||||
|
||||
if (! perm_is_allowed($sys['channel_id'],$observer_hash,'view_stream'))
|
||||
$sys['xchan_hash'] .= 'disabled';
|
||||
|
||||
if ($load) {
|
||||
$r = null;
|
||||
|
||||
if (local_channel()) {
|
||||
$r = q("SELECT mid, MAX(id) as item_id from item
|
||||
WHERE ((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 )
|
||||
OR ( item.uid = %d )) OR item.owner_xchan = '%s' )
|
||||
$r = q("SELECT mid, MAX(id) as item_id from item where uid = %d
|
||||
$item_normal
|
||||
$sql_extra
|
||||
group by mid, created order by created desc $pager_sql ",
|
||||
intval(local_channel()),
|
||||
dbesc($sys['xchan_hash'])
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
if ($r === null) {
|
||||
$r = q("SELECT mid, MAX(id) as item_id from item
|
||||
WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = ''
|
||||
AND item.deny_gid = '' AND item_private = 0 )
|
||||
and owner_xchan in ( " . stream_perms_xchans(($observer) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
$pub_sql ) OR owner_xchan = '%s')
|
||||
$r = q("SELECT mid, MAX(id) as item_id from item $pub_sql
|
||||
$item_normal
|
||||
$sql_extra
|
||||
group by mid, created order by created desc $pager_sql",
|
||||
dbesc($sys['xchan_hash'])
|
||||
group by mid, created order by created desc $pager_sql"
|
||||
);
|
||||
}
|
||||
if ($r) {
|
||||
|
|
|
@ -512,7 +512,7 @@ class Channel {
|
|||
$autoperms = '<input type="hidden" name="autoperms" value="' . intval(get_pconfig(local_channel(),'system','autoperms')) . '" />';
|
||||
}
|
||||
|
||||
$hyperdrive = [ 'hyperdrive', t('Enable hyperdrive'), ((get_pconfig(local_channel(),'system','hyperdrive',true)) ? 1 : 0), t('Import public third-party conversations in which your connections participate.'), $yes_no ];
|
||||
$hyperdrive = [ 'hyperdrive', t('Friend-of-friend conversations'), ((get_pconfig(local_channel(),'system','hyperdrive',true)) ? 1 : 0), t('Import public third-party conversations in which your connections participate.'), $yes_no ];
|
||||
|
||||
if (get_config('system','activitypub')) {
|
||||
$apconfig = true;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
namespace Zotlabs\Module;
|
||||
|
||||
use Zotlabs\Lib\System;
|
||||
use Zotlabs\Lib\Config;
|
||||
use Zotlabs\Web\Controller;
|
||||
|
||||
class Siteinfo extends Controller {
|
||||
|
@ -15,11 +16,9 @@ class Siteinfo extends Controller {
|
|||
|
||||
function get() {
|
||||
|
||||
if(! get_config('system','activitypub')) {
|
||||
$federated = [ 'zot6' ];
|
||||
}
|
||||
else {
|
||||
$federated = [ 'zot6','activitypub' ];
|
||||
$federated = 'Zot6';
|
||||
if (Config::get('system','activitypub')) {
|
||||
$federated .= ', ActivityPub';
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,8 +40,8 @@ class Siteinfo extends Controller {
|
|||
'$transport_link' => '<a href="https://zotlabs.com">https://zotlabs.com</a>',
|
||||
|
||||
'$ebs' => System::ebs(),
|
||||
'$additional_text' => t('Additional federated transport protocols:'),
|
||||
'$additional_fed' => implode(', ',array_unique($federated)),
|
||||
'$additional_text' => t('Federated transport protocols:'),
|
||||
'$additional_fed' => $federated,
|
||||
'$prj_version' => ((get_config('system','hidden_version_siteinfo')) ? '' : sprintf( t('Version %s'), System::get_project_version())),
|
||||
'$prj_linktxt' => t('Project homepage'),
|
||||
'$prj_srctxt' => t('Developer homepage'),
|
||||
|
|
2
boot.php
2
boot.php
|
@ -48,7 +48,7 @@ require_once('include/items.php');
|
|||
|
||||
|
||||
|
||||
define ( 'STD_VERSION', '19.10.5' );
|
||||
define ( 'STD_VERSION', '19.10.9' );
|
||||
define ( 'ZOT_REVISION', '6.0' );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1236 );
|
||||
|
|
|
@ -31,9 +31,8 @@ function nav($template = 'default') {
|
|||
);
|
||||
|
||||
if(! $_SESSION['delegate']) {
|
||||
$chans = q("select channel_name, channel_id from channel left join pconfig on channel_id = pconfig.uid where channel_account_id = %d and channel_removed = 0 and pconfig.cat = 'system' and pconfig.k = 'include_in_menu' and pconfig.v = '1' and channel_id != %d order by channel_name ",
|
||||
intval(get_account_id()),
|
||||
intval(local_channel())
|
||||
$chans = q("select channel_name, channel_id from channel left join pconfig on channel_id = pconfig.uid where channel_account_id = %d and channel_removed = 0 and pconfig.cat = 'system' and pconfig.k = 'include_in_menu' and pconfig.v = '1' order by channel_name ",
|
||||
intval(get_account_id())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1632,6 +1632,10 @@ function get_site_info() {
|
|||
}
|
||||
}
|
||||
|
||||
$protocols = [ 'zot' ];
|
||||
if (get_config('system','activitypub')) {
|
||||
$protocols[] = 'activitypub';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'url' => z_root(),
|
||||
|
@ -1642,6 +1646,7 @@ function get_site_info() {
|
|||
'addon_version' => defined('ADDON_VERSION') ? ADDON_VERSION : 'unknown',
|
||||
'server_role' => System::get_server_role(),
|
||||
'commit' => $commit,
|
||||
'protocols' => $protocols,
|
||||
'plugins' => $visible_plugins,
|
||||
'register_policy' => $register_policy[get_config('system','register_policy')],
|
||||
'invitation_only' => (bool) intval(get_config('system','invitation_only')),
|
||||
|
|
|
@ -684,103 +684,3 @@ function get_security_ids($channel_id, $ob_hash) {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This is used to determine which uid have posts which are visible to the logged in user (from the API) for the
|
||||
// public_timeline, and we can use this in a community page by making
|
||||
// $perms = (PERMS_NETWORK|PERMS_PUBLIC) unless logged in.
|
||||
// Collect uids of everybody on this site who has opened their posts to everybody on this site (or greater visibility)
|
||||
// We always include yourself if logged in because you can always see your own posts
|
||||
// resolving granular permissions for the observer against every person and every post on the site
|
||||
// will likely be too expensive.
|
||||
// Returns a string list of comma separated channel_ids suitable for direct inclusion in a SQL query
|
||||
|
||||
function stream_perms_api_uids($perms = NULL, $limit = 0, $rand = 0 ) {
|
||||
$perms = is_null($perms) ? (PERMS_SITE|PERMS_NETWORK|PERMS_PUBLIC) : $perms;
|
||||
|
||||
$ret = array();
|
||||
$limit_sql = (($limit) ? " LIMIT " . intval($limit) . " " : '');
|
||||
$random_sql = (($rand) ? " ORDER BY " . db_getfunc('RAND') . " " : '');
|
||||
if(local_channel())
|
||||
$ret[] = local_channel();
|
||||
$x = q("select uid, v from pconfig where cat = 'perm_limits' and k = 'view_stream' ");
|
||||
if($x) {
|
||||
$y = [];
|
||||
foreach($x as $xv) {
|
||||
if(intval($xv['v']) & $perms) {
|
||||
$y[] = $xv;
|
||||
}
|
||||
}
|
||||
if($y) {
|
||||
$ids = ids_to_querystr($y,'uid');
|
||||
$r = q("select channel_id from channel where channel_id in ( $ids ) and ( channel_pageflags & %d ) = 0 and channel_system = 0 and channel_removed = 0 $random_sql $limit_sql ",
|
||||
intval(PAGE_ADULT|PAGE_CENSORED)
|
||||
);
|
||||
if($r) {
|
||||
foreach($r as $rr)
|
||||
if(! in_array($rr['channel_id'], $ret))
|
||||
$ret[] = $rr['channel_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$str = '';
|
||||
if($ret) {
|
||||
foreach($ret as $rr) {
|
||||
if($str)
|
||||
$str .= ',';
|
||||
$str .= intval($rr);
|
||||
}
|
||||
}
|
||||
else
|
||||
$str = "''";
|
||||
|
||||
logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function stream_perms_xchans($perms = NULL ) {
|
||||
$perms = is_null($perms) ? (PERMS_SITE|PERMS_NETWORK|PERMS_PUBLIC) : $perms;
|
||||
|
||||
$ret = array();
|
||||
if(local_channel())
|
||||
$ret[] = get_observer_hash();
|
||||
|
||||
$x = q("select uid, v from pconfig where cat = 'perm_limits' and k = 'view_stream' ");
|
||||
if($x) {
|
||||
$y = [];
|
||||
foreach($x as $xv) {
|
||||
if(intval($xv['v']) & $perms) {
|
||||
$y[] = $xv;
|
||||
}
|
||||
}
|
||||
if($y) {
|
||||
$ids = ids_to_querystr($y,'uid');
|
||||
|
||||
$r = q("select channel_hash from channel where channel_id in ( $ids ) and ( channel_pageflags & %d ) = 0 and channel_system = 0 and channel_removed = 0 ",
|
||||
intval(PAGE_ADULT|PAGE_CENSORED)
|
||||
);
|
||||
|
||||
if($r) {
|
||||
foreach($r as $rr)
|
||||
if(! in_array($rr['channel_hash'], $ret))
|
||||
$ret[] = $rr['channel_hash'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$str = '';
|
||||
if($ret) {
|
||||
foreach($ret as $rr) {
|
||||
if($str)
|
||||
$str .= ',';
|
||||
$str .= "'" . dbesc($rr) . "'";
|
||||
}
|
||||
}
|
||||
else
|
||||
$str = "''";
|
||||
|
||||
logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
|
|
@ -336,7 +336,7 @@ function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) {
|
|||
$count = intval($limit);
|
||||
|
||||
if($site) {
|
||||
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
|
||||
$uids = " and item_private = 0 and item_wall = 1 ";
|
||||
}
|
||||
else {
|
||||
$sys = get_sys_channel();
|
||||
|
|
|
@ -207,7 +207,7 @@ ACL.prototype.on_button_hide = function(event) {
|
|||
|
||||
ACL.prototype.set_allow = function(itemid) {
|
||||
type = itemid[0];
|
||||
id = itemid.substr(1);
|
||||
id = decodeURIComponent(itemid.substr(1));
|
||||
switch(type) {
|
||||
case "g":
|
||||
if (that.allow_gid.indexOf(id)<0) {
|
||||
|
@ -231,7 +231,7 @@ ACL.prototype.set_allow = function(itemid) {
|
|||
|
||||
ACL.prototype.set_deny = function(itemid) {
|
||||
type = itemid[0];
|
||||
id = itemid.substr(1);
|
||||
id = decodeURIComponent(itemid.substr(1));
|
||||
switch(type) {
|
||||
case "g":
|
||||
if (that.deny_gid.indexOf(id)<0) {
|
||||
|
@ -310,8 +310,12 @@ ACL.prototype.update_view = function(value) {
|
|||
|
||||
else {
|
||||
that.list.show(); //show acl-list
|
||||
datasrc2src('#acl-list-content .list-group-item img[data-src]');
|
||||
that.info.hide(); //hide acl-info
|
||||
that.update_select('custom');
|
||||
if(typeof value === 'undefined') {
|
||||
value = 'custom';
|
||||
}
|
||||
|
||||
/* jot acl */
|
||||
if(that.allow_gid.length === 0 && that.allow_cid.length === 0 && that.deny_gid.length === 0 && that.deny_cid.length === 0 && value === 'custom') {
|
||||
|
@ -334,7 +338,7 @@ ACL.prototype.update_view = function(value) {
|
|||
$("#acl-list-content .acl-list-item").each(function() {
|
||||
itemid = $(this).attr('id');
|
||||
type = itemid[0];
|
||||
id = itemid.substr(1);
|
||||
id = decodeURIComponent(itemid.substr(1));
|
||||
|
||||
btshow = $(this).children(".acl-button-show").removeClass("btn-success").addClass("btn-outline-success");
|
||||
bthide = $(this).children(".acl-button-hide").removeClass("btn-danger").addClass("btn-outline-danger");
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
{{/if}}
|
||||
<br>
|
||||
{{if $channel.include_in_menu}}
|
||||
<a href="manage/{{$channel.channel_id}}/noop" class="channel-menu-link">
|
||||
<a href="manage/{{$channel.channel_id}}/menu" class="channel-menu-link">
|
||||
<i class="fa fa-check-square-o"></i> {{$msg_no_include}}
|
||||
</a>
|
||||
{{else}}
|
||||
|
|
Loading…
Reference in a new issue