diff --git a/Code/Lib/AccessList.php b/Code/Lib/AccessList.php index 995fb3546..70fdce3b8 100644 --- a/Code/Lib/AccessList.php +++ b/Code/Lib/AccessList.php @@ -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) diff --git a/Code/Lib/Navbar.php b/Code/Lib/Navbar.php index 6b582d914..9ce99227b 100644 --- a/Code/Lib/Navbar.php +++ b/Code/Lib/Navbar.php @@ -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 )); diff --git a/Code/Module/Import.php b/Code/Module/Import.php index a556b1b45..183ee935e 100644 --- a/Code/Module/Import.php +++ b/Code/Module/Import.php @@ -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); } } diff --git a/include/import.php b/include/import.php index 7c35f6dcd..1c2bc3f89 100644 --- a/include/import.php +++ b/include/import.php @@ -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'); diff --git a/include/items.php b/include/items.php index d89a48dac..d9601557f 100644 --- a/include/items.php +++ b/include/items.php @@ -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; } diff --git a/include/text.php b/include/text.php index 8ec893048..73ab198b9 100644 --- a/include/text.php +++ b/include/text.php @@ -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']) { diff --git a/include/zid.php b/include/zid.php index 8a4dccd52..84e3020da 100644 --- a/include/zid.php +++ b/include/zid.php @@ -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; + // } } } diff --git a/view/tpl/navbar_default.tpl b/view/tpl/navbar_default.tpl index 97ccf5552..1b74dd8bc 100755 --- a/view/tpl/navbar_default.tpl +++ b/view/tpl/navbar_default.tpl @@ -27,6 +27,9 @@ {{foreach $nav.usermenu as $usermenu}} {{$usermenu.1}} {{/foreach}} + {{if $nav.settings}} + {{$nav.settings.1}} + {{/if}} {{if $nav.group}} {{$nav.group.1}} {{/if}} @@ -41,10 +44,6 @@ {{if $nav.profiles}} {{$nav.profiles.1}} {{/if}} - {{if $nav.settings}} - - {{$nav.settings.1}} - {{/if}} {{if $nav.safe}} {{$nav.safe.1}} {{$nav.safe.2}}