Example #1
0
             $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')) {
Example #2
0
 public function result($data, $level = 0)
 {
     return '<input ' . \HTML::expandAttributes(array('type' => 'hidden', 'id' => $this->id(), 'name' => \Form::getTokenName(), 'value' => \Form::getToken($this->attribute('name')))) . ' />';
 }
Example #3
0
/**
 * Print csrf token meta
 */
function csrf_token()
{
    return Form::getToken();
}