diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-03-07 16:39:56 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-03-07 16:39:56 +0100 |
commit | 75323b86d157c48031b9ac8c151e4a41577a1481 (patch) | |
tree | 6e047d81b17a4bcbd15e9799ef8c5209c96a0ea5 /apps/contacts/ajax/addproperty.php | |
parent | faf6055baa224fbf4248a70d28ae4416c9c7eb1c (diff) | |
download | nextcloud-server-75323b86d157c48031b9ac8c151e4a41577a1481.tar.gz nextcloud-server-75323b86d157c48031b9ac8c151e4a41577a1481.zip |
Contacts: UI updates and ajax methods for categories.
Diffstat (limited to 'apps/contacts/ajax/addproperty.php')
-rw-r--r-- | apps/contacts/ajax/addproperty.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 028974e1c66..a28aed34d2c 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -27,14 +27,16 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$id = $_POST['id']; -$vcard = OC_Contacts_App::getContactVCard( $id ); +$id = isset($_POST['id'])?$_POST['id']:null; +$name = isset($_POST['name'])?$_POST['name']:null; +$value = isset($_POST['value'])?$_POST['value']:null; +$parameters = isset($_POST['parameters'])?$_POST['parameters']:array(); + +$vcard = OC_Contacts_App::getContactVCard($id); -$name = $_POST['name']; -$value = $_POST['value']; if(!is_array($value)){ $value = trim($value); - if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME'))) { + if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME', 'NOTE'))) { OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.')))); exit(); } @@ -51,7 +53,6 @@ if(!is_array($value)){ exit(); } } -$parameters = isset($_POST['parameters']) ? $_POST['parameters'] : array(); // Prevent setting a duplicate entry $current = $vcard->select($name); @@ -82,7 +83,9 @@ switch($name) { } case 'N': case 'ORG': + case 'NOTE': case 'NICKNAME': + // TODO: Escape commas and semicolons. break; case 'EMAIL': $value = strtolower($value); |