/**
* Delete an infolog entry, evtl. incl. it's children / subs
*
- * @param int/array $info_id int id or array with keys 'info_id', 'delete=
_children' and 'new_parent' setting all 3 params
+ * @param int/array $info_id int id
* @param boolean $delete_children should the children be deleted
* @param int/boolean $new_parent parent to use for not deleted children =
if > 0
* @return boolean True if delete was successful, False otherwise ($info_=
id does not exist or no rights)
@@ -470,24 +430,14 @@
{
if (is_array($info_id))
{
- $delete_children =3D $info_id['delete_children'];
- $new_parent =3D $info_id['new_parent'];
$info_id =3D (int)(isset($info_id[0]) ? $info_id[0] : (isset($info_id['=
info_id']) ? $info_id['info_id'] : $info_id['info_id']));
}
if ($this->so->read($info_id) =3D=3D=3D False)
{
- if ($this->xmlrpc)
- {
- $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$G=
LOBALS['xmlrpcstr']['not_exist']);
- }
return False;
}
if (!$this->check_access($info_id,EGW_ACL_DELETE))
{
- if ($this->xmlrpc)
- {
- $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$G=
LOBALS['xmlrpcstr']['no_access']);
- }
return False;
}
// check if we have children and delete or re-parent them
@@ -550,8 +500,7 @@
*
* checks and asures ACL
*
- * @param array &$values values to write, if contains values for check_def=
aults and touch_modified,
- * they have precedens over the parameters. The
+ * @param array &$values values to write
* @param boolean $check_defaults=3Dtrue check and set certain defaults
* @param boolean $touch_modified=3Dtrue touch the modification data and s=
ets the modiefier's user-id
* @return int/boolean info_id on a successfull write or false
@@ -559,15 +508,6 @@
function write(&$values,$check_defaults=3DTrue,$touch_modified=3DTrue)
{
//echo "boinfolog::write()values=3D"; _debug_array($values);
- // allow to (un)set check_defaults and touch_modified via values, eg. vi=
a xmlrpc
- foreach(array('check_defaults','touch_modified') as $var)
- {
- if(isset($values[$var]))
- {
- $$var =3D $values[$var];
- unset($values[$var]);
- }
- }
if ($status_only =3D $values['info_id'] && !$this->check_access($values[=
'info_id'],EGW_ACL_EDIT))
{
if (!isset($values['info_responsible']))
@@ -591,15 +531,7 @@
if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_AC=
L_EDIT) && !$status_only ||
!$values['info_id'] && $values['info_id_parent'] && !$this->check_ac=
cess($values['info_id_parent'],EGW_ACL_ADD))
{
- if ($this->xmlrpc)
- {
- $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['no_access'],$G=
LOBALS['xmlrpcstr']['no_access']);
- }
return False;
- }
- if ($this->xmlrpc)
- {
- $values =3D $this->xmlrpc2data($values);
}
if ($status_only && !$undelete) // make sure only status gets writen
{
@@ -668,7 +600,8 @@
// Should only an entry be updated which includes the original modifica=
tion date?
// Used in the web-GUI to check against a modification by an other user=
while editing the entry.
// It's now disabled for xmlrpc, as otherwise the xmlrpc code need to b=
e changed!
- $check_modified =3D $values['info_datemodified'] && !$this->xmlrpc ? $v=
alues['info_datemodified']-$this->tz_offset_s : false;
+ $xmprpc =3D is_object($GLOBALS['server']) && $GLOBALS['server']->last_m=
ethod;
+ $check_modified =3D $values['info_datemodified'] && !$xmlrpc ? $values[=
'info_datemodified']-$this->tz_offset_s : false;
$values['info_datemodified'] =3D $this->user_time_now;
}
if ($touch_modified || !$values['info_modifier'])
@@ -771,16 +704,6 @@
{
if ($data[$time]) $ret[$id][$time] +=3D $this->tz_offset_s;
}
- }
- }
- if ($this->xmlrpc && is_array($ret))
- {
- $infos =3D& $ret;
- unset($ret);
- $ret =3D array();
- foreach($infos as $id =3D> $data)
- {
- $ret[] =3D $this->data2xmlrpc($data);
}
}
//echo "<p>boinfolog::search(".print_r($query,True).")=3D<pre>".print_r(=
$ret,True)."</pre>\n";
@@ -1035,156 +958,6 @@
}
=
/**
- * 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.
- *
- * @param string $_type=3D'xmlrpc' xmlrpc or soap
- * @return array
- */
- function list_methods($_type=3D'xmlrpc')
- {
- if (is_array($_type))
- {
- $_type =3D $_type['type'] ? $_type['type'] : $_type[0];
- }
-
- switch($_type)
- {
- case 'xmlrpc':
- $xml_functions =3D array(
- 'read' =3D> array(
- 'function' =3D> 'read',
- 'signature' =3D> array(array(xmlrpcInt,xmlrpcInt)),
- 'docstring' =3D> lang('Read one record by passing its id.')
- ),
- 'search' =3D> array(
- 'function' =3D> 'search',
- 'signature' =3D> array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =3D> lang('Returns a list / search for records.')
- ),
- 'write' =3D> array(
- 'function' =3D> 'write',
- 'signature' =3D> array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =3D> lang('Write (add or update) a record by passing its=
fields.')
- ),
- 'delete' =3D> array(
- 'function' =3D> 'delete',
- 'signature' =3D> array(array(xmlrpcInt,xmlrpcInt)),
- 'docstring' =3D> lang('Delete one record by passing its id.')
- ),
- 'categories' =3D> array(
- 'function' =3D> 'categories',
- 'signature' =3D> array(array(xmlrpcBoolean,xmlrpcBoolean)),
- 'docstring' =3D> lang('List all categories')
- ),
- 'list_methods' =3D> array(
- 'function' =3D> 'list_methods',
- 'signature' =3D> array(array(xmlrpcStruct,xmlrpcString)),
- 'docstring' =3D> lang('Read this list of methods.')
- )
- );
- return $xml_functions;
- break;
- case 'soap':
- return $this->soap_functions;
- break;
- default:
- return array();
- break;
- }
- }
-
- /**
- * Convert an InfoLog entry into its xmlrpc representation, eg. convert t=
imestamps to datetime.iso8601
- *
- * @param array $data infolog entry
- * @param array xmlrpc infolog entry
- */
- function data2xmlrpc($data)
- {
- $data['rights'] =3D $this->so->grants[$data['info_owner']];
-
- // translate timestamps
- if($data['info_enddate'] =3D=3D 0) unset($data['info_enddate']);
- foreach($this->timestamps as $name)
- {
- if (isset($data[$name]))
- {
- $data[$name] =3D $GLOBALS['server']->date2iso8601($data[$name]);
- }
- }
- $ret[$id]['info_percent'] =3D (int)$data['info_percent'].'%';
-
- // translate cat_id
- if (isset($data['info_cat']))
- {
- $data['info_cat'] =3D $GLOBALS['server']->cats2xmlrpc(array($data['info=
_cat']));
- }
- foreach($data as $name =3D> $val)
- {
- if (substr($name,0,5) =3D=3D 'info_')
- {
- unset($data[$name]);
- $data[substr($name,5)] =3D $val;
- }
- }
- // unsetting everything which could result in an typeless <value />
- foreach($data as $key =3D> $value)
- {
- if (is_null($value) || is_array($value) && !$value)
- {
- unset($data[$key]);
- }
- }
- return $data;
- }
-
- /**
- * Convert an InfoLog xmlrpc representation into the internal one, eg. co=
nvert datetime.iso8601 to timestamps
- *
- * @param array $data infolog entry
- * @param array xmlrpc infolog entry
- */
- function xmlrpc2data($data)
- {
- foreach($data as $name =3D> $val)
- {
- if (substr($name,0,5) !=3D 'info_')
- {
- unset($data[$name]);
- $data['info_'.$name] =3D $val;
- }
- }
- // translate timestamps
- foreach($this->timestamps as $name)
- {
- if (isset($data[$name]))
- {
- $data[$name] =3D $GLOBALS['server']->iso86012date($data[$name],True);
- }
- }
- // translate cat_id
- if (isset($data['info_cat']))
- {
- $cats =3D $GLOBALS['server']->xmlrpc2cats($data['info_cat']);
- $data['info_cat'] =3D (int)$cats[0];
- }
- return $data;
- }
-
- /**
- * return array with all infolog categories (for xmlrpc)
- *
- * @param boolean $complete true returns array with all data for each cat=
, else only the title is returned
- * @return array with cat_id / title or data pairs (see above)
- */
- function categories($complete =3D False)
- {
- return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False;
- }
-
- /**
* Returm InfoLog (custom) status icons for projectmanager
*
* @param array $args array with id's in $args['infolog']