Merge branch 'dev' into 'dev'

Prevent return wrong profile photo modification date by plugin

See merge request hubzilla/core!1582
This commit is contained in:
Max Kostikov
2019-04-05 14:24:22 +02:00

View File

@@ -72,6 +72,23 @@ class Photo extends \Zotlabs\Web\Controller {
$default = z_root() . '/' . $default; $default = z_root() . '/' . $default;
$uid = $person; $uid = $person;
$data = '';
$r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
intval($resolution),
intval($uid),
intval(PHOTO_PROFILE)
);
if($r) {
$modified = strtotime($r[0]['edited'] . "Z");
$mimetype = $r[0]['mimetype'];
if(intval($r[0]['os_storage']))
$data = file_get_contents($data);
else
$data = dbunescbin($r[0]['content']);
}
if(! $data) {
$d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ]; $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ];
call_hooks('get_profile_photo',$d); call_hooks('get_profile_photo',$d);
@@ -80,20 +97,6 @@ class Photo extends \Zotlabs\Web\Controller {
$default = $d['default']; $default = $d['default'];
$data = $d['data']; $data = $d['data'];
$mimetype = $d['mimetype']; $mimetype = $d['mimetype'];
if(! $data) {
$r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1",
intval($resolution),
intval($uid),
intval(PHOTO_PROFILE)
);
if($r) {
$modified = strtotime($r[0]['edited'] . "Z");
$data = dbunescbin($r[0]['content']);
$mimetype = $r[0]['mimetype'];
}
if(intval($r[0]['os_storage']))
$data = file_get_contents($data);
} }
if(! $data) { if(! $data) {