diff options
author | Mario <mario@mariovavti.com> | 2022-10-12 19:36:24 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-12 19:36:24 +0000 |
commit | 71efb0565803018cb1ba362706c763714c596cf7 (patch) | |
tree | 508827af55db42365892e6064f0e009e5068567e /include | |
parent | a9a36894cb2637b546ed566ee06f20511cce031f (diff) | |
download | volse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.tar.gz volse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.tar.bz2 volse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.zip |
fix php warnings
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 42 | ||||
-rw-r--r-- | include/items.php | 16 |
2 files changed, 32 insertions, 26 deletions
diff --git a/include/attach.php b/include/attach.php index 32a86fcba..37d176adb 100644 --- a/include/attach.php +++ b/include/attach.php @@ -491,7 +491,7 @@ function attach_by_hash_nodata($hash, $observer_hash, $rev = 0) { function attach_store($channel, $observer_hash, $options = '', $arr = null) { require_once('include/photos.php'); - +hz_syslog(print_r($channel,true)); /** * @hooks photo_upload_begin * Called when attempting to upload a photo. @@ -501,13 +501,13 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $ret = array('success' => false); $channel_id = $channel['channel_id']; $sql_options = ''; - $source = (($arr) ? $arr['source'] : ''); - $album = (($arr) ? $arr['album'] : ''); - $newalbum = (($arr) ? $arr['newalbum'] : ''); - $hash = (($arr && $arr['hash']) ? $arr['hash'] : null); - $upload_path = (($arr && $arr['directory']) ? $arr['directory'] : ''); - $visible = (($arr && $arr['visible']) ? $arr['visible'] : ''); - $notify = (($arr && $arr['notify']) ? $arr['notify'] : ''); + $source = $arr['source'] ?? ''; + $album = $arr['album'] ?? ''; + $newalbum = $arr['newalbum'] ?? ''; + $hash = $arr['hash'] ?? null; + $upload_path = $arr['directory'] ?? ''; + $visible = $arr['visible'] ?? 0; + $notify = $arr['notify'] ?? 0; $observer = array(); @@ -528,10 +528,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { return $ret; } - $str_group_allow = perms2str($arr['group_allow']); - $str_contact_allow = perms2str($arr['contact_allow']); - $str_group_deny = perms2str($arr['group_deny']); - $str_contact_deny = perms2str($arr['contact_deny']); + $str_group_allow = ((isset($arr['group_allow'])) ? perms2str($arr['group_allow']) : ''); + $str_contact_allow = ((isset($arr['contact_allow'])) ? perms2str($arr['contact_allow']) : ''); + $str_group_deny = ((isset($arr['group_deny'])) ? perms2str($arr['group_deny']) : ''); + $str_contact_deny = ((isset($arr['contact_deny'])) ? perms2str($arr['contact_deny']) : ''); // The 'update' option sets db values without uploading a new attachment @@ -546,6 +546,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { $remove_when_processed = true; $import_replace = false; + $type = ''; + if($options === 'import') { $src = $arr['src']; $filename = $arr['filename']; @@ -707,10 +709,10 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { // if we need to create a directory, use the channel default permissions. - $darr['allow_cid'] = $channel['allow_cid']; - $darr['allow_gid'] = $channel['allow_gid']; - $darr['deny_cid'] = $channel['deny_cid']; - $darr['deny_gid'] = $channel['deny_gid']; + $darr['allow_cid'] = $channel['channel_allow_cid']; + $darr['allow_gid'] = $channel['channel_allow_gid']; + $darr['deny_cid'] = $channel['channel_deny_cid']; + $darr['deny_gid'] = $channel['channel_deny_gid']; $direct = null; @@ -1175,7 +1177,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { return $ret; } - $arr['hash'] = (($arr['hash']) ? $arr['hash'] : new_uuid()); + $arr['hash'] = $arr['hash'] ?? new_uuid(); // Check for duplicate name. // Check both the filename and the hash as we will be making use of both. @@ -1201,6 +1203,9 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { return $ret; } + $path = ''; + $dpath = ''; + if($arr['folder']) { // Walk the directory tree from parent back to root to make sure the parent is valid and name is unique and we @@ -1237,8 +1242,7 @@ function attach_mkdir($channel, $observer_hash, $arr = null) { $path = $lpath; } - else - $path = ''; + $created = datetime_convert(); diff --git a/include/items.php b/include/items.php index be3c83f7d..bf81cf56d 100644 --- a/include/items.php +++ b/include/items.php @@ -2966,18 +2966,20 @@ function tgroup_check($uid, $item) { if(! $u) return false; - - $terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_FORUM)); - - if($terms) - logger('tgroup_check: post mentions: ' . print_r($terms,true), LOGGER_DATA); - $max_forums = get_config('system','max_tagged_forums',2); $matched_forums = 0; $link = normalise_link($u[0]['xchan_url']); + $terms = []; + + if (isset($item['terms']) && $item['terms']) { + $terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_FORUM)); + } + if($terms) { + logger('tgroup_check: post mentions: ' . print_r($terms,true), LOGGER_DATA); + foreach($terms as $term) { if(! link_compare($term['url'],$link)) { continue; @@ -4715,7 +4717,7 @@ function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow, foreach($linkified as $x) { $access_tag = $x['success']['access_tag']; if(($access_tag) && (! $parent_item)) { - logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA); + logger('access_tag: ' . print_r($access_tag,true), LOGGER_DATA); if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) { // This is a tough call, hence configurable. The issue is that one can type in a @!privacy mention |