public function __construct($model = null) { parent::__construct(); $this->data = new stdClass(); $this->meta = new ControllerMeta(); /*{ TODO Having an XDO should be optional not all app asks for an XDO*/ if (!$this instanceof NoXDO) { $this->xdo = new ControllerXDO(); if ($this->xdo->serialized()) { $this->xdo->unserialize(); } } else { $this->xdo = new DummyXDO(); } /*}*/ /*{ TODO Save applies here too. not all app need a session Storage some wants to work real Stateless too*/ if (!$this instanceof NoSession) { $this->session = new SessionXDO(); if ($this->session->serialized()) { $this->session->unserialize(); } } else { $this->session = new DummyXDO(); } /**/ $controllerName = get_class($this); if (!$this instanceof NoXDO) { $desc = new \ROM\BongXDODescriptor(\ROM\BongXDODescriptor::ControllerXDO, $controllerName, $this->xdo->sessionFilePath()); \ROM\BongCurrentUserData::instance()->addXDO($desc); } $this->spiritEngine = EngineFactory::produce("SpiritEngine", array(&$this)); $this->ctor(); }
public function __construct(&$engine, $spiritName, $instanceId = null) { if (!static::iCheck()) { assert("/*Some Interface Not Implemented Properly Check Previous Errors*/"); return false; } parent::__construct(); $this->data = new stdClass(); $this->_engine = $engine; $this->meta = new SpiritMeta($spiritName); if (static::serializable() == SpiritAbstractor::SerializableXDO) { $this->xdo = new SpiritXDO(); } else { $this->xdo = new SpiritMemoryXDO(); //TODO should be new MemoryXDO() Instead. } $this->xdo->setAbstractor($this); $this->xdo->setSpirit($spiritName); if (static::serializable() == SpiritAbstractor::SerializableXDO) { $_spiritName = get_class($this); $desc = new \ROM\BongXDODescriptor(\ROM\BongXDODescriptor::SpiritXDO, $_spiritName, $this->xdo->sessionFilePath()); \ROM\BongCurrentUserData::instance()->addXDO($desc); } if (static::feeder() == SpiritAbstractor::ControllerFeeded) { $this->controller = $engine->currentController(); } elseif (static::feeder() == SpiritAbstractor::SpiritFeeded) { $this->controller = $engine->abstractor(); } /*} */ if (static::binding() == SpiritAbstractor::InstanceBinding) { $this->_instanceId = $instanceId; $this->xdo->setUID($this->uid()); } if ($this->xdo->serialized()) { $this->xdo->unserialize(); } $this->xdo->setSpirit($spiritName); $this->ctor(); }
\ROM\BongCurrentUserData::startSession(); $router = URLAnalyzer::instance()->decide(); \ROM\BongCurrentUserData::instance()->load(); if (!\ROM\BongCurrentUserData::instance()->identical()) { \ROM\BongCurrentUserData::reset(); } $urlReq = new \ROM\UrlRequest(time(), session_id(), $_SERVER['SCRIPT_NAME']); \ROM\BongCurrentUserData::instance()->addUrlRequest($urlReq); Runtime::loadModule('dal'); /*AbstractContentEngine* */ $engine = $router->engine(); $engine->run(); HTTPHeaders::send(); $response = $engine->response(); $res = new stdClass(); $res->url = $r_url; $res->res = base64_encode($response); $res->checksum = md5($res->res); if (!empty($r_checksum) && $r_checksum == $res->checksum) { $res->res = ''; } $response = ""; $response_buff[] = $res; \ROM\BongCurrentUserData::instance()->dump(); Singleton::clearAllInstances(); //var_dump(Path::instance()->evaluate(":mkt.apps.view.+&controller.-&method.@&method.view.php")); } /**/ /*}*/ header('Content-Type: application/json'); echo json_encode($response_buff);