From e9ca17cec14c5a702cc7d656e5206a3c086dd550 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 18 Oct 2022 12:39:13 +0200 Subject: fix php warnings --- include/attach.php | 23 ++++++++++++----------- include/items.php | 6 +++--- include/photos.php | 10 +++++----- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index edf05689e..3b63bd651 100644 --- a/include/attach.php +++ b/include/attach.php @@ -962,32 +962,33 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { if($is_photo && $r) { $args = array( 'source' => $source, 'visible' => $visible, 'resource_id' => $hash, 'album' => $pathname, 'os_syspath' => $os_basepath . $os_relpath, 'os_path' => $os_path, 'display_path' => $display_path, 'filename' => $filename, 'getimagesize' => $gis, 'directory' => $direct, 'options' => $options ); - if($arr['contact_allow']) + if (array_key_exists('contact_allow', $arr)) $args['contact_allow'] = $arr['contact_allow']; - if($arr['group_allow']) + if (array_key_exists('contact_deny', $arr)) $args['group_allow'] = $arr['group_allow']; - if($arr['contact_deny']) + if (array_key_exists('contact_deny', $arr)) $args['contact_deny'] = $arr['contact_deny']; - if($arr['group_deny']) + if (array_key_exists('group_deny', $arr)) $args['group_deny'] = $arr['group_deny']; - if(array_key_exists('allow_cid',$arr)) + if (array_key_exists('allow_cid', $arr)) $args['allow_cid'] = $arr['allow_cid']; - if(array_key_exists('allow_gid',$arr)) + if (array_key_exists('allow_gid', $arr)) $args['allow_gid'] = $arr['allow_gid']; - if(array_key_exists('deny_cid',$arr)) + if (array_key_exists('deny_cid', $arr)) $args['deny_cid'] = $arr['deny_cid']; - if(array_key_exists('deny_gid',$arr)) + if (array_key_exists('deny_gid', $arr)) $args['deny_gid'] = $arr['deny_gid']; $args['created'] = $created; $args['edited'] = $edited; - if($arr['item']) + + if (array_key_exists('item', $arr)) $args['item'] = $arr['item']; - if($arr['body']) + if (array_key_exists('body', $arr)) $args['body'] = $arr['body']; - if($arr['description']) + if (array_key_exists('description', $arr)) $args['description'] = $arr['description']; $args['deliver'] = $dosync; diff --git a/include/items.php b/include/items.php index bf81cf56d..28b311021 100644 --- a/include/items.php +++ b/include/items.php @@ -1030,20 +1030,20 @@ function import_author_unknown($x) { return $r[0]['xchan_hash']; } - $name = trim($x['name']); + $name = ((isset($x['name'])) ? trim($x['name']) : 'Unknown'); $r = xchan_store_lowlevel( [ 'xchan_hash' => $x['url'], 'xchan_guid' => $x['url'], 'xchan_url' => $x['url'], - 'xchan_name' => (($name) ? $name : t('(Unknown)')), + 'xchan_name' => $name, 'xchan_name_date' => datetime_convert(), 'xchan_network' => 'unknown' ] ); - if($r && $x['photo']) { + if($r && isset($x['photo']) && $x['photo']) { $photos = import_xchan_photo($x['photo']['src'],$x['url']); diff --git a/include/photos.php b/include/photos.php index 9e4e8923d..de9cc6b13 100644 --- a/include/photos.php +++ b/include/photos.php @@ -247,13 +247,13 @@ function photo_upload($channel, $observer, $args) { 'os_storage' => $os_storage, 'os_syspath' => $args['os_syspath'], 'os_path' => $args['os_path'], 'display_path' => $args['display_path'] ]; - if ($args['created']) + if (isset($args['created'])) $p['created'] = $args['created']; - if ($args['edited']) + if (isset($args['edited'])) $p['edited'] = $args['edited']; - if ($args['title']) + if (isset($args['title'])) $p['title'] = $args['title']; - if ($args['description']) + if (isset($args['description'])) $p['description'] = $args['description']; $url = []; @@ -446,7 +446,7 @@ function photo_upload($channel, $observer, $args) { ]; // Create item container - if ($args['item']) { + if (isset($args['item'])) { foreach ($args['item'] as $i) { $item = get_item_elements($i); -- cgit v1.2.3