aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-08-16 19:32:08 +0200
committerMario <mario@mariovavti.com>2019-08-16 19:32:08 +0200
commitea8621d6ece810479adc0cd785212d66cbe01d23 (patch)
tree32350070ec5601282afe4411486c629ce14e1a2e /Zotlabs
parentb325b2c003ae73c8c9869d35b15444fe9a17fd74 (diff)
parentac05a2ede7023495618b316635b93274416b69d8 (diff)
downloadvolse-hubzilla-ea8621d6ece810479adc0cd785212d66cbe01d23.tar.gz
volse-hubzilla-ea8621d6ece810479adc0cd785212d66cbe01d23.tar.bz2
volse-hubzilla-ea8621d6ece810479adc0cd785212d66cbe01d23.zip
Merge branch 'dev' into 'dev'
zot6 compatibility: when posting from a non-primary clone the actor->id is... See merge request hubzilla/core!1710
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php37
-rw-r--r--Zotlabs/Module/Admin/Addons.php31
-rw-r--r--Zotlabs/Module/Cloud.php7
-rw-r--r--Zotlabs/Module/Dav.php2
-rw-r--r--Zotlabs/Storage/Directory.php9
5 files changed, 60 insertions, 26 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index f86dc1604..0757eec37 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -63,12 +63,31 @@ class Activity {
}
else {
$m = parse_url($url);
+
+ // handle bearcaps
+ if ($m['scheme'] === 'bear') {
+ $params = explode('&',$m['query']);
+ if ($params) {
+ foreach ($params as $p) {
+ if (substr($p,0,2) === 'u=') {
+ $url = substr($p,2);
+ }
+ if (substr($p,0,2) === 't=') {
+ $token = substr($p,2);
+ }
+ }
+ }
+ }
+
$headers = [
'Accept' => 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'Host' => $m['host'],
'(request-target)' => 'get ' . get_request_string($url),
'Date' => datetime_convert('UTC','UTC','now','D, d M Y H:i:s') . ' UTC'
];
+ if (isset($token)) {
+ $headers['Authorization'] = 'Bearer ' . $token;
+ }
$h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),false);
$x = z_fetch_url($url, true, $redirects, [ 'headers' => $h ] );
}
@@ -668,8 +687,24 @@ class Activity {
}
$ret = [];
+ $c = ((array_key_exists('channel_id',$p)) ? $p : channelx_by_hash($p['xchan_hash']));
+
$ret['type'] = 'Person';
- $ret['id'] = $p['xchan_url'];
+
+ if ($c) {
+ $role = get_pconfig($c['channel_id'],'system','permissions_role');
+ if (strpos($role,'forum') !== false) {
+ $ret['type'] = 'Group';
+ }
+ }
+
+ if ($c) {
+ $ret['id'] = channel_url($c);
+ }
+ else {
+ $ret['id'] = ((strpos($p['xchan_hash'],'http') === 0) ? $p['xchan_hash'] : $p['xchan_url']);
+ }
+
if($p['xchan_addr'] && strpos($p['xchan_addr'],'@'))
$ret['preferredUsername'] = substr($p['xchan_addr'],0,strpos($p['xchan_addr'],'@'));
$ret['name'] = $p['xchan_name'];
diff --git a/Zotlabs/Module/Admin/Addons.php b/Zotlabs/Module/Admin/Addons.php
index b8e3e3a2e..243eb242f 100644
--- a/Zotlabs/Module/Admin/Addons.php
+++ b/Zotlabs/Module/Admin/Addons.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module\Admin;
+use App;
use \Zotlabs\Storage\GitRepo;
use \Michelf\MarkdownExtra;
@@ -253,14 +254,14 @@ class Addons {
* Single plugin
*/
- if (\App::$argc == 3){
- $plugin = \App::$argv[2];
+ if (App::$argc == 3){
+ $plugin = App::$argv[2];
if (!is_file("addon/$plugin/$plugin.php")){
notice( t("Item not found.") );
return '';
}
- $enabled = in_array($plugin,\App::$plugins);
+ $enabled = in_array($plugin,App::$plugins);
$info = get_plugin_info($plugin);
$x = check_plugin_versions($info);
@@ -268,11 +269,11 @@ class Addons {
if($enabled && ! $x) {
$enabled = false;
- $idz = array_search($plugin, \App::$plugins);
+ $idz = array_search($plugin, App::$plugins);
if ($idz !== false) {
- unset(\App::$plugins[$idz]);
+ unset(App::$plugins[$idz]);
uninstall_plugin($plugin);
- set_config("system","addon", implode(", ",\App::$plugins));
+ set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -281,19 +282,19 @@ class Addons {
check_form_security_token_redirectOnErr('/admin/addons', 'admin_addons', 't');
$pinstalled = false;
// Toggle plugin status
- $idx = array_search($plugin, \App::$plugins);
+ $idx = array_search($plugin, App::$plugins);
if ($idx !== false){
- unset(\App::$plugins[$idx]);
+ unset(App::$plugins[$idx]);
uninstall_plugin($plugin);
$pinstalled = false;
info( sprintf( t("Plugin %s disabled."), $plugin ) );
} else {
- \App::$plugins[] = $plugin;
+ App::$plugins[] = $plugin;
install_plugin($plugin);
$pinstalled = true;
info( sprintf( t("Plugin %s enabled."), $plugin ) );
}
- set_config("system","addon", implode(", ",\App::$plugins));
+ set_config("system","addon", implode(", ",App::$plugins));
if($pinstalled) {
@require_once("addon/$plugin/$plugin.php");
@@ -305,7 +306,7 @@ class Addons {
// display plugin details
- if (in_array($plugin, \App::$plugins)){
+ if (in_array($plugin, App::$plugins)){
$status = 'on';
$action = t('Disable');
} else {
@@ -380,18 +381,18 @@ class Addons {
list($tmp, $id) = array_map('trim', explode('/', $file));
$info = get_plugin_info($id);
- $enabled = in_array($id,\App::$plugins);
+ $enabled = in_array($id,App::$plugins);
$x = check_plugin_versions($info);
// disable plugins which are installed but incompatible versions
if($enabled && ! $x) {
$enabled = false;
- $idz = array_search($id, \App::$plugins);
+ $idz = array_search($id, App::$plugins);
if ($idz !== false) {
- unset(\App::$plugins[$idz]);
+ unset(App::$plugins[$idz]);
uninstall_plugin($id);
- set_config("system","addon", implode(", ",\App::$plugins));
+ set_config("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php
index 1b330ecba..f595e0fac 100644
--- a/Zotlabs/Module/Cloud.php
+++ b/Zotlabs/Module/Cloud.php
@@ -35,13 +35,6 @@ class Cloud extends \Zotlabs\Web\Controller {
if (argc() > 1)
$which = argv(1);
-
- if (argc() < 2 && intval(get_config('system','cloud_disable_siteroot'))) {
- notice( t('Permission denied.') . EOL);
- construct_page();
- killme();
- }
-
$profile = 0;
if ($which)
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php
index 866520461..e8ce6a703 100644
--- a/Zotlabs/Module/Dav.php
+++ b/Zotlabs/Module/Dav.php
@@ -95,6 +95,8 @@ class Dav extends \Zotlabs\Web\Controller {
$auth = new \Zotlabs\Storage\BasicAuth();
+ $auth->observer = get_observer_hash();
+
$auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . ' ' . 'WebDAV');
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index b30aecf92..ae36fc1c0 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -720,7 +720,11 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
* @return array Directory[]
*/
function ChannelList(&$auth) {
- $ret = array();
+ $ret = [];
+
+ if (intval(get_config('system','cloud_disable_siteroot'))) {
+ return $ret;
+ }
$r = q("SELECT channel_id, channel_address, profile.publish FROM channel left join profile on profile.uid = channel.channel_id WHERE channel_removed = 0 AND channel_system = 0 AND (channel_pageflags & %d) = 0",
intval(PAGE_HIDDEN)
@@ -730,8 +734,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
foreach ($r as $rr) {
if (perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage') && $rr['publish']) {
logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA);
- // @todo can't we drop '/cloud'? It gets stripped off anyway in RedDirectory
- $ret[] = new Directory('/cloud/' . $rr['channel_address'], $auth);
+ $ret[] = new Directory($rr['channel_address'], $auth);
}
}
}