2001-07-08 15:54:40 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-02-15 19:21:35 +01:00
|
|
|
* eGroupWare - Addressbook *
|
2004-01-25 23:02:59 +01:00
|
|
|
* http://www.egroupware.org *
|
2004-02-15 19:21:35 +01:00
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org *
|
|
|
|
* and Miles Lott <milos@groupwhere.org> *
|
2001-07-08 15:54:40 +02:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
class boaddressbook
|
|
|
|
{
|
|
|
|
var $public_functions = array(
|
|
|
|
'read_entries' => True,
|
|
|
|
'read_entry' => True,
|
|
|
|
'read_last_entry' => True,
|
|
|
|
'add_entry' => True,
|
|
|
|
'add_vcard' => True,
|
|
|
|
'add_email' => True,
|
2003-10-24 21:05:05 +02:00
|
|
|
'update_entry' => True,
|
|
|
|
'delete_entry' => True,
|
2001-07-08 15:54:40 +02:00
|
|
|
);
|
2001-08-09 02:19:28 +02:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
var $xml_functions = array();
|
|
|
|
var $xmlrpc_methods = array();
|
2001-08-04 16:12:32 +02:00
|
|
|
var $soap_functions = array(
|
|
|
|
'read_entries' => array(
|
2001-08-27 11:51:32 +02:00
|
|
|
'in' => array('int','int','struct','string','int'),
|
|
|
|
'out' => array('array')
|
2001-08-04 16:12:32 +02:00
|
|
|
),
|
|
|
|
'read_entry' => array(
|
2001-08-27 11:51:32 +02:00
|
|
|
'in' => array('int','struct'),
|
|
|
|
'out' => array('array')
|
2001-08-04 16:12:32 +02:00
|
|
|
),
|
|
|
|
'read_last_entry' => array(
|
2001-08-27 11:51:32 +02:00
|
|
|
'in' => array('struct'),
|
|
|
|
'out' => array('array')
|
2001-08-04 16:12:32 +02:00
|
|
|
),
|
|
|
|
'add_entry' => array(
|
2001-08-27 11:51:32 +02:00
|
|
|
'in' => array('int','struct'),
|
2001-08-04 16:12:32 +02:00
|
|
|
'out' => array()
|
|
|
|
),
|
|
|
|
'update_entry' => array(
|
2001-08-27 11:51:32 +02:00
|
|
|
'in' => array('int','struct'),
|
2001-08-04 16:12:32 +02:00
|
|
|
'out' => array()
|
2004-03-10 08:53:37 +01:00
|
|
|
),
|
|
|
|
'categories' => array(
|
2004-03-21 16:06:01 +01:00
|
|
|
'in' => array('bool'),
|
2004-03-10 08:53:37 +01:00
|
|
|
'out' => array('struct')
|
|
|
|
),
|
2004-03-14 18:02:18 +01:00
|
|
|
'customfields' => array(
|
|
|
|
'in' => array('array'),
|
|
|
|
'out'=> array('struct')
|
|
|
|
),
|
2001-08-04 16:12:32 +02:00
|
|
|
);
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
var $debug = False;
|
|
|
|
|
|
|
|
var $so;
|
|
|
|
var $start;
|
2003-08-28 16:16:30 +02:00
|
|
|
var $limit;
|
2001-07-08 15:54:40 +02:00
|
|
|
var $query;
|
|
|
|
var $sort;
|
|
|
|
var $order;
|
|
|
|
var $filter;
|
|
|
|
var $cat_id;
|
2001-07-12 03:01:11 +02:00
|
|
|
var $total;
|
2003-10-24 21:05:05 +02:00
|
|
|
var $contact_cache = array();
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
var $use_session = False;
|
|
|
|
|
|
|
|
function boaddressbook($session=False)
|
|
|
|
{
|
|
|
|
$this->so = CreateObject('addressbook.soaddressbook');
|
2003-10-25 12:16:12 +02:00
|
|
|
// make some fields of the contacts-object availible
|
2003-10-24 21:05:05 +02:00
|
|
|
$this->grants = &$this->so->grants;
|
2003-10-25 12:16:12 +02:00
|
|
|
$this->stock_contact_fields = &$this->so->contacts->stock_contact_fields;
|
|
|
|
$this->tel_types = &$this->so->contacts->tel_types;
|
|
|
|
$this->email_types = &$this->so->contacts->email_types;
|
|
|
|
$this->adr_types = &$this->so->contacts->adr_types;
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
if($session)
|
|
|
|
{
|
|
|
|
$this->read_sessiondata();
|
|
|
|
$this->use_session = True;
|
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
// are we called via xmlrpc?
|
|
|
|
$this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
|
|
|
|
|
2003-10-24 21:05:05 +02:00
|
|
|
/* _debug_array($_POST); */
|
|
|
|
$_start = get_var('start',array('POST','GET'));
|
2004-01-27 04:30:25 +01:00
|
|
|
$_query = get_var('query',array('POST','GET'),'_UNSET_');
|
|
|
|
$_cquery = get_var('cquery', array('GET','POST'),'_UNSET_');
|
2003-10-24 21:05:05 +02:00
|
|
|
$_sort = get_var('sort',array('POST','GET'));
|
|
|
|
$_order = get_var('order',array('POST','GET'));
|
|
|
|
$_filter = get_var('filter',array('POST','GET'));
|
2004-02-22 16:18:36 +01:00
|
|
|
// $_cat_id = get_var('cat_id',array('POST','GET'));
|
2003-10-24 21:05:05 +02:00
|
|
|
$_fcat_id = get_var('fcat_id',array('POST','GET'));
|
2004-02-22 16:18:36 +01:00
|
|
|
$_typeid = get_var('typeid',array('POST','GET'),'_UNSET_');
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
if(!empty($_start) || ($_start == '0') || ($_start == 0))
|
|
|
|
{
|
|
|
|
if($this->debug) { echo '<br>overriding $start: "' . $this->start . '" now "' . $_start . '"'; }
|
|
|
|
$this->start = $_start;
|
|
|
|
}
|
|
|
|
if($_limit)
|
|
|
|
{
|
|
|
|
$this->limit = $_limit;
|
|
|
|
}
|
2004-01-27 04:30:25 +01:00
|
|
|
|
|
|
|
if($_query != '_UNSET_')
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
2004-01-27 04:30:25 +01:00
|
|
|
$this->query = $_query;
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
2004-01-27 04:30:25 +01:00
|
|
|
if($_cquery != '_UNSET_')
|
2004-01-17 04:21:21 +01:00
|
|
|
{
|
|
|
|
$this->cquery = $_cquery;
|
|
|
|
}
|
|
|
|
|
2004-02-22 16:18:36 +01:00
|
|
|
if($_typeid != '_UNSET_')
|
|
|
|
{
|
|
|
|
$this->typeid = $_typeid;
|
|
|
|
}
|
|
|
|
if(!@in_array($this->typeid,array('n','c')))
|
|
|
|
{
|
|
|
|
$this->typeid = 'n';
|
|
|
|
}
|
|
|
|
|
2003-10-24 21:05:05 +02:00
|
|
|
if(isset($_POST['fcat_id']) || isset($_POST['fcat_id']))
|
2003-08-28 16:16:30 +02:00
|
|
|
{
|
|
|
|
$this->cat_id = $_fcat_id;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->cat_id = -1;
|
|
|
|
}
|
2003-12-01 01:46:45 +01:00
|
|
|
|
2004-02-22 16:18:36 +01:00
|
|
|
/*
|
|
|
|
if(isset($_POST['typeid']) || isset($_POST['typeid']))
|
|
|
|
{
|
|
|
|
$this->typeid = $typeid;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->typeid = 'n';
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if(isset($_sort) && !empty($_sort))
|
|
|
|
{
|
|
|
|
if($this->debug) { echo '<br>overriding $sort: "' . $this->sort . '" now "' . $_sort . '"'; }
|
|
|
|
$this->sort = $_sort;
|
|
|
|
}
|
2001-12-23 18:28:14 +01:00
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if(isset($_order) && !empty($_order))
|
2002-01-17 04:52:56 +01:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
if($this->debug) { echo '<br>overriding $order: "' . $this->order . '" now "' . $_order . '"'; }
|
|
|
|
$this->order = $_order;
|
2002-01-17 04:52:56 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
if(isset($_filter) && !empty($_filter))
|
|
|
|
{
|
|
|
|
if($this->debug) { echo '<br>overriding $filter: "' . $this->filter . '" now "' . $_filter . '"'; }
|
|
|
|
$this->filter = $_filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->debug) { $this->_debug_sqsof(); }
|
2001-12-23 18:28:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function _debug_sqsof()
|
|
|
|
{
|
|
|
|
$data = array(
|
|
|
|
'start' => $this->start,
|
2003-08-28 16:16:30 +02:00
|
|
|
'limit' => $this->limit,
|
2001-12-23 18:28:14 +01:00
|
|
|
'query' => $this->query,
|
2004-01-17 04:21:21 +01:00
|
|
|
'cquery' => $this->cquery,
|
2001-12-23 18:28:14 +01:00
|
|
|
'sort' => $this->sort,
|
|
|
|
'order' => $this->order,
|
|
|
|
'filter' => $this->filter,
|
2004-02-22 16:18:36 +01:00
|
|
|
'cat_id' => $this->cat_id,
|
|
|
|
'typeid' => $this->typeid
|
2001-12-23 18:28:14 +01:00
|
|
|
);
|
|
|
|
echo '<br>BO:';
|
|
|
|
_debug_array($data);
|
2001-08-20 18:30:02 +02:00
|
|
|
}
|
2001-08-09 02:19:28 +02:00
|
|
|
|
2001-07-12 06:09:12 +02:00
|
|
|
function save_sessiondata($data)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if($this->use_session)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
if($this->debug) { echo '<br>Save:'; _debug_array($data); }
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->session->appsession('session_data','addressbook',$data);
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function read_sessiondata()
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$data = $GLOBALS['egw']->session->appsession('session_data','addressbook');
|
2003-08-28 16:16:30 +02:00
|
|
|
if($this->debug) { echo '<br>Read:'; _debug_array($data); }
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
$this->start = $data['start'];
|
2003-08-28 16:16:30 +02:00
|
|
|
$this->limit = $data['limit'];
|
2001-07-08 15:54:40 +02:00
|
|
|
$this->query = $data['query'];
|
2004-01-17 04:21:21 +01:00
|
|
|
$this->cquery = $data['cquery'];
|
2001-07-08 15:54:40 +02:00
|
|
|
$this->sort = $data['sort'];
|
|
|
|
$this->order = $data['order'];
|
|
|
|
$this->filter = $data['filter'];
|
|
|
|
$this->cat_id = $data['cat_id'];
|
2004-02-22 16:18:36 +01:00
|
|
|
$this->typeid = $data['typeid'];
|
2001-12-23 18:28:14 +01:00
|
|
|
if($this->debug) { echo '<br>read_sessiondata();'; $this->_debug_sqsof(); }
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
2003-12-01 01:46:45 +01:00
|
|
|
function strip_html($dirty='')
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if($dirty == '')
|
2001-08-04 16:12:32 +02:00
|
|
|
{
|
|
|
|
$dirty = array();
|
|
|
|
}
|
2001-07-08 15:54:40 +02:00
|
|
|
for($i=0;$i<count($dirty);$i++)
|
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if(@is_array($dirty[$i]))
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2004-01-17 04:21:21 +01:00
|
|
|
foreach($dirty[$i] as $name => $value)
|
2001-08-04 16:12:32 +02:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$cleaned[$i][$name] = $GLOBALS['egw']->strip_html($dirty[$i][$name]);
|
2001-08-04 16:12:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$cleaned[$i] == $GLOBALS['egw']->strip_html($dirty[$i]);
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $cleaned;
|
|
|
|
}
|
|
|
|
|
2004-03-10 08:53:37 +01:00
|
|
|
// return array with all addressbook categories (for xmlrpc)
|
|
|
|
function categories($complete = False)
|
|
|
|
{
|
|
|
|
return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False;
|
|
|
|
}
|
|
|
|
|
2004-03-14 18:02:18 +01:00
|
|
|
// return array with all addressbook customfields (for xmlrpc)
|
|
|
|
function customfields($new_fields=False)
|
|
|
|
{
|
|
|
|
$fields = CreateObject('addressbook.uifields',True); // no extra bo-class
|
|
|
|
|
2005-04-22 14:45:23 +02:00
|
|
|
if(is_array($new_fields) && count($new_fields))
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
if(!$GLOBALS['egw_info']['user']['apps']['admin'])
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
|
|
|
}
|
|
|
|
foreach($new_fields as $new)
|
|
|
|
{
|
|
|
|
$fields->save_custom_field('',$new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$customfields = array();
|
|
|
|
foreach($fields->read_custom_fields() as $data)
|
|
|
|
{
|
|
|
|
$customfields[$data['name']] = $data['title'];
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc && !isset($customfields['freebusy_url']))
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$fields->save_custom_field('','freebusy URL');
|
|
|
|
$customfields['freebusy_url'] = 'freebusy URL';
|
|
|
|
}
|
|
|
|
return $customfields;
|
|
|
|
}
|
|
|
|
|
2004-03-10 08:53:37 +01:00
|
|
|
// translate array of internal datas to xmlrpc, eg. format bday as iso8601
|
|
|
|
function data2xmlrpc($datas)
|
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if(is_array($datas))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
foreach($datas as $n => $data)
|
|
|
|
{
|
|
|
|
// translate birthday to a iso8601 date
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['bday']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if(strlen($data['bday']) > 2)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
list($m,$d,$y) = explode('/',$data['bday']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$y = $m = $d = 0;
|
|
|
|
}
|
|
|
|
$datas[$n]['bday'] = $GLOBALS['server']->date2iso8601(array('year'=>$y,'month'=>$m,'mday'=>$d));
|
|
|
|
}
|
|
|
|
// translate modification time
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['last_mod']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$datas[$n]['last_mod'] = $GLOBALS['server']->date2iso8601($data['last_mod']);
|
|
|
|
}
|
|
|
|
// translate categories-id-list to array with id-name pairs
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['cat_id']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$datas[$n]['cat_id'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$data['cat_id']));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $datas;
|
|
|
|
}
|
|
|
|
|
|
|
|
// retranslate from xmlrpc / iso8601 to internal format
|
|
|
|
function xmlrpc2data($data)
|
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['bday']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$arr = $GLOBALS['server']->iso86012date($data['bday']);
|
2004-03-14 13:07:02 +01:00
|
|
|
$data['bday'] = $arr['year'] && $arr['month'] && $arr['mday'] ? sprintf('%d/%02d/%04d',$arr['month'],$arr['mday'],$arr['year']) : '';
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['last_mod']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$data['last_mod'] = $GLOBALS['server']->iso86012date($data['last_mod'],True);
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if(isset($data['cat_id']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$cats = $GLOBALS['server']->xmlrpc2cats($data['cat_id']);
|
|
|
|
$data['cat_id'] = count($cats) > 1 ? ','.implode(',',$cats).',' : (int)$cats[0];
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
2004-03-14 18:02:18 +01:00
|
|
|
// return a pseudo addressbook-entry for a user
|
|
|
|
function user_pseudo_entry($account)
|
|
|
|
{
|
|
|
|
static $prefs=False;
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!is_object($prefs))
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$prefs = CreateObject('phpgwapi.preferences'); // wie need a new copy, as wie change the user
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!is_array($account))
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->accounts->account_id = $account;
|
|
|
|
$account = $GLOBALS['egw']->accounts->read_repository();
|
2004-03-14 18:02:18 +01:00
|
|
|
}
|
|
|
|
$prefs->account_id = $account['account_id'];
|
|
|
|
$prefs->read_repository();
|
2005-05-01 16:34:59 +02:00
|
|
|
$freebusy_url = $GLOBALS['egw_info']['server']['webserver_url'].'/calendar/freebusy.php?user='.$account['account_lid'];
|
2005-04-22 14:45:23 +02:00
|
|
|
if($freebusy_url[0] == '/')
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$freebusy_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$freebusy_url;
|
|
|
|
}
|
|
|
|
$firstname = $account['account_firstname'] ? $account['account_firstname'] : $account['firstname'];
|
|
|
|
$lastname = $account['account_lastname'] ? $account['account_lastname'] : $account['lastname'];
|
|
|
|
$ret = array(
|
|
|
|
'n_family' => $lastname,
|
|
|
|
'n_given' => $firstname,
|
2005-05-01 16:34:59 +02:00
|
|
|
'fn' => $GLOBALS['egw']->common->display_fullname($account['account_lid'],$firstname,$lastname),
|
2004-03-14 18:02:18 +01:00
|
|
|
'email' => $prefs->email_address($account['account_id']),
|
|
|
|
'freebusy_url' => $freebusy_url,
|
|
|
|
'rights' => PHPGW_ACL_READ, // readonly access
|
|
|
|
'id' => -$account['account_id'],
|
|
|
|
'tid' => 'p', // Profil
|
|
|
|
);
|
|
|
|
//echo "<p>user_pseudo_entry(".print_r($account,True).")=".print_r($ret,True)."</p>";
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_users($type='all')
|
|
|
|
{
|
|
|
|
$users = array();
|
2005-04-22 14:45:23 +02:00
|
|
|
switch($type)
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
case 'all': // all
|
2005-05-01 16:34:59 +02:00
|
|
|
$accounts = $GLOBALS['egw']->accounts->get_list('accounts');
|
2004-03-14 18:02:18 +01:00
|
|
|
break;
|
|
|
|
case 'calendar': // Calendar users
|
2005-05-01 16:34:59 +02:00
|
|
|
$accounts = $GLOBALS['egw']->acl->get_ids_for_location('run',1,'calendar');
|
2004-03-14 18:02:18 +01:00
|
|
|
break;
|
|
|
|
case 'groupmates': // Groupmates
|
|
|
|
$accounts = array();
|
2005-05-01 16:34:59 +02:00
|
|
|
foreach($GLOBALS['egw']->accounts->membership() as $group)
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$accounts[] = $group['account_id'];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
foreach($accounts as $key => $account)
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
if($type == 'calendar' && $GLOBALS['egw']->accounts->get_type($account) == 'g' || $type == 'groupmates')
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
// $account is a group
|
|
|
|
unset($accounts[$key]);
|
2005-05-01 16:34:59 +02:00
|
|
|
$members = $GLOBALS['egw']->accounts->member($account);
|
2005-04-22 14:45:23 +02:00
|
|
|
if(is_array($members))
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
2004-07-12 22:02:15 +02:00
|
|
|
foreach($members as $member)
|
|
|
|
{
|
|
|
|
$accounts[] = $member['account_id'];
|
|
|
|
}
|
2004-03-14 18:02:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($type != 'all')
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$accounts = array_unique($accounts); // remove doubles
|
|
|
|
}
|
|
|
|
$prefs = CreateObject('phpgwapi.preferences'); // wie need a new copy, as wie change the user
|
|
|
|
foreach($accounts as $account)
|
|
|
|
{
|
|
|
|
$users[] = $this->user_pseudo_entry($account);
|
|
|
|
}
|
|
|
|
return $users;
|
|
|
|
}
|
|
|
|
|
2001-08-09 02:19:28 +02:00
|
|
|
function read_entries($data)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc && !isset($data['fields']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
2004-03-14 18:02:18 +01:00
|
|
|
$data['fields'] = array_keys(array_merge($this->so->contacts->non_contact_fields,$this->so->contacts->stock_contact_fields,$this->customfields()));
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
2001-08-23 08:57:37 +02:00
|
|
|
$entries = $this->so->read_entries($data);
|
2001-07-12 03:01:11 +02:00
|
|
|
$this->total = $this->so->contacts->total_records;
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!is_array($entries))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$entries = array();
|
|
|
|
}
|
|
|
|
$entries = $this->strip_html($entries);
|
2004-03-14 18:02:18 +01:00
|
|
|
|
|
|
|
// evtl. get uses as read-only addressbook entries, just with Name, Firstname, Email
|
2005-04-22 14:45:23 +02:00
|
|
|
if(@$data['include_users'])
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$entries = array_merge($entries,$this->get_users($data['include_users']));
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$entries = $this->data2xmlrpc($entries);
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
if($this->debug) { echo '<br>Total records="' . $this->total . '"'; }
|
2004-03-10 08:53:37 +01:00
|
|
|
return $entries;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
2001-08-09 02:19:28 +02:00
|
|
|
function read_entry($data)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc && !isset($data['fields']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
2004-03-14 18:02:18 +01:00
|
|
|
$data['fields'] = array_keys(array_merge($this->so->contacts->non_contact_fields,$this->so->contacts->stock_contact_fields,$this->customfields()));
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($data['id'] < 0)
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$entry = array($this->user_pseudo_entry(-$data['id']));
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
$entry = $this->data2xmlrpc($entry);
|
|
|
|
}
|
|
|
|
return $entry;
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
2003-12-01 01:46:45 +01:00
|
|
|
if($this->check_perms($data,PHPGW_ACL_READ))
|
2003-10-24 21:05:05 +02:00
|
|
|
{
|
|
|
|
$entry = $this->so->read_entry($data['id'],$data['fields']);
|
2004-03-10 08:53:37 +01:00
|
|
|
$entry = $this->strip_html($entry);
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$entry = $this->data2xmlrpc($entry);
|
|
|
|
}
|
|
|
|
return $entry;
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
return False;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function read_last_entry($fields)
|
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if($this->check_perms($fields,PHPGW_ACL_READ))
|
2003-10-24 21:05:05 +02:00
|
|
|
{
|
|
|
|
$entry = $this->so->read_last_entry($fields);
|
2004-03-10 08:53:37 +01:00
|
|
|
$entry = $this->strip_html($entry);
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$entry = $this->data2xmlrpc($entry);
|
|
|
|
}
|
|
|
|
return $entry;
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
return False;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
2003-11-19 15:16:15 +01:00
|
|
|
function add_vcard($uploadedfile='')
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-12-05 12:27:47 +01:00
|
|
|
if($uploadedfile == 'none' || $uploadedfile == '' || substr($uploadedfile['name'],-4) != '.vcf')
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-11-19 15:16:15 +01:00
|
|
|
return False;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-05 12:27:47 +01:00
|
|
|
$filename = $uploadedfile['tmp_name'];
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
$vcard = CreateObject('phpgwapi.vcard');
|
|
|
|
$entry = $vcard->in_file($filename);
|
|
|
|
/* _debug_array($entry);exit; */
|
2005-05-01 16:34:59 +02:00
|
|
|
$entry['owner'] = (int)$GLOBALS['egw_info']['user']['account_id'];
|
2001-08-04 16:12:32 +02:00
|
|
|
$entry['access'] = 'private';
|
|
|
|
$entry['tid'] = 'n';
|
|
|
|
/* _debug_array($entry);exit; */
|
2003-11-19 15:16:15 +01:00
|
|
|
|
2001-08-04 16:12:32 +02:00
|
|
|
$this->so->add_entry($entry);
|
2001-07-08 15:54:40 +02:00
|
|
|
$ab_id = $this->get_lastid();
|
|
|
|
|
2003-12-01 01:46:45 +01:00
|
|
|
return(int)$ab_id;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function add_email()
|
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
global $name,$referer;
|
2001-07-08 15:54:40 +02:00
|
|
|
|
|
|
|
$named = explode(' ', $name);
|
2003-12-01 01:46:45 +01:00
|
|
|
for($i=count($named);$i>=0;$i--) { $names[$i] = $named[$i]; }
|
|
|
|
if($names[2])
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
|
|
|
$fields['n_given'] = $names[0];
|
|
|
|
$fields['n_middle'] = $names[1];
|
|
|
|
$fields['n_family'] = $names[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$fields['n_given'] = $names[0];
|
|
|
|
$fields['n_family'] = $names[1];
|
|
|
|
}
|
|
|
|
$fields['email'] = $add_email;
|
|
|
|
$referer = urlencode($referer);
|
|
|
|
|
2005-05-01 16:34:59 +02:00
|
|
|
$this->so->add_entry($GLOBALS['egw_info']['user']['account_id'],$fields,'private','','n');
|
2001-07-08 15:54:40 +02:00
|
|
|
$ab_id = $this->get_lastid();
|
|
|
|
|
|
|
|
Header('Location: '
|
2005-05-01 16:34:59 +02:00
|
|
|
. $GLOBALS['egw']->link('/index.php',"menuaction=addressbook.uiaddressbook.view&ab_id=$ab_id&referer=$referer"));
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
2001-08-04 16:12:32 +02:00
|
|
|
function add_entry($fields)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2003-10-24 21:05:05 +02:00
|
|
|
// setting some defaults, if not set eg. via xmlrpc
|
|
|
|
$fields['tid'] = trim($fields['tid']);
|
|
|
|
if(empty($fields['tid']))
|
|
|
|
{
|
|
|
|
$fields['tid'] = 'n';
|
|
|
|
}
|
|
|
|
if(!@$fields['owner'])
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$fields['owner'] = (int)$GLOBALS['egw_info']['user']['account_id'];
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
|
|
|
if(empty($fields['access']))
|
|
|
|
{
|
|
|
|
$fields['access'] = 'public';
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$fields = $this->xmlrpc2data($fields);
|
|
|
|
}
|
|
|
|
$id = $this->so->add_entry($fields);
|
2005-02-28 00:33:14 +01:00
|
|
|
|
2005-03-03 18:07:32 +01:00
|
|
|
if($id)
|
2005-02-28 00:33:14 +01:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $id, 'add', time());
|
2005-02-28 00:33:14 +01:00
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc && !$id)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
|
|
|
}
|
|
|
|
return $id;
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_lastid()
|
|
|
|
{
|
|
|
|
return $this->so->get_lastid();
|
|
|
|
}
|
|
|
|
|
2001-08-04 16:12:32 +02:00
|
|
|
function update_entry($fields)
|
2001-07-08 15:54:40 +02:00
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!$fields['id'] && !$fields['ab_id'])
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
2004-03-13 18:34:26 +01:00
|
|
|
return $this->add_entry($fields);
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
|
|
|
$ok = False;
|
2003-12-01 01:46:45 +01:00
|
|
|
if($this->check_perms($fields,PHPGW_ACL_EDIT))
|
2003-10-24 21:05:05 +02:00
|
|
|
{
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$fields = $this->xmlrpc2data($fields);
|
|
|
|
}
|
|
|
|
$ok = $this->so->update_entry($fields);
|
2005-04-15 14:39:26 +02:00
|
|
|
if($ok)
|
2005-02-28 00:33:14 +01:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $fields['ab_id'], 'modify', time());
|
2005-02-28 00:33:14 +01:00
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if($this->xmlrpc && !$ok)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
2004-03-10 08:53:37 +01:00
|
|
|
return $ok;
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function delete_entry($addr)
|
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if(!is_array($addr))
|
2003-10-24 22:42:00 +02:00
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
$id = (int)$addr;
|
2003-10-24 22:42:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
if(is_numeric($addr[0])) // xmlrpc liefert array($id)
|
2003-10-24 22:42:00 +02:00
|
|
|
{
|
2003-12-01 01:46:45 +01:00
|
|
|
$id = (int)$addr[0];
|
2003-10-24 22:42:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$id = isset($addr['id']) ? $addr['id'] : $addr['ab_id'];
|
|
|
|
}
|
|
|
|
}
|
2003-12-01 01:46:45 +01:00
|
|
|
if($this->check_perms($id,PHPGW_ACL_DELETE))
|
2003-10-24 21:05:05 +02:00
|
|
|
{
|
2004-03-10 08:53:37 +01:00
|
|
|
$this->so->delete_entry($id);
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $id, 'delete', time());
|
2004-03-10 08:53:37 +01:00
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
elseif($this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$GLOBALS['xmlrpcstr']['no_access']);
|
2003-10-24 21:05:05 +02:00
|
|
|
}
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
2001-07-12 06:09:12 +02:00
|
|
|
|
2003-10-24 21:05:05 +02:00
|
|
|
/*!
|
|
|
|
@function check_perms
|
|
|
|
@abstract checks if user has the necessary rights on the given address or address-id
|
|
|
|
@syntax check_perms($addr,$rights)
|
|
|
|
@param $addr mixed address-record with id and owner or addr-id
|
|
|
|
@param $rights integer PHPGW_ACL_{READ|EDIT|ADD|DELETE}
|
|
|
|
@return True if the user has the requested rights, else False
|
|
|
|
*/
|
|
|
|
function check_perms($addr,$rights)
|
2001-07-12 06:09:12 +02:00
|
|
|
{
|
2004-03-14 18:02:18 +01:00
|
|
|
$id = (int) (!is_array($addr) ? $addr : (isset($addr['id']) ? $addr['id'] : $addr['ab_id']));
|
|
|
|
|
2005-04-22 14:45:23 +02:00
|
|
|
if($id < 0)
|
2004-03-14 18:02:18 +01:00
|
|
|
{
|
|
|
|
return $rights == PHPGW_ACL_READ;
|
|
|
|
}
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!is_array($addr) || !isset($addr['rights']) && !isset($addr['owner']))
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$addr = $this->so->read_entry($id,array('owner'));
|
2005-04-22 14:45:23 +02:00
|
|
|
if(!$addr && $this->xmlrpc)
|
2004-03-10 08:53:37 +01:00
|
|
|
{
|
|
|
|
$GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$GLOBALS['xmlrpcstr']['not_exist']);
|
|
|
|
}
|
|
|
|
$addr = $addr[0];
|
|
|
|
}
|
2003-10-25 12:16:12 +02:00
|
|
|
$ret = $this->so->contacts->check_perms(False,$rights,$addr);
|
|
|
|
//echo "<p>boaddressbook::check_perms(".print_r($addr,True).",$rights) = ".($ret?'True':'False')."</p>\n";
|
|
|
|
return $ret;
|
2001-07-12 06:09:12 +02:00
|
|
|
}
|
2001-07-13 11:03:31 +02:00
|
|
|
|
|
|
|
function save_preferences($prefs,$other,$qfields,$fcat_id)
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->read_repository();
|
2003-12-01 01:46:45 +01:00
|
|
|
if(is_array($prefs))
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
2001-08-04 16:12:32 +02:00
|
|
|
/* _debug_array($prefs);exit; */
|
2003-12-01 01:46:45 +01:00
|
|
|
while(list($pref,$x) = each($qfields))
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
|
|
|
/* echo '<br>checking: ' . $pref . '=' . $prefs[$pref]; */
|
2003-12-01 01:46:45 +01:00
|
|
|
if($prefs[$pref] == 'on')
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->add('addressbook',$pref,'addressbook_on');
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('addressbook',$pref);
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(is_array($other))
|
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('addressbook','mainscreen_showbirthdays');
|
2003-12-01 01:46:45 +01:00
|
|
|
if($other['mainscreen_showbirthdays'])
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->add('addressbook','mainscreen_showbirthdays',True);
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('addressbook','default_filter');
|
2003-12-01 01:46:45 +01:00
|
|
|
if($other['default_filter'])
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->add('addressbook','default_filter',$other['default_filter']);
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('addressbook','autosave_category');
|
2003-12-01 01:46:45 +01:00
|
|
|
if($other['autosave_category'])
|
2001-07-13 11:03:31 +02:00
|
|
|
{
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->add('addressbook','autosave_category',True);
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->delete('addressbook','default_category');
|
|
|
|
$GLOBALS['egw']->preferences->add('addressbook','default_category',$fcat_id);
|
2001-07-13 11:03:31 +02:00
|
|
|
|
2005-05-01 16:34:59 +02:00
|
|
|
$GLOBALS['egw']->preferences->save_repository(True);
|
2001-07-13 11:03:31 +02:00
|
|
|
}
|
2004-02-22 16:18:36 +01:00
|
|
|
|
|
|
|
function list_methods($_type='xmlrpc')
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
This handles introspection or discovery by the logged in client,
|
|
|
|
in which case the input might be an array. The server always calls
|
|
|
|
this function to fill the server dispatch map using a string.
|
|
|
|
*/
|
|
|
|
if(is_array($_type))
|
|
|
|
{
|
|
|
|
$_type = $_type['type'] ? $_type['type'] : $_type[0];
|
|
|
|
}
|
|
|
|
switch($_type)
|
|
|
|
{
|
|
|
|
case 'xmlrpc':
|
|
|
|
$xml_functions = array(
|
|
|
|
'read' => array(
|
|
|
|
'function' => 'read_entry',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
|
|
|
),
|
|
|
|
'add' => array(
|
|
|
|
'function' => 'add_entry',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Add a single entry by passing the fields.')
|
|
|
|
),
|
|
|
|
'save' => array(
|
|
|
|
'function' => 'update_entry',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Update a single entry by passing the fields.')
|
|
|
|
),
|
2004-03-10 08:53:37 +01:00
|
|
|
'write' => array( // alias for consistent nameing
|
|
|
|
'function' => 'update_entry',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Write (update or add) a single entry by passing the fields.')
|
|
|
|
),
|
2004-02-22 16:18:36 +01:00
|
|
|
'delete' => array(
|
|
|
|
'function' => 'delete_entry',
|
2004-10-06 11:29:12 +02:00
|
|
|
'signature' => array(array(xmlrpcString,xmlrpcString)),
|
2004-02-22 16:18:36 +01:00
|
|
|
'docstring' => lang('Delete a single entry by passing the id.')
|
|
|
|
),
|
|
|
|
'read_list' => array(
|
|
|
|
'function' => 'read_entries',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
2004-03-10 08:53:37 +01:00
|
|
|
'docstring' => lang('Read a list / search for entries.')
|
|
|
|
),
|
|
|
|
'search' => array( // alias for consitent nameing
|
|
|
|
'function' => 'read_entries',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
|
|
|
'docstring' => lang('Read a list / search for entries.')
|
|
|
|
),
|
|
|
|
'categories' => array(
|
|
|
|
'function' => 'categories',
|
2004-03-14 18:02:18 +01:00
|
|
|
'signature' => array(array(xmlrpcBoolean,xmlrpcBoolean)),
|
2004-03-10 08:53:37 +01:00
|
|
|
'docstring' => lang('List all categories')
|
2004-02-22 16:18:36 +01:00
|
|
|
),
|
2004-03-14 18:02:18 +01:00
|
|
|
'customfields' => array(
|
|
|
|
'function' => 'customfields',
|
|
|
|
'signature' => array(array(xmlrpcArray,xmlrpcArray)),
|
|
|
|
'docstring' => lang('List all customfields')
|
|
|
|
),
|
2004-02-22 16:18:36 +01:00
|
|
|
'list_methods' => array(
|
|
|
|
'function' => 'list_methods',
|
|
|
|
'signature' => array(array(xmlrpcStruct,xmlrpcString)),
|
|
|
|
'docstring' => lang('Read this list of methods.')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
return $xml_functions;
|
|
|
|
break;
|
|
|
|
case 'soap':
|
|
|
|
return $this->soap_functions;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return array();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-08 15:54:40 +02:00
|
|
|
}
|
|
|
|
?>
|