1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Remove deprecated code.

This commit is contained in:
Thomas Tanghus 2012-07-30 05:31:48 +02:00
parent 06c8e0cfe6
commit b9e23c409e

View File

@ -82,22 +82,6 @@ class OC_Contacts_App {
$card = self::getContactObject( $id );
$vcard = OC_VObject::parse($card['carddata']);
// Try to fix cards with missing 'N' field from pre ownCloud 4. Hot damn, this is ugly...
if(!is_null($vcard) && !$vcard->__isset('N')) {
$version = OCP\App::getAppVersion('contacts');
if($version >= 5) {
OCP\Util::writeLog('contacts', 'OC_Contacts_App::getContactVCard. Deprecated check for missing N field', OCP\Util::DEBUG);
}
OCP\Util::writeLog('contacts', 'getContactVCard, Missing N field', OCP\Util::DEBUG);
if($vcard->__isset('FN')) {
OCP\Util::writeLog('contacts', 'getContactVCard, found FN field: '.$vcard->__get('FN'), OCP\Util::DEBUG);
$n = implode(';', array_reverse(array_slice(explode(' ', $vcard->__get('FN')), 0, 2))).';;;';
$vcard->setString('N', $n);
OC_Contacts_VCard::edit( $id, $vcard);
} else { // Else just add an empty 'N' field :-P
$vcard->setString('N', 'Unknown;Name;;;');
}
}
if (!is_null($vcard) && !isset($vcard->REV)) {
$rev = new DateTime('@'.$card['lastmodified']);
$vcard->setString('REV', $rev->format(DateTime::W3C));