function CreateResponse(array &$result = NULL, $error = false) { $encoding = $this->GetResponseEncoding(REQUEST::ENCODING_XML); switch ($encoding) { case REQUEST::ENCODING_JSON: if ($error) { echo json_encode(array("error" => $error)); } else { echo json_encode(array_merge(array("error" => 0), $result)); } break; default: $xslt = $this->GetProp('xslt'); $time_format = $this->GetTimeFormat(); return ADEI::EncodeToStandardXML($error, $result, $xslt, array('time_format' => $time_format)); } return 0; }