aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-09-11 14:58:40 +0000
committerMario <mario@mariovavti.com>2022-09-11 14:58:40 +0000
commit480862d7143f291658b48e785eda2e61a438a74b (patch)
tree29661e5f26e4ca5b1e9aff1e8875485157a057d3 /include
parent990a3af2a7349e07c10224cf2a023d179ecfd6ca (diff)
downloadvolse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.tar.gz
volse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.tar.bz2
volse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.zip
php8: fix more warnings
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php19
-rw-r--r--include/event.php12
-rw-r--r--include/feedutils.php28
-rw-r--r--include/items.php10
-rw-r--r--include/nav.php5
-rw-r--r--include/text.php1
6 files changed, 35 insertions, 40 deletions
diff --git a/include/conversation.php b/include/conversation.php
index fe001a79d..7df7b62c2 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -102,28 +102,29 @@ function localize_item(&$item){
logger('localize_item: failed to decode object: ' . print_r($item['obj'],true));
}
- if(is_array($obj['author']) && $obj['author']['link'])
+ if(isset($obj['author']) && isset($obj['author']['link']))
$author_link = get_rel_link($obj['author']['link'],'alternate');
- elseif(is_array($obj['actor']) && $obj['actor']['url'])
+ elseif(isset($obj['actor']) && isset($obj['actor']['url']))
$author_link = ((is_array($obj['actor']['url'])) ? $obj['actor']['url'][0]['href'] : $obj['actor']['url']);
elseif (is_string($obj['actor']))
$author_link = $obj['actor'];
else
$author_link = '';
- $author_name = (($obj['author'] && $obj['author']['name']) ? $obj['author']['name'] : '');
+ $author_name = $obj['author']['name'] ?? '';
if(!$author_name)
- $author_name = ((is_array($obj['actor']) && $obj['actor']['name']) ? $obj['actor']['name'] : '');
+ $author_name = $obj['actor']['name'] ?? '';
if(!$author_name && is_string($obj['actor'])) {
$cached_actor = Activity::get_cached_actor($obj['actor']);
if (is_array($cached_actor)) {
- $author_name = (($cached_actor['name']) ? $cached_actor['name'] : $cached_actor['preferredUsername']);
+ $author_name = $cached_actor['name'] ?? $cached_actor['preferredUsername'];
}
}
- if(is_array($obj['link']))
+ $item_url = '';
+ if(isset($obj['link']) && is_array($obj['link']))
$item_url = get_rel_link($obj['link'],'alternate');
if(!$item_url)
@@ -1055,14 +1056,14 @@ function author_is_pmable($xchan, $abook) {
function thread_author_menu($item, $mode = '') {
$menu = [];
-
+ $channel = [];
$local_channel = local_channel();
if($local_channel) {
if(! count(App::$contacts))
load_contact_links($local_channel);
+
$channel = App::get_channel();
- $channel_hash = (($channel) ? $channel['channel_hash'] : '');
}
$profile_link = chanlink_hash($item['author_xchan']);
@@ -1070,7 +1071,7 @@ function thread_author_menu($item, $mode = '') {
$follow_url = '';
- if($channel['channel_hash'] !== $item['author_xchan']) {
+ if(isset($channel['channel_hash']) && $channel['channel_hash'] !== $item['author_xchan']) {
if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) {
$contact = App::$contacts[$item['author_xchan']];
}
diff --git a/include/event.php b/include/event.php
index f62c22792..0805bd2fe 100644
--- a/include/event.php
+++ b/include/event.php
@@ -28,7 +28,7 @@ function format_event_html($ev) {
if(! ((is_array($ev)) && count($ev)))
return '';
- $tz = (($ev['timezone']) ? $ev['timezone'] : 'UTC');
+ $tz = $ev['timezone'] ?? 'UTC';
$bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8:01 AM
@@ -39,9 +39,9 @@ function format_event_html($ev) {
$o .= '<div class="event-title"><h3><i class="fa fa-calendar"></i>&nbsp;' . zidify_links(smilies(bbcode($ev['summary']))) . '</h3></div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
- . datetime_convert('UTC', 'UTC', $ev['dtstart'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
+ . datetime_convert('UTC', 'UTC', $ev['dtstart'], ((isset($ev['adjust']) && $ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ . ((isset($ev['adjust']) && $ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
$ev['dtstart'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtstart'] , $bd_format)))
@@ -49,9 +49,9 @@ function format_event_html($ev) {
if(! $ev['nofinish'])
$o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="'
- . datetime_convert('UTC','UTC',$ev['dtend'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
+ . datetime_convert('UTC','UTC',$ev['dtend'], ((isset($ev['adjust']) && $ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ . ((isset($ev['adjust']) && $ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
$ev['dtend'] , $bd_format ))
: day_translate(datetime_convert('UTC', 'UTC',
$ev['dtend'] , $bd_format )))
@@ -59,7 +59,7 @@ function format_event_html($ev) {
$o .= '<div class="event-description">' . zidify_links(smilies(bbcode($ev['description']))) . '</div>' . "\r\n";
- if(strlen($ev['location']))
+ if(isset($ev['location']) && $ev['location'])
$o .= '<div class="event-location"><span class="event-label"> ' . t('Location:') . '</span>&nbsp;<span class="location">'
. zidify_links(smilies(bbcode($ev['location'])))
. '</span></div>' . "\r\n";
diff --git a/include/feedutils.php b/include/feedutils.php
index 734018922..33bacc2bb 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -270,18 +270,17 @@ function get_atom_author($feed, $item) {
$found_author = $item->get_author();
if($found_author) {
- /// @FIXME $rawauthor is undefined here
+ $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
+ hz_syslog('rawauthor: ' . print_r($rawauthor, true));
+
if($rawauthor) {
- if($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data'])
+ if(isset($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data']))
$author['full_name'] = unxmlify($rawauthor[0]['child'][NAMESPACE_POCO]['displayName'][0]['data']);
}
+
$author['author_name'] = unxmlify($found_author->get_name());
$author['author_link'] = unxmlify($found_author->get_link());
$author['author_is_feed'] = false;
-
- $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
- //logger('rawauthor: ' . print_r($rawauthor, true));
-
}
else {
$author['author_name'] = unxmlify($feed->get_title());
@@ -497,6 +496,7 @@ function get_atom_elements($feed, $item) {
$res['verb'] = unxmlify($rawverb[0]['data']);
}
+ $ostatus_conversation = '';
$rawcnv = $item->get_item_tags(NAMESPACE_OSTATUS, 'conversation');
if($rawcnv) {
// new style
@@ -1434,9 +1434,9 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
if($author['author_link'] != $contact['xchan_url']) {
$name = '';
- if($author['full_name']) {
+ if(isset($author['full_name'])) {
$name = $author['full_name'];
- if($author['author_name'])
+ if(isset($author['author_name']))
$name .= ' (' . $author['author_name'] . ')';
}
else {
@@ -1468,8 +1468,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
// Update content if 'updated' changes
if($r) {
- if(activity_match($datarray['verb'],ACTIVITY_DELETE)
- && $datarray['author_xchan'] === $r[0]['author_xchan']) {
+ if(isset($datarray['verb']) && activity_match($datarray['verb'], ACTIVITY_DELETE)
+ && isset($datarray['author_xchan']) && $datarray['author_xchan'] === $r[0]['author_xchan']) {
if(! intval($r[0]['item_deleted'])) {
logger('deleting item ' . $r[0]['id'] . ' mid=' . $datarray['mid'], LOGGER_DEBUG);
drop_item($r[0]['id'],false);
@@ -1498,11 +1498,11 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray['uid'] = $importer['channel_id'];
$datarray['aid'] = $importer['channel_account_id'];
- if(! link_compare($author['owner_link'], $contact['xchan_url'])) {
+ if(isset($author['owner_link']) && !link_compare($author['owner_link'], $contact['xchan_url'])) {
logger('Correcting item owner.', LOGGER_DEBUG);
- $author['owner_name'] = $contact['name'];
- $author['owner_link'] = $contact['url'];
- $author['owner_avatar'] = $contact['thumb'];
+ $author['owner_name'] = $contact['xchan_name'];
+ $author['owner_link'] = $contact['xchan_url'];
+ $author['owner_avatar'] = $contact['xchan_photo_m'];
}
if($importer['channel_system']) {
diff --git a/include/items.php b/include/items.php
index d4c27ab28..c8b032806 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1163,8 +1163,7 @@ function encode_item($item,$mirror = false,$zap_compat = false) {
if($item['comments_closed'] > NULL_DATE)
$x['comments_closed'] = $item['comments_closed'];
- $x['public_scope'] = $scope;
-
+ $x['public_scope'] = $item['public_policy'];
$x['comment_scope'] = $item['comment_policy'];
if(! empty($item['term']))
@@ -2432,17 +2431,14 @@ function send_status_notifications($post_id,$item) {
return;
// my own post - no notification needed
- if($item['author_xchan'] === $r[0]['channel_hash'])
+ if(isset($item['author_xchan']) && $item['author_xchan'] === $r[0]['channel_hash'])
return;
-
// I'm the owner - notify me
-
- if($item['owner_hash'] === $r[0]['channel_hash'])
+ if(isset($item['owner_hash']) && $item['owner_hash'] === $r[0]['channel_hash'])
$notify = true;
// Was I involved in this conversation?
-
$x = q("select * from item where parent_mid = '%s' and uid = %d",
dbesc($item['parent_mid']),
intval($item['uid'])
diff --git a/include/nav.php b/include/nav.php
index 0097a206b..65d5a3ef6 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -416,9 +416,6 @@ function channel_apps($is_owner = false, $nickname = null) {
$has_webpages = (($r) ? true : false);
- if (x($_GET, 'tab'))
- $tab = notags(trim($_GET['tab']));
-
$url = z_root() . '/channel/' . $nickname;
$pr = z_root() . '/profile/' . $nickname;
@@ -524,7 +521,7 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
- $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => (($tab) ? $tab : false), 'tabs' => $tabs];
+ $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tabs' => $tabs];
call_hooks('channel_apps', $arr);
diff --git a/include/text.php b/include/text.php
index 87aaf7bf8..63b472bbd 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1836,6 +1836,7 @@ function prepare_body(&$item,$attach = false,$opts = false) {
$categories = format_categories($item,$writeable);
+ $filer = '';
if(local_channel() == $item['uid'])
$filer = format_filer($item);