diff options
author | Mario Vavti <mario@mariovavti.com> | 2022-10-20 11:15:06 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2022-10-20 11:15:06 +0200 |
commit | 53931017b99c6fc77fc7632747e51b06a89b2287 (patch) | |
tree | 26357decc1d3a76471863b3f58a0a0455d637e33 /Zotlabs | |
parent | e9ca17cec14c5a702cc7d656e5206a3c086dd550 (diff) | |
download | volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.tar.gz volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.tar.bz2 volse-hubzilla-53931017b99c6fc77fc7632747e51b06a89b2287.zip |
fix php warnings
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Activity.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Libsync.php | 2 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Connections.php | 17 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 18 | ||||
-rw-r--r-- | Zotlabs/Module/Sitelist.php | 48 |
6 files changed, 52 insertions, 39 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 633f18235..d80394c7b 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -121,7 +121,7 @@ class Activity { $y = json_decode($x['body'], true); logger('returned: ' . json_encode($y, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DEBUG); - if (ActivityStreams::is_an_actor($y['type'])) { + if (isset($y['type']) && ActivityStreams::is_an_actor($y['type'])) { XConfig::Set($y['id'], 'system', 'actor_record', $y); } diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 4e090b937..914969d97 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -774,7 +774,7 @@ class Libsync { ); } - if ($arr['locations']) { + if (isset($arr['locations']) && $arr['locations']) { if ($absolute) Libzot::check_location_move($sender['hash'], $arr['locations']); diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 77b481c25..ee551f6b8 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2017,6 +2017,10 @@ class Libzot { $arr = Activity::decode_note($AS); + if (!$arr) { + continue; + } + if ($r) { $arr['author_xchan'] = $r['hubloc_hash']; } diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index 0f674965d..0effcdfc3 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -45,7 +45,7 @@ class Connections extends \Zotlabs\Web\Controller { $unconnected = false; $all = false; - if(! $_REQUEST['aj']) + if(!(isset($_REQUEST['aj']) && $_REQUEST['aj'])) $_SESSION['return_url'] = App::$query_string; $search_flags = ""; @@ -128,7 +128,9 @@ class Connections extends \Zotlabs\Web\Controller { $unblocked = true; } - switch($_REQUEST['order']) { + $order = $_REQUEST['order'] ?? ''; + + switch($order) { case 'name_desc': $sql_order = 'xchan_name DESC'; break; @@ -227,6 +229,8 @@ class Connections extends \Zotlabs\Web\Controller { //$t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); $searching = false; + $search_hdr = ''; + if($search) { $search_hdr = $search; $search_txt = dbesc(protect_sprintf(preg_quote($search))); @@ -234,7 +238,7 @@ class Connections extends \Zotlabs\Web\Controller { } $sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : ""); - if($_REQUEST['gid']) { + if(isset($_REQUEST['gid']) && $_REQUEST['gid']) { $sql_extra .= " and xchan_hash in ( select xchan from pgrp_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) "; } @@ -272,14 +276,13 @@ class Connections extends \Zotlabs\Web\Controller { foreach($r as $rr) { if($rr['xchan_url']) { - if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr']) + if((isset($rr['vcard'])) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr']) $phone = $rr['vcard']['tels'][0]['nr']; else $phone = ''; $status_str = ''; $status = array( - ((intval($rr['abook_active'])) ? t('Active') : ''), ((intval($rr['abook_pending'])) ? t('Pending approval') : ''), ((intval($rr['abook_archived'])) ? t('Archived') : ''), ((intval($rr['abook_hidden'])) ? t('Hidden') : ''), @@ -356,7 +359,7 @@ class Connections extends \Zotlabs\Web\Controller { 'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''), 'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0', 'connect_hover' => t('Connect at this location'), - 'role' => $roles_dict[$rr['abook_role']], + 'role' => $roles_dict[$rr['abook_role']] ?? '', 'pending' => intval($rr['abook_pending']) ); } @@ -371,7 +374,7 @@ class Connections extends \Zotlabs\Web\Controller { $abook_usage_message = ''; } - if($_REQUEST['aj']) { + if(isset($_REQUEST['aj']) && $_REQUEST['aj']) { if($contacts) { $o = replace_macros(get_markup_template('contactsajax.tpl'),array( '$contacts' => $contacts, diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 26d3b9fc2..29d592e19 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -36,7 +36,7 @@ class Display extends \Zotlabs\Web\Controller { } } - if($_REQUEST['mid']) { + if(isset($_REQUEST['mid']) && $_REQUEST['mid']) { $item_hash = $_REQUEST['mid']; } @@ -56,6 +56,8 @@ class Display extends \Zotlabs\Web\Controller { $observer_is_owner = false; + $o = ''; + if(local_channel() && (! $update)) { $channel = App::get_channel(); @@ -87,7 +89,7 @@ class Display extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ); - $o = '<div id="jot-popup">'; + $o .= '<div id="jot-popup">'; $o .= status_editor($a,$x,false,'Display'); $o .= '</div>'; } @@ -107,17 +109,21 @@ class Display extends \Zotlabs\Web\Controller { dbesc($item_hash) ); - if($r) { - $target_item = $r[0]; + if (!$r) { + notice( t('Item not found.') . EOL); + return ''; } + $target_item = $r[0]; + + /* not yet ready for prime time $x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($target_item['author_xchan']) ); if($x) { -// not yet ready for prime time -// App::$poi = $x[0]; + App::$poi = $x[0]; } + */ //if the item is to be moderated redirect to /moderate if($target_item['item_blocked'] == ITEM_MODERATED) { diff --git a/Zotlabs/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php index 2ac5ed1b8..9908aa651 100644 --- a/Zotlabs/Module/Sitelist.php +++ b/Zotlabs/Module/Sitelist.php @@ -5,63 +5,63 @@ namespace Zotlabs\Module; /** @file */ class Sitelist extends \Zotlabs\Web\Controller { function init() { - - $start = (($_REQUEST['start']) ? intval($_REQUEST['start']) : 0); - $limit = ((intval($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30); - $order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'random'); - $open = (($_REQUEST['open']) ? intval($_REQUEST['open']) : false); - - + + $start = ((isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0); + $limit = ((isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30); + $order = ((isset($_REQUEST['order'])) ? $_REQUEST['order'] : 'random'); + $open = ((isset($_REQUEST['open'])) ? intval($_REQUEST['open']) : false); + + $sql_order = " order by site_url "; $rand = db_getfunc('rand'); if($order == 'random') $sql_order = " order by $rand "; - + $sql_limit = " LIMIT $limit OFFSET $start "; - + $sql_extra = ""; if($open) $sql_extra = " and site_register = " . intval(REGISTER_OPEN) . " "; - + $realm = get_directory_realm(); if($realm == DIRECTORY_REALM) { $sql_extra .= " and ( site_realm = '" . dbesc($realm) . "' or site_realm = '') "; } else $sql_extra .= " and site_realm = '" . dbesc($realm) . "' "; - + $result = array('success' => false); - + $r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ", intval(SITE_TYPE_ZOT) ); - + if($r) $result['total'] = intval($r[0]['total']); - + $result['start'] = $start; - $result['limit'] = $limit; - + $result['limit'] = $limit; + $r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit", intval(SITE_TYPE_ZOT) ); - + $result['results'] = 0; $result['entries'] = array(); - + if($r) { - $result['success'] = true; + $result['success'] = true; $result['results'] = count($r); - + foreach($r as $rr) { $result['entries'][] = array('url' => $rr['site_url']); } - + } - + echo json_encode($result); killme(); - - + + } } |