diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-04-19 15:34:02 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-04-19 15:34:02 +0200 |
commit | 39a53113153cd5ddd985d4c1fd177c3e5fb70884 (patch) | |
tree | 0f855774b37fd28153638d05bdd953d4f83b95e7 /Zotlabs/Module | |
parent | 9b6e46dc6b245a229b0b5af0efea88c2838ce56a (diff) | |
parent | fb03e3f00e14c424062253edc1a0f76817493b05 (diff) | |
download | volse-hubzilla-39a53113153cd5ddd985d4c1fd177c3e5fb70884.tar.gz volse-hubzilla-39a53113153cd5ddd985d4c1fd177c3e5fb70884.tar.bz2 volse-hubzilla-39a53113153cd5ddd985d4c1fd177c3e5fb70884.zip |
Merge branch 'dev' into calendar_merge
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Photo.php | 43 | ||||
-rw-r--r-- | Zotlabs/Module/Setup.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Wfinger.php | 2 |
3 files changed, 15 insertions, 32 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 37ae03460..7e25e08b2 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -40,7 +40,7 @@ class Photo extends \Zotlabs\Web\Controller { call_hooks('cache_mode_hook', $cache_mode); $observer_xchan = get_observer_hash(); - $ismodified = $_SERVER['HTTP_IF_MODIFIED_SINCE']; + $cachecontrol = ''; if(isset($type)) { @@ -68,8 +68,6 @@ class Photo extends \Zotlabs\Web\Controller { } } - $modified = filemtime($default); - $default = z_root() . '/' . $default; $uid = $person; $data = ''; @@ -97,13 +95,17 @@ class Photo extends \Zotlabs\Web\Controller { $default = $d['default']; $data = $d['data']; $mimetype = $d['mimetype']; + $modified = time(); } if(! $data) { - $x = z_fetch_url($default,true,0,[ 'novalidate' => true ]); + $x = z_fetch_url(z_root() . '/' . $default, true, 0, [ 'novalidate' => true ]); $data = ($x['success'] ? $x['body'] : EMPTY_STR); $mimetype = 'image/png'; + $modified = filemtime($default); } + + $cachecontrol = ', must-revalidate'; } else { @@ -216,38 +218,18 @@ class Photo extends \Zotlabs\Web\Controller { http_status_exit(404,'not found'); } + if(! $data) + killme(); + header_remove('Pragma'); - if($ismodified === gmdate("D, d M Y H:i:s", $modified) . " GMT") { + if($_SERVER['HTTP_IF_NONE_MATCH'] === md5($data) || $_SERVER['HTTP_IF_MODIFIED_SINCE'] === gmdate("D, d M Y H:i:s", $modified) . " GMT") { header_remove('Expires'); header_remove('Cache-Control'); header_remove('Set-Cookie'); http_status_exit(304,'not modified'); - } - - if(! isset($data)) { - if(isset($resolution)) { - switch($resolution) { - case 4: - $default = get_default_profile_photo(); - break; - case 5: - $default = get_default_profile_photo(80); - break; - case 6: - $default = get_default_profile_photo(48); - break; - default: - killme(); - // NOTREACHED - break; - } - $x = z_fetch_url(z_root() . '/' . $default,true,0,[ 'novalidate' => true ]); - $data = ($x['success'] ? $x['body'] : EMPTY_STR); - $mimetype = 'image/png'; - } } - + if(isset($res) && intval($res) && $res < 500) { $ph = photo_factory($data, $mimetype); if($ph->is_valid()) { @@ -284,12 +266,13 @@ class Photo extends \Zotlabs\Web\Controller { $maxage = $expires - time(); header("Expires: " . gmdate("D, d M Y H:i:s", $expires) . " GMT"); - header("Cache-Control: max-age=" . $maxage); + header("Cache-Control: max-age=" . $maxage . $cachecontrol); } header("Content-type: " . $mimetype); header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modified) . " GMT"); + header("ETag: " . md5($data)); header("Content-Length: " . (isset($filesize) ? $filesize : strlen($data))); // If it's a file resource, stream it. diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index c809ff5ec..541e4fa21 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -377,7 +377,7 @@ class Setup extends \Zotlabs\Web\Controller { if(version_compare(PHP_VERSION, '7.1') < 0) { $help .= t('PHP version 7.1 or greater is required.'); - $this->check_add($checks, t('PHP version'), false, false, $help); + $this->check_add($checks, t('PHP version'), false, true, $help); } if(strlen($phpath)) { diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php index 03275abbc..a19bdbedc 100644 --- a/Zotlabs/Module/Wfinger.php +++ b/Zotlabs/Module/Wfinger.php @@ -128,7 +128,7 @@ class Wfinger extends \Zotlabs\Web\Controller { 'http://webfinger.net/ns/name' => $r[0]['channel_name'], 'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'], 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'], - 'http://purl.org/zot/federation' => 'zot' + 'http://purl.org/zot/federation' => 'zot,zot6' ]; foreach($aliases as $alias) |