diff options
author | Mario <mario@mariovavti.com> | 2022-09-14 12:31:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-09-14 12:31:19 +0000 |
commit | 1d56b9a1bb155d7a0b4377f9bb1e195230e545e4 (patch) | |
tree | f7b6413727a97cfa0512dc9701d493d6751dc741 /include/photo | |
parent | 96535ee4df967f04d4cc6c3b7f9ab335a50f543d (diff) | |
download | volse-hubzilla-1d56b9a1bb155d7a0b4377f9bb1e195230e545e4.tar.gz volse-hubzilla-1d56b9a1bb155d7a0b4377f9bb1e195230e545e4.tar.bz2 volse-hubzilla-1d56b9a1bb155d7a0b4377f9bb1e195230e545e4.zip |
php8: warning fixes
Diffstat (limited to 'include/photo')
-rw-r--r-- | include/photo/photo_driver.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 3fced76f2..14408ea50 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -263,16 +263,23 @@ function import_xchan_photo($photo, $xchan, $thing = false, $force = false) { $hdrs[strtolower($t)] = $v; } + $expires = time() + 86400; + if(array_key_exists('expires', $hdrs)) $expires = strtotime($hdrs['expires']); - if($expires - 60 < time()) - $expires = time() + 60; + + if($expires - 60 < time()) { + $expires = time() + 60; + } else { $cc = ''; - if(array_key_exists('cache-control', $hdrs)) + if(array_key_exists('cache-control', $hdrs)) { $cc = $hdrs['cache-control']; - if(strpos($cc, 'no-cache')) + } + + if(strpos($cc, 'no-cache')) { $expires = time() + 60; + } else { $ttl = (preg_match('/max-age=(\d+)/i', $cc, $o) ? intval($o[1]) : 86400); $expires = time() + $ttl; @@ -297,7 +304,7 @@ function import_xchan_photo($photo, $xchan, $thing = false, $force = false) { $micro = z_root() . '/photo/' . $hash . '-6'; if(isset($result)) q("UPDATE photo SET expires = '%s' WHERE xchan = '%s' and photo_usage = %d and imgscale IN (4, 5, 6)", - dbescdate(gmdate('Y-m-d H:i:s', (isset($expires) ? $expires : time() + 86400))), + dbescdate(gmdate('Y-m-d H:i:s', $expires)), dbesc($xchan), intval(PHOTO_XCHAN) ); |