コード例 #1
0
 /**
  * Handle the submitted forms.
  */
 protected final function handleForm()
 {
     // check, if user is logged in (except for /user/login OR /booking/website)
     if ($this->s->auth() === false && !($this->s->controller == 'user' && $this->s->action == 'login') && !($this->s->controller == 'booking' && $this->s->action == 'website')) {
         Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Sie sind nicht im System angemeldet!', true);
         return false;
     }
     // check if action is allowed for the user
     $right = $this->right();
     $action = $this->s->controller . ':' . $right;
     if (!($this->s->controller == 'user' && $this->s->action == 'login') && !($this->s->controller == 'booking' && $this->s->action == 'website') && !$this->s->user->hasRights($action) && array_key_exists($right, $this->registerRights())) {
         Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Du besitzt nicht die erforderlichen Rechte, um die Aktion ' . $action . ' auszuführen!', true);
         return false;
     }
     // get the validation rules for this action
     $rules = $this->config['rules'][$this->s->action];
     // is it a valid action?
     if (!is_array($rules)) {
         Error::addError('<strong>Die Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Es sind keine Regeln für die Aktion "' . $this->s->action . '" im Modul "' . $this->s->controller . '" definiert. Bitte benachrichtigen Sie den Administrator!', true);
         return false;
     }
     // validate the form fields using the rules of the module for this action
     $vars = array_merge($this->s->get, $this->s->post);
     $check = new Check($vars, $rules, $this->config["messages"]);
     if (true === $check->run($escape)) {
         // replace unfiltered post vars
         $this->vars = $check->vars;
         // execute the requested action
         return $this->formAction();
     } else {
         $this->form['errors'] = $check->errorFields;
         foreach ($check->errorMessages as $error) {
             Error::addWarning($error);
         }
         return false;
     }
 }
コード例 #2
0
ファイル: check_install.php プロジェクト: electrolinux/yaskef
    <h1>Yaskef - Fatal error.</h1>

    <ul>%error%</ul>

    <p>This is a fatal error. Please fix the error, and refresh the page.
    Yaskef can not run, until this error has been corrected. <br>
    </p>

    <ul>
        <li><a href="http://electrolinux.github.com/yaskef/">Yaskef documentation</a></li>
        <li><a href="https://github.com/electrolinux/yaskef">Yaskef Project on Github</a></li>
    </ul>

    </div>
    <hr>

</body>
</html>
EOM;
        if (!is_array($errors)) {
            $errors = array($errors);
        }
        $message = '<li><strong>' . implode('</strong></li><li><strong>', $errors) . '</strong></li>';
        $html = str_replace("%error%", $message, $html);
        echo $html;
        die;
    }
}
return Check::run();