error = false; $action = KTUtil::arrayGet($_SERVER, 'PATH_INFO'); $action = trim($action); $action = trim($action, "/"); if (empty($action)) { $this->error = true; $this->errorPage("No action given"); } $oRegistry =& KTActionRegistry::getSingleton(); $aActionInfo = $oRegistry->getActionByNsname($action); if (empty($aActionInfo)) { $this->error = true; $this->errorPage("No such action exists in KnowledgeTree"); } $sFilename = $aActionInfo[1]; if (!empty($sFilename)) { require_once($sFilename); } $oAction = new $aActionInfo[0]; $oAction->dispatch(); } function json_main() { return $this->do_main(); } /** * Handle output from this dispatcher. * * If there's an error in _this_ dispatcher, use the standard * surroundings. If not, don't put anything around the output - the * chained dispatcher will take care of that. */ function handleOutput ($data) { if ($this->bJSONMode || $this->error) { parent::handleOutput($data); } else { print $data; } } } $d = new KTActionDispatcher(); $d->dispatch();