From 42a65497295aeba95163af89802989701aea30ca Mon Sep 17 00:00:00 2001
From: Jakob Sack <kde@jakobsack.de>
Date: Sat, 6 Aug 2011 23:09:38 +0200
Subject: [PATCH] Database.xml

---
 apps/contacts/appinfo/database.xml | 129 +++++++++++++++++++++++++++++
 lib/connector/sabre/principal.php  |   4 +-
 2 files changed, 131 insertions(+), 2 deletions(-)
 create mode 100644 apps/contacts/appinfo/database.xml

diff --git a/apps/contacts/appinfo/database.xml b/apps/contacts/appinfo/database.xml
new file mode 100644
index 0000000000..7c8268d71f
--- /dev/null
+++ b/apps/contacts/appinfo/database.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<database>
+
+ <name>*dbname*</name>
+ <create>true</create>
+ <overwrite>false</overwrite>
+
+ <charset>utf8</charset>
+
+ <table>
+
+  <name>*dbprefix*contacts_addressbooks</name>
+
+  <declaration>
+
+   <field>
+    <name>id</name>
+    <type>integer</type>
+    <default>0</default>
+    <notnull>true</notnull>
+    <autoincrement>1</autoincrement>
+    <unsigned>true</unsigned>
+    <length>4</length>
+   </field>
+
+   <field>
+    <name>userid</name>
+    <type>text</type>
+    <default></default>
+    <notnull>true</notnull>
+    <length>255</length>
+   </field>
+
+   <field>
+    <name>displayname</name>
+    <type>text</type>
+    <default></default>
+    <notnull>false</notnull>
+    <length>255</length>
+   </field>
+
+   <field>
+    <name>uri</name>
+    <type>text</type>
+    <default></default>
+    <notnull>false</notnull>
+    <length>100</length>
+   </field>
+
+   <field>
+    <name>description</name>
+    <type>clob</type>
+    <notnull>false</notnull>
+   </field>
+
+   <field>
+    <name>ctag</name>
+    <type>integer</type>
+    <default>1</default>
+    <notnull>true</notnull>
+    <unsigned>true</unsigned>
+    <length>4</length>
+   </field>
+
+  </declaration>
+
+ </table>
+
+ <table>
+
+  <name>*dbprefix*contacts_cards</name>
+
+  <declaration>
+
+   <field>
+    <name>id</name>
+    <type>integer</type>
+    <default>0</default>
+    <notnull>true</notnull>
+    <autoincrement>1</autoincrement>
+    <unsigned>true</unsigned>
+    <length>4</length>
+   </field>
+
+   <field>
+    <name>addressbookid</name>
+    <type>integer</type>
+    <default></default>
+    <notnull>true</notnull>
+    <unsigned>true</unsigned>
+    <length>4</length>
+   </field>
+
+   <field>
+    <name>fullname</name>
+    <type>text</type>
+    <default></default>
+    <notnull>false</notnull>
+    <length>255</length>
+   </field>
+
+   <field>
+    <name>carddata</name>
+    <type>clob</type>
+    <notnull>false</notnull>
+   </field>
+
+   <field>
+    <name>uri</name>
+    <type>text</type>
+    <default></default>
+    <notnull>false</notnull>
+    <length>100</length>
+   </field>
+
+   <field>
+    <name>lastmodified</name>
+    <type>integer</type>
+    <default></default>
+    <notnull>false</notnull>
+    <unsigned>true</unsigned>
+    <length>4</length>
+   </field>
+
+  </declaration>
+
+ </table>
+
+</database>
diff --git a/lib/connector/sabre/principal.php b/lib/connector/sabre/principal.php
index b3070087fd..9c386f85e1 100644
--- a/lib/connector/sabre/principal.php
+++ b/lib/connector/sabre/principal.php
@@ -37,8 +37,8 @@ class OC_Connector_Sabre_Principal implements Sabre_DAVACL_IPrincipalBackend {
 		// We have to delete the principals and relations! Principals include 
 		while($row = $result->fetchRow()){
 			// Checking if the principal is in the prefix
-			list($rowPrefix,$rowUser) = Sabre_DAV_URLUtil::splitPath($row['uri']);
-			if ($rowUser !== $params['uid']) continue;
+			$array = explode('/',$row['uri']);
+			if ($array[1] != $params['uid']) continue;
 			$deleteprincipal->execute(array($row['id']));
 			$deletegroup->execute(array($row['id'],$row['id']));
 		}
-- 
GitLab