diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-04-22 20:38:17 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-04-22 20:47:24 +0200 |
commit | 8a6cb23170b95336770bc4dcd6d58583de82815e (patch) | |
tree | c3811c2a26c9a64af5b6972d98659d5238d11b30 /apps/contacts | |
parent | 1bba4456420d1824ab6d58f3d9bb523fcde5c4c2 (diff) | |
download | nextcloud-server-8a6cb23170b95336770bc4dcd6d58583de82815e.tar.gz nextcloud-server-8a6cb23170b95336770bc4dcd6d58583de82815e.zip |
Contacts: Clear cache for contact photo and thumbnail when it has been changed.
Diffstat (limited to 'apps/contacts')
-rw-r--r-- | apps/contacts/ajax/savecrop.php | 2 | ||||
-rw-r--r-- | apps/contacts/photo.php | 9 | ||||
-rw-r--r-- | apps/contacts/thumbnail.php | 3 |
3 files changed, 11 insertions, 3 deletions
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php index 73ac521e04b..d003834ef8c 100644 --- a/apps/contacts/ajax/savecrop.php +++ b/apps/contacts/ajax/savecrop.php @@ -94,6 +94,8 @@ if(file_exists($tmp_path)) { OC_Log::write('contacts','savecrop.php: files: Adding PHOTO property.', OC_Log::DEBUG); $card->addProperty('PHOTO', $image->__toString(), array('ENCODING' => 'b', 'TYPE' => $image->mimeType())); } + $now = new DateTime; + $card->setString('REV', $now->format(DateTime::W3C)); if(!OC_Contacts_VCard::edit($id,$card)) { bailOut('Error saving contact.'); } diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php index 298f1215e3c..117d0a9808f 100644 --- a/apps/contacts/photo.php +++ b/apps/contacts/photo.php @@ -19,7 +19,12 @@ function getStandardImage(){ OC_Response::redirect(OC_Helper::imagePath('contacts', 'person_large.png')); } -$id = $_GET['id']; +$id = isset($_GET['id']) ? $_GET['id'] : null; +$caching = isset($_GET['refresh']) ? 0 : null; + +if(is_null($id)) { + getStandardImage(); +} $contact = OC_Contacts_App::getContactVCard($id); $image = new OC_Image(); @@ -30,7 +35,7 @@ if(!$image) { if( is_null($contact)) { OC_Log::write('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR); } else { - OC_Response::enableCaching(); + OC_Response::enableCaching($caching); OC_Contacts_App::setLastModifiedHeader($contact); // Photo :-) diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php index 5082626499b..28b8eba22c9 100644 --- a/apps/contacts/thumbnail.php +++ b/apps/contacts/thumbnail.php @@ -39,6 +39,7 @@ if(!function_exists('imagecreatefromjpeg')) { } $id = $_GET['id']; +$caching = isset($_GET['refresh']) ? 0 : null; $contact = OC_Contacts_App::getContactVCard($id); @@ -48,7 +49,7 @@ if(is_null($contact)){ getStandardImage(); exit(); } -OC_Response::enableCaching(); +OC_Response::enableCaching($caching); OC_Contacts_App::setLastModifiedHeader($contact); $thumbnail_size = 23; |