decode($raw); // Parse prefix and method $chunks = explode('.', $input['method']); $type = $chunks[0]; $input['method'] = $chunks[1]; // Clean up type, only a-z stuff. $type = preg_replace("/[^a-z]/i", "", $type); if ($type == "") die('{"result":null,"id":null,"error":{"errstr":"No type set.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}'); // Include Base and Core and Config. $man = new Moxiecode_ManagerEngine($type); require_once($basepath ."CorePlugin.php"); require_once("../config.php"); $man->dispatchEvent("onPreInit", array($type)); $config =& $man->getConfig(); // Include all plugins $pluginPaths = $man->getPluginPaths(); foreach ($pluginPaths as $path) require_once("../". $path); // Dispatch onInit event if ($man->isAuthenticated()) { $man->dispatchEvent("onBeforeRPC", array($input['method'], $input['params'][0])); $result = new stdClass(); $result->result = $man->executeEvent("onRPC", array($input['method'], $input['params'][0])); $result->id = $input['id']; $result->error = null; $data = $json->encode($result); //header('Content-Length: ' . strlen($data)); die($data); } else die('{"result":{"login_url":"' . addslashes($config["authenticator.login_page"]) . '"},"id":null,"error":{"errstr":"Access denied by authenicator.","errfile":"","errline":null,"errcontext":"","level":"AUTH"}}'); ?>