]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: Clear cache for contact photo and thumbnail when it has been changed.
authorThomas Tanghus <thomas@tanghus.net>
Sun, 22 Apr 2012 18:38:17 +0000 (20:38 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sun, 22 Apr 2012 18:47:24 +0000 (20:47 +0200)
apps/contacts/ajax/savecrop.php
apps/contacts/photo.php
apps/contacts/thumbnail.php

index 73ac521e04bf0331cf7e2cc9a7c9c527131ff104..d003834ef8c963966e0d58f07fd6ed82d754d43d 100644 (file)
@@ -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.');
                                        }
index 298f1215e3c467685b629cdd37d832093ba28a57..117d0a9808f6b4b0147eaa4de3777070abaef676 100644 (file)
@@ -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 :-)
index 5082626499bacbd10fc33a58a19157dd4f8c7af0..28b8eba22c91a032bb8d7218188ccda9efddc17b 100644 (file)
@@ -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;