diff options
author | Max Kostikov <max@kostikov.co> | 2019-04-05 14:10:48 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-04-05 14:10:48 +0200 |
commit | e20c5cf9cf56eaf6af23676996fa8a1d63208899 (patch) | |
tree | 9d651ce840f42a2330fed7b8d527003b47781dbf /Zotlabs/Module/Photo.php | |
parent | 0c2db1cea593ea0f59d1cd3c918a5bccaf90c4c5 (diff) | |
download | volse-hubzilla-e20c5cf9cf56eaf6af23676996fa8a1d63208899.tar.gz volse-hubzilla-e20c5cf9cf56eaf6af23676996fa8a1d63208899.tar.bz2 volse-hubzilla-e20c5cf9cf56eaf6af23676996fa8a1d63208899.zip |
Prevent return wrong profile photo modification date by plugin
Diffstat (limited to 'Zotlabs/Module/Photo.php')
-rw-r--r-- | Zotlabs/Module/Photo.php | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 96a4e1f40..c31e63262 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -71,29 +71,31 @@ 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"); + $data = dbunescbin($r[0]['content']); + $mimetype = $r[0]['mimetype']; + } + if(intval($r[0]['os_storage'])) + $data = file_get_contents($data); + 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) { |