aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
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 /Zotlabs
parent990a3af2a7349e07c10224cf2a023d179ecfd6ca (diff)
downloadvolse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.tar.gz
volse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.tar.bz2
volse-hubzilla-480862d7143f291658b48e785eda2e61a438a74b.zip
php8: fix more warnings
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php22
-rw-r--r--Zotlabs/Lib/ActivityStreams.php8
-rw-r--r--Zotlabs/Lib/Libzot.php5
-rw-r--r--Zotlabs/Lib/System.php16
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--Zotlabs/Module/Sse_bs.php6
-rw-r--r--Zotlabs/Widget/Notifications.php1
7 files changed, 36 insertions, 28 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index b400ffd61..7e6f7d42d 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -646,15 +646,15 @@ class Activity {
$ret = [];
- if (is_array($item['attachment']) && $item['attachment']) {
+ if (isset($item['attachment'])) {
$ptr = $item['attachment'];
if (!array_key_exists(0, $ptr)) {
$ptr = [$ptr];
}
foreach ($ptr as $att) {
$entry = [];
- if ($att['type'] === 'PropertyValue') {
- if (array_key_exists('name', $att) && $att['name']) {
+ if (isset($att['type']) && $att['type'] === 'PropertyValue') {
+ if (isset($att['name'])) {
$key = explode('.', $att['name']);
if (count($key) === 3 && $key[0] === 'zot') {
$entry['cat'] = $key[1];
@@ -674,7 +674,7 @@ class Activity {
$ret = [];
- if (array_key_exists('attachment', $item) && is_array($item['attachment'])) {
+ if (isset($item['attachment'])) {
$ptr = $item['attachment'];
if (!array_key_exists(0, $ptr)) {
$ptr = [$ptr];
@@ -1600,7 +1600,7 @@ class Activity {
$m = parse_url($url);
if ($m) {
$hostname = $m['host'];
- $baseurl = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
+ $baseurl = $m['scheme'] . '://' . $m['host'] . ((isset($m['port'])) ? ':' . $m['port'] : '');
$site_url = $m['scheme'] . '://' . $m['host'];
}
@@ -1791,9 +1791,13 @@ class Activity {
// sort function width decreasing
static function vid_sort($a, $b) {
- if ($a['width'] === $b['width'])
+ $a_width = $a['width'] ?? 0;
+ $b_width = $b['width'] ?? 0;
+
+ if ($a_width === $b_width)
return 0;
- return (($a['width'] > $b['width']) ? -1 : 1);
+
+ return (($a_width > $b_width) ? -1 : 1);
}
static function create_note($channel, $observer_hash, $act) {
@@ -2673,7 +2677,7 @@ class Activity {
}
}
- if (!$s['plink']) {
+ if (!(isset($s['plink']) && $s['plink'])) {
$s['plink'] = $s['mid'];
}
@@ -2865,7 +2869,7 @@ class Activity {
// The $item['item_fetched'] flag is set in fetch_and_store_parents().
// In this case we should check against author permissions because sender is not owner.
- if (perm_is_allowed($channel['channel_id'], (($item['item_fetched']) ? $item['author_xchan'] : $observer_hash), 'send_stream') || $is_sys_channel) {
+ if (perm_is_allowed($channel['channel_id'], ((isset($item['item_fetched']) && $item['item_fetched']) ? $item['author_xchan'] : $observer_hash), 'send_stream') || $is_sys_channel) {
$allowed = true;
}
// TODO: not implemented
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index c0b07bfb5..fc580e9aa 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -116,17 +116,17 @@ class ActivityStreams {
$this->obj['object'] = $this->get_compound_property($this->obj['object']);
}
- if ($this->obj && is_array($this->obj) && $this->obj['actor'])
+ if ($this->obj && is_array($this->obj) && isset($this->obj['actor']))
$this->obj['actor'] = $this->get_actor('actor', $this->obj);
- if ($this->tgt && is_array($this->tgt) && $this->tgt['actor'])
+ if ($this->tgt && is_array($this->tgt) && isset($this->tgt['actor']))
$this->tgt['actor'] = $this->get_actor('actor', $this->tgt);
$this->parent_id = $this->get_property_obj('inReplyTo');
- if ((!$this->parent_id) && is_array($this->obj)) {
+ if ((!$this->parent_id) && is_array($this->obj) && isset($this->obj['inReplyTo'])) {
$this->parent_id = $this->obj['inReplyTo'];
}
- if ((!$this->parent_id) && is_array($this->obj)) {
+ if ((!$this->parent_id) && is_array($this->obj) && isset($this->obj['id'])) {
$this->parent_id = $this->obj['id'];
}
}
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 09ce3a9de..340f844d5 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -2926,12 +2926,11 @@ class Libzot {
// This is a template - %s will be replaced with the follow_url we discover for the return channel.
if ($special_channel) {
- $ret['connect_url'] = (($e['xchan_connpage']) ? $e['xchan_connpage'] : z_root() . '/connect/' . $e['channel_address']);
+ $ret['connect_url'] = $e['xchan_connpage'] ?? z_root() . '/connect/' . $e['channel_address'];
}
// This is a template for our follow url, %s will be replaced with a webbie
- if (!$ret['follow_url'])
- $ret['follow_url'] = z_root() . '/follow?f=&url=%s';
+ $ret['follow_url'] = $ret['follow_url'] ?? z_root() . '/follow?f=&url=%s';
$permissions = get_all_perms($e['channel_id'], $ztarget_hash, false, false);
diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php
index 3cc46fbda..087378f16 100644
--- a/Zotlabs/Lib/System.php
+++ b/Zotlabs/Lib/System.php
@@ -16,13 +16,13 @@ class System {
}
static public function get_site_name() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['sitename'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['sitename']))
return \App::$config['system']['sitename'];
return '';
}
static public function get_project_version() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['hide_version'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['hide_version']))
return '';
if(is_array(\App::$config) && is_array(\App::$config['system']) && array_key_exists('std_version',\App::$config['system']))
return \App::$config['system']['std_version'];
@@ -31,33 +31,33 @@ class System {
}
static public function get_update_version() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['hide_version'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['hide_version']))
return '';
return DB_UPDATE_VERSION;
}
static public function get_notify_icon() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['email_notify_icon_url'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['email_notify_icon_url']))
return \App::$config['system']['email_notify_icon_url'];
return z_root() . DEFAULT_NOTIFY_ICON;
}
static public function get_site_icon() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['site_icon_url'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['site_icon_url']))
return \App::$config['system']['site_icon_url'];
return z_root() . DEFAULT_PLATFORM_ICON ;
}
static public function get_project_link() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_link'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['project_link']))
return \App::$config['system']['project_link'];
return 'https://hubzilla.org';
}
static public function get_project_srclink() {
- if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_srclink'])
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && isset(\App::$config['system']['project_srclink']))
return \App::$config['system']['project_srclink'];
return 'https://framagit.org/hubzilla/core.git';
}
@@ -68,7 +68,7 @@ class System {
static public function get_zot_revision() {
- $x = [ 'revision' => ZOT_REVISION ];
+ $x = [ 'revision' => ZOT_REVISION ];
call_hooks('zot_revision',$x);
return $x['revision'];
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 20cbff4fc..0a7e40e0e 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -180,7 +180,7 @@ class ThreadItem {
$dropping = false;
}
-
+ $drop = [];
if($dropping) {
$drop = array(
'dropping' => $dropping,
@@ -309,6 +309,10 @@ class ThreadItem {
if(($item['obj_type'] === ACTIVITY_OBJ_EVENT) && $conv->get_profile_owner() == local_channel())
$has_event = true;
+ $like = [];
+ $dislike = [];
+ $reply_to = [];
+
if($this->is_commentable() && $observer) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index 619050aaf..3a4e4e09e 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -580,12 +580,12 @@ class Sse_bs extends Controller {
$forums[$x]['notify_link'] = z_root() . '/network/?f=&pf=1&unseen=1&cid=' . $forums[$x]['abook_id'];
$forums[$x]['name'] = $forums[$x]['xchan_name'];
- $forums[$x]['addr'] = $forums[$x]['xchan_addr'];
+ $forums[$x]['addr'] = $forums[$x]['xchan_addr'] ?? $forums[$x]['xchan_url'];
$forums[$x]['url'] = $forums[$x]['xchan_url'];
$forums[$x]['photo'] = $forums[$x]['xchan_photo_s'];
$forums[$x]['unseen'] = count($b64mids);
- $forums[$x]['private_forum'] = (($forums[$x]['private_forum']) ? 'lock' : '');
- $forums[$x]['message'] = (($forums[$x]['private_forum']) ? t('Private forum') : t('Public forum'));
+ $forums[$x]['private_forum'] = ((isset($forums[$x]['private_forum']) && $forums[$x]['private_forum']) ? 'lock' : '');
+ $forums[$x]['message'] = ((isset($forums[$x]['private_forum']) && $forums[$x]['private_forum']) ? t('Private forum') : t('Public forum'));
$forums[$x]['mids'] = json_encode($b64mids);
unset($forums[$x]['abook_id']);
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 0e02d5cc1..a4e632a9f 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -13,6 +13,7 @@ class Notifications {
function widget($arr) {
$channel = \App::get_channel();
+ $notifications = [];
if(local_channel()) {
$notifications[] = [