Some more work on the address book

This commit is contained in:
Jakob Sack 2011-08-09 13:53:58 +02:00
parent 4e5b6f72c1
commit 76fc062f27
27 changed files with 1085 additions and 48 deletions

View file

@ -0,0 +1,54 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$aid = $_POST['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $aid );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your addressbook!'))));
exit();
}
$fn = $_POST['fn'];
$vcard = new Sabre_VObject_Component('VCARD');
$vcard->add(new Sabre_VObject_Property('FN',$fn));
$vcard->add(new Sabre_VObject_Property('UID',OC_Contacts_Addressbook::createUID()));
$id = OC_Contacts_Addressbook::addCard($aid,$vcard->serialize());
$details = OC_Contacts_Addressbook::structureContact($vcard);
$tmpl = new OC_Template('contacts','part.details');
$tmpl->assign('details',$details);
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page )));

View file

@ -0,0 +1,59 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_POST['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg';
$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name']));
$photo = new Sabre_VObject_Property( 'PHOTO', $photobase );
$photo->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype);
$photo->parameters[] = new Sabre_VObject_Parameter('ENCODING','b');
$vcard->add($photo);
$line = count($vcard->children) - 1;
$checksum = md5($vcard->children[$line]->serialize());
OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum )));

View file

@ -0,0 +1,73 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_POST['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
$name = $_POST['name'];
$value = $_POST['value'];
$parameters = $_POST['parameters'];
if(is_array($value)){
$value = OC_Contacts_Addressbook::escapeSemicolons($value);
}
$property = new Sabre_VObject_Property( $name, $value );
$parameternames = array_keys($parameters);
foreach($parameternames as $i){
$property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
}
$vcard->add($property);
$line = count($vcard->children) - 1;
$checksum = md5($property->serialize());
OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
$tmpl = new OC_Template('contacts','part.property');
$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($property,$line));
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));

View file

@ -0,0 +1,44 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $id );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
OC_Contacts_Addressbook::deleteAddressbook($id);
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));

View file

@ -0,0 +1,50 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
OC_Contacts_Addressbook::deleteCard($id);
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));

View file

@ -0,0 +1,62 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_GET['id'];
$line = $_GET['line'];
$checksum = $_GET['checksum'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
if(md5($vcard->children[$line]->serialize()) != $checksum ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
exit();
}
unset($vcard->children[$line]);
OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));

View file

@ -21,7 +21,7 @@
*/
// Init owncloud
require_once('../../lib/base.php');
require_once('../../../lib/base.php');
$id = $_GET['id'];
@ -29,7 +29,7 @@ $l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo $l10n->t('You need to log in!');
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
@ -48,10 +48,9 @@ if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
$vcard = Sabre_VObject_Reader::read($card['carddata']);
$details = OC_Contacts_Addressbook::structureContact($vcard);
$tmpl = new OC_Template('contacts','_details');
$tmpl = new OC_Template('contacts','part.details');
$tmpl->assign('details',$details);
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'page' => $page )));

View file

@ -0,0 +1,77 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_POST['id'];
$line = $_POST['line'];
$checksum = $_POST['checksum'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
$mimetype = $_FILES['photo']['type'] ? $_FILES['photo']['type'] : 'image/jpeg';
$photobase = base64_encode(file_get_contents($_FILES['photo']['tmp_name']));
if(md5($vcard->children[$line]->serialize()) != $checksum){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
exit();
}
// replace photo
$vcard->children[$line]->setValue($photobase);
$encoding = $type = false;
foreach($vcard->children[$line]->parameters as &$parameter){
if($parameter->name == 'TYPE'){
$parameter->value = $mimetype;
$type = true;
}
elseif($parameter->name == 'ENCODING'){
$parameter->value = 'b';
$encoding = true;
}
} unset($parameter);
if(!$encoding) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('ENCODING','b');
if(!$type) $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter('TYPE',$mimetype);
$checksum = md5($vcard->children[$line]->serialize());
OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id, 'line' => $line, 'checksum' => $checksum )));

View file

@ -0,0 +1,93 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_POST['id'];
$line = $_POST['line'];
$checksum = $_POST['checksum'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
if(md5($vcard->children[$line]->serialize()) != $checksum){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
exit();
}
// Set the value
$value = $_POST['value'];
if(is_array($value)){
$value = OC_Contacts_Addressbook::escapeSemicolons($value);
}
$vcard->children[$line]->setValue($value);
// Add parameters
$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array();
for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
$name = $vcard->children[$line]->parameters[$i]->name;
if(array_key_exists($name,$postparameters)){
if($postparameters[$name] == '' || is_null($postparameters[$name])){
unset($vcard->children[$line]->parameters[$i]);
}
else{
$vcard->children[$line]->parameters[$i]->value = $postparameters[$name];
}
unset($postparameters[$name]);
}
}
$missingparameters = array_keys($postparameters);
foreach($missingparameters as $i){
if(!$postparameters[$i] == '' && !is_null($postparameters[$i])){
$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($i,$postparameters[$i]);
}
}
// Do checksum and be happy
$checksum = md5($vcard->children[$line]->serialize());
OC_Contacts_Addressbook::editCard($id,$vcard->serialize());
$tmpl = new OC_Template('contacts','part.property');
$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line));
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page, 'line' => $line, 'oldchecksum' => $_POST['checksum'] )));

View file

@ -0,0 +1,39 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$addressbooks = OC_Contacts_Addressbook::allAddressbooks(OC_USER::getUser());
$tmpl = new OC_Template('contacts','part.addcardform');
$tmpl->assign('addressbooks',$addressbooks);
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));

View file

@ -0,0 +1,51 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$tmpl = new OC_Template('contacts','part.addpropertyform');
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));

View file

@ -0,0 +1,62 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../../lib/base.php');
$id = $_GET['id'];
$line = $_GET['line'];
$checksum = $_GET['checksum'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
if( !OC_User::isLoggedIn()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!'))));
exit();
}
$card = OC_Contacts_Addressbook::findCard( $id );
if( $card === false ){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Contact!'))));
exit();
}
$addressbook = OC_Contacts_Addressbook::findAddressbook( $card['addressbookid'] );
if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your contact!'))));
exit();
}
$vcard = Sabre_VObject_Reader::read($card['carddata']);
if(md5($vcard->children[$line]->serialize()) != $checksum){
echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Information about vCard is incorrect. Please reload page!'))));
exit();
}
$tmpl = new OC_Template('contacts','part.setpropertyform');
$tmpl->assign('id',$id);
$tmpl->assign('checksum',$checksum);
$tmpl->assign('property',OC_Contacts_Addressbook::structureProperty($vcard->children[$line],$line));
$page = $tmpl->fetchPage();
echo json_encode( array( 'status' => 'success', 'data' => array( 'page' => $page )));

View file

@ -1,4 +1,24 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Do not load FS ...
$RUNTIME_NOSETUPFS = true;

View file

@ -1 +1 @@
.contacts_propertyname {float:left;}

View file

@ -63,7 +63,8 @@ usort($contacts,'contacts_namesort');
$details = array();
if( !is_null($id) || count($contacts)){
$contact = OC_Contacts_Addressbook::findCard(is_null($id)?$contacts[0]['id']:$id);
if(is_null($id)) $id = $contacts[0]['id'];
$contact = OC_Contacts_Addressbook::findCard($id);
$vcard = Sabre_VObject_Reader::read($contact['carddata']);
$details = OC_Contacts_Addressbook::structureContact($vcard);
}

View file

@ -1,9 +1,15 @@
$(document).ready(function(){
$('.contacts_contacts').find('li').live('click',function(){
/* $('.contacts_addressbooksexpander').click(function(){
$('.contacts_addressbooksdetails').toggle();
return false;
});*/
$('#contacts_contacts li').live('click',function(){
var id = $(this).attr('x-id');
$.getJSON('details.php',{'id':id},function(jsondata){
$.getJSON('ajax/getdetails.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_details').html(jsondata.data.page);
$('#contacts_details').attr('x-id',jsondata.data.id);
$('#contacts_details').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
@ -12,8 +18,140 @@ $(document).ready(function(){
return false;
});
$('.contacts_addressbooksexpander').click(function(){
$('.contacts_addressbooksdetails').toggle();
$('#contacts_deletecard').live('click',function(){
var id = $('#contacts_details').attr('x-id');
$.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_contacts [x-id="'+jsondata.data.id+'"]').remove();
$('#contacts_details').attr('x-id','');
$('#contacts_details').html('');
}
else{
alert(jsondata.data.message);
}
});
return false;
});
$('#contacts_addproperty').live('click',function(){
var id = $('#contacts_details').attr('x-id');
$.getJSON('ajax/showaddproperty.php',{'id':id},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').append(jsondata.data.page);
}
else{
alert(jsondata.data.message);
}
});
return false;
});
$('#contacts_addpropertyform [name="name"]').live('change',function(){
$('#contacts_addpropertyform #contacts_addresspart').remove();
$('#contacts_addpropertyform #contacts_phonepart').remove();
$('#contacts_addpropertyform #contacts_fieldpart').remove();
$('#contacts_addpropertyform #contacts_generic').remove();
if($(this).val() == 'ADR'){
$('#contacts_addresspart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
}
else if($(this).val() == 'TEL'){
$('#contacts_phonepart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
}
else if($(this).val() == 'NOTE'){
$('#contacts_fieldpart').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
}
else{
$('#contacts_generic').clone().insertBefore($('#contacts_addpropertyform input[type="submit"]'));
}
});
$('#contacts_addpropertyform input[type="submit"]').live('click',function(){
$.post('ajax/addproperty.php',$('#contacts_addpropertyform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').append(jsondata.data.page);
$('#contacts_addpropertyform').remove();
}
else{
alert(jsondata.data.message);
}
}, 'json');
return false;
});
$('#contacts_newcontact').click(function(){
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').attr('x-id','');
$('#contacts_details').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
}
});
return false;
});
$('#contacts_addcardform input[type="submit"]').live('click',function(){
$.post('ajax/addcard.php',$('#contacts_addcardform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('#contacts_details').attr('x-id',jsondata.data.id);
$('#contacts_details').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
}
}, 'json');
return false;
});
$('.contacts_property [x-use="edit"]').live('click',function(){
var id = $('#contacts_details').attr('x-id');
var checksum = $(this).parent().parent().attr('x-checksum');
var line = $(this).parent().parent().attr('x-line');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"] .contacts_propertyvalue').html(jsondata.data.page);
}
else{
alert(jsondata.data.message);
}
});
return false;
});
$('#contacts_setpropertyform input[type="submit"]').live('click',function(){
$.post('ajax/setproperty.php',$('#contacts_setpropertyform').serialize(),function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[x-line="'+jsondata.data.line+'"][x-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
}
else{
alert(jsondata.data.message);
}
},'json');
return false;
});
$('.contacts_property [x-use="delete"]').live('click',function(){
var id = $('#contacts_details').attr('x-id');
var checksum = $(this).parent().parent().attr('x-checksum');
var line = $(this).parent().parent().attr('x-line');
$.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum, 'line': line },function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[x-line="'+line+'"][x-checksum="'+checksum+'"]').remove();
}
else{
alert(jsondata.data.message);
}
});
return false;
});
$('.contacts_property').live('mouseenter',function(){
$(this).find('span').show();
});
$('.contacts_property').live('mouseleave',function(){
$(this).find('span').hide();
});
});

View file

@ -167,14 +167,14 @@ class OC_Contacts_Addressbook{
$uri = $property->value.'.vcf';
}
}
$uri = self::createUID().'.vcf';
if(is_null($uri)) $uri = self::createUID().'.vcf';
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
self::touch($id);
self::touchAddressbook($id);
return OC_DB::insertid;
return OC_DB::insertid();
}
public static function addCardFromDAVData($id,$uri,$data){
@ -189,13 +189,13 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
$result = $stmt->execute(array($id,$fn,$data,$uri,time()));
self::touch($id);
self::touchAddressbook($id);
return OC_DB::insertid;
return OC_DB::insertid();
}
public static function editCard($id, $data){
$oldcard = self::findCard($id,$aid,$uri);
$oldcard = self::findCard($id);
$fn = null;
$card = Sabre_VObject_Reader::read($data);
foreach($card->children as $property){
@ -207,7 +207,7 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
$result = $stmt->execute(array($fn,$data,time(),$id));
self::touch($oldcard['addressbookid']);
self::touchAddressbook($oldcard['addressbookid']);
return true;
}
@ -226,20 +226,20 @@ class OC_Contacts_Addressbook{
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
$result = $stmt->execute(array($fn,$data,time(),$oldcard['id']));
self::touch($oldcard['addressbookid']);
self::touchAddressbook($oldcard['addressbookid']);
return true;
}
public static function deleteCard($id){
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
$stmt->execute(array($id));
return true;
}
public static function deleteCardFromDAVData($aid,$uri){
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE addressbookid = ? AND uri=?' );
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
$stmt->execute(array($aid,$uri));
return true;
@ -265,23 +265,60 @@ class OC_Contacts_Addressbook{
return $userid;
}
public static function escapeSemicolons($value){
foreach($value as &$i ){
$i = implode("\\\\;", explode(';', $i));
} unset($i);
return implode(';',$value);
}
public static function unescapeSemicolons($value){
$array = explode(';',$value);
for($i=0;$i<count($array);$i++){
if(substr($array[$i],-2,2)=="\\\\"){
if(isset($array[$i+1])){
$array[$i] = substr($array[$i],0,count($array[$i])-2).';'.$array[$i+1];
unset($array[$i+1]);
}
else{
$array[$i] = substr($array[$i],0,count($array[$i])-2).';';
}
$i = $i - 1;
}
}
return $array;
}
public static function structureContact($object){
$details = array();
$line = 0;
foreach($object->children as $property){
$temp = array(
'name' => $property->name,
'value' => ($property->name == 'PHOTO' || $property->name == 'LOGO' ? null : $property->value ),
'parameters' => array());
foreach($property->parameters as $parameter){
$temp['parameters'][] = array( 'name' => $parameter->name, 'value' => $parameter->value);
}
$temp = self::structureProperty($property,$line);
if(array_key_exists($property->name,$details)){
$details[$property->name][] = $temp;
}
else{
$details[$property->name] = array($temp);
}
$line++;
}
return $details;
}
public static function structureProperty($property,$line=null){
$value = $property->value;
if($property->name == 'ADR'){
$value = self::unescapeSemicolons($value);
}
$temp = array(
'name' => $property->name,
'value' => $value,
'line' => $line,
'parameters' => array(),
'checksum' => md5($property->serialize()));
foreach($property->parameters as $parameter){
$temp['parameters'][$parameter->name] = $parameter->value;
}
return $temp;
}
}

View file

@ -1,13 +1,23 @@
<?php
/**
* PDO CardDAV backend
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* @package Sabre
* @subpackage CardDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
/**

View file

@ -1,4 +0,0 @@
Name <?php echo $_['details']['FN'][0]['value']; ?>
<?php if(array_key_exists('PHOTO',$_['details'])): ?>
<img src="photo.php?id=<?php echo $_['id']; ?>">
<?php endif; ?>

View file

@ -3,7 +3,8 @@ OC_Util::addScript('contacts','interface');
OC_Util::addStyle('contacts','styles');
?>
<div class="contacts_addressbooks">
<?php
/*<div class="contacts_addressbooks">
<div class="contacts_addressbooksexpander">
Addressbooks
</div>
@ -13,12 +14,14 @@ OC_Util::addStyle('contacts','styles');
<?php endforeach; ?>
<br>To use this addressbook, use .../apps/contacts/carddav.php/addressbooks/USERNAME/addressbookname.php
</div>
</div>
<div class="contacts_contacts leftcontent">
</div>*/
?>
<div id="contacts_contacts" class="leftcontent">
<ul>
<?php echo $this->inc("_contacts"); ?>
<?php echo $this->inc("part.contacts"); ?>
</ul>
<a id="contacts_newcontact"><?php echo $l->t('Add Contact'); ?></a>
</div>
<div class="contacts_details rightcontent">
<?php echo $this->inc("_details"); ?>
<div id="contacts_details" class="rightcontent" x-id="<?php echo $_['id']; ?>">
<?php echo $this->inc("part.details"); ?>
</div>

View file

@ -0,0 +1,13 @@
<form id="contacts_addcardform">
<?php if(count($_['addressbooks'])==1): ?>
<input type="hidden" name="id" value="<?php echo $_['addressbooks'][0]['id']; ?>">
<?php else: ?>
<select name="id" size="1">
<?php foreach($_['addressbooks'] as $addressbook): ?>
<option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['displayname']; ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<input type="text" name="fn" value=""><br>
<input type="submit">
</form>

View file

@ -0,0 +1,43 @@
<form id="contacts_addpropertyform">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<select name="name" size="1">
<option value="BDAY"><?php echo $l->t('Birthday'); ?></option>
<option value="ADR"><?php echo $l->t('Address'); ?></option>
<option value="TEL"><?php echo $l->t('Telephone'); ?></option>
<option value="EMAIL" selected="selected"><?php echo $l->t('Email'); ?></option>
<option value="ORG"><?php echo $l->t('Organization'); ?></option>
</select>
<div id="contacts_generic">
<input type="text" name="value" value="">
</div>
<input type="submit">
</form>
<div id="contacts_addcontactsparts" style="display:none;">
<div id="contacts_addresspart">
<select name="parameters[TYPE]" size="1">
<option value="WORK"><?php echo $l->t('Work'); ?></option>
<option value="HOME" selected="selected"><?php echo $l->t('Home'); ?></option>
</select>
<?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="">
<?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value="">
<?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value="">
<?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="">
<?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="">
<?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value="">
<?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="">
</div>
<div id="contacts_phonepart">
<select name="parameters[TYPE]" size="1">
<option value="WORK"><?php echo $l->t('Work'); ?></option>
<option value="CELL" selected="selected"><?php echo $l->t('Mobile'); ?></option>
<option value="HOME"><?php echo $l->t('Home'); ?></option>
</select>
<input type="text" name="value" value="">
</div>
<div id="contacts_fieldpart">
<textarea type="text" name="value"></textarea>
</div>
<div id="contacts_generic">
<input type="text" name="value" value="">
</div>
</div>

View file

@ -0,0 +1,22 @@
<?php if(array_key_exists('PHOTO',$_['details'])): ?>
<img src="photo.php?id=<?php echo $_['id']; ?>">
<?php endif; ?>
<?php echo $this->inc('part.property', array('property' => $_['details']['FN'][0])); ?>
<?php if(isset($_['details']['BDAY'])): // Emails first ?>
<?php echo $this->inc('part.property', array('property' => $_['details']['BDAY'][0])); ?>
<?php endif; ?>
<?php if(isset($_['details']['ORG'])): // Emails first ?>
<?php echo $this->inc('part.property', array('property' => $_['details']['ORG'][0])); ?>
<?php endif; ?>
<?php foreach(array('EMAIL','TEL','ADR') as $type): ?>
<?php if(isset($_['details'][$type])): // Emails first ?>
<br>
<?php foreach($_['details'][$type] as $property): ?>
<?php echo $this->inc('part.property',array('property' => $property )); ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
<a id="contacts_deletecard"><img src="../../core/img/actions/delete.png"></a>
<a id="contacts_addproperty"><img src="../../core/img/actions/download.png"></a>

View file

@ -0,0 +1,50 @@
<div class="contacts_property" x-line="<?php echo $_['property']['line']; ?>" x-checksum="<?php echo $_['property']['checksum']; ?>">
<?php if($_['property']['name'] == 'FN'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Name'); ?></div>
<div class="contacts_propertyvalue">
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<?php echo $_['property']['value']; ?>
</div>
<?php elseif($_['property']['name'] == 'BDAY'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Birthday'); ?></div>
<div class="contacts_propertyvalue">
<?php echo $l->l('date',new DateTime($_['property']['value'])); ?>
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
</div>
<?php elseif($_['property']['name'] == 'ORG'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Organisation'); ?></div>
<div class="contacts_propertyvalue">
<?php echo $_['property']['value']; ?>
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
</div>
<?php elseif($_['property']['name'] == 'EMAIL'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Email'); ?></div>
<div class="contacts_propertyvalue">
<?php echo $_['property']['value']; ?>
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
</div>
<?php elseif($_['property']['name'] == 'TEL'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Telefon'); ?></div>
<div class="contacts_propertyvalue">
<?php echo $_['property']['value']; ?>
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
</div>
<?php elseif($_['property']['name'] == 'ADR'): ?>
<div class="contacts_propertyname"><?php echo $l->t('Address'); ?></div>
<div class="contacts_propertyvalue">
<?php echo $l->t('PO Box'); ?> <?php echo $_['property']['value'][0]; ?><br>
<?php echo $l->t('Extended Address'); ?> <?php echo $_['property']['value'][1]; ?><br>
<?php echo $l->t('Street Name'); ?> <?php echo $_['property']['value'][2]; ?><br>
<?php echo $l->t('City'); ?> <?php echo $_['property']['value'][3]; ?><br>
<?php echo $l->t('Region'); ?> <?php echo $_['property']['value'][4]; ?><br>
<?php echo $l->t('Postal Code'); ?> <?php echo $_['property']['value'][5]; ?><br>
<?php echo $l->t('Country'); ?> <?php echo $_['property']['value'][6]; ?>
<span style="display:none;" x-use="edit"><img src="../../core/img/actions/rename.png"></span>
<span style="display:none;" x-use="delete"><img src="../../core/img/actions/delete.png"></span>
</div>
<?php endif; ?>
</div>

View file

@ -0,0 +1,21 @@
<form id="contacts_setpropertyform">
<input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
<input type="hidden" name="line" value="<?php echo $_['property']['line']; ?>">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<?php if($_['property']['name']=='ADR'): ?>
<?php echo $l->t('PO Box'); ?> <input type="text" name="value[0]" value="<?php echo $_['property']['value'][0]; ?>">
<?php echo $l->t('Extended Address'); ?> <input type="text" name="value[1]" value="<?php echo $_['property']['value'][1]; ?>">
<?php echo $l->t('Street Name'); ?> <input type="text" name="value[2]" value="<?php echo $_['property']['value'][2]; ?>">
<?php echo $l->t('City'); ?> <input type="text" name="value[3]" value="<?php echo $_['property']['value'][3]; ?>">
<?php echo $l->t('Region'); ?> <input type="text" name="value[4]" value="<?php echo $_['property']['value'][4]; ?>">
<?php echo $l->t('Postal Code'); ?> <input type="text" name="value[5]" value="<?php echo $_['property']['value'][5]; ?>">
<?php echo $l->t('Country'); ?> <input type="text" name="value[6]" value="<?php echo $_['property']['value'][6]; ?>">
<?php elseif($_['property']['name']=='TEL'): ?>
<input type="text" name="value" value="<?php echo $_['property']['value']; ?>">
<?php elseif($_['property']['name']=='NOTE'): ?>
<textarea type="text" name="value"><?php echo $_['property']['value']; ?></textarea>
<?php else: ?>
<input type="text" name="value" value="<?php echo $_['property']['value']; ?>">
<?php endif; ?>
<input type="submit">
</form>

View file

@ -1,4 +1,24 @@
<?php
/**
* ownCloud - Addressbook
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack mail@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Init owncloud
require_once('../../lib/base.php');
$connector = new OC_Connector_Sabre_Principal;