Precise 'Modified:' header processing if no profile photo added; remove duplicated code
This commit is contained in:
parent
c490970324
commit
a62f891a60
@ -68,7 +68,7 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$modified = filemtime($default);
|
$modified = time();
|
||||||
$default = z_root() . '/' . $default;
|
$default = z_root() . '/' . $default;
|
||||||
$uid = $person;
|
$uid = $person;
|
||||||
|
|
||||||
@ -209,13 +209,15 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
if(! $exists) {
|
if(! $exists) {
|
||||||
http_status_exit(404,'not found');
|
http_status_exit(404,'not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
http_status_exit(404,'not found');
|
http_status_exit(404,'not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! $data)
|
||||||
|
killme();
|
||||||
|
|
||||||
header_remove('Pragma');
|
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") {
|
||||||
@ -225,29 +227,6 @@ class Photo extends \Zotlabs\Web\Controller {
|
|||||||
http_status_exit(304,'not modified');
|
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) {
|
if(isset($res) && intval($res) && $res < 500) {
|
||||||
$ph = photo_factory($data, $mimetype);
|
$ph = photo_factory($data, $mimetype);
|
||||||
if($ph->is_valid()) {
|
if($ph->is_valid()) {
|
||||||
|
Reference in New Issue
Block a user