aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Photo.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-04-17 18:30:50 +0200
committerMax Kostikov <max@kostikov.co>2019-04-17 18:30:50 +0200
commita62f891a60fff0fd7e0a3f625524ed3277290e58 (patch)
treeb61979b38b099955a4ab70390ca5b604a1bad694 /Zotlabs/Module/Photo.php
parentc4909703243297e49cbb1e37cc16e88b499835a4 (diff)
downloadvolse-hubzilla-a62f891a60fff0fd7e0a3f625524ed3277290e58.tar.gz
volse-hubzilla-a62f891a60fff0fd7e0a3f625524ed3277290e58.tar.bz2
volse-hubzilla-a62f891a60fff0fd7e0a3f625524ed3277290e58.zip
Precise 'Modified:' header processing if no profile photo added; remove duplicated code
Diffstat (limited to 'Zotlabs/Module/Photo.php')
-rw-r--r--Zotlabs/Module/Photo.php37
1 files changed, 8 insertions, 29 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 37ae03460..37dfa03e4 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -68,7 +68,7 @@ class Photo extends \Zotlabs\Web\Controller {
}
}
- $modified = filemtime($default);
+ $modified = time();
$default = z_root() . '/' . $default;
$uid = $person;
@@ -209,45 +209,24 @@ class Photo extends \Zotlabs\Web\Controller {
if(! $exists) {
http_status_exit(404,'not found');
}
-
}
}
else
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($ismodified === 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()) {