From fcfb9e975836c4abbbfd339d46bf8ea937747e57 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 7 Sep 2022 12:50:46 +0000 Subject: fix random php warnings --- Zotlabs/Lib/Apps.php | 7 ++++++- Zotlabs/Module/Acl.php | 14 +++++++------- Zotlabs/Module/Home.php | 2 +- Zotlabs/Module/Hq.php | 16 +--------------- Zotlabs/Module/Sse_bs.php | 2 +- Zotlabs/Widget/Channel_activities.php | 2 +- Zotlabs/Widget/Messages.php | 17 +++++++---------- 7 files changed, 24 insertions(+), 36 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 98ebc546a..a29992bbc 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -521,8 +521,13 @@ class Apps { $hosturl = ''; if(local_channel()) { - if(self::app_installed(local_channel(),$papp) && !$papp['deleted']) + if(self::app_installed(local_channel(),$papp)) { $installed = true; + } + + if ($installed && isset($papp['deleted']) && $papp['deleted']) { + $installed = false; + } $hosturl = z_root() . '/'; } diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 5b37f2707..9dc422e6b 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -66,6 +66,11 @@ class Acl extends \Zotlabs\Web\Controller { killme(); $permitted = []; + $sql_extra = ''; + $sql_extra2 = ''; + $sql_extra3 = ''; + $sql_extra2_xchan = ''; + $order_extra2 = ''; if(in_array($type, [ 'm', 'a', 'c', 'f' ])) { @@ -81,7 +86,6 @@ class Acl extends \Zotlabs\Web\Controller { } - if($search) { $sql_extra = " AND pgrp.gname LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; $sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc(punify($search)) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") "; @@ -100,10 +104,6 @@ class Acl extends \Zotlabs\Web\Controller { $sql_extra3 = "AND ( xchan_addr like " . protect_sprintf( "'%" . dbesc(punify($search)) . "%'" ) . " OR xchan_name like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ) "; } - else { - $sql_extra = $sql_extra2 = $sql_extra3 = ""; - } - $groups = array(); $contacts = array(); @@ -342,7 +342,7 @@ class Acl extends \Zotlabs\Web\Controller { $x = []; foreach($r as $g) { - if(in_array($g['net'],['rss','anon','unknown']) && ($type != 'a')) + if(isset($g['net']) && in_array($g['net'], ['rss','anon','unknown']) && ($type != 'a')) continue; $g['hash'] = urlencode($g['hash']); @@ -383,7 +383,7 @@ class Acl extends \Zotlabs\Web\Controller { "self" => (intval($g['abook_self']) ? 'abook-self' : ''), "taggable" => '', "label" => '', - "net" => $g['net'] + "net" => $g['net'] ?? '' ); } } diff --git a/Zotlabs/Module/Home.php b/Zotlabs/Module/Home.php index 315d05af6..8d78960cc 100644 --- a/Zotlabs/Module/Home.php +++ b/Zotlabs/Module/Home.php @@ -36,7 +36,7 @@ class Home extends Controller { $channel = App::get_channel(); if (local_channel() && $channel && $channel['xchan_url'] && !$splash) { - $dest = (($ret['startpage']) ? $ret['startpage'] : ''); + $dest = $ret['startpage'] ?? ''; if (!$dest) $dest = get_config('system', 'startpage'); if (!$dest) diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index efbfcf084..120f7caeb 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -47,24 +47,10 @@ class Hq extends \Zotlabs\Web\Controller { $sys = get_sys_channel(); $sys_item = false; $sql_extra = ''; - - if(! $item_hash) { - //$r = q("SELECT mid FROM item - //WHERE uid = %d $item_normal - //AND mid = parent_mid - //AND item_private IN (0, 1) - //ORDER BY created DESC LIMIT 1", - //intval(local_channel()) - //); - //if($r[0]['mid']) { - //$item_hash = $r[0]['mid']; - //} - } + $target_item = null; if($item_hash) { - $target_item = null; - $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid = '%s' limit 1", dbesc($item_hash) ); diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php index ad9be0938..619050aaf 100644 --- a/Zotlabs/Module/Sse_bs.php +++ b/Zotlabs/Module/Sse_bs.php @@ -41,7 +41,7 @@ class Sse_bs extends Controller { self::$offset = 0; self::$xchans = ''; - if($_REQUEST['sse_rmids']) + if(isset($_REQUEST['sse_rmids'])) self::mark_read($_REQUEST['sse_rmids']); if(!empty($_REQUEST['nquery']) && $_REQUEST['nquery'] !== '%') { diff --git a/Zotlabs/Widget/Channel_activities.php b/Zotlabs/Widget/Channel_activities.php index 47aa971a2..9acde591d 100644 --- a/Zotlabs/Widget/Channel_activities.php +++ b/Zotlabs/Widget/Channel_activities.php @@ -25,7 +25,7 @@ class Channel_activities { self::$uid = local_channel(); self::$channel = App::get_channel(); - $o .= '
'; + $o = '
'; $o .= '

Welcome ' . self::$channel['channel_name'] . '!

'; //$o .= 'Last login date: ' . get_pconfig(self::$uid, 'system', 'stored_login_date') . ' from ' . get_pconfig(self::$uid, 'system', 'stored_login_addr'); diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 3d9ed8955..66b371c8e 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -45,11 +45,14 @@ class Messages { if (!local_channel()) return; - if (isset($options['offset']) && $options['offset'] == -1) { + $offset = $options['offset'] ?? 0; + $type = $options['type'] ?? 'default'; + + if ($offset == -1) { return; } - if (isset($options['type']) && $options['type'] == 'notification') { + if ($type == 'notification') { return self::get_notices_page($options); } @@ -58,15 +61,9 @@ class Messages { $entries = []; $limit = 30; $dummy_order_sql = ''; - - $offset = 0; - if ($options['offset']) { - $offset = intval($options['offset']); - } - $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); - switch($options['type']) { + switch($type) { case 'direct': $type_sql = ' AND item_private = 2 '; // $dummy_order_sql has no other meaning but to trick @@ -99,7 +96,7 @@ class Messages { foreach($items as $item) { $info = ''; - if ($options['type'] == 'direct') { + if ($type == 'direct') { $info .= self::get_dm_recipients($channel, $item); } -- cgit v1.2.3