Exemplo n.º 1
0
 private function createSessions()
 {
     if (session_status() == PHP_SESSION_NONE && !session_id()) {
         session_start();
     }
     $alert = new Alert();
     $alert->init();
 }
Exemplo n.º 2
0
 public function actionDelete(Request $request)
 {
     if (!Oauth::isLogged()) {
         return $this->goBack();
     }
     /* @var $model Unit */
     $model = Unit::find($request->getAttribute('id'));
     if ($model->delete()) {
         Alert::add("Successful delete {$model->name}");
     }
     return $this->goBack();
 }
Exemplo n.º 3
0
 public function actionLogin(Request $request)
 {
     $model = Oauth::firstOrNew($request->getParams());
     if (!$model->id) {
         Alert::add('Wrong pin', Alert::ERROR);
         return $this->render('oauth/index');
     }
     if (!$model->validateTime()) {
         Alert::add('Pin is outdated', Alert::ERROR);
         return $this->render('oauth/index');
     }
     $this->login();
     return $this->goHome();
 }
Exemplo n.º 4
0
 public function validate($attributes = [])
 {
     /* @var $this Model */
     if (!method_exists($this, 'rules')) {
         return true;
     }
     $attributes = $attributes ? array_merge($this->getAttributes(), $attributes) : $this->getAttributes();
     $validator = Main::$app->connection->validator->make($attributes, $this->rules());
     $result = $validator->passes();
     if (!$result) {
         $this->errors = $validator->errors();
         foreach ($this->errors->getMessages() as $errors) {
             foreach ($errors as $error) {
                 Alert::add($error, Alert::ERROR);
             }
         }
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <link href="/css/main.css" rel="stylesheet">
    </head>
    <body>
        <div class="wrap">
            <nav class="navbar navbar-default navbar-inverse navbar-static-top">
                <?php 
echo $this->render('search/form');
?>
            </nav>
            <main class="<?php 
echo $this->containerClass;
?>
">
                <?php 
echo Alert::display();
?>
                <?php 
echo $content;
?>
            </main>
        </div>
        <footer class="footer text-center">
            <p>&copy; xandros. Images and media relating to Millennium War Aigis are property of Nutaku.net and DMM.com</p>
        </footer>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script src="/js/bootstrap.min.js"></script>
        <script>
            globalUrl = '<?php 
echo Main::$app->web->siteUrl;
?>
Exemplo n.º 6
0
 private function showErrors(array $errors)
 {
     foreach ($errors as $message) {
         Alert::add($message, Alert::ERROR);
     }
 }