Улучшил обработку ошибок
This commit is contained in:
parent
b84e13f769
commit
3ebc007b8d
3 changed files with 11 additions and 5 deletions
|
|
@ -332,6 +332,11 @@ class Controller
|
||||||
$request->session()->clean('page');
|
$request->session()->clean('page');
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirect($action) {
|
||||||
|
header('location: ' . $this->fUrl($action));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Controller_Action extends Controller {}
|
class Controller_Action extends Controller {}
|
||||||
|
|
|
||||||
|
|
@ -193,10 +193,10 @@ class Mail
|
||||||
function send()
|
function send()
|
||||||
{
|
{
|
||||||
$result = mail($this->to, $this->getSubject(), $this->getMessage(), $this->getHeader());
|
$result = mail($this->to, $this->getSubject(), $this->getMessage(), $this->getHeader());
|
||||||
// $result = false;
|
|
||||||
if(! $result) {
|
if(! $result) {
|
||||||
require_once "core/path.php";
|
throw new Exception('Невозможно отправить почту');
|
||||||
file_put_contents(Path::resolveFile("data/email/send.eml"), $this->eml());
|
// require_once "core/path.php";
|
||||||
|
// file_put_contents(Path::resolveFile("data/email/send.eml"), $this->eml());
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,8 @@ class Validator
|
||||||
// Формат правила 'rule1|rule2,param1=value1|rule3,param1=value1,param2=value2'
|
// Формат правила 'rule1|rule2,param1=value1|rule3,param1=value1,param2=value2'
|
||||||
foreach ($input as $value) {
|
foreach ($input as $value) {
|
||||||
// Список правил
|
// Список правил
|
||||||
if (! isset($value['validate'])) continue;
|
if (!isset($value['validate']) || $value['validate'] == '') continue;
|
||||||
|
|
||||||
$rules = explode("|", $value['validate']);
|
$rules = explode("|", $value['validate']);
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
// Список параметров правила
|
// Список параметров правила
|
||||||
|
|
@ -61,7 +62,7 @@ class Validator
|
||||||
}
|
}
|
||||||
$this->addRule($rule);
|
$this->addRule($rule);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unknown validation rule ' . $name);
|
throw new Exception('Unknown validation rule "' . $rule . "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue