From 990a3af2a7349e07c10224cf2a023d179ecfd6ca Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Sep 2022 20:02:22 +0000 Subject: php8: random cleanup and warning fixes --- Zotlabs/Photo/PhotoDriver.php | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'Zotlabs/Photo') diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php index f50ef17ae..7439ab401 100644 --- a/Zotlabs/Photo/PhotoDriver.php +++ b/Zotlabs/Photo/PhotoDriver.php @@ -421,30 +421,30 @@ abstract class PhotoDriver { $p = []; - $p['aid'] = ((intval($arr['aid'])) ? intval($arr['aid']) : 0); - $p['uid'] = ((intval($arr['uid'])) ? intval($arr['uid']) : 0); - $p['xchan'] = (($arr['xchan']) ? $arr['xchan'] : ''); - $p['resource_id'] = (($arr['resource_id']) ? $arr['resource_id'] : ''); - $p['filename'] = (($arr['filename']) ? $arr['filename'] : ''); - $p['mimetype'] = (($arr['mimetype']) ? $arr['mimetype'] : $this->getType()); - $p['album'] = (($arr['album']) ? $arr['album'] : ''); - $p['imgscale'] = ((intval($arr['imgscale'])) ? intval($arr['imgscale']) : 0); - $p['allow_cid'] = (($arr['allow_cid']) ? $arr['allow_cid'] : ''); - $p['allow_gid'] = (($arr['allow_gid']) ? $arr['allow_gid'] : ''); - $p['deny_cid'] = (($arr['deny_cid']) ? $arr['deny_cid'] : ''); - $p['deny_gid'] = (($arr['deny_gid']) ? $arr['deny_gid'] : ''); - $p['edited'] = (($arr['edited']) ? $arr['edited'] : datetime_convert()); - $p['title'] = (($arr['title']) ? $arr['title'] : ''); - $p['description'] = (($arr['description']) ? $arr['description'] : ''); - $p['photo_usage'] = intval($arr['photo_usage']); - $p['os_storage'] = intval($arr['os_storage']); - $p['os_path'] = $arr['os_path']; - $p['os_syspath'] = ((array_key_exists('os_syspath', $arr)) ? $arr['os_syspath'] : ''); - $p['display_path'] = (($arr['display_path']) ? $arr['display_path'] : ''); - $p['width'] = (($arr['width']) ? $arr['width'] : $this->getWidth()); - $p['height'] = (($arr['height']) ? $arr['height'] : $this->getHeight()); - $p['expires'] = (($arr['expires']) ? $arr['expires'] : gmdate('Y-m-d H:i:s', time() + get_config('system', 'photo_cache_time', 86400))); - $p['profile'] = ((array_key_exists('profile', $arr)) ? intval($arr['profile']) : 0); + $p['aid'] = $arr['aid'] ?? 0; + $p['uid'] = $arr['uid'] ?? 0; + $p['xchan'] = $arr['xchan'] ?? ''; + $p['resource_id'] = $arr['resource_id'] ?? ''; + $p['filename'] = $arr['filename'] ?? ''; + $p['mimetype'] = $arr['mimetype'] ?? $this->getType(); + $p['album'] = $arr['album'] ?? ''; + $p['imgscale'] = $arr['imgscale'] ?? 0; + $p['allow_cid'] = $arr['allow_cid'] ?? ''; + $p['allow_gid'] = $arr['allow_gid'] ?? ''; + $p['deny_cid'] = $arr['deny_cid'] ?? ''; + $p['deny_gid'] = $arr['deny_gid'] ?? ''; + $p['edited'] = $arr['edited'] ?? datetime_convert(); + $p['title'] = $arr['title'] ?? ''; + $p['description'] = $arr['description'] ?? ''; + $p['photo_usage'] = $arr['photo_usage'] ?? PHOTO_NORMAL; + $p['os_storage'] = $arr['os_storage'] ?? 1; + $p['os_path'] = $arr['os_path'] ?? ''; + $p['os_syspath'] = $arr['os_syspath'] ?? ''; + $p['display_path'] = $arr['display_path'] ?? ''; + $p['width'] = $arr['width'] ?? $this->getWidth(); + $p['height'] = $arr['height'] ?? $this->getHeight(); + $p['expires'] = $arr['expires'] ?? gmdate('Y-m-d H:i:s', time() + get_config('system', 'photo_cache_time', 86400)); + $p['profile'] = $arr['profile'] ?? 0; if(! intval($p['imgscale'])) logger('save: ' . print_r($arr, true), LOGGER_DATA); @@ -452,7 +452,7 @@ abstract class PhotoDriver { $x = q("select id, created from photo where resource_id = '%s' and uid = %d and xchan = '%s' and imgscale = %d limit 1", dbesc($p['resource_id']), intval($p['uid']), dbesc($p['xchan']), intval($p['imgscale'])); if($x) { - $p['created'] = (($x['created']) ? $x['created'] : $p['edited']); + $p['created'] = $x['created'] ?? $p['edited']; $r = q("UPDATE photo set aid = %d, uid = %d, -- cgit v1.2.3