public function __call($method, $params) { if (!isset(CWebUser::$data['sessionid'])) { CWebUser::$data['sessionid'] = null; } $param = empty($params) ? null : reset($params); $result = czbxrpc::call($this->_name . '.' . $method, $param, CWebUser::$data['sessionid']); // saving API call for the debug statement CProfiler::getInstance()->profileApiCall($this->_name, $method, $params, isset($result['result']) ? $result['result'] : ''); if (isset($result['result'])) { return $result['result']; } else { $trace = $result['data']; if (isset($result['debug'])) { $trace .= ' ['; $chain = array(); foreach ($result['debug'] as $bt) { if ($bt['function'] == 'exception') { continue; } if ($bt['function'] == 'call_user_func') { break; } $chain[] = isset($bt['class']) ? $bt['class'] . '.' . $bt['function'] : $bt['function']; $chain[] = ' -> '; } array_pop($chain); $trace .= implode('', array_reverse($chain)); $trace .= ']'; } error($trace); return false; } }
public function __call($method, $params) { if (!isset(CWebUser::$data['sessionid'])) { CWebUser::$data['sessionid'] = null; } $param = empty($params) ? null : reset($params); $result = czbxrpc::call($this->_name . '.' . $method, $param, CWebUser::$data['sessionid']); // saving API call for the debug statement CProfiler::getInstance()->profileApiCall($this->_name, $method, $params, isset($result['result']) ? $result['result'] : ''); if (isset($result['result'])) { return $result['result']; } else { $trace = $result['data']; if (isset($result['debug'])) { $trace .= ' [' . CProfiler::getInstance()->formatCallStack($result['debug']) . ']'; } error($trace); return false; } }
public function execute($encoded = true) { foreach ($this->_jsonDecoded as $call) { // notification if (!isset($call['id'])) { $call['id'] = null; } if (!$this->validate($call)) { continue; } $params = isset($call['params']) ? $call['params'] : null; $auth = isset($call['auth']) ? $call['auth'] : null; $result = czbxrpc::call($call['method'], $params, $auth); $this->processResult($call, $result); } if (!$encoded) { return $this->_response; } else { return $this->json->encode($this->_response); } }
private function execute($call) { if (!isset($call['id'])) { $call['id'] = null; } // Notification if ($this->validate($call)) { $method = $call['method']; $params = isset($call['params']) ? $call['params'] : null; $auth = isset($call['auth']) ? $call['auth'] : null; $result = czbxrpc::call($method, $params, $auth); if (isset($result['result'])) { $this->json_success($call['id'], $result['result']); } else { $result['data'] = isset($result['data']) ? $result['data'] : null; $errno = $this->zbx2json_error($result['error']); $this->json_error($call['id'], $errno, $result['data']); } } }