summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-08-23 01:18:59 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-08-23 01:18:59 +0200
commit99d17c5190435b2d60ce4316a1a8a7cfdebc212e (patch)
treee8fc08adff65bfe59e942b4d2373714771d1bbd4 /apps
parent1df596e758dcb6c17474ce2b0856def05763d510 (diff)
downloadnextcloud-server-99d17c5190435b2d60ce4316a1a8a7cfdebc212e.tar.gz
nextcloud-server-99d17c5190435b2d60ce4316a1a8a7cfdebc212e.zip
Don't add empty property parameters.
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/ajax/contact/addproperty.php6
-rw-r--r--apps/contacts/ajax/contact/saveproperty.php18
2 files changed, 16 insertions, 8 deletions
diff --git a/apps/contacts/ajax/contact/addproperty.php b/apps/contacts/ajax/contact/addproperty.php
index 0447950fbdd..89f7a2bd9a3 100644
--- a/apps/contacts/ajax/contact/addproperty.php
+++ b/apps/contacts/ajax/contact/addproperty.php
@@ -141,11 +141,15 @@ foreach ($parameters as $key=>$element) {
// And it probably shouldn't be done here anyways :-/
foreach($element as $e) {
if($e != '' && !is_null($e)) {
- $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
+ if(trim($e)) {
+ $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
+ }
}
}
} else {
+ if(trim($element)) {
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $element);
+ }
}
}
$checksum = md5($vcard->children[$line]->serialize());
diff --git a/apps/contacts/ajax/contact/saveproperty.php b/apps/contacts/ajax/contact/saveproperty.php
index 9556c4a44c3..296b9ad3b77 100644
--- a/apps/contacts/ajax/contact/saveproperty.php
+++ b/apps/contacts/ajax/contact/saveproperty.php
@@ -133,17 +133,21 @@ if(!$value) {
debug('Adding parameter: '.$key);
if(is_array($parameter)) {
foreach($parameter as $val) {
- debug('Adding parameter: '.$key.'=>'.$val);
+ if(trim($val)) {
+ debug('Adding parameter: '.$key.'=>'.$val);
+ $vcard->children[$line]->add(new Sabre_VObject_Parameter(
+ $key,
+ strtoupper(strip_tags($val)))
+ );
+ }
+ }
+ } else {
+ if(trim($parameter)) {
$vcard->children[$line]->add(new Sabre_VObject_Parameter(
$key,
- strtoupper(strip_tags($val)))
+ strtoupper(strip_tags($parameter)))
);
}
- } else {
- $vcard->children[$line]->add(new Sabre_VObject_Parameter(
- $key,
- strtoupper(strip_tags($parameter)))
- );
}
}
}