diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-01-12 18:04:23 +0100 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-01-12 22:50:12 +0100 |
commit | e60860148cbe9e97cd898712b63302da3df82ed0 (patch) | |
tree | 0599179896c776dcefff50b93a8f4505eddd707c /apps | |
parent | 22356533a0529197d8a4c383307b566f94ed6fc4 (diff) | |
download | nextcloud-server-e60860148cbe9e97cd898712b63302da3df82ed0.tar.gz nextcloud-server-e60860148cbe9e97cd898712b63302da3df82ed0.zip |
Don't chunk_split encoded image string.
Don't return json error but null if card can't be parsed.
Small check for non-parsable card in index.php.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/contacts/index.php | 12 | ||||
-rw-r--r-- | apps/contacts/lib/app.php | 9 |
2 files changed, 9 insertions, 12 deletions
diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 6f65ac1c605..b179d9bbfe5 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -44,19 +44,17 @@ OC_App::setActiveNavigationEntry( 'contacts_index' ); $id = isset( $_GET['id'] ) ? $_GET['id'] : null; $details = array(); -// FIXME: This cannot work..? if(is_null($id) && count($contacts) > 0) { $id = $contacts[0]['id']; } +$vcard = null; +$details = null; if(!is_null($id)) { $vcard = OC_Contacts_App::getContactVCard($id); - $details = OC_Contacts_VCard::structureContact($vcard); + if(!is_null($vcard) { + $details = OC_Contacts_VCard::structureContact($vcard); + } } -// if( !is_null($id)/* || count($contacts)*/){ -// if(is_null($id)) $id = $contacts[0]['id']; -// $vcard = OC_Contacts_App::getContactVCard($id); -// $details = OC_Contacts_VCard::structureContact($vcard); -// } // Include Style and Script OC_Util::addScript('contacts','interface'); diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index 907ce82c76a..00a830d5e5f 100644 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -56,15 +56,14 @@ class OC_Contacts_App{ return $card; } + /** + * @brief Gets the VCard as text + * @returns The card or null if the card could not be parsed. + */ public static function getContactVCard($id){ $card = self::getContactObject( $id ); $vcard = OC_VObject::parse($card['carddata']); - // Check if the card is valid - if(is_null($vcard)){ - OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('vCard could not be read.')))); - exit(); - } return $vcard; } |