From 35b3b8756ed904ffeddf525982bc6567caca4fbc Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 20:24:05 +0100 Subject: [PATCH] Changed SQL queries for looking up contacts to only query once and sort at the same time. --- ajax/addcard.php | 1 - ajax/contacts.php | 15 --------------- index.php | 17 ----------------- 3 files changed, 33 deletions(-) diff --git a/ajax/addcard.php b/ajax/addcard.php index 54c455e5..9d782246 100644 --- a/ajax/addcard.php +++ b/ajax/addcard.php @@ -61,6 +61,5 @@ foreach( $add as $propname){ $vcard->addProperty($propname, $value, $prop_parameters); } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); -OC_Log::write('contacts','ajax/addcard.php - adding id: '.$id,OC_Log::DEBUG); OC_Contacts_App::renderDetails($id, $vcard); diff --git a/ajax/contacts.php b/ajax/contacts.php index 54ad3e4c..cf867641 100644 --- a/ajax/contacts.php +++ b/ajax/contacts.php @@ -12,21 +12,6 @@ OC_JSON::checkAppEnabled('contacts'); $ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); $contacts = OC_Contacts_VCard::all($ids); -//OC_Log::write('contacts','contacts.php: '.count($contacts).' contacts.',OC_Log::DEBUG); -/* -$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser()); -$contacts = array(); -foreach( $addressbooks as $addressbook ){ - $addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']); - foreach( $addressbookcontacts as $contact ){ - if(is_null($contact['fullname'])){ - continue; - } - $contacts[] = $contact; - } -} -usort($contacts,'contacts_namesort'); -*/ $tmpl = new OC_TEMPLATE("contacts", "part.contacts"); $tmpl->assign('contacts', $contacts); $page = $tmpl->fetchPage(); diff --git a/index.php b/index.php index 5ab6f293..b392b195 100644 --- a/index.php +++ b/index.php @@ -42,23 +42,6 @@ OC_App::setActiveNavigationEntry( 'contacts_index' ); // Load a specific user? $id = isset( $_GET['id'] ) ? $_GET['id'] : null; -/* -// sort addressbooks (use contactsort) -usort($addressbooks,'contacts_namesort'); - -$contacts = array(); -foreach( $addressbooks as $addressbook ){ - $addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']); - foreach( $addressbookcontacts as $contact ){ - if(is_null($contact['fullname'])){ - continue; - } - $contacts[] = $contact; - } -} - -usort($contacts,'contacts_namesort'); -*/ $details = array(); // FIXME: This cannot work..?