From 89324029f13fae8ef1d4c537c415432713782aa2 Mon Sep 17 00:00:00 2001 From: loic Date: Wed, 10 Oct 2001 15:17:21 +0000 Subject: [PATCH] xmlrpc preference setting --- admin/inc/class.boconfig.inc.php | 98 ++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 admin/inc/class.boconfig.inc.php diff --git a/admin/inc/class.boconfig.inc.php b/admin/inc/class.boconfig.inc.php new file mode 100644 index 0000000000..5bff5a98e7 --- /dev/null +++ b/admin/inc/class.boconfig.inc.php @@ -0,0 +1,98 @@ + array( + 'in' => array('struct', 'struct'), + 'out' => array() + ) + ); + + 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( + 'rpc_values' => array( + 'function' => 'rpc_values', + 'signature' => array(array(xmlrpcStruct,xmlrpcStruct)), + 'docstring' => lang('Set preference values.') + ), + '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; + } + } + + // xmlrpc functions + + function rpc_values($data) + { + $newsettings = $data['newsettings']; + if (!$data['appname']) + { + $errors[] = "Missing appname"; + } + if (!is_array($newsettings)) + { + $errors[] = "Missing newsettings or not an array"; + } + + if (is_array($errors)) + { + return $errors; + } + + $conf = CreateObject('phpgwapi.config', $data['appname']); + + $conf->read_repository(); + reset($newsettings); + while(list($key,$val) = each($newsettings)) + { + $conf->value($key, $val); + } + $conf->save_repository(); + return True; + } + + } +?>