示例#1
0
文件: index.php 项目: dapepe/tymio
             $message = 'Please login!';
         }
         throw new Exception($message);
     }
 } catch (Exception $e) {
     if ($e->getMessage() != '') {
         $xmlMeta->addChild(new \Xily\Xml('message', $e->getMessage(), array('class' => 'alert alert-error')));
     }
     $view = 'login';
 }
 if ($view === 'login') {
     $returnUrl = HTTP::readGET('return', '');
     if (!Form::verify('loginreturn', Form::METHOD_GET)) {
         $returnUrl = '';
     }
     $xmlMeta->addChildren(array(new \Xily\Xml('tokenName', Form::getTokenName()), new \Xily\Xml('tokenValue', Form::getToken('login')), new \Xily\Xml('return', empty($returnUrl) ? $_SERVER['SCRIPT_URI'] : $returnUrl)));
 }
 // Check if there is a controller for the view
 if (file_exists(CONTROLLER_DIR . $view . '.php')) {
     include_once CONTROLLER_DIR . $view . '.php';
 }
 $controllerClass = ucfirst($view) . 'Controller';
 if (class_exists($controllerClass)) {
     $controller = new $controllerClass($locale);
     $controller->enrichMeta($xmlMeta);
     $xlyPage = $controller->getView();
 } else {
     // Check if the module exists
     if (is_dir(MODULE_DIR . $view)) {
         // Check if the module has a controller
         if (file_exists(MODULE_DIR . $view . '/' . $view . '.php')) {