本文整理汇总了PHP中Check::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::run方法的具体用法?PHP Check::run怎么用?PHP Check::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleForm
/**
* 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: array
<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();