From 71accb6b0a2aa5e3c77f7ef73d685639d0c6526a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Oct 2022 16:38:18 +0200 Subject: fix php warnings --- Zotlabs/Lib/Libzot.php | 11 +++++++++-- Zotlabs/Lib/ThreadItem.php | 5 +++-- Zotlabs/Module/Help.php | 9 +++++---- Zotlabs/Module/Pubstream.php | 20 +++++++++----------- Zotlabs/Module/Sslify.php | 18 +++++++++++------- Zotlabs/Widget/Helpindex.php | 2 +- Zotlabs/Zot6/Receiver.php | 1 + 7 files changed, 39 insertions(+), 27 deletions(-) diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index a19af98e3..01d403c09 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -473,7 +473,7 @@ class Libzot { unset($new_connection[0]['abook_account']); unset($new_connection[0]['abook_channel']); - $abconfig = load_abconfig($channel['channel_id'], $new_connection['abook_xchan']); + $abconfig = load_abconfig($channel['channel_id'], $new_connection[0]['abook_xchan']); if ($abconfig) { $new_connection['abconfig'] = $abconfig; @@ -1979,13 +1979,18 @@ class Libzot { logger('FOF Activity rejected: ' . print_r($activity, true)); continue; } - $arr = Activity::decode_note($AS); // logger($AS->debug()); + if(empty($AS->actor['id'])) { + logger('No actor id!'); + continue; + } + $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'", dbesc($AS->actor['id']) ); + $r = self::zot_record_preferred($r); if (!$r) { @@ -2010,6 +2015,8 @@ class Libzot { } } + $arr = Activity::decode_note($AS); + if ($r) { $arr['author_xchan'] = $r['hubloc_hash']; } diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 0343dc1e5..472e2c6db 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -240,6 +240,7 @@ class ThreadItem { } $like_button_label = tt('Like','Likes',$like_count,'noun'); + $showdislike = ''; if (feature_enabled($conv->get_profile_owner(),'dislike')) { $dislike_count = ((x($conv_responses['dislike'],$item['mid'])) ? $conv_responses['dislike'][$item['mid']] : ''); $dislike_list = ((x($conv_responses['dislike'],$item['mid'])) ? $conv_responses['dislike'][$item['mid'] . '-l'] : ''); @@ -250,11 +251,11 @@ class ThreadItem { } else { $dislike_list_part = ''; } + + $showdislike = ((x($conv_responses['dislike'],$item['mid'])) ? format_like($conv_responses['dislike'][$item['mid']],$conv_responses['dislike'][$item['mid'] . '-l'],'dislike',$item['mid']) : ''); } $showlike = ((x($conv_responses['like'],$item['mid'])) ? format_like($conv_responses['like'][$item['mid']],$conv_responses['like'][$item['mid'] . '-l'],'like',$item['mid']) : ''); - $showdislike = ((x($conv_responses['dislike'],$item['mid']) && feature_enabled($conv->get_profile_owner(),'dislike')) - ? format_like($conv_responses['dislike'][$item['mid']],$conv_responses['dislike'][$item['mid'] . '-l'],'dislike',$item['mid']) : ''); /* * We should avoid doing this all the time, but it depends on the conversation mode diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index ce05035b3..bfe1d4e12 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -17,7 +17,7 @@ class Help extends \Zotlabs\Web\Controller { function get() { nav_set_selected('Help'); - if($_REQUEST['search']) { + if(isset($_REQUEST['search']) && $_REQUEST['search']) { $o .= '
'; $o .= '
'; $o .= '

' . t('Documentation Search') . ' - ' . htmlspecialchars($_REQUEST['search']) . '

'; @@ -44,8 +44,8 @@ class Help extends \Zotlabs\Web\Controller { return $o; } - - + + if(argc() > 2 && argv(argc()-2) === 'assets') { $path = ''; for($x = 1; $x < argc(); $x ++) { @@ -87,11 +87,12 @@ class Help extends \Zotlabs\Web\Controller { 'tutorials' => t('Tutorials') ]; + $heading = ''; if(array_key_exists(argv(1), $headings)) $heading = $headings[argv(1)]; $content = get_help_content(); - + $language = determine_help_language()['language']; return replace_macros(get_markup_template('help.tpl'), array( diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 583974e22..1eb0e2142 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -75,7 +75,7 @@ class Pubstream extends \Zotlabs\Web\Controller { 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], - 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'), 'permissions' => $channel_acl, 'bang' => '', @@ -91,6 +91,7 @@ class Pubstream extends \Zotlabs\Web\Controller { ); $o .= '
'; + $a = ''; $o .= status_editor($a,$x,false,'Pubstream'); $o .= '
'; } @@ -181,14 +182,14 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); - $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; - $simple_update = ''; if($update && $_SESSION['loadtime']) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; //logger('update: ' . $update . ' load: ' . $load); + $items = []; + if($update) { $ordering = get_config('system', 'pubstream_ordering', 'commented'); @@ -200,18 +201,18 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query WHERE mid = '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2", + $sql_extra $net_query2", dbesc($mid) ); } else { // Fetch a page full of parent items for this page $r = dbq("SELECT item.id AS item_id FROM item - left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) + left join abook on ( item.author_xchan = abook.abook_xchan ) $net_query WHERE true $uids and item.item_thread_top = 1 $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2 + $sql_extra $net_query2 ORDER BY $ordering DESC $pager_sql " ); } @@ -223,7 +224,7 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query WHERE mid = '%s' $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2", + $sql_extra $net_query2", dbesc($mid) ); } @@ -234,7 +235,7 @@ class Pubstream extends \Zotlabs\Web\Controller { WHERE true $uids $item_normal_update $simple_update and (abook.abook_blocked = 0 or abook.abook_flags is null) - $sql_extra3 $sql_extra $sql_nets $net_query2" + $sql_extra $net_query2" ); } } @@ -259,9 +260,6 @@ class Pubstream extends \Zotlabs\Web\Controller { $items = fetch_post_tags($items,true); $items = conv_sort($items,$ordering); } - else { - $items = array(); - } } diff --git a/Zotlabs/Module/Sslify.php b/Zotlabs/Module/Sslify.php index 37be4423b..9dd5c4a0b 100644 --- a/Zotlabs/Module/Sslify.php +++ b/Zotlabs/Module/Sslify.php @@ -9,23 +9,27 @@ class Sslify extends \Zotlabs\Web\Controller { if($x['success']) { $h = explode("\n",$x['header']); foreach ($h as $l) { + if (strpos($l, ':') === false) { + continue; + } + list($k,$v) = array_map("trim", explode(":", trim($l), 2)); $hdrs[strtolower($k)] = $v; } - - if (array_key_exists('content-type', $hdrs)) + + if (array_key_exists('content-type', $hdrs)) header('Content-Type: ' . $hdrs['content-type']); - if (array_key_exists('last-modified', $hdrs)) + if (array_key_exists('last-modified', $hdrs)) header('Last-Modified: ' . $hdrs['last-modified']); - if (array_key_exists('cache-control', $hdrs)) + if (array_key_exists('cache-control', $hdrs)) header('Cache-Control: ' . $hdrs['cache-control']); - if (array_key_exists('expires', $hdrs)) + if (array_key_exists('expires', $hdrs)) header('Expires: ' . $hdrs['expires']); - + echo $x['body']; killme(); } killme(); - } + } } diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php index fbcd8c8b2..63e686d3a 100644 --- a/Zotlabs/Widget/Helpindex.php +++ b/Zotlabs/Widget/Helpindex.php @@ -13,7 +13,7 @@ class Helpindex { require_once('include/help.php'); - $o .= '
'; + $o = '
'; $level_0 = get_help_content('sitetoc'); if(! $level_0) { diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php index 964c61651..b9a89262a 100644 --- a/Zotlabs/Zot6/Receiver.php +++ b/Zotlabs/Zot6/Receiver.php @@ -34,6 +34,7 @@ class Receiver { $this->rawdata = null; $this->site_id = null; $this->prvkey = Config::get('system','prvkey'); + $this->hub = null; if($localdata) { $this->rawdata = $localdata; -- cgit v1.2.3