diff options
-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 | ||||
-rw-r--r-- | include/channel.php | 8 | ||||
-rw-r--r-- | include/hubloc.php | 4 | ||||
-rw-r--r-- | include/items.php | 3 | ||||
-rw-r--r-- | include/nav.php | 8 |
10 files changed, 63 insertions, 51 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(); - - + + } } diff --git a/include/channel.php b/include/channel.php index a309fa5c8..a42315ed6 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1890,18 +1890,18 @@ function advanced_profile() { function get_my_url() { - if(x($_SESSION, 'zrl_override')) + if(isset($_SESSION['zrl_override']) && $_SESSION['zrl_override']) return $_SESSION['zrl_override']; - if(x($_SESSION, 'my_url')) + if(isset($_SESSION['my_url']) && $_SESSION['my_url']) return $_SESSION['my_url']; return false; } function get_my_address() { - if(x($_SESSION, 'zid_override')) + if(isset($_SESSION['zid_override']) && $_SESSION['zid_override']) return $_SESSION['zid_override']; - if(x($_SESSION, 'my_address')) + if(isset($_SESSION['my_address']) && $_SESSION['my_address']) return $_SESSION['my_address']; return false; diff --git a/include/hubloc.php b/include/hubloc.php index 6401d1f0d..bf5d8f120 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -137,11 +137,11 @@ function remove_obsolete_hublocs() { // Do we have any invalid ones? - $r = q("select hubloc_id from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'", + $r = q("select hubloc_id, hubloc_hash from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'", dbesc(get_config('system', 'pubkey')), dbesc(z_root()) ); - $p = q("select hubloc_id from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'", + $p = q("select hubloc_id, hubloc_hash from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'", dbesc(get_config('system', 'pubkey')), dbesc(z_root()) ); diff --git a/include/items.php b/include/items.php index 28b311021..8a244db2f 100644 --- a/include/items.php +++ b/include/items.php @@ -3757,8 +3757,7 @@ function item_expire($uid,$days,$comment_days = 7) { // don't expire filed items - $terms = get_terms_oftype($item['term'],TERM_FILE); - if($terms) { + if (isset($item['term']) && get_terms_oftype($item['term'], TERM_FILE)) { retain_item($item['id']); continue; } diff --git a/include/nav.php b/include/nav.php index 71b3bec49..29d99aaee 100644 --- a/include/nav.php +++ b/include/nav.php @@ -110,12 +110,12 @@ function nav($template = 'default') { $nav['logout'] = ['logout', t('Logout'), "", t('End this session'), 'logout_nav_btn']; // user menu - $nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), ((App::$nav_sel['raw_name'] == 'Profile') ? 'active' : ''), t('Your profile page'), 'profile_nav_btn']; + $nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), ((isset(App::$nav_sel['raw_name']) && App::$nav_sel['raw_name'] == 'Profile') ? 'active' : ''), t('Your profile page'), 'profile_nav_btn']; if (feature_enabled(local_channel(), 'multi_profiles')) - $nav['usermenu'][] = ['profiles', t('Edit Profiles'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Manage/Edit profiles'), 'profiles_nav_btn']; + $nav['usermenu'][] = ['profiles', t('Edit Profiles'), ((isset(App::$nav_sel['raw_name']) && App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Manage/Edit profiles'), 'profiles_nav_btn']; else - $nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Edit your profile'), 'profiles_nav_btn']; + $nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'), ((isset(App::$nav_sel['raw_name']) && App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Edit your profile'), 'profiles_nav_btn']; } else { @@ -276,7 +276,7 @@ function nav($template = 'default') { if ($pinned_list) { foreach ($pinned_list as $app) { - if (App::$nav_sel['name'] == $app['name']) + if (isset(App::$nav_sel['name']) && App::$nav_sel['name'] == $app['name']) $app['active'] = true; if ($is_owner) { |