From a9a36894cb2637b546ed566ee06f20511cce031f Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 12 Oct 2022 12:15:30 +0000 Subject: fix php warnings --- Zotlabs/Lib/Libsync.php | 2 ++ Zotlabs/Lib/Libzot.php | 12 ++++++------ Zotlabs/Lib/ThreadItem.php | 2 +- Zotlabs/Module/Cloud.php | 2 +- include/markdown.php | 5 ++++- include/nav.php | 2 +- include/socgraph.php | 3 ++- include/zid.php | 6 ++++-- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 36a0a044c..4e090b937 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -762,6 +762,8 @@ class Libsync { static function sync_locations($sender, $arr, $absolute = false) { $ret = []; + $what = ''; + $changed = false; // If a sender reports that the channel has been deleted, delete its hubloc if (isset($arr['deleted_locally']) && intval($arr['deleted_locally'])) { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 6f7d74606..5c55b0ba9 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -710,11 +710,11 @@ class Libzot { $hidden_changed = $adult_changed = $deleted_changed = $pubforum_changed = 0; - if (intval($r[0]['xchan_hidden']) != (1 - intval($arr['searchable']))) + if (isset($arr['searchable']) && intval($r[0]['xchan_hidden']) != (1 - intval($arr['searchable']))) $hidden_changed = 1; - if (intval($r[0]['xchan_selfcensored']) != intval($arr['adult_content'])) + if (isset($arr['adult_content']) && intval($r[0]['xchan_selfcensored']) != intval($arr['adult_content'])) $adult_changed = 1; - if (intval($r[0]['xchan_deleted']) != intval($arr['deleted'])) + if (isset($arr['xchan_deleted']) && intval($r[0]['xchan_deleted']) != intval($arr['deleted'])) $deleted_changed = 1; // new style 6-MAR-2019 @@ -733,7 +733,7 @@ class Libzot { // old style - if (intval($r[0]['xchan_pubforum']) != intval($arr['public_forum'])) + if (isset($arr['public_forum']) && intval($r[0]['xchan_pubforum']) != intval($arr['public_forum'])) $pubforum_changed = 1; @@ -1027,7 +1027,7 @@ class Libzot { // handle remote validation issues $b = q("update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s'", - dbesc(($x['message']) ? $x['message'] : 'unknown delivery error'), + dbesc($x['message'] ?? 'unknown delivery error'), dbesc(datetime_convert()), dbesc($outq['outq_hash']) ); @@ -1437,7 +1437,7 @@ class Libzot { if ($check_mentions) { // It's a top level post. Look at the tags. See if any of them are mentions and are on this hub. if ($act && $act->obj) { - if (is_array($act->obj['tag']) && $act->obj['tag']) { + if (isset($act->obj['tag']) && is_array($act->obj['tag']) && $act->obj['tag']) { foreach ($act->obj['tag'] as $tag) { if ($tag['type'] === 'Mention' && (strpos($tag['href'], z_root()) !== false)) { $address = basename($tag['href']); diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 8cc0f6aa5..0343dc1e5 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -298,7 +298,7 @@ class ThreadItem { } $has_bookmarks = false; - if(Apps::system_app_installed(local_channel(), 'Bookmarks') && is_array($item['term'])) { + if(Apps::system_app_installed(local_channel(), 'Bookmarks') && isset($item['term']) && is_array($item['term'])) { foreach($item['term'] as $t) { if(($t['ttype'] == TERM_BOOKMARK)) $has_bookmarks = true; diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index 6ff95b5cf..4cc7595a1 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -70,7 +70,7 @@ class Cloud extends Controller { $_SESSION['cloud_sort'] = 'name'; } - $_SESSION['cloud_sort'] = (($_REQUEST['sort']) ? trim(notags($_REQUEST['sort'])) : $_SESSION['cloud_sort']); + $_SESSION['cloud_sort'] = ((isset($_REQUEST['sort']) && $_REQUEST['sort']) ? trim(notags($_REQUEST['sort'])) : $_SESSION['cloud_sort']); $x = clean_query_string(); if($x !== \App::$query_string) diff --git a/include/markdown.php b/include/markdown.php index a0e07ba68..7fba1259f 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -66,7 +66,10 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) { $s = MarkdownExtra::defaultTransform($s); - if($options && $options['preserve_lf']) { + + $preserve_lf = $options['preserve_lf'] ?? false; + + if($preserve_lf) { $s = str_replace(["\r","\n"],["",'
'],$s); } else { diff --git a/include/nav.php b/include/nav.php index 65d5a3ef6..71b3bec49 100644 --- a/include/nav.php +++ b/include/nav.php @@ -206,7 +206,7 @@ function nav($template = 'default') { $url = ''; $settings_url = ''; - if (App::$profile_uid && App::$nav_sel['raw_name']) { + if (App::$profile_uid && isset(App::$nav_sel['raw_name']) && App::$nav_sel['raw_name']) { $active_app = q("SELECT app_url FROM app WHERE app_channel = %d AND app_name = '%s' LIMIT 1", intval(App::$profile_uid), dbesc(App::$nav_sel['raw_name']) diff --git a/include/socgraph.php b/include/socgraph.php index 874086788..f08913ee2 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -342,6 +342,7 @@ function poco() { } $observer = App::get_observer(); + $user = ''; if(argc() > 1) { $user = notags(trim(argv(1))); @@ -355,7 +356,7 @@ function poco() { $system_mode = true; } - $format = (($_REQUEST['format']) ? $_REQUEST['format'] : 'json'); + $format = $_REQUEST['format'] ?? 'json'; $justme = false; diff --git a/include/zid.php b/include/zid.php index 5710d9f3f..b38457d99 100644 --- a/include/zid.php +++ b/include/zid.php @@ -359,10 +359,12 @@ function owt_init($token) { $_SESSION['authenticated'] = 1; + $delegate = $_REQUEST['delegate'] ?? ''; $delegate_success = false; - if($_REQUEST['delegate']) { + + if($delegate) { $r = q("select * from channel left join xchan on channel_hash = xchan_hash where xchan_addr = '%s' limit 1", - dbesc($_REQUEST['delegate']) + dbesc($delegate) ); if ($r && intval($r[0]['channel_id'])) { $allowed = perm_is_allowed($r[0]['channel_id'],$hubloc['xchan_hash'],'delegate'); -- cgit v1.2.3