summaryrefslogtreecommitdiffstats
path: root/core/avatar/controller.php
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-09-01 21:17:48 +0200
committerkondou <kondou@ts.unde.re>2013-09-01 21:17:48 +0200
commit74c922328123fe40265e3f4e42a34feff057c0d6 (patch)
treed8f0a77ecd1f3b2f88fafc076f317cd5ed28241b /core/avatar/controller.php
parentc95d4cafa90ab1775cae1fd5d70f098005f8b134 (diff)
downloadnextcloud-server-74c922328123fe40265e3f4e42a34feff057c0d6.tar.gz
nextcloud-server-74c922328123fe40265e3f4e42a34feff057c0d6.zip
Properly check for tmpavatar, invalidate cache, fix debug msgs
Diffstat (limited to 'core/avatar/controller.php')
-rw-r--r--core/avatar/controller.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/avatar/controller.php b/core/avatar/controller.php
index 249c4cb6e2b..5044f3374cd 100644
--- a/core/avatar/controller.php
+++ b/core/avatar/controller.php
@@ -28,6 +28,11 @@ class OC_Core_Avatar_Controller {
$avatar = new \OC_Avatar();
$image = $avatar->get($user, $size);
+ header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
+ header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT');
+ header('Cache-Control: no-store, no-cache, must-revalidate');
+ header('Cache-Control: post-check=0, pre-check=0', false);
+ header('Pragma: no-cache');
if ($image instanceof \OC_Image) {
$image->show();
} elseif ($image === false) {
@@ -99,12 +104,18 @@ class OC_Core_Avatar_Controller {
$user = OC_User::getUser();
$tmpavatar = \OC_Cache::get('tmpavatar');
- if ($tmpavatar === false) {
- \OC_JSON::error();
+ if (is_null($tmpavatar)) {
+ $l = new \OC_L10n('core');
+ \OC_JSON::error(array("data" => array("message" => $l->t("No temporary avatar available, try again")) ));
return;
}
$image = new \OC_Image($tmpavatar);
+ header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
+ header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT');
+ header('Cache-Control: no-store, no-cache, must-revalidate');
+ header('Cache-Control: post-check=0, pre-check=0', false);
+ header('Pragma: no-cache');
$image->show();
}
@@ -119,7 +130,7 @@ class OC_Core_Avatar_Controller {
}
$tmpavatar = \OC_Cache::get('tmpavatar');
- if ($tmpavatar === false) {
+ if (is_null($tmpavatar)) {
$l = new \OC_L10n('core');
\OC_JSON::error(array("data" => array("message" => $l->t("No temporary avatar available, try again")) ));
return;