本文整理汇总了PHP中Error::addWarning方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::addWarning方法的具体用法?PHP Error::addWarning怎么用?PHP Error::addWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::addWarning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formAction
/**
* Handle form action
*/
protected function formAction()
{
switch ($this->s->action) {
case 'reload':
// element: submenu
$this->s->resetParams('form');
$module = $this->s->loadModule($this->s->controller);
$tpl = new Template('system');
$tpl->assign('subnav', $this->generateNav($module->getSection()));
$tpl->display('submenu.html');
return true;
break;
case 'submenu':
if ($this->s->element == '') {
Error::addWarning('Fehler: ID des Untermenüs ist nicht definiert!');
return false;
}
$section = str_replace('nav_', '', $this->s->element);
$this->s->resetParams();
$tpl = new Template('system');
$tpl->assign('subnav', $this->generateNav($section));
$tpl->display('submenu.html');
return true;
break;
case 'cleanlog':
if ($this->s->element == 'error') {
$file = fopen("logs/error.log", "w+");
fclose($file);
}
return true;
break;
}
}
示例2: 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;
}
}
示例3: delete
/**
* delete current message from server
*
* @return bool
* @author Elias Müller
**/
public function delete()
{
if (($error = $this->server->DeleteMessage($this->current)) == "") {
return true;
} else {
Error::addWarning('Fehler beim Mail-Abruf: Eine Nachricht konnte nicht gelöscht werden', true);
}
return false;
}
示例4: delete
/**
* delete the object
*/
public function delete()
{
$db = DB::getInstance();
if (!is_array($this->info['replies'])) {
$sql = "DELETE FROM messages\n\t\t\t\t\t WHERE idmessage = " . $this->id;
if ($db->query($sql) === true) {
return true;
}
} else {
Error::addWarning('Nachricht kann nicht gelöscht werden: Noch Antworten vorhanden!');
}
return false;
}
示例5: login
/**
* login to the backend system
*
* @param string $username
* @param string $password
*/
public function login($username, $password)
{
session_start();
$user = User::getInstance($username);
//Error::addMessage($this->generateHash($password));
if ($user !== false) {
$hash = $this->generateHash($password, $user->password);
if ($hash == $user->password) {
$_SESSION['loggedin'] = $username;
// set datetime of login
$user->last_login = $user->current_login;
$user->current_login = date("Y-m-d H:i:s");
$user->save();
// redirect to previous page
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);
header('Location: http://' . $hostname . ($path == '/' ? '' : $path) . '/' . ($this->s->config['site']['has_frontend'] === true ? 'admin/' : '') . $this->s->post["path"]);
return true;
}
}
$_SESSION['loggedin'] = 0;
Error::addWarning("Login fehlgeschlagen! Benutzername und/oder Passwort falsch!");
return false;
}