diff options
author | Max Kostikov <max@kostikov.co> | 2019-04-05 14:24:22 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-04-05 14:24:22 +0200 |
commit | 9d5f8883a7d7767b447771664209761f9e3ce66f (patch) | |
tree | 20ceb5d509acfdf4be5a7aee277d9c154e000a33 | |
parent | 6adb489cb3e82d988f40b3ad79041bf8c6e48f32 (diff) | |
parent | 8e0b9b82e9e6791d264703e5b823f8cbd5504dff (diff) | |
download | volse-hubzilla-9d5f8883a7d7767b447771664209761f9e3ce66f.tar.gz volse-hubzilla-9d5f8883a7d7767b447771664209761f9e3ce66f.tar.bz2 volse-hubzilla-9d5f8883a7d7767b447771664209761f9e3ce66f.zip |
Merge branch 'dev' into 'dev'
Prevent return wrong profile photo modification date by plugin
See merge request hubzilla/core!1582
-rw-r--r-- | Zotlabs/Module/Photo.php | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 96a4e1f40..6912322aa 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -71,29 +71,32 @@ class Photo extends \Zotlabs\Web\Controller { $modified = filemtime($default); $default = z_root() . '/' . $default; $uid = $person; + + $data = ''; - $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ]; - call_hooks('get_profile_photo',$d); - - $resolution = $d['imgscale']; - $uid = $d['channel_id']; - $default = $d['default']; - $data = $d['data']; - $mimetype = $d['mimetype']; - + $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) { - $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); + $d = [ 'imgscale' => $resolution, 'channel_id' => $uid, 'default' => $default, 'data' => '', 'mimetype' => '' ]; + call_hooks('get_profile_photo',$d); + + $resolution = $d['imgscale']; + $uid = $d['channel_id']; + $default = $d['default']; + $data = $d['data']; + $mimetype = $d['mimetype']; } if(! $data) { |