mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 17:15:13 +00:00
Merge branch 'dev' into release
This commit is contained in:
commit
70b4a1ef3c
12 changed files with 70 additions and 100 deletions
|
@ -9,7 +9,7 @@ use Code\Lib\ActivityStreams;
|
|||
use Code\Lib\Activity;
|
||||
use Code\Lib\ASCollection;
|
||||
use Code\Lib\Socgraph;
|
||||
|
||||
use Code\Lib\PConfig;
|
||||
|
||||
class Onepoll
|
||||
{
|
||||
|
@ -112,7 +112,8 @@ class Onepoll
|
|||
|
||||
// we haven't given them permission to send us their stream
|
||||
|
||||
$can_send_stream = intval(get_abconfig($importer_uid, $contact['abook_xchan'], 'my_perms', 'send_stream'));
|
||||
$can_send_stream = ( intval(get_abconfig($importer_uid, $contact['abook_xchan'], 'my_perms', 'send_stream'))
|
||||
|| PConfig::Get($importer_uid,'system','preview_outbox', false));
|
||||
|
||||
if (! $can_send_stream) {
|
||||
$fetch_feed = false;
|
||||
|
@ -130,7 +131,7 @@ class Onepoll
|
|||
// prohibitive as deletion requests would need to be relayed over potentially hostile networks.
|
||||
|
||||
if ($fetch_feed) {
|
||||
$max = intval(get_config('system', 'max_imported_posts', 20));
|
||||
$max = intval(get_config('system', 'max_imported_posts', 50));
|
||||
if (intval($max)) {
|
||||
$cl = get_xconfig($xchan, 'activitypub', 'collections');
|
||||
if (is_array($cl) && $cl) {
|
||||
|
@ -161,7 +162,7 @@ class Onepoll
|
|||
}
|
||||
}
|
||||
|
||||
// update the poco details for this connection
|
||||
// update the poco details for this connection once a week
|
||||
|
||||
$r = q(
|
||||
"SELECT xlink_id from xlink
|
||||
|
|
|
@ -603,11 +603,13 @@ class Activity
|
|||
if ($atts) {
|
||||
foreach ($atts as $att) {
|
||||
if (isset($att['type']) && strpos($att['type'], 'image') !== false) {
|
||||
$ret[] = [
|
||||
'type' => 'Image',
|
||||
'url' => $arr['href'],
|
||||
'name' => ($arr['name']) ? $arr['name'] : '',
|
||||
];
|
||||
if (!empty($arr['href'])) {
|
||||
$ret[] = [
|
||||
'type' => 'Image',
|
||||
'url' => $arr['href'],
|
||||
'name' => ($arr['name']) ? $arr['name'] : '',
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$ret[] = [
|
||||
'type' => 'Link',
|
||||
|
@ -2114,6 +2116,9 @@ class Activity
|
|||
Run::Summon(['Notifier', 'permissions_create', $new_connection[0]['abook_id']]);
|
||||
}
|
||||
|
||||
if ($automatic || PConfig::Get($channel['channel_id'],'system','preview_outbox')) {
|
||||
Run::Summon(['Onepoll', $new_connection[0]['abook_id']]);
|
||||
}
|
||||
$clone = [];
|
||||
foreach ($new_connection[0] as $k => $v) {
|
||||
if (strpos($k, 'abook_') === 0) {
|
||||
|
|
|
@ -436,12 +436,11 @@ class Libzot
|
|||
);
|
||||
|
||||
if (!$y) {
|
||||
logger('abook update failed');
|
||||
} else {
|
||||
// if we were just granted read stream permission and didn't have it before, try to pull in some posts
|
||||
if ((!$old_read_stream_perm) && (intval($permissions['view_stream']))) {
|
||||
Run::Summon(['Onepoll', $r[0]['abook_id']]);
|
||||
}
|
||||
logger('abook birthday update failed');
|
||||
}
|
||||
// if we were just granted read stream permission and didn't have it before, try to pull in some posts
|
||||
if ((!$old_read_stream_perm) && (intval($permissions['view_stream']))) {
|
||||
Run::Summon(['Onepoll', $r[0]['abook_id']]);
|
||||
}
|
||||
} else {
|
||||
// limit the ability to do connection spamming, this limit is per channel
|
||||
|
@ -549,6 +548,7 @@ class Libzot
|
|||
if (
|
||||
intval(get_pconfig($channel['channel_id'], 'perm_limits', 'send_stream') & PERMS_PENDING)
|
||||
|| (!intval($new_connection[0]['abook_pending']))
|
||||
|| intval(PConfig::Get($channel['channel_id'],'system','preview_outbox',false))
|
||||
) {
|
||||
Run::Summon(['Onepoll', $new_connection[0]['abook_id']]);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class Socgraph {
|
|||
} else {
|
||||
$x = q(
|
||||
"insert into xchat ( xchat_url, xchat_desc, xchat_xchan, xchat_edited )
|
||||
values ( '%s', '%s', '%s', '%s' ) ",
|
||||
values ( '%s', '%s', '%s', '%s' ) ",
|
||||
dbesc(escape_tags($room['url'])),
|
||||
dbesc(escape_tags($room['desc'])),
|
||||
dbesc($xchan),
|
||||
|
@ -359,7 +359,7 @@ class Socgraph {
|
|||
|
||||
$r = q(
|
||||
"SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
|
||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 )",
|
||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 )",
|
||||
dbesc($xchan),
|
||||
dbesc($xchan),
|
||||
intval($uid)
|
||||
|
@ -384,7 +384,7 @@ class Socgraph {
|
|||
|
||||
$r = q(
|
||||
"SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
|
||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 ) $sql_extra limit %d offset %d",
|
||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_self = 0 ) $sql_extra limit %d offset %d",
|
||||
dbesc($xchan),
|
||||
dbesc($xchan),
|
||||
intval($uid),
|
||||
|
@ -405,15 +405,15 @@ class Socgraph {
|
|||
|
||||
$r1 = q(
|
||||
"SELECT count(xlink_xchan) as total, xchan.* from xchan
|
||||
left join xlink on xlink_link = xchan_hash
|
||||
where xlink_xchan in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||
and xlink_xchan != ''
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
and xlink_static = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
left join xlink on xlink_link = xchan_hash
|
||||
where xlink_xchan in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||
and xlink_xchan != ''
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
and xlink_static = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
intval($uid),
|
||||
|
@ -427,14 +427,14 @@ class Socgraph {
|
|||
|
||||
$r2 = q(
|
||||
"SELECT count(xtag_hash) as total, xchan.* from xchan
|
||||
left join xtag on xtag_hash = xchan_hash
|
||||
where xtag_hash != '%s'
|
||||
and not xtag_hash in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and xtag_term in ( select xtag_term from xtag where xtag_hash = '%s' )
|
||||
and not xtag_hash in ( select xchan from xign where uid = %d )
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
left join xtag on xtag_hash = xchan_hash
|
||||
where xtag_hash != '%s'
|
||||
and not xtag_hash in ( select abook_xchan from abook where abook_channel = %d )
|
||||
and xtag_term in ( select xtag_term from xtag where xtag_hash = '%s' )
|
||||
and not xtag_hash in ( select xchan from xign where uid = %d )
|
||||
and xchan_hidden = 0
|
||||
and xchan_deleted = 0
|
||||
group by xchan_hash order by total desc limit %d offset %d ",
|
||||
dbesc($myxchan),
|
||||
intval($uid),
|
||||
dbesc($myxchan),
|
||||
|
@ -543,11 +543,11 @@ class Socgraph {
|
|||
|
||||
if (isset($system_mode) && $system_mode) {
|
||||
$r = q("SELECT count(*) as total from abook where abook_self = 1
|
||||
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') ");
|
||||
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1') ");
|
||||
} else {
|
||||
$r = q(
|
||||
"SELECT count(*) as total from abook where abook_channel = %d
|
||||
$sql_extra ",
|
||||
$sql_extra ",
|
||||
intval($channel_id)
|
||||
);
|
||||
$rooms = q(
|
||||
|
@ -571,15 +571,15 @@ class Socgraph {
|
|||
if ($system_mode) {
|
||||
$r = q(
|
||||
"SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_self = 1
|
||||
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1')
|
||||
limit %d offset %d ",
|
||||
and abook_channel in (select uid from pconfig where cat = 'system' and k = 'suggestme' and v = '1')
|
||||
limit %d offset %d ",
|
||||
intval($itemsPerPage),
|
||||
intval($startIndex)
|
||||
);
|
||||
} else {
|
||||
$r = q(
|
||||
"SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d
|
||||
$sql_extra LIMIT %d OFFSET %d",
|
||||
$sql_extra LIMIT %d OFFSET %d",
|
||||
intval($channel_id),
|
||||
intval($itemsPerPage),
|
||||
intval($startIndex)
|
||||
|
@ -689,4 +689,4 @@ class Socgraph {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ class Chanview extends Controller
|
|||
|
||||
public function get()
|
||||
{
|
||||
|
||||
$load_outbox = false;
|
||||
|
||||
$observer = App::get_observer();
|
||||
|
@ -38,7 +39,7 @@ class Chanview extends Controller
|
|||
);
|
||||
} elseif (local_channel() && intval($_REQUEST['cid'])) {
|
||||
$r = q(
|
||||
"SELECT abook.*, xchan.*
|
||||
"SELECT abook.*, xchan.*
|
||||
FROM abook left join xchan on abook_xchan = xchan_hash
|
||||
WHERE abook_channel = %d and abook_id = %d LIMIT 1",
|
||||
intval(local_channel()),
|
||||
|
@ -169,42 +170,6 @@ class Chanview extends Controller
|
|||
$following = intval($m['totalItems']);
|
||||
}
|
||||
}
|
||||
if ($f && $channel && $load_outbox && !empty($f['outbox'])) {
|
||||
$j = Activity::fetch($f['outbox'], $channel);
|
||||
if ($j) {
|
||||
$AS = new ActivityStreams($j, null, true);
|
||||
if ($AS->is_valid() && isset($AS->data['type'])) {
|
||||
if (is_array($AS->obj)) {
|
||||
// matches Collection and orderedCollection
|
||||
if (isset($AS->obj['type']) && strpos($AS->obj['type'], 'Collection') !== false) {
|
||||
|
||||
$max = 20;
|
||||
|
||||
if (intval($max)) {
|
||||
$obj = new ASCollection($f['outbox'], $channel, 0, $max);
|
||||
$messages = $obj->get();
|
||||
// logger('received: ' . print_r($messages,true));
|
||||
if ($messages) {
|
||||
logger('received ' . count($messages) . ' items from collection.', LOGGER_DEBUG);
|
||||
foreach ($messages as $message) {
|
||||
if (is_string($message)) {
|
||||
$message = Activity::fetch($message, $channel);
|
||||
}
|
||||
$AS = new ActivityStreams($message, null, true);
|
||||
if ($AS->is_valid() && is_array($AS->obj)) {
|
||||
$item = Activity::decode_note($AS, true);
|
||||
}
|
||||
if ($item) {
|
||||
Activity::store($channel, get_observer_hash(), $AS, $item, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$o = replace_macros(Theme::get_template('chanview.tpl'), [
|
||||
'$url' => $url,
|
||||
|
|
|
@ -23,14 +23,10 @@ class Dreport extends Controller
|
|||
|
||||
$channel = App::get_channel();
|
||||
|
||||
if (argc() > 2) {
|
||||
if (argc() > 1) {
|
||||
$cmd = argv(1);
|
||||
$mid = argv(2);
|
||||
} elseif (argc() > 1) {
|
||||
$cmd = EMPTY_STR;
|
||||
$mid = argv(1);
|
||||
}
|
||||
|
||||
$mid = escape_tags($_REQUEST['mid']);
|
||||
$message_id = unpack_link_id($mid);
|
||||
|
||||
if (!$message_id) {
|
||||
|
|
|
@ -20,7 +20,7 @@ use Code\Lib\Menu;
|
|||
use Code\Extend\Hook;
|
||||
use Code\Render\Theme;
|
||||
|
||||
|
||||
|
||||
class Channel
|
||||
{
|
||||
|
||||
|
@ -35,7 +35,7 @@ class Channel
|
|||
Hook::call('settings_post', $_POST);
|
||||
|
||||
$set_perms = '';
|
||||
|
||||
|
||||
$role = ((x($_POST, 'permissions_role')) ? notags(trim($_POST['permissions_role'])) : '');
|
||||
$oldrole = get_pconfig(local_channel(), 'system', 'permissions_role');
|
||||
|
||||
|
@ -64,8 +64,8 @@ class Channel
|
|||
$x = $acl->get();
|
||||
|
||||
$r = q(
|
||||
"update channel set channel_allow_cid = '%s', channel_allow_gid = '%s',
|
||||
channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d",
|
||||
"update channel set channel_allow_cid = '%s', channel_allow_gid = '%s',
|
||||
channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d",
|
||||
dbesc($x['allow_cid']),
|
||||
dbesc($x['allow_gid']),
|
||||
dbesc($x['deny_cid']),
|
||||
|
@ -108,8 +108,8 @@ class Channel
|
|||
} // no default permissions
|
||||
else {
|
||||
q(
|
||||
"update channel set channel_default_group = '', channel_allow_gid = '', channel_allow_cid = '', channel_deny_gid = '',
|
||||
channel_deny_cid = '' where channel_id = %d",
|
||||
"update channel set channel_default_group = '', channel_allow_gid = '', channel_allow_cid = '', channel_deny_gid = '',
|
||||
channel_deny_cid = '' where channel_id = %d",
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class Channel
|
|||
$expire_starred = ((x($_POST, 'expire_starred')) ? intval($_POST['expire_starred']) : 0);
|
||||
$expire_photos = ((x($_POST, 'expire_photos')) ? intval($_POST['expire_photos']) : 0);
|
||||
$expire_network_only = ((x($_POST, 'expire_network_only')) ? intval($_POST['expire_network_only']) : 0);
|
||||
|
||||
$preview_outbox = ((x($_POST, 'preview_outbox')) ? intval($_POST['preview_outbox']) : 0);
|
||||
$allow_location = (((x($_POST, 'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1 : 0);
|
||||
|
||||
$blocktags = (((x($_POST, 'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0 : 1); // this setting is inverted!
|
||||
|
@ -194,7 +194,7 @@ class Channel
|
|||
} else {
|
||||
set_pconfig(local_channel(), 'system', 'close_comments', EMPTY_STR);
|
||||
}
|
||||
|
||||
|
||||
// allow a permission change to over-ride the autoperms setting from the form
|
||||
if (!isset($autoperms)) {
|
||||
$autoperms = ((x($_POST, 'autoperms')) ? intval($_POST['autoperms']) : 0);
|
||||
|
@ -350,6 +350,7 @@ class Channel
|
|||
set_pconfig(local_channel(), 'system', 'unless_mention_count', $unless_mention_count);
|
||||
set_pconfig(local_channel(), 'system', 'unless_tag_count', $unless_tag_count);
|
||||
set_pconfig(local_channel(), 'system', 'noindex', $noindex);
|
||||
set_pconfig(local_channel(), 'system', 'preview_outbox', $preview_outbox);
|
||||
|
||||
|
||||
$r = q(
|
||||
|
@ -653,13 +654,14 @@ class Channel
|
|||
'$permissions_set' => $permissions_set,
|
||||
'$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'),
|
||||
|
||||
'$hide_presence' => array('hide_presence', t('Hide my online presence'), $hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no),
|
||||
'$hide_presence' => array('hide_presence', t('Hide your online presence'), $hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no),
|
||||
'$hidefriends' => array('hide_friends', t('Allow others to view your friends and connections'), 1 - intval($profile['hide_friends']), '', $yes_no),
|
||||
'$preview_outbox' => [ 'preview_outbox', t('Preview some public posts from new connections prior to connection approval'), intval(get_pconfig($channel['channel_id'], 'system','preview_outbox', false)), '', $yes_no ],
|
||||
'$permiss_arr' => $permiss,
|
||||
'$comment_perms' => $comment_perms,
|
||||
'$mail_perms' => $mail_perms,
|
||||
'$noindex' => ['noindex', t('Forbid indexing of your public channel content by search engines'), get_pconfig($channel['channel_id'], 'system', 'noindex'), '', $yes_no],
|
||||
'$close_comments' => ['close_comments', t('Disable acceptance of comments on my posts after this many days'), ((intval(get_pconfig(local_channel(), 'system', 'close_comments'))) ? intval(get_pconfig(local_channel(), 'system', 'close_comments')) : EMPTY_STR), t('Leave unset or enter 0 to allow comments indefinitely')],
|
||||
'$close_comments' => ['close_comments', t('Disable acceptance of comments on your posts after this many days'), ((intval(get_pconfig(local_channel(), 'system', 'close_comments'))) ? intval(get_pconfig(local_channel(), 'system', 'close_comments')) : EMPTY_STR), t('Leave unset or enter 0 to allow comments indefinitely')],
|
||||
'$blocktags' => array('blocktags', t('Allow others to tag your posts'), 1 - $blocktags, t('Often used by the community to retro-actively flag inappropriate content'), $yes_no),
|
||||
|
||||
'$lbl_p2macro' => t('Channel Permission Limits'),
|
||||
|
@ -668,7 +670,7 @@ class Channel
|
|||
'$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']), t('May reduce spam activity')),
|
||||
'$permissions' => t('Default Access List'),
|
||||
'$permdesc' => t("(click to open/close)"),
|
||||
'$aclselect' => Libacl::populate($perm_defaults, false, PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
|
||||
'$aclselect' => Libacl::populate($perm_defaults, false, PermissionDescription::fromDescription(t('Use your default audience setting for the type of object published'))),
|
||||
'$profseltxt' => t('Profile to assign new connections'),
|
||||
'$profselect' => ((Features::enabled(local_channel(), 'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(), 'system', 'profile_assign', '')) : ''),
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class Notifications
|
|||
|
||||
$notifications[] = [
|
||||
'type' => 'stream',
|
||||
'icon' => 'th',
|
||||
'icon' => 'list-alt',
|
||||
'severity' => 'secondary',
|
||||
'label' => t('New Stream Activity'),
|
||||
'title' => t('New Stream Activity Notifications'),
|
||||
|
|
|
@ -181,11 +181,11 @@
|
|||
{{/if}}
|
||||
{{if $item.dropdown_extras}}
|
||||
<div class="dropdown-divider"></div>
|
||||
{{$item.dropdown_extras}}
|
||||
{{$item.dropdown_extras}}
|
||||
{{/if}}
|
||||
{{if ($item.edpost || $item.myconv) && $item.dreport}}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="dreport/{{$item.dreport_link}}">{{$item.dreport}}</a>
|
||||
<a class="dropdown-item" href="dreport/?mid={{$item.dreport_link}}">{{$item.dreport}}</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
{{/if}}
|
||||
<div class="dropdown-divider"></div>
|
||||
{{if $item.edpost && $item.dreport}}
|
||||
<a class="dropdown-item" href="dreport/{{$item.mid}}">{{$item.dreport}}</a>
|
||||
<a class="dropdown-item" href="dreport/?mid={{$item.mid}}">{{$item.dreport}}</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<i class="fa fa-sort-desc"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="dreport/push/{{$mid}}">{{$push}}</a></li>
|
||||
<li><a href="dreport/push/?mid={{$mid}}">{{$push}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
{{include file="field_input.tpl" field=$unless_mention_count}}
|
||||
{{include file="field_input.tpl" field=$followed_tags}}
|
||||
{{include file="field_input.tpl" field=$unless_tag_count}}
|
||||
{{include file="field_checkbox.tpl" field=$preview_outbox}}
|
||||
|
||||
<div id="advanced-perm" style="display:{{if $permissions_set}}none{{else}}block{{/if}};">
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Reference in a new issue