14 include_once (
"OFFLINE/Class.DomainApi.php");
22 $method = $action->getArgument(
"method");
23 $id = $action->getArgument(
"id");
24 $use = $action->getArgument(
"use");
25 $redirect = $action->getArgument(
"htmlRedirect");
27 $out =
new stdClass();
29 if (method_exists(
"DomainApi", $use ? $use : $method)) {
31 $domain = new_doc($action->dbaccess, $id);
32 if ((!$domain->isAlive()) || ($domain->control(
'view') !=
"")) {
33 $out->error = sprintf(
"unknow domain %s ", $id);
42 if ($action->getArgument(
"use")) {
43 $apiDomain = $out = call_user_func(array(
45 $action->getArgument(
"use")
47 if (!method_exists($apiDomain, $method)) {
48 $out->error = sprintf(
"method %s::%s not registered",get_class($apiDomain), $method);
54 $aconfig=array_merge($_GET, $_POST);
55 $config=
new stdClass();
56 $strip = get_magic_quotes_gpc();
57 foreach ($aconfig as $k=>$v) {
58 if ($strip) $v=stripslashes($v);
60 $config->$k=$vd?$vd:$v;
62 $out = call_user_func(array(
68 }
catch ( Exception $e ) {
69 $out->error = $e->getMessage();
70 $out->errorContext=sprintf(
"exception in method %s", $method);
74 $out->error = sprintf(
"method %s not registered", $method);
77 if ($out->error) $action->addWarningMsg($out->error);
78 redirect($action,
'FDL',
'FDL_CARD&latest=Y&refreshfld=Y&id='.$redirect);
80 $action->lay->template = json_encode($out);
81 $action->lay->noparse =
true;
off_domainapi(Action &$action)