aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-11-05 09:50:55 +0000
committerMario <mario@mariovavti.com>2022-11-05 09:50:55 +0000
commit7fc9c83986d0ca0707c408b77f2acfb954532c42 (patch)
treef65e899b792ef86f99539b06232e5baf2fe80714 /Zotlabs
parent81b02d04b5c486ed5b23467b25e1441ed6d37da9 (diff)
parent5502f1cc63d87bed8198d360ae0e8e7c5fa58f44 (diff)
downloadvolse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.tar.gz
volse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.tar.bz2
volse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.zip
Merge branch 'dev'
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Notifier.php3
-rw-r--r--Zotlabs/Lib/Activity.php20
-rw-r--r--Zotlabs/Lib/Connect.php6
-rw-r--r--Zotlabs/Lib/Enotify.php2
-rw-r--r--Zotlabs/Lib/Libsync.php8
-rw-r--r--Zotlabs/Lib/Libzot.php56
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--Zotlabs/Module/Acl.php2
-rw-r--r--Zotlabs/Module/Channel.php8
-rw-r--r--Zotlabs/Module/Connections.php2
-rw-r--r--Zotlabs/Module/Display.php95
-rw-r--r--Zotlabs/Module/Dreport.php6
-rw-r--r--Zotlabs/Module/Fhublocs.php29
-rw-r--r--Zotlabs/Module/Oep.php36
-rw-r--r--Zotlabs/Module/Pconfig.php3
-rw-r--r--Zotlabs/Module/Register.php2
-rw-r--r--Zotlabs/Module/Update.php8
-rw-r--r--Zotlabs/Widget/Messages.php2
-rw-r--r--Zotlabs/Zot6/Zot6Handler.php5
19 files changed, 156 insertions, 143 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index f9e1d13d5..bfccb4099 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -657,7 +657,8 @@ class Notifier {
$hash = new_uuid();
- $env = (($hub_env && $hub_env[$hub['hubloc_site_id']]) ? $hub_env[$hub['hubloc_site_id']] : '');
+ $env = $hub_env[$hub['hubloc_site_id']] ?? '';
+
if ((self::$private) && (!$env)) {
continue;
}
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 1a34fdae6..963a8ff75 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1702,9 +1702,8 @@ class Activity {
);
// update existing xchan record
- q("update xchan set xchan_name = '%s', xchan_guid = '%s', xchan_pubkey = '%s', xchan_addr = '%s', xchan_network = 'activitypub', xchan_name_date = '%s' where xchan_hash = '%s'",
+ q("update xchan set xchan_name = '%s', xchan_pubkey = '%s', xchan_addr = '%s', xchan_network = 'activitypub', xchan_name_date = '%s' where xchan_hash = '%s'",
dbesc(escape_tags($name)),
- dbesc($url),
dbesc(escape_tags($pubkey)),
dbesc(escape_tags($webfinger_addr)),
dbescdate(datetime_convert()),
@@ -1712,8 +1711,7 @@ class Activity {
);
// update existing hubloc record
- q("update hubloc set hubloc_guid = '%s', hubloc_addr = '%s', hubloc_network = 'activitypub', hubloc_url = '%s', hubloc_host = '%s', hubloc_callback = '%s', hubloc_updated = '%s', hubloc_id_url = '%s' where hubloc_hash = '%s'",
- dbesc($url),
+ q("update hubloc set hubloc_addr = '%s', hubloc_network = 'activitypub', hubloc_url = '%s', hubloc_host = '%s', hubloc_callback = '%s', hubloc_updated = '%s', hubloc_id_url = '%s' where hubloc_hash = '%s'",
dbesc(escape_tags($webfinger_addr)),
dbesc($baseurl),
dbesc($hostname),
@@ -2208,6 +2206,8 @@ class Activity {
$s['owner_xchan'] = $act->actor['id'];
$s['author_xchan'] = $act->actor['id'];
+ $content = [];
+
if (is_array($act->obj)) {
$content = self::get_content($act->obj);
}
@@ -2280,10 +2280,10 @@ class Activity {
$mention = self::get_actor_bbmention($obj_actor['id']);
if ($act->type === 'Like') {
- $content['content'] = sprintf(t('Likes %1$s\'s %2$s'), $mention, $act->obj['type']) . "\n\n" . $content['content'];
+ $content['content'] = sprintf(t('Likes %1$s\'s %2$s'), $mention, $act->obj['type']) . "\n\n" . $content['content'] ?? '';
}
if ($act->type === 'Dislike') {
- $content['content'] = sprintf(t('Doesn\'t like %1$s\'s %2$s'), $mention, $act->obj['type']) . "\n\n" . $content['content'];
+ $content['content'] = sprintf(t('Doesn\'t like %1$s\'s %2$s'), $mention, $act->obj['type']) . "\n\n" . $content['content'] ?? '';
}
// handle event RSVPs
@@ -2791,11 +2791,7 @@ class Activity {
call_hooks('decode_note', $hookinfo);
- $s = $hookinfo['s'];
-
-
-
- return $s;
+ return $hookinfo['s'];
}
@@ -3823,7 +3819,7 @@ class Activity {
}
if (array_path_exists('source/mediaType', $act) && array_path_exists('source/content', $act)) {
- if ($act['source']['mediaType'] === 'text/bbcode') {
+ if (in_array($act['source']['mediaType'], ['text/bbcode', 'text/x-multicode'])) {
$content['bbcode'] = purify_html($act['source']['content']);
}
}
diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php
index 6f10bbbae..4570627fc 100644
--- a/Zotlabs/Lib/Connect.php
+++ b/Zotlabs/Lib/Connect.php
@@ -69,7 +69,7 @@ class Connect {
$xchan_hash = '';
$sql_options = (($protocol) ? " and xchan_network = '" . dbesc($protocol) . "' " : '');
- $r = q("select * from xchan where ( xchan_hash = '%s' or xchan_url = '%s' or xchan_addr = '%s') $sql_options ",
+ $r = q("SELECT * FROM xchan LEFT JOIN hubloc ON xchan_hash = hubloc_hash WHERE ( xchan_hash = '%s' or xchan_url = '%s' or xchan_addr = '%s') $sql_options ORDER BY hubloc_id DESC",
dbesc($url),
dbesc($url),
dbesc($url)
@@ -80,7 +80,7 @@ class Connect {
// reset results to the best record or the first if we don't have the best
// note: this is a single record and not an array of results
- $r = Libzot::zot_record_preferred($r,'xchan_network');
+ $r = Libzot::zot_record_preferred($r, 'xchan_network');
}
@@ -120,7 +120,7 @@ class Connect {
// convert to a single record (once again preferring a zot solution in the case of multiples)
if ($r) {
- $r = Libzot::zot_record_preferred($r,'xchan_network');
+ $r = Libzot::zot_record_preferred($r, 'xchan_network');
}
}
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 67efe5e9d..2015b260d 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -869,7 +869,7 @@ class Enotify {
$x = array(
'notify_link' => $item['llink'],
'name' => $item[$who]['xchan_name'],
- 'addr' => (($item[$who]['xchan_addr']) ? $item[$who]['xchan_addr'] : $item[$who]['xchan_url']),
+ 'addr' => $item[$who]['xchan_addr'] ?? $item[$who]['xchan_url'],
'url' => $item[$who]['xchan_url'],
'photo' => $item[$who]['xchan_photo_s'],
'when' => (($edit) ? datetime_convert('UTC', date_default_timezone_get(), $item['edited']) : datetime_convert('UTC', date_default_timezone_get(), $item['created'])),
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 914969d97..9851ce52a 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -202,6 +202,8 @@ class Libsync {
$channel = $r[0];
+ $mid = 'sync';
+
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
$max_friends = service_class_fetch($channel['channel_id'], 'total_channels');
@@ -293,8 +295,10 @@ class Libsync {
if (array_key_exists('event_item', $arr) && $arr['event_item'])
sync_items($channel, $arr['event_item'], ((array_key_exists('relocate', $arr)) ? $arr['relocate'] : null));
- if (array_key_exists('item', $arr) && $arr['item'])
+ if (array_key_exists('item', $arr) && $arr['item']) {
sync_items($channel, $arr['item'], ((array_key_exists('relocate', $arr)) ? $arr['relocate'] : null));
+ $mid = $arr['item']['mid'] . '#sync';
+ }
// deprecated, maintaining for a few months for upward compatibility
// this should sync webpages, but the logic is a bit subtle
@@ -740,7 +744,7 @@ class Libsync {
*/
call_hooks('process_channel_sync_delivery', $addon);
- $DR = new DReport(z_root(), $d, $d, 'sync', 'channel sync delivered');
+ $DR = new DReport(z_root(), $d, $d, $mid, 'channel sync processed');
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index cbb614429..b0d33e055 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1172,10 +1172,14 @@ class Libzot {
return;
}
if (is_array($AS->obj)) {
- $arr = Activity::decode_note($AS);
+ $item = Activity::decode_note($AS);
+ if (!$item) {
+ logger('Could not decode activity: ' . print_r($AS, true));
+ return;
+ }
}
else {
- $arr = [];
+ $item = [];
}
logger($AS->debug(), LOGGER_DATA);
@@ -1260,15 +1264,15 @@ class Libzot {
if ($r) {
$r = self::zot_record_preferred($r);
- $arr['author_xchan'] = $r['hubloc_hash'];
+ $item['author_xchan'] = $r['hubloc_hash'];
}
- if (! $arr['author_xchan']) {
+ if (! $item['author_xchan']) {
logger('No author!');
return;
}
- $arr['owner_xchan'] = $env['sender'];
+ $item['owner_xchan'] = $env['sender'];
if(filter_var($env['sender'], FILTER_VALIDATE_URL)) {
// in individual delivery, change owner if needed
@@ -1277,67 +1281,67 @@ class Libzot {
);
if ($s) {
- $arr['owner_xchan'] = $s[0]['hubloc_hash'];
+ $item['owner_xchan'] = $s[0]['hubloc_hash'];
}
}
- if (! $arr['owner_xchan']) {
+ if (! $item['owner_xchan']) {
logger('No owner!');
return;
}
- if ($private && (!intval($arr['item_private']))) {
- $arr['item_private'] = 1;
+ if ($private && (!intval($item['item_private']))) {
+ $item['item_private'] = 1;
}
- if ($arr['mid'] === $arr['parent_mid']) {
+ if ($item['mid'] === $item['parent_mid']) {
if (is_array($AS->obj) && array_key_exists('commentPolicy', $AS->obj)) {
$p = strstr($AS->obj['commentPolicy'], 'until=');
if ($p !== false) {
$comments_closed_at = datetime_convert('UTC', 'UTC', substr($p, 6));
- if ($comments_closed_at === $arr['created']) {
- $arr['item_nocomment'] = 1;
+ if ($comments_closed_at === $item['created']) {
+ $item['item_nocomment'] = 1;
}
else {
- $arr['comments_closed'] = $comments_closed_at;
- $arr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy']));
+ $item['comments_closed'] = $comments_closed_at;
+ $aritemr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy']));
}
}
else {
- $arr['comment_policy'] = $AS->obj['commentPolicy'];
+ $item['comment_policy'] = $AS->obj['commentPolicy'];
}
}
}
if (isset($AS->meta['hubloc']) && $AS->meta['hubloc']) {
- $arr['item_verified'] = true;
+ $item['item_verified'] = true;
}
- if (!array_key_exists('comment_policy', $arr)) {
- $arr['comment_policy'] = 'authenticated';
+ if (!array_key_exists('comment_policy', $item)) {
+ $item['comment_policy'] = 'authenticated';
}
if (isset($AS->meta['signed_data']) && $AS->meta['signed_data']) {
- IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false);
+ IConfig::Set($item, 'activitypub', 'signed_data', $AS->meta['signed_data'], false);
}
- logger('Activity received: ' . print_r($arr, true), LOGGER_DATA, LOG_DEBUG);
+ logger('Activity received: ' . print_r($item, true), LOGGER_DATA, LOG_DEBUG);
logger('Activity recipients: ' . print_r($deliveries, true), LOGGER_DATA, LOG_DEBUG);
$relay = (($env['type'] === 'response') ? true : false);
- $result = self::process_delivery($env['sender'], $AS, $arr, $deliveries, $relay, false, $message_request);
+ $result = self::process_delivery($env['sender'], $AS, $item, $deliveries, $relay, false, $message_request);
}
elseif ($env['type'] === 'sync') {
- // $arr = get_channelsync_elements($data);
+ // $item = get_channelsync_elements($data);
- $arr = json_decode($data, true);
+ $item = json_decode($data, true);
- logger('Channel sync received: ' . print_r($arr, true), LOGGER_DATA, LOG_DEBUG);
+ logger('Channel sync received: ' . print_r($item, true), LOGGER_DATA, LOG_DEBUG);
logger('Channel sync recipients: ' . print_r($deliveries, true), LOGGER_DATA, LOG_DEBUG);
if ($env['encoding'] === 'hz') {
- $result = Libsync::process_channel_sync_delivery($env['sender'], $arr, $deliveries);
+ $result = Libsync::process_channel_sync_delivery($env['sender'], $item, $deliveries);
}
else {
logger('sync packet type not supported.');
@@ -1920,7 +1924,7 @@ class Libzot {
// preserve conversations with which you are involved from expiration
- $stored = (($item_result && $item_result['item']) ? $item_result['item'] : false);
+ $stored = ((isset($item_result['item'])) ? $item_result['item'] : false);
if ((is_array($stored)) && ($stored['id'] != $stored['parent'])
&& ($stored['author_xchan'] === $channel['channel_hash'])) {
retain_item($stored['item']['parent']);
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 472e2c6db..6ca952969 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -84,10 +84,8 @@ class ThreadItem {
public function get_template_data($conv_responses, $thread_level=1, $conv_flags = []) {
- $result = array();
-
- $item = $this->get_data();
-
+ $result = [];
+ $item = $this->get_data();
$commentww = '';
$sparkle = '';
$buttons = '';
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index f8c6232c5..bcd79c873 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -304,7 +304,7 @@ class Acl extends \Zotlabs\Web\Controller {
}
elseif($type == 'a') {
- $r = q("SELECT abook_id as id, xchan_name as name, xchan_network as net, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
+ $r = q("SELECT abook_id as id, xchan_name as name, xchan_network as net, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url, xchan_addr as attag, abook_their_perms, abook_self FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and xchan_deleted = 0
$sql_extra3
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 0874551d6..d3d72ca10 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -31,8 +31,10 @@ class Channel extends Controller {
goaway(z_root() . '/search?f=&search=' . $_GET['search']);
$which = null;
- if (argc() > 1)
+ if (argc() > 1) {
$which = argv(1);
+ }
+
if (!$which) {
if (local_channel()) {
$channel = App::get_channel();
@@ -40,9 +42,9 @@ class Channel extends Controller {
$which = $channel['channel_address'];
}
}
+
if (!$which) {
- notice(t('You must be logged in to see this page.') . EOL);
- return;
+ http_status_exit(404, 'Not found');
}
$profile = 0;
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index 0101bf8a8..ea30b9b9e 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -357,7 +357,7 @@ class Connections extends \Zotlabs\Web\Controller {
'oneway' => $oneway,
'perminfo' => $perminfo,
'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''),
- 'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0',
+ 'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=1',
'connect_hover' => t('Connect at this location'),
'role' => $roles_dict[$rr['abook_role']] ?? '',
'pending' => intval($rr['abook_pending'])
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 4e7c1587c..0aac96f4a 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -90,6 +90,7 @@ class Display extends \Zotlabs\Web\Controller {
);
$o .= '<div id="jot-popup">';
+ $a = '';
$o .= status_editor($a,$x,false,'Display');
$o .= '</div>';
}
@@ -307,71 +308,71 @@ class Display extends \Zotlabs\Web\Controller {
$items = array();
}
-
switch($module_format) {
- case 'html':
+ case 'html':
- if ($update) {
- $o .= conversation($items, 'display', $update, 'client');
- }
- else {
- $o .= '<noscript>';
- if($noscript_content) {
- $o .= conversation($items, 'display', $update, 'traditional');
+ if ($update) {
+ $o .= conversation($items, 'display', $update, 'client');
}
else {
- $o .= '<div class="section-content-warning-wrapper">' . t('You must enable javascript for your browser to be able to view this content.') . '</div>';
+ $o .= '<noscript>';
+ if($noscript_content) {
+ $o .= conversation($items, 'display', $update, 'traditional');
+ }
+ else {
+ $o .= '<div class="section-content-warning-wrapper">' . t('You must enable javascript for your browser to be able to view this content.') . '</div>';
+ }
+ $o .= '</noscript>';
+
+ if (isset($items[0]['title'])) {
+ App::$page['title'] = $items[0]['title'] . ' - ' . App::$page['title'];
+ }
+
+ $o .= conversation($items, 'display', $update, 'client');
}
- $o .= '</noscript>';
- App::$page['title'] = (($items[0]['title']) ? $items[0]['title'] . " - " . App::$page['title'] : App::$page['title']);
+ break;
- $o .= conversation($items, 'display', $update, 'client');
- }
+ case 'atom':
- break;
+ $atom = replace_macros(get_markup_template('atom_feed.tpl'), array(
+ '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()),
+ '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()),
+ '$generator_uri' => 'https://hubzilla.org',
+ '$feed_id' => xmlify(App::$cmd),
+ '$feed_title' => xmlify(t('Article')),
+ '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)),
+ '$author' => '',
+ '$owner' => '',
+ '$profile_page' => xmlify(z_root() . '/display/' . gen_link_id($target_item['mid'])),
+ ));
- case 'atom':
+ $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ];
+ call_hooks('atom_feed_top',$x);
- $atom = replace_macros(get_markup_template('atom_feed.tpl'), array(
- '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()),
- '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()),
- '$generator_uri' => 'https://hubzilla.org',
- '$feed_id' => xmlify(App::$cmd),
- '$feed_title' => xmlify(t('Article')),
- '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)),
- '$author' => '',
- '$owner' => '',
- '$profile_page' => xmlify(z_root() . '/display/' . gen_link_id($target_item['mid'])),
- ));
+ $atom = $x['xml'];
- $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ];
- call_hooks('atom_feed_top',$x);
+ // a much simpler interface
+ call_hooks('atom_feed', $atom);
- $atom = $x['xml'];
- // a much simpler interface
- call_hooks('atom_feed', $atom);
-
-
- if($items) {
- $type = 'html';
- foreach($items as $item) {
- if($item['item_private'])
- continue;
- $atom .= atom_entry($item, $type, null, '', true, '', false);
+ if($items) {
+ $type = 'html';
+ foreach($items as $item) {
+ if($item['item_private'])
+ continue;
+ $atom .= atom_entry($item, $type, null, '', true, '', false);
+ }
}
- }
-
- call_hooks('atom_feed_end', $atom);
- $atom .= '</feed>' . "\r\n";
+ call_hooks('atom_feed_end', $atom);
- header('Content-type: application/atom+xml');
- echo $atom;
- killme();
+ $atom .= '</feed>' . "\r\n";
+ header('Content-type: application/atom+xml');
+ echo $atom;
+ killme();
}
$o .= '<div id="content-complete"></div>';
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index 759e1acb4..f5ad80eef 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -56,10 +56,12 @@ class Dreport extends \Zotlabs\Web\Controller {
return;
}
- $r = q("select * from dreport where dreport_xchan = '%s' and (dreport_mid = '%s' or dreport_mid = '%s')",
+ $r = q("select * from dreport where dreport_xchan = '%s' and (dreport_mid = '%s' or dreport_mid = '%s' or dreport_mid = '%s' or dreport_mid = '%s')",
dbesc($channel['channel_hash']),
dbesc($mid),
- dbesc(str_replace('/item/', '/activity/', $mid))
+ dbesc($mid . '#sync'),
+ dbesc(str_replace('/item/', '/activity/', $mid)),
+ dbesc(str_replace('/item/', '/activity/', $mid) . '#sync')
);
if(! $r) {
diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php
index df847c835..a4d335a94 100644
--- a/Zotlabs/Module/Fhublocs.php
+++ b/Zotlabs/Module/Fhublocs.php
@@ -60,20 +60,21 @@ class Fhublocs extends \Zotlabs\Web\Controller {
$h = hubloc_store_lowlevel(
[
- 'hubloc_guid' => $rr['channel_guid'],
- 'hubloc_guid_sig' => $rr['channel_guid_sig'],
- 'hubloc_hash' => $rr['channel_hash'],
- 'hubloc_id_url' => channel_url($rr),
- 'hubloc_addr' => channel_reddress($rr),
- 'hubloc_primary' => intval($primary),
- 'hubloc_url' => z_root(),
- 'hubloc_url_sig' => Libzot::sign(z_root(), $rr['channel_prvkey']),
- 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), $sitekey),
- 'hubloc_host' => \App::get_hostname(),
- 'hubloc_callback' => z_root() . '/zot',
- 'hubloc_sitekey' => $sitekey,
- 'hubloc_network' => 'zot6',
- 'hubloc_updated' => datetime_convert()
+ 'hubloc_guid' => $rr['channel_guid'],
+ 'hubloc_guid_sig' => $rr['channel_guid_sig'],
+ 'hubloc_hash' => $rr['channel_hash'],
+ 'hubloc_id_url' => channel_url($rr),
+ 'hubloc_addr' => channel_reddress($rr),
+ 'hubloc_primary' => intval($primary),
+ 'hubloc_url' => z_root(),
+ 'hubloc_url_sig' => Libzot::sign(z_root(), $rr['channel_prvkey']),
+ 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), $sitekey),
+ 'hubloc_host' => \App::get_hostname(),
+ 'hubloc_callback' => z_root() . '/zot',
+ 'hubloc_sitekey' => $sitekey,
+ 'hubloc_network' => 'zot6',
+ 'hubloc_updated' => datetime_convert(),
+ 'hubloc_connected' => datetime_convert()
]
);
diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php
index 8e048a487..d3ef05e16 100644
--- a/Zotlabs/Module/Oep.php
+++ b/Zotlabs/Module/Oep.php
@@ -15,7 +15,7 @@ class Oep extends \Zotlabs\Web\Controller {
logger('oep: ' . print_r($_REQUEST,true), LOGGER_DEBUG, LOG_INFO);
$html = ((argc() > 1 && argv(1) === 'html') ? true : false);
- if($_REQUEST['url']) {
+ if(isset($_REQUEST['url'])) {
$_REQUEST['url'] = strip_zids($_REQUEST['url']);
$url = $_REQUEST['url'];
}
@@ -23,9 +23,9 @@ class Oep extends \Zotlabs\Web\Controller {
if(! $url)
http_status_exit(404, 'Not found');
- $maxwidth = $_REQUEST['maxwidth'];
- $maxheight = $_REQUEST['maxheight'];
- $format = $_REQUEST['format'];
+ $maxwidth = $_REQUEST['maxwidth'] ?? 0;
+ $maxheight = $_REQUEST['maxheight'] ?? 0;
+ $format = $_REQUEST['format'] ?? '';
if($format && $format !== 'json')
http_status_exit(501, 'Not implemented');
@@ -70,8 +70,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = array();
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('#//(.*?)/display/(.*?)(&|\?|$)#',$url,$matches)) {
$res = $matches[2];
@@ -159,8 +159,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = [];
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('#//(.*?)/cards/(.*?)/(.*?)(&|\?|$)#',$url,$matches)) {
$nick = $matches[2];
@@ -246,8 +246,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = [];
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('#//(.*?)/articles/(.*?)/(.*?)(&|\?|$)#',$url,$matches)) {
$nick = $matches[2];
@@ -333,8 +333,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = array();
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('#//(.*?)/(.*?)/(.*?)/(.*?)mid\=(.*?)(&|$)#',$url,$matches)) {
$chn = $matches[3];
@@ -454,8 +454,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = array();
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('|//(.*?)/(.*?)/(.*?)/album/|',$url,$matches)) {
$chn = $matches[3];
@@ -519,8 +519,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = array();
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('|//(.*?)/(.*?)/(.*?)$|',$url,$matches)) {
$chn = $matches[3];
@@ -582,8 +582,8 @@ class Oep extends \Zotlabs\Web\Controller {
$ret = array();
$url = $args['url'];
- $maxwidth = intval($args['maxwidth']);
- $maxheight = intval($args['maxheight']);
+ $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0);
+ $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0);
if(preg_match('|//(.*?)/(.*?)/(.*?)/image/|',$url,$matches)) {
$chn = $matches[3];
diff --git a/Zotlabs/Module/Pconfig.php b/Zotlabs/Module/Pconfig.php
index 8a71ab974..106254050 100644
--- a/Zotlabs/Module/Pconfig.php
+++ b/Zotlabs/Module/Pconfig.php
@@ -13,8 +13,9 @@ class Pconfig extends \Zotlabs\Web\Controller {
return;
- if($_SESSION['delegate'])
+ if(isset($_SESSION['delegate'])) {
return;
+ }
check_form_security_token_redirectOnErr('/pconfig', 'pconfig');
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index 0d423e0cd..5a50b4de0 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -26,7 +26,7 @@ class Register extends Controller {
// created a channel, we'll try to revive the connection request
// and process it.
- if($_REQUEST['connect'])
+ if(isset($_REQUEST['connect']))
$_SESSION['connect'] = $_REQUEST['connect'];
switch($cmd) {
diff --git a/Zotlabs/Module/Update.php b/Zotlabs/Module/Update.php
index b3252f8b9..7a8db3469 100644
--- a/Zotlabs/Module/Update.php
+++ b/Zotlabs/Module/Update.php
@@ -5,8 +5,8 @@ namespace Zotlabs\Module;
class Update extends \Zotlabs\Web\Controller {
function get() {
-
- $profile_uid = intval($_GET['p']);
+
+ $profile_uid = $_GET['p'] ?? 0;
// it's probably safe to do this for all modules and not just a limited subset,
// but it needs to be verified.
@@ -23,7 +23,7 @@ class Update extends \Zotlabs\Web\Controller {
if(in_array(strtolower(argv(1)),['articles','cards']))
killme();
- $module = "\\Zotlabs\\Module\\" . ucfirst(argv(1));
+ $module = "\\Zotlabs\\Module\\" . ucfirst(argv(1));
$load = (((argc() > 2) && (argv(2) == 'load')) ? 1 : 0);
$mod = new $module;
@@ -38,6 +38,6 @@ class Update extends \Zotlabs\Web\Controller {
echo "</section></body></html>\r\n";
killme();
-
+
}
}
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 267467bb0..38c822502 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -148,7 +148,7 @@ class Messages {
}
$entries[$i]['author_name'] = $item['author']['xchan_name'];
- $entries[$i]['author_addr'] = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']);
+ $entries[$i]['author_addr'] = $item['author']['xchan_addr'] ?? $item['author']['xchan_url'];
$entries[$i]['info'] = $info;
$entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']);
$entries[$i]['summary'] = $summary;
diff --git a/Zotlabs/Zot6/Zot6Handler.php b/Zotlabs/Zot6/Zot6Handler.php
index 4dc410f52..053901205 100644
--- a/Zotlabs/Zot6/Zot6Handler.php
+++ b/Zotlabs/Zot6/Zot6Handler.php
@@ -71,7 +71,10 @@ class Zot6Handler implements IHandler {
where xchan_hash ='%s' limit 1",
dbesc($recip)
);
- $x = Libzot::refresh([ 'hubloc_id_url' => $hub['hubloc_id_url']], $r[0], $force);
+
+ if ($r) {
+ $x = Libzot::refresh([ 'hubloc_id_url' => $hub['hubloc_id_url']], $r[0], $force);
+ }
}
}
else {