From 00cf07ec1a67eb81215ab310a928d7854e20023b Mon Sep 17 00:00:00 2001 From: LEDfan Date: Thu, 3 Apr 2014 18:59:34 +0200 Subject: [PATCH] Small cleanup --- lib/backend/localusers.php | 7 +------ lib/localusersaddressbookprovider.php | 8 ++------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/backend/localusers.php b/lib/backend/localusers.php index 69facf06..c6a698fa 100644 --- a/lib/backend/localusers.php +++ b/lib/backend/localusers.php @@ -77,9 +77,6 @@ class LocalUsers extends AbstractBackend { "backend" => $this->name, "active" => 1 ); - //var_dump($addressbook); - //throw new \Exception($addressBookId); - return $addressbook; } @@ -124,8 +121,6 @@ class LocalUsers extends AbstractBackend { $this->removeContacts($remove, $addressbookid); $recall = true; } - //var_dump($contacts); - //throw new \Exception('err'); if($recall === true){ return $this->getContacts($addressbookid); @@ -232,7 +227,7 @@ class LocalUsers extends AbstractBackend { */ private function removeContacts($contacts, $addressbookid){ foreach($contacts as $user){ - try{ + try{ $sql = 'DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND id = ?'; $query = \OCP\DB::prepare($sql); $result = $query->execute(array($this->userid, $user)); diff --git a/lib/localusersaddressbookprovider.php b/lib/localusersaddressbookprovider.php index 433d6996..63e09288 100644 --- a/lib/localusersaddressbookprovider.php +++ b/lib/localusersaddressbookprovider.php @@ -16,22 +16,18 @@ class LocalUsersAddressbookProvider implements \OCP\IAddressBook { */ public function search($pattern, $searchProperties, $options) { if(in_array("FN", $searchProperties) && in_array("id", $searchProperties)){ - echo "beide"; $query = 'SELECT DISTINCT * FROM `*PREFIX*contacts_ocu_cards` WHERE addressbookid = ? AND (`id` LIKE ? OR `fullname` LIKE ?) '; $stmt = \OCP\DB::prepare($query); $result = $stmt->execute(array(\OCP\User::getUser(), '%' . $pattern . "%", '%' . $pattern . "%")); } elseif(in_array("FN", $searchProperties)){ - echo "fn"; $query = 'SELECT * FROM `*PREFIX*contacts_ocu_cards` WHERE addressbookid = ? AND `fullname` LIKE ? '; $stmt = \OCP\DB::prepare($query); $result = $stmt->execute(array(\OCP\User::getUser(), '%' . $pattern . "%")); } elseif(in_array("id", $searchProperties)){ - echo "id"; $query = 'SELECT * FROM `*PREFIX*contacts_ocu_cards` WHERE addressbookid = ? AND `id` LIKE ? '; $stmt = \OCP\DB::prepare($query); $result = $stmt->execute(array(\OCP\User::getUser(), '%' . $pattern . "%")); } else { - echo "else"; $query = 'SELECT * FROM `*PREFIX*contacts_ocu_cards` WHERE addressbookid = ?'; $stmt = \OCP\DB::prepare($query); $result = $stmt->execute(array(\OCP\User::getUser())); @@ -46,7 +42,7 @@ class LocalUsersAddressbookProvider implements \OCP\IAddressBook { $contacts = array(); while( $row = $result->fetchRow()) { - $contacts[] = $row['id']; + $contacts[] = $row; } return $contacts; @@ -80,7 +76,7 @@ class LocalUsersAddressbookProvider implements \OCP\IAddressBook { * @return bool successful or not */ public function delete($id){ - + } }