/** * @brief Add property to vcard object * @param object $vcard * @param object $name of property * @param object $value of property * @param object $paramerters of property */ public static function addVCardProperty($vcard, $name, $value, $parameters = array()) { if (is_array($value)) { $value = OC_Contacts_VCard::escapeSemicolons($value); } $property = new Sabre_VObject_Property($name, $value); $parameternames = array_keys($parameters); foreach ($parameternames as $i) { $property->parameters[] = new Sabre_VObject_Parameter($i, $parameters[$i]); } $vcard->add($property); return $property; }
exit; } $line = null; for ($i = 0; $i < count($vcard->children); $i++) { if (md5($vcard->children[$i]->serialize()) == $checksum) { $line = $i; } } if (is_null($line)) { OC_JSON::error(array('data' => array('message' => $l10n->t('Information about vCard is incorrect. Please reload the page.')))); exit; } // Set the value $value = $_POST['value']; if (is_array($value)) { $value = OC_Contacts_VCard::escapeSemicolons($value); } $vcard->children[$line]->setValue($value); // Add parameters $postparameters = isset($_POST['parameters']) ? $_POST['parameters'] : array(); for ($i = 0; $i < count($vcard->children[$line]->parameters); $i++) { $name = $vcard->children[$line]->parameters[$i]->name; if (array_key_exists($name, $postparameters)) { if ($postparameters[$name] == '' || is_null($postparameters[$name])) { unset($vcard->children[$line]->parameters[$i]); } else { $vcard->children[$line]->parameters[$i]->value = $postparameters[$name]; } unset($postparameters[$name]); } }