Merge branch 'dev' into release

This commit is contained in:
nobody 2022-03-16 22:16:25 -07:00
commit d09507d930
8 changed files with 44 additions and 18 deletions

View file

@ -78,7 +78,7 @@ class AccessList
$user_info = array_shift($r);
$change = false;
if ($user_info['channel_default_group'] == $group_hash) {
if ($user_info['channel_default_group'] === $group_hash) {
$user_info['channel_default_group'] = '';
$change = true;
}
@ -95,7 +95,7 @@ class AccessList
q(
"UPDATE channel SET channel_default_group = '%s', channel_allow_gid = '%s', channel_deny_gid = '%s'
WHERE channel_id = %d",
intval($user_info['channel_default_group']),
dbesc($user_info['channel_default_group']),
dbesc($user_info['channel_allow_gid']),
dbesc($user_info['channel_deny_gid']),
intval($uid)

View file

@ -73,11 +73,7 @@ class Navbar {
$site_icon = System::get_site_icon();
$banner = EMPTY_STR;
// $banner = System::get_site_name();
// if (! isset(App::$page['header'])) {
// App::$page['header'] = EMPTY_STR;
// }
App::$page['header'] .= replace_macros(Theme::get_template('hdr.tpl'), array(
//we could additionally use this to display important system notifications e.g. for updates
));

View file

@ -463,11 +463,19 @@ class Import extends Controller
$group['gname'] = $group['name'];
unset($group['name']);
}
$r = q("select * from pgrp where gname = '%s' and uid = %d",
dbesc($group['gname']),
intval($channel['channel_id'])
);
if ($r) {
continue;
}
unset($group['id']);
$group['uid'] = $channel['channel_id'];
create_table_from_array('pgrp', $group);
}
// create a list of ids that applies to this system so we can map members to them
$r = q(
"select * from pgrp where uid = %d",
intval($channel['channel_id'])
@ -490,6 +498,14 @@ class Import extends Controller
$group_member['gid'] = $x['new'];
}
}
// check if it's a duplicate
$r = q("select * from pgrp_member where xchan = '%s' and gid = %d",
dbesc($group_member['xchan']),
intval($group_member['gid'])
);
if ($r) {
continue;
}
create_table_from_array('pgrp_member', $group_member);
}
}

View file

@ -1452,7 +1452,9 @@ function sync_files($channel, $files)
if (! $f) {
continue;
}
$fetch_url = $f['fetch_url'];
$oldbase = dirname($fetch_url);
$original_channel = $f['original_channel'];
@ -1462,8 +1464,10 @@ function sync_files($channel, $files)
$has_undeleted_attachments = false;
if ($f['attach']) {
foreach ($f['attach'] as $att) {
$attachment_stored = false;
convert_oldfields($att, 'data', 'content');

View file

@ -135,7 +135,7 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
// We've determined this is public. Send it also to the system channel.
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($item['uid']) !== intval($sys['channel_id'])) {
$recipients[] = $sys['channel_hash'];
}
@ -1413,7 +1413,7 @@ function activity_sanitise($arr) {
if(is_array($x))
$ret[$k] = activity_sanitise($x);
else
$ret[$k] = htmlspecialchars($x, ENT_COMPAT, 'UTF-8', false);
$ret[$k] = htmlspecialchars((isset($x) ? $x : ''), ENT_COMPAT, 'UTF-8', false);
}
return $ret;
}

View file

@ -1515,8 +1515,9 @@ function theme_attachments(&$item)
$attaches = [];
foreach ($arr as $r) {
$label = EMPTY_STR;
$icon = getIconFromType($r['type']);
if (isset($r['type'])) {
$icon = getIconFromType($r['type']);
}
if (isset($r['title']) && $r['title']) {
$label = urldecode(htmlspecialchars($r['title'], ENT_COMPAT, 'UTF-8'));
}
@ -3450,9 +3451,11 @@ function item_url_replace($channel, &$item, $old, $new, $oldnick = '')
$item['plink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['plink']);
}
$item['llink'] = str_replace($old, $new, $item['llink']);
if ($oldnick && ($oldnick !== $channel['channel_address'])) {
$item['llink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['llink']);
if (isset($item['llink'])) {
$item['llink'] = str_replace($old, $new, $item['llink']);
if ($oldnick && ($oldnick !== $channel['channel_address'])) {
$item['llink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['llink']);
}
}
if ($item['term']) {

View file

@ -367,6 +367,14 @@ function owt_init($token)
change_channel($r[0]['channel_id']);
$delegate_success = true;
}
// experimental 2022-03-16
// $allowed = perm_is_allowed($r[0]['channel_id'], $hubloc['xchan_hash'], 'full_control');
// if ($allowed) {
// $_SESSION['account_id'] = intval($r[0]['channel_account_id']);
// // this will set the local_channel authentication in the session
// change_channel($r[0]['channel_id']);
// $delegate_success = true;
// }
}
}

View file

@ -27,6 +27,9 @@
{{foreach $nav.usermenu as $usermenu}}
<a class="dropdown-item{{if $usermenu.2}} active{{/if}}" href="{{$usermenu.0}}" title="{{$usermenu.3}}" role="menuitem" id="{{$usermenu.4}}">{{$usermenu.1}}</a>
{{/foreach}}
{{if $nav.settings}}
<a class="dropdown-item{{if $sel.name == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
{{/if}}
{{if $nav.group}}
<a class="dropdown-item" href="{{$nav.group.0}}" title="{{$nav.group.3}}" role="menuitem" id="{{$nav.group.4}}">{{$nav.group.1}}</a>
{{/if}}
@ -41,10 +44,6 @@
{{if $nav.profiles}}
<a class="dropdown-item" href="{{$nav.profiles.0}}" title="{{$nav.profiles.3}}" role="menuitem" id="{{$nav.profiles.4}}">{{$nav.profiles.1}}</a>
{{/if}}
{{if $nav.settings}}
<div class="dropdown-divider"></div>
<a class="dropdown-item{{if $sel.name == Settings}} active{{/if}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}" role="menuitem" id="{{$nav.settings.4}}">{{$nav.settings.1}}</a>
{{/if}}
{{if $nav.safe}}
<div class="dropdown-divider"></div>
<a class="dropdown-item{{if $sel.name == Safe}} active{{/if}}" href="{{$nav.safe.0}}" title="{{$nav.safe.3}}" role="menuitem" id="{{$nav.safe.4}}">{{$nav.safe.1}} {{$nav.safe.2}}</a>