Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2021-09-23 16:39:33 -07:00
commit b473b96527
21 changed files with 419 additions and 270 deletions

View file

@ -487,7 +487,7 @@ class Notifier {
self::$recipients = collect_recipients($parent_item,self::$private);
}
// FIXME add any additional recipients such as mentions, etc.
// @FIXME add any additional recipients such as mentions, etc.
if ($top_level_post) {
// remove clones who will receive the post via sync
@ -606,7 +606,7 @@ class Notifier {
}
}
}
if (! $hubs) {
logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE);
return;

View file

@ -1753,12 +1753,12 @@ class Activity {
// information
$ret = self::encode_person($sys,true,true);
$ret['type'] = 'Service';
$ret['type'] = ((is_group($sys['channel_id'])) ? 'Group' : 'Service');
$ret['id'] = z_root();
$ret['alsoKnownAs'] = z_root() . '/channel/sys';
$auto_follow = false;
$ret['preferredUsername'] = System::get_site_name();
$ret['preferredUsername'] = 'sys';
$ret['name'] = System::get_site_name();
$ret['icon'] = [
@ -1781,7 +1781,7 @@ class Activity {
];
}
$ret['summary'] = bbcode(get_config('system','siteinfo',''),['export' => true ]);
$ret['summary'] = bbcode(get_config('system','siteinfo',''),[ 'export' => true ]);
$ret['source'] = [
'mediaType' => 'text/x-multicode',
'summary' => get_config('system','siteinfo','')
@ -3584,11 +3584,6 @@ class Activity {
if ($is_sys_channel) {
if (! $pubstream) {
$allowed = false;
$reason[] = 'unlisted post delivered to sys channel';
}
if (! check_pubstream_channelallowed($observer_hash)) {
$allowed = false;
$reason[] = 'pubstream channel blocked';

View file

@ -84,11 +84,36 @@ class Connect {
$r = Libzot::zot_record_preferred($r,'xchan_network');
// Some Hubzilla records were originally stored as activitypub. If we find one, force rediscovery
// since Zap cannot connect with them.
// ensure there's a valid hubloc for this xchan before proceeding - you cannot connect without it
if (($r['xchan_network'] === 'activitypub') && (! $ap_allowed)) {
$r = null;
if (in_array($r['xchan_network'], [ 'zot6','activitypub' ])) {
$h = q("select * from hubloc where hubloc_hash = '%s'",
dbesc($r['xchan_hash'])
);
if (! $h) {
$r = null;
}
}
// we may have nulled out this record so check again
if ($r) {
// Check the site table to see if we should have a zot6 hubloc,
// If so, clear the xchan and start fresh
if ($r['xchan_network'] === 'activitypub') {
$m = parse_url($r['xchan_hash']);
unset($m['path']);
$h = unparse_url($m);
$s = q("select * from site where site_url = '%s'",
dbesc($h)
);
if (intval($s['site_type']) === SITE_TYPE_ZOT) {
logger('got zot - ignore activitypub entry');
$r = null;
}
}
}
}

View file

@ -3207,7 +3207,7 @@ class Libzot {
$profile['region'] = $p[0]['region'];
$profile['postcode'] = $p[0]['postal_code'];
$profile['country'] = $p[0]['country_name'];
$profile['about'] = $p[0]['about'];
$profile['about'] = ((is_sys_channel($e['channel_id'])) ? get_config('system','siteinfo') : $p[0]['about']);
$profile['homepage'] = $p[0]['homepage'];
$profile['hometown'] = $p[0]['hometown'];

View file

@ -28,9 +28,9 @@ class Followers extends Controller {
http_status_exit(404, 'Not found');
}
if (intval($channel['channel_system'])) {
http_status_exit(403,'Permission denied');
}
// if (intval($channel['channel_system'])) {
// http_status_exit(403,'Permission denied');
// }
Libprofile::load(argv(1));

View file

@ -26,9 +26,9 @@ class Following extends Controller {
http_status_exit(404, 'Not found');
}
if (intval($channel['channel_system'])) {
http_status_exit(403,'Permission denied');
}
// if (intval($channel['channel_system'])) {
// http_status_exit(403,'Permission denied');
// }
Libprofile::load(argv(1));

View file

@ -6,6 +6,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Crypto;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
@ -44,20 +45,37 @@ class Home extends Controller {
killme();
}
if (Libzot::is_zot_request()) {
$key = get_config('system','prvkey');
$ret = json_encode(Libzot::site_info());
$channel = get_sys_channel();
$sigdata = HTTPSig::verify(file_get_contents('php://input'), EMPTY_STR, 'zot6');
$headers = [ 'Content-Type' => 'application/x-zot+json', 'Digest' => HTTPSig::generate_digest_header($ret) ];
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
$h = HTTPSig::create_sig($headers, $key, z_root());
if($sigdata && $sigdata['signer'] && $sigdata['header_valid']) {
$data = json_encode(Libzot::zotinfo([ 'guid_hash' => $channel['channel_hash'], 'target_url' => $sigdata['signer'] ]));
$s = q("select site_crypto, hubloc_sitekey from site left join hubloc on hubloc_url = site_url where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($sigdata['signer'])
);
if($s && $s[0]['hubloc_sitekey'] && $s[0]['site_crypto']) {
$data = json_encode(Crypto::encapsulate($data,$s[0]['hubloc_sitekey'],Libzot::best_algorithm($s[0]['site_crypto'])));
}
}
else {
$data = json_encode(Libzot::zotinfo([ 'guid_hash' => $channel['channel_hash'] ]));
}
$headers = [
'Content-Type' => 'application/x-zot+json',
'Digest' => HTTPSig::generate_digest_header($data),
'(request-target)' => strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI']
];
$h = HTTPSig::create_sig($headers,get_config('system','prvkey'),z_root());
HTTPSig::set_headers($h);
echo $ret;
echo $data;
killme();
}
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
$channel = App::get_channel();

View file

@ -261,6 +261,8 @@ class Inbox extends Controller {
foreach ($channels as $channel) {
// Even though activitypub may be enabled for the site, check if the channel has specifically disabled it
if (! PConfig::Get($channel['channel_id'],'system','activitypub',Config::Get('system','activitypub',ACTIVITYPUB_ENABLED))) {
continue;
}

View file

@ -64,7 +64,8 @@ class Manage extends Controller {
$account = App::get_account();
if ($r && count($r)) {
$channels = $r;
$channels = ((is_site_admin()) ? array_merge ([ get_sys_channel() ], $r) : $r);
for ($x = 0; $x < count($channels); $x ++) {
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
$channels[$x]['include_in_menu'] = intval(PConfig::get($channels[$x]['channel_id'],'system','include_in_menu',0));

View file

@ -210,9 +210,9 @@ return;
killme();
}
if (intval($channel['channel_system'])) {
killme();
}
// if (intval($channel['channel_system'])) {
// killme();
// }
if (ActivityStreams::is_as_request()) {
$sigdata = HTTPSig::verify(($_SERVER['REQUEST_METHOD'] === 'POST') ? file_get_contents('php://input') : EMPTY_STR);

View file

@ -164,7 +164,7 @@ class Pubstream extends Controller {
}
else {
$sys = get_sys_channel();
$uids = " and ( item.uid = " . intval($sys['channel_id']) . " )";
$uids = " and item_private = 0 and item_wall = 0 and item.uid = " . intval($sys['channel_id']) . " ";
$sql_extra = item_permissions_sql($sys['channel_id']);
App::$data['firehose'] = intval($sys['channel_id']);
}

View file

@ -635,7 +635,7 @@ class Channel {
'$group_select' => $group_select,
'$can_change_role' => ((in_array($permissions_role, [ 'collection', 'collection_restricted'] )) ? false : true),
'$permissions_role' => $permissions_role,
'$role' => array('permissions_role' , t('Channel role and privacy'), $permissions_role, '', $perm_roles, ' onchange="update_role_text(); return false;"'),
'$role' => array('permissions_role' , t('Channel type and privacy'), $permissions_role, '', $perm_roles, ' onchange="update_role_text(); return false;"'),
'$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ],
'$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$profile_in_dir' => $profile_in_dir,

View file

@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\System;
use App;
class Webfinger extends Controller {
@ -30,68 +31,55 @@ class Webfinger extends Controller {
logger('webfinger: ' . $resource, LOGGER_DEBUG);
// Response for a site resource
// Determine whether to respond as a site actor
// or a normal channel
if (strcasecmp(rtrim($resource,'/'),z_root()) === 0) {
$site_query = false;
if (strcasecmp(rtrim($resource,'/'),z_root()) === 0
|| strcasecmp($resource,'acct:sys@' . App::get_hostname()) === 0
|| $resource === z_root() . '/channel/sys') {
$site_query = true;
$result['subject'] = $resource;
$result['properties'] = [
'https://w3id.org/security/v1#publicKeyPem' => get_config('system','pubkey')
];
$result['links'] = [
[
'rel' => 'http://purl.org/openwebauth/v1',
'type' => 'application/x-zot+json',
'href' => z_root() . '/owa',
],
[
'rel' => 'http://purl.org/zot/protocol/6.0',
'type' => 'application/x-zot+json',
'href' => z_root(),
],
];
$resource = z_root() . '/channel/sys';
}
else {
// some other resource
if (strpos($resource,'tag:' === 0)) {
$arr = explode(':',$resource);
if (count($arr) > 3 && $arr[2] === 'zotid') {
$hash = $arr[3];
$channel_target = channelx_by_hash($hash);
}
if (strpos($resource,'tag:' === 0)) {
$arr = explode(':',$resource);
if (count($arr) > 3 && $arr[2] === 'zotid') {
$hash = $arr[3];
$channel_target = channelx_by_hash($hash);
}
}
if (strpos($resource,'acct:') === 0) {
$channel_nickname = punify(str_replace('acct:','',$resource));
if (strrpos($channel_nickname,'@') !== false) {
$host = punify(substr($channel_nickname,strrpos($channel_nickname,'@')+1));
if (strpos($resource,'acct:') === 0) {
$channel_nickname = punify(str_replace('acct:','',$resource));
if (strrpos($channel_nickname,'@') !== false) {
$host = punify(substr($channel_nickname,strrpos($channel_nickname,'@')+1));
// If the webfinger address points off site, redirect to the correct site
// If the webfinger address points off site, redirect to the correct site
if (strcasecmp($host, App::get_hostname())) {
goaway('https://' . $host . '/.well-known/webfinger?f=&resource=' . $resource);
}
$channel_nickname = substr($channel_nickname,0,strrpos($channel_nickname,'@'));
}
}
if (strpos($resource,'http') === 0) {
$channel_nickname = str_replace( ['~','@'],['',''],basename($resource));
}
if ($channel_nickname) {
$channel_target = channelx_by_nick($channel_nickname);
}
if (strcasecmp($host, App::get_hostname())) {
goaway('https://' . $host . '/.well-known/webfinger?f=&resource=' . $resource);
}
$channel_nickname = substr($channel_nickname,0,strrpos($channel_nickname,'@'));
}
}
if (strpos($resource,'http') === 0) {
$channel_nickname = str_replace( ['~','@'],['',''],basename($resource));
}
if ($channel_target) {
if ($channel_nickname) {
$channel_target = channelx_by_nick($channel_nickname);
}
if ($channel_target || $site_query) {
$h = get_hubloc_addrs_by_hash($channel_target['channel_hash']);
$result['subject'] = $resource;
if (! isset($result['subject'])) {
$result['subject'] = $resource;
}
$aliases = [
z_root() . '/channel/' . $channel_target['channel_address'],
z_root() . '/~' . $channel_target['channel_address'],
@ -108,14 +96,19 @@ class Webfinger extends Controller {
$result['aliases'] = [];
$result['properties'] = [
'http://webfinger.net/ns/name' => $channel_target['channel_name'],
'http://xmlns.com/foaf/0.1/name' => $channel_target['channel_name'],
'https://w3id.org/security/v1#publicKeyPem' => $channel_target['xchan_pubkey'],
'http://webfinger.net/ns/name' => $site_query ? System::get_site_name() : $channel_target['channel_name'],
'http://xmlns.com/foaf/0.1/name' => $site_query ? System::get_site_name() : $channel_target['channel_name'],
'https://w3id.org/security/v1#publicKeyPem' => (($site_query) ? get_config('system','pubkey') : $channel_target['xchan_pubkey']),
'http://purl.org/zot/federation' => ((get_config('system','activitypub', ACTIVITYPUB_ENABLED)) ? 'zot6,activitypub' : 'zot6')
];
if ($site_query) {
$aliases[] = z_root();
$aliases[] = 'acct:sys@' . App::get_hostname();
}
foreach ($aliases as $alias) {
if ($alias != $resource) {
if ($alias !== $result['subject']) {
$result['aliases'][] = $alias;
}
}
@ -141,7 +134,7 @@ class Webfinger extends Controller {
[
'rel' => 'http://purl.org/zot/protocol/6.0',
'type' => 'application/x-zot+json',
'href' => z_root() . '/channel/' . $channel_target['channel_address'],
'href' => (($site_query) ? z_root() : z_root() . '/channel/' . $channel_target['channel_address']),
],
[
@ -153,13 +146,13 @@ class Webfinger extends Controller {
[
'rel' => 'self',
'type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'href' => z_root() . '/channel/' . $channel_target['channel_address']
'href' => (($site_query) ? z_root() : z_root() . '/channel/' . $channel_target['channel_address'])
],
[
'rel' => 'self',
'type' => 'application/activity+json',
'href' => z_root() . '/channel/' . $channel_target['channel_address']
'href' => (($site_query) ? z_root() : z_root() . '/channel/' . $channel_target['channel_address'])
],
[

View file

@ -20,6 +20,7 @@ class Activity_filter {
$video_active = false;
$polls_active = false;
$group_active = false;
$drafts_active = false;
$forum_active = false;
$tabs = [];
@ -64,6 +65,21 @@ class Activity_filter {
'title' => t('Show posts that I have saved')
];
if (local_channel() && Apps::system_app_installed(local_channel(),'Drafts')) {
$drafts_active = ((isset($_GET['draft']) && intval($_GET['draft'])) ? 'active' : '');
if ($drafts_active) {
$filter_active = 'drafts';
}
$tabs[] = [
'label' => t('Drafts'),
'icon' => 'floppy-o',
'url' => z_root() . '/' . $cmd . '/?draft=1',
'sel' => $drafts_active,
'title' => t('Show drafts that I have saved')
];
}
if(x($_GET,'search')) {
$video_active = (($_GET['search'] == 'video]') ? 'active' : '');
$filter_active = (($events_active) ? 'videos' : 'search');

View file

@ -17,7 +17,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '21.09.17' );
define ( 'STD_VERSION', '21.09.24' );
define ( 'ZOT_REVISION', '10.0' );
define ( 'DB_UPDATE_VERSION', 1251 );
@ -740,6 +740,7 @@ class App {
public static $channel = null; // channel record of the current channel of the logged-in account
public static $observer = null; // xchan record of the page observer
public static $profile_uid = 0; // If applicable, the channel_id of the "page owner"
public static $sys_channel = null; // cache sys channel lookups here
public static $poi = null; // "person of interest", generally a referenced connection or directory entry
private static $oauth_key = null; // consumer_id of oauth request, if used
public static $layout = []; // Comanche parsed template
@ -1326,10 +1327,10 @@ class App {
/**
* @brief Multi-purpose function to check variable state.
*
* Usage: x($var) or $x($array, 'key')
* Usage: x($var) or x($array, 'key')
*
* returns false if variable/key is not set
* if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0.
* if variable is set, returns 1 if variable contains 'truthy' value, otherwise returns 0.
* e.g. x('') or x(0) returns 0;
*
* @param string|array $s variable to check
@ -1492,13 +1493,13 @@ function check_config() {
App::set_baseurl(z_root());
// Make sure each site has a system channel. This is now created on install
// so we just need to keep this around a couple of weeks until the hubs that
// already exist have one
$syschan_exists = get_sys_channel();
if (! $syschan_exists)
create_sys_channel();
// Make sure each site has a system channel and that it has been upgraded.
$syschan_exists = get_sys_channel();
if ((! $syschan_exists) || ($syschan_exists['channel_pubkey'] !== get_config('system','pubkey'))) {
create_sys_channel();
}
$x = new DB_Upgrade(DB_UPDATE_VERSION);
plugins_sync();

View file

@ -101,24 +101,75 @@ function validate_channelname($name) {
*
*/
function create_sys_channel() {
if (get_sys_channel())
return;
// Ensure that there is a host keypair.
if ((! get_config('system', 'pubkey')) && (! get_config('system', 'prvkey'))) {
if ((! get_config('system', 'pubkey')) || (! get_config('system', 'prvkey'))) {
$hostkey = Crypto::new_keypair(4096);
set_config('system', 'pubkey', $hostkey['pubkey']);
set_config('system', 'prvkey', $hostkey['prvkey']);
}
$sys = get_sys_channel();
if ($sys) {
if (isset($sys['channel_pubkey']) && $sys['channel_pubkey'] && $sys['channel_pubkey'] === get_config('system','pubkey')) {
return;
}
else {
// upgrade the sys channel and return
$pubkey = get_config('system','pubkey');
$prvkey = get_config('system','prvkey');
$guid_sig = Libzot::sign($sys['channel_guid'],$prvkey);
$hash = Libzot::make_xchan_hash($sys['channel_guid'],$pubkey);
q("update channel set channel_guid_sig = '%s', channel_hash = '%s', channel_pubkey = '%s', channel_prvkey = '%s' where channel_id = %d",
dbesc($guid_sig),
dbesc($hash),
dbesc($pubkey),
dbesc($prvkey),
dbesc($sys['channel_id'])
);
q("update xchan set xchan_guid_sig = '%s', xchan_hash = '%s', xchan_pubkey = '%s', xchan_url = '%s' where xchan_hash = '%s'",
dbesc($guid_sig),
dbesc($hash),
dbesc($pubkey),
dbesc(z_root()),
dbesc($sys['channel_hash'])
);
q("update hubloc set hubloc_guid_sig = '%s', hubloc_hash = '%s', hubloc_id_url = '%s', hubloc_url_sig = '%s', hubloc_site_id = '%s', hubloc_orphancheck = 0, hubloc_error = 0, hubloc_deleted = 0 where hubloc_hash = '%s'",
dbesc($guid_sig),
dbesc($hash),
dbesc(z_root()),
dbesc(Libzot::sign(z_root(),$prvkey)),
dbesc(Libzot::make_xchan_hash(z_root(),$pubkey)),
dbesc($sys['channel_hash'])
);
q("update abook set abook_xchan = '%s' where abook_xchan = '%s'",
dbesc($hash),
dbesc($sys['channel_hash'])
);
q("update abconfig set xchan = '%s' where xchan = '%s'",
dbesc($hash),
dbesc($sys['channel_hash'])
);
return;
}
}
create_identity([
'account_id' => 'xxx', // Typecast trickery: account_id is required. This will create an identity with an (integer) account_id of 0
'nickname' => 'sys',
'name' => 'System',
'pageflags' => 0,
'publish' => 0,
'system' => 1
'account_id' => 'xxx', // Typecast trickery: account_id is required. This will create an identity with an (integer) account_id of 0
'nickname' => 'sys',
'name' => 'System',
'permissions_role' => 'social',
'pageflags' => 0,
'publish' => 0,
'system' => 1
]);
}
@ -129,11 +180,19 @@ function create_sys_channel() {
* @return array|boolean
*/
function get_sys_channel() {
// App::$sys_channel caches this lookup
if (is_array(App::$sys_channel)) {
return App::$sys_channel;
}
$r = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_system = 1 limit 1");
if ($r)
return $r[0];
if ($r) {
App::$sys_channel = array_shift($r);
return App::$sys_channel;
}
return false;
}
@ -145,13 +204,10 @@ function get_sys_channel() {
* @return boolean
*/
function is_sys_channel($channel_id) {
$r = q("select channel_system from channel where channel_id = %d and channel_system = 1 limit 1",
intval($channel_id)
);
if($r)
return true;
$s = get_sys_channel();
if ($s) {
return (intval($s['channel_id']) === intval($channel_id));
}
return false;
}
@ -232,8 +288,14 @@ function create_identity($arr) {
}
$guid = Libzot::new_uid($nick);
$key = Crypto::new_keypair(4096);
if ($system) {
$key = [ 'pubkey' => get_config('system','pubkey'), 'prvkey' => get_config('system','prvkey') ];
}
else {
$key = Crypto::new_keypair(4096);
}
$sig = Libzot::sign($guid,$key['prvkey']);
$hash = Libzot::make_xchan_hash($guid,$key['pubkey']);
@ -339,7 +401,7 @@ function create_identity($arr) {
[
'hubloc_guid' => $guid,
'hubloc_guid_sig' => $sig,
'hubloc_id_url' => channel_url($ret['channel']),
'hubloc_id_url' => (($system) ? z_root() : channel_url($ret['channel'])),
'hubloc_hash' => $hash,
'hubloc_addr' => channel_reddress($ret['channel']),
'hubloc_primary' => intval($primary),
@ -369,7 +431,7 @@ function create_identity($arr) {
'xchan_photo_m' => z_root() . "/photo/profile/m/{$newuid}",
'xchan_photo_s' => z_root() . "/photo/profile/s/{$newuid}",
'xchan_addr' => channel_reddress($ret['channel']),
'xchan_url' => channel_url($ret['channel']),
'xchan_url' => (($system) ? z_root() : channel_url($ret['channel'])),
'xchan_follow' => z_root() . '/follow?f=&url=%s',
'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'],
'xchan_name' => $ret['channel']['channel_name'],
@ -455,11 +517,9 @@ function create_identity($arr) {
);
}
if(! $system) {
set_pconfig($ret['channel']['channel_id'],'system','photo_path', '%Y/%Y-%m');
set_pconfig($ret['channel']['channel_id'],'system','attach_path','%Y/%Y-%m');
}
set_pconfig($ret['channel']['channel_id'],'system','photo_path', '%Y/%Y-%m');
set_pconfig($ret['channel']['channel_id'],'system','attach_path','%Y/%Y-%m');
// If this channel has a parent, auto follow them.
if($parent_channel_hash) {
@ -2400,3 +2460,9 @@ function channel_url($channel) {
return (($channel) ? z_root() . '/channel/' . $channel['channel_address'] : z_root());
}
function is_group($uid) {
$role = get_pconfig($uid,'system','permissions_role');
$rolesettings = PermissionRoles::role_perms($role);
return ((isset($rolesettings['channel_type']) && $rolesettings['channel_type'] === 'group') ? true : false);
}

View file

@ -133,8 +133,23 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
}
}
}
// We've determined it is public. If it is also a wall post and not owned by the sys channel,
// send this also to followers of the sys_channel
$sys = get_sys_channel();
if ($sys && intval($item['uid']) !== intval($sys['channel_id']) && intval($item['item_wall'])) {
$r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ",
intval($sys['channel_id'])
);
if ($r) {
foreach ($r as $rv) {
$recipients[] = $rv['abook_xchan'];
}
}
}
}
// Add the authors of any posts in this thread, if they are known to us.
// This is specifically designed to forward wall-to-wall posts to the original author,
// in case they aren't a connection but have permission to write on our wall.
@ -158,7 +173,8 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) {
// This is a somewhat expensive operation but important.
// Don't send this item to anybody who isn't allowed to see it
$recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
// Note: commented out - no longer needed in zap and later projects because we do not allow this permission to be changed.
// $recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
// remove any upstream recipients from our list.
// If it is ourself we'll add it back in a second.

View file

@ -38,6 +38,10 @@ function nav($template = 'default') {
$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())
);
$q = get_sys_channel();
if (is_site_admin() && intval(get_pconfig($q['channel_id'],'system','include_in_menu'))) {
$chans = array_merge([$q],$chans);
}
}
$sitelocation = (($is_owner) ? '' : App::$profile['reddress']);

View file

@ -268,13 +268,11 @@ function change_channel($change_channel) {
);
// It's not there. Is this an administrator, and is this the sys channel?
if (is_developer()) {
if (! $r) {
if (is_site_admin()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_system = 1 and channel_removed = 0 limit 1",
intval($change_channel)
);
}
if (! $r) {
if (is_developer() || is_site_admin()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel_id = %d and channel_system = 1 and channel_removed = 0 limit 1",
intval($change_channel)
);
}
}

View file

@ -3241,37 +3241,44 @@ function item_url_replace($channel,&$item,$old,$new,$oldnick = '') {
if($item['attach']) {
json_url_replace($old,$new,$item['attach']);
if($oldnick)
if($oldnick && ($oldnick !== $channel['channel_address']))
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['attach']);
}
if($item['object']) {
json_url_replace($old,$new,$item['object']);
if($oldnick)
if($oldnick && ($oldnick !== $channel['channel_address']))
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['object']);
}
if($item['target']) {
json_url_replace($old,$new,$item['target']);
if($oldnick)
if($oldnick && ($oldnick !== $channel['channel_address']))
json_url_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['target']);
}
if(string_replace($old,$new,$item['body'])) {
$item['sig'] = Libzot::sign($item['body'],$channel['channel_prvkey']);
$item['item_verified'] = 1;
}
$root_replaced = null;
$nick_replaced = null;
$item['body'] = str_replace($old, $new, $item['body']);
if($oldnick && ($oldnick !== $channel['channel_address'])) {
$item['body'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['body']);
}
$item['sig'] = Libzot::sign($item['body'],$channel['channel_prvkey']);
$item['item_verified'] = 1;
$item['plink'] = str_replace($old,$new,$item['plink']);
if($oldnick)
if($oldnick && ($oldnick !== $channel['channel_address']))
$item['plink'] = str_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['plink']);
$item['llink'] = str_replace($old,$new,$item['llink']);
if($oldnick)
if($oldnick && ($oldnick !== $channel['channel_address']))
$item['llink'] = str_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['llink']);
if($item['term']) {
for($x = 0; $x < count($item['term']); $x ++) {
$item['term'][$x]['url'] = str_replace($old,$new,$item['term'][$x]['url']);
if ($oldnick) {
if($oldnick && ($oldnick !== $channel['channel_address'])) {
$item['term'][$x]['url'] = str_replace('/' . $oldnick . '/' ,'/' . $channel['channel_address'] . '/' ,$item['term'][$x]['url']);
}
}

View file

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 21.09.17\n"
"Project-Id-Version: 21.09.24\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-17 05:52-0700\n"
"POT-Creation-Date: 2021-09-23 16:32-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -884,8 +884,8 @@ msgstr ""
#: Zotlabs/Lib/Apps.php:327 Zotlabs/Module/Connedit.php:669
#: Zotlabs/Module/Connections.php:369 Zotlabs/Module/Stream.php:122
#: Zotlabs/Module/Affinity.php:62 Zotlabs/Widget/Affinity.php:28
#: Zotlabs/Widget/Activity_filter.php:128 include/connections.php:908
#: Zotlabs/Module/Affinity.php:62 Zotlabs/Widget/Activity_filter.php:144
#: Zotlabs/Widget/Affinity.php:28 include/connections.php:908
msgid "Connections"
msgstr ""
@ -902,11 +902,11 @@ msgstr ""
msgid "Directory"
msgstr ""
#: Zotlabs/Lib/Apps.php:331
#: Zotlabs/Lib/Apps.php:331 Zotlabs/Widget/Activity_filter.php:75
msgid "Drafts"
msgstr ""
#: Zotlabs/Lib/Apps.php:332 Zotlabs/Widget/Activity_filter.php:87
#: Zotlabs/Lib/Apps.php:332 Zotlabs/Widget/Activity_filter.php:103
#: include/conversation.php:1965 include/conversation.php:1968
msgid "Events"
msgstr ""
@ -960,7 +960,7 @@ msgid "Language"
msgstr ""
#: Zotlabs/Lib/Apps.php:344 Zotlabs/Lib/AccessList.php:367
#: Zotlabs/Widget/Activity_filter.php:156 include/nav.php:98
#: Zotlabs/Widget/Activity_filter.php:172 include/nav.php:98
msgid "Lists"
msgstr ""
@ -1391,7 +1391,7 @@ msgstr ""
msgid "Select an alternate language"
msgstr ""
#: Zotlabs/Lib/Connect.php:48 Zotlabs/Lib/Connect.php:144
#: Zotlabs/Lib/Connect.php:48 Zotlabs/Lib/Connect.php:169
msgid "Channel is blocked on this site."
msgstr ""
@ -1399,23 +1399,23 @@ msgstr ""
msgid "Channel location missing."
msgstr ""
#: Zotlabs/Lib/Connect.php:105
#: Zotlabs/Lib/Connect.php:130
msgid "Remote channel or protocol unavailable."
msgstr ""
#: Zotlabs/Lib/Connect.php:138
#: Zotlabs/Lib/Connect.php:163
msgid "Channel discovery failed."
msgstr ""
#: Zotlabs/Lib/Connect.php:153
#: Zotlabs/Lib/Connect.php:178
msgid "Protocol not supported"
msgstr ""
#: Zotlabs/Lib/Connect.php:166
#: Zotlabs/Lib/Connect.php:191
msgid "Cannot connect to yourself."
msgstr ""
#: Zotlabs/Lib/Connect.php:244
#: Zotlabs/Lib/Connect.php:269
msgid "error saving data"
msgstr ""
@ -2054,7 +2054,7 @@ msgstr ""
#: Zotlabs/Module/Settings/Oauth.php:90 Zotlabs/Module/Settings/Oauth.php:116
#: Zotlabs/Module/Settings/Oauth2.php:107
#: Zotlabs/Module/Settings/Oauth2.php:136 Zotlabs/Module/Sharedwithme.php:109
#: Zotlabs/Storage/Browser.php:310 Zotlabs/Widget/Activity_filter.php:277
#: Zotlabs/Storage/Browser.php:310 Zotlabs/Widget/Activity_filter.php:293
msgid "Name"
msgstr ""
@ -2852,7 +2852,7 @@ msgstr ""
msgid "Site settings updated."
msgstr ""
#: Zotlabs/Module/Admin/Site.php:192 include/text.php:3383
#: Zotlabs/Module/Admin/Site.php:192 include/text.php:3390
#: view/theme/redbasic/php/config.php:15
msgid "Default"
msgstr ""
@ -5094,7 +5094,6 @@ msgid ""
msgstr ""
#: Zotlabs/Module/Register.php:277 Zotlabs/Module/New_channel.php:185
#: Zotlabs/Module/Settings/Channel.php:638
msgid "Channel role and privacy"
msgstr ""
@ -7406,12 +7405,12 @@ msgstr ""
msgid "Ask me"
msgstr ""
#: Zotlabs/Module/Stream.php:126 Zotlabs/Widget/Activity_filter.php:131
#: Zotlabs/Module/Stream.php:126 Zotlabs/Widget/Activity_filter.php:147
#: include/network.php:1603
msgid "Nomad"
msgstr ""
#: Zotlabs/Module/Stream.php:130 Zotlabs/Widget/Activity_filter.php:134
#: Zotlabs/Module/Stream.php:130 Zotlabs/Widget/Activity_filter.php:150
#: include/network.php:1599
msgid "ActivityPub"
msgstr ""
@ -8277,6 +8276,10 @@ msgstr ""
msgid "Profile to assign new connections"
msgstr ""
#: Zotlabs/Module/Settings/Channel.php:638
msgid "Channel type and privacy"
msgstr ""
#: Zotlabs/Module/Settings/Channel.php:639
msgid "Default Permissions Group"
msgstr ""
@ -9446,6 +9449,116 @@ msgstr ""
msgid "Client apps"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:34
msgid "Direct Messages"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:38
msgid "Show direct (private) messages"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:48
msgid "Personal Posts"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:52
msgid "Show posts that mention or involve me"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:61
msgid "Saved Posts"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:65
msgid "Show posts that I have saved"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:79
msgid "Show drafts that I have saved"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:89
msgid "Videos"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:93
msgid "Show posts that include videos"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:107
msgid "Show posts that include events"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:111
msgid "Polls"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:115
msgid "Show posts that include polls"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:136
#: Zotlabs/Widget/Activity_filter.php:166
#, php-format
msgid "Show posts related to the %s access list"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:176
msgid "Show my access lists"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:194
msgid "Show posts to this group"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:196
msgid "New post"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:203 Zotlabs/Widget/Notifications.php:105
#: Zotlabs/Widget/Notifications.php:106 Zotlabs/Widget/Groups.php:108
msgid "Groups"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:207
msgid "Show groups"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:229
#, php-format
msgid "Show posts that I have filed to %s"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:235 Zotlabs/Widget/Filer.php:28
#: include/features.php:492
msgid "Saved Folders"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:239
msgid "Show filed post categories"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:259
#, php-format
msgid "Show posts with hashtag %s"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:265
msgid "Followed Hashtags"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:269
msgid "Show followed hashtags"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:307
msgid "Remove active filter"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:323
msgid "Stream Filters"
msgstr ""
#: Zotlabs/Widget/Hq_controls.php:14
msgid "HQ Control Panel"
msgstr ""
@ -9618,11 +9731,6 @@ msgstr ""
msgid "Mark all notices seen"
msgstr ""
#: Zotlabs/Widget/Notifications.php:105 Zotlabs/Widget/Notifications.php:106
#: Zotlabs/Widget/Activity_filter.php:187 Zotlabs/Widget/Groups.php:108
msgid "Groups"
msgstr ""
#: Zotlabs/Widget/Notifications.php:118
msgid "New Registrations"
msgstr ""
@ -9659,107 +9767,6 @@ msgstr ""
msgid "See more..."
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:33
msgid "Direct Messages"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:37
msgid "Show direct (private) messages"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:47
msgid "Personal Posts"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:51
msgid "Show posts that mention or involve me"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:60
msgid "Saved Posts"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:64
msgid "Show posts that I have saved"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:73
msgid "Videos"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:77
msgid "Show posts that include videos"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:91
msgid "Show posts that include events"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:95
msgid "Polls"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:99
msgid "Show posts that include polls"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:120
#: Zotlabs/Widget/Activity_filter.php:150
#, php-format
msgid "Show posts related to the %s access list"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:160
msgid "Show my access lists"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:178
msgid "Show posts to this group"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:180
msgid "New post"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:191
msgid "Show groups"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:213
#, php-format
msgid "Show posts that I have filed to %s"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:219 Zotlabs/Widget/Filer.php:28
#: include/features.php:492
msgid "Saved Folders"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:223
msgid "Show filed post categories"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:243
#, php-format
msgid "Show posts with hashtag %s"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:249
msgid "Followed Hashtags"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:253
msgid "Show followed hashtags"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:291
msgid "Remove active filter"
msgstr ""
#: Zotlabs/Widget/Activity_filter.php:307
msgid "Stream Filters"
msgstr ""
#: Zotlabs/Widget/Activity.php:58
msgctxt "widget"
msgid "Activity"