From 3ab079e781de546be4ae4a60277fc4ce83243036 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 26 Oct 2012 00:02:44 +0200 Subject: [PATCH] Cut some more off of the json response. --- ajax/contact/addproperty.php | 2 +- ajax/contact/saveproperty.php | 2 +- lib/app.php | 2 +- lib/vcard.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ajax/contact/addproperty.php b/ajax/contact/addproperty.php index f8b1b97c..a8b8e6d3 100644 --- a/ajax/contact/addproperty.php +++ b/ajax/contact/addproperty.php @@ -152,7 +152,7 @@ foreach ($parameters as $key=>$element) { } } } -$checksum = md5($vcard->children[$line]->serialize()); +$checksum = substr(md5($vcard->children[$line]->serialize()), 0, 8); try { OCA\Contacts\VCard::edit($id, $vcard); diff --git a/ajax/contact/saveproperty.php b/ajax/contact/saveproperty.php index eae0b881..eafbf778 100644 --- a/ajax/contact/saveproperty.php +++ b/ajax/contact/saveproperty.php @@ -174,7 +174,7 @@ if(!$value) { } // Do checksum and be happy if(in_array($name, $multi_properties)) { - $checksum = md5($property->serialize()); + $checksum = substr(md5($property->serialize()), 0, 8); } } //debug('New checksum: '.$checksum); diff --git a/lib/app.php b/lib/app.php index 43a9667c..9d447481 100644 --- a/lib/app.php +++ b/lib/app.php @@ -55,7 +55,7 @@ class App { public static function getPropertyLineByChecksum($vcard, $checksum) { $line = null; for($i=0;$ichildren);$i++) { - if(md5($vcard->children[$i]->serialize()) == $checksum ) { + if(substr(md5($vcard->children[$i]->serialize()), 0, 8) == $checksum ) { $line = $i; break; } diff --git a/lib/vcard.php b/lib/vcard.php index 37a0b1a5..a25f7543 100644 --- a/lib/vcard.php +++ b/lib/vcard.php @@ -736,7 +736,7 @@ class VCard { // This cuts around a 3rd off of the json response size. if(in_array($property->name, App::$multi_properties)) { - $temp['checksum'] = md5($property->serialize()); + $temp['checksum'] = substr(md5($property->serialize()), 0, 8); } foreach($property->parameters as $parameter) { // Faulty entries by kaddressbook