protected function getContent() { $man_ctr = \OWeb\manage\Controller::getInstance(); //On va voir quel page on doit charger $get = \OWeb\OWeb::getInstance()->get_get(); if (isset($get['page'])) { $ctr = $get['page']; } else { $ctr = OWEB_DEFAULT_PAGE; } try { $ctr = str_replace("\\\\", "\\", $ctr); $ctr = str_replace(".", "\\", $ctr); $ctr = $man_ctr->loadController('Page\\' . $ctr); $ctr->loadParams(); $man_ctr->initController(); } catch (\Exception $ex) { $ctr = $man_ctr->loadController('Page\\OWeb\\errors\\http\\NotFound'); } ob_start(); try { $ctr->display(); } catch (\Exception $e) { ob_end_clean(); ob_start(); $ctr = $man_ctr->loadException($e); $ctr->addParams("exception", $e); $man_ctr->display(); } $this->content = ob_get_contents(); ob_end_clean(); Events::getInstance()->sendEvent('Didplay_Prepare@OWeb\\manage\\Headers'); $header = \OWeb\manage\Headers::getInstance()->getAllHeaders(); return array('headers' => $header, "content" => $this->content); }
protected function startConnection() { $get = \OWeb\OWeb::getInstance()->get_get(); $post = \OWeb\OWeb::getInstance()->get_post(); $cookies = \OWeb\OWeb::getInstance()->get_cookies(); session_name($this->set_SessionName); session_start(); if (isset($get['ext_a']) && $get['ext_a'] == 'disconnect') { $this->disconnect(); $this->getLandDisConnected($get, $cookies); return false; } //If we have login information in the session let's try to connect; if (isset($_SESSION[$this->set_SessionName . '_auth'])) { $result = explode(":", $_SESSION[$this->set_SessionName . '_auth']); if (sizeof($result) > 1) { if ($this->connect_session($result[0], $result[1])) { $_SESSION[$this->set_SessionName . '_auth'] = $result[0] . ":" . $result[1]; $this->connection_type = self::TYPE_SESSION; $this->getLangConnected($get, $cookies); return true; } } } //Well let's se with the cookes then if (isset($cookies[$this->set_SessionName . '_auth']) && isset($cookies[$this->set_SessionName . '_auth']['login']) && isset($cookies[$this->set_SessionName . '_auth']['pwd'])) { if ($this->connect_cookie($cookies[$this->set_SessionName . '_auth']['login'], $cookies[$this->set_SessionName . '_auth']['pwd'])) { $this->connection_type = self::TYPE_COOKIE; $this->getLangConnected($get, $cookies); return true; } } //Still nothing. Maybe a new connection? if (isset($post['ext_a']) && $post['ext_a'] == 'connect' && isset($post['login']) && isset($post['pwd'])) { if ($this->connect_new($post['login'], $post['pwd'])) { $_SESSION[$this->set_SessionName . '_auth'] = $post['login'] . ":" . md5($post['pwd']); $this->connection_type = self::TYPE_NEW; $this->getLangConnected($get, $cookies); return true; } } $this->getLandDisConnected($get, $cookies); return false; }
public function initMode() { //On va charger le controleur. $man_ctr = \OWeb\manage\Controller::getInstance(); //On va voir quel page on doit charger $get = \OWeb\OWeb::getInstance()->get_get(); if (isset($get['page'])) { $ctr = $get['page']; } else { $ctr = OWEB_DEFAULT_PAGE; } try { $ctr = str_replace("\\\\", "\\", $ctr); $ctr = str_replace(".", "\\", $ctr); $ctr = $man_ctr->loadController('Page\\' . $ctr); $ctr->loadParams(); } catch (\Exception $ex) { $ctr = $man_ctr->loadController('Page\\OWeb\\errors\\http\\NotFound'); $ctr->loadParams(); } }
public function display() { $result = ''; $get = \OWeb\OWeb::getInstance()->get_get(); if (isset($get['action'])) { $r = $this->extension->doAction($get['action']); if ($r != null) { if (empty($result)) { $result = $r; } elseif (is_array($result)) { $result[] = $r; } else { $r2 = $result; $result = array(); $result[] = $r2; $result[] = $r; } } } $i = 1; while (isset($get['action_' . $i])) { $r = $this->extension->doAction($get['action_' . $i]); if ($r != null) { if (empty($result)) { $result = $r; } elseif (is_array($result)) { $result[] = $r; } else { $r2 = $result; $result = array(); $result[] = $r2; $result[] = $r; } } $i++; } echo json_encode($result); }
/** * Will initialize the Controller and will do the Actions to which the Controller has register * * @param \OWeb\types\Controller $controller The controller to Initialize */ public function initController(\OWeb\types\Controller $controller = null) { if ($this->controller == null) { return; } Events::getInstance()->sendEvent('Init_Prepare@OWeb\\manage\\Controller', $this->controller); $this->controller->initController(); Events::getInstance()->sendEvent('Init_Done@OWeb\\manage\\Controller', $this->controller); Events::getInstance()->sendEvent('ActionDist_Prepare@OWeb\\manage\\Controller', $this->controller); //gestion des Actions... $source[] = \OWeb\OWeb::getInstance()->get_get(); $source[] = \OWeb\OWeb::getInstance()->get_post(); foreach ($source as $get) { if (isset($get['action'])) { $this->controller->doAction($get['action']); } $i = 1; while (isset($get['action_' . $i])) { $this->controller->doAction($get['action_' . $i]); $i++; } } Events::getInstance()->sendEvent('ActionDist_Done@OWeb\\manage\\Controller', $this->controller); }
/** * Automatically loads parameters throught PHP get and Post variables */ public function loadParams() { switch ($this->action_mode) { case self::ACTION_DOUBLE: $a = array_merge(\OWeb\OWeb::getInstance()->get_post(), \OWeb\OWeb::getInstance()->get_get()); break; case self::ACTION_GET: $a = \OWeb\OWeb::getInstance()->get_get(); break; case self::ACTION_POST: $a = \OWeb\OWeb::getInstance()->get_post(); break; } $this->params = $a; }
/** * Automatically loads parameters throught PHP get and Post variables */ public function loadParams() { $this->params = \OWeb\OWeb::getInstance()->get_get(); }
public function doRefresh() { //Validating elements. Should be already done but let's say on the safe side $this->form->validateElements(); print_r(\OWeb\OWeb::getInstance()->get_get()); }
protected function ready() { parent::ready(); $this->scripts = OWeb::getInstance()->getManageExtensions()->getExtension('Maniaplanet\\Manialink\\Maniascript', 'Header'); }
protected function init() { $this->eventM = OWeb::getInstance()->getManageEvents(); $this->addAlias("addScript", "addScript"); }
public static function getCurrentLink() { return new Link(\OWeb\OWeb::getInstance()->get_get()); }