本文整理汇总了PHP中Error::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::error方法的具体用法?PHP Error::error怎么用?PHP Error::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::error方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error
function error($msg, $file = false, $errorType = self::INFO)
{
if (self::$USER instanceof World_User) {
$msg .= ' (' . $file . ')';
self::$USER->log($msg, $errorType);
} else {
parent::error($msg, $file, $errorType);
}
}
示例2: about
public function about()
{
$user_id = (int) $this->getParam('author');
if ($user_id) {
$author = DB::run()->query('select u.name, u.registered_date, a.description from users u left join blog_authors a on a.user_id=u.id where u.id = ' . $user_id)->fetch();
if ($author) {
$this->view->author = $author;
$this->view->pageDescription = 'Страница автора - ' . $author->name;
$this->view->pageTitle = $author->name . ' - ' . Registry::get('site_name');
$this->view->menu = 'system-news';
$this->view->view('author');
return;
}
}
$err = new Error();
$err->error(404);
}
示例3: delegate
public function delegate()
{
// Анализируем путь
$this->getController($file, $controller, $action, $args);
// Файл доступен?
if (!is_readable($file)) {
exit('Controller\'s file is not readable!');
}
// Подключаем файл
require_once $file;
// Создаём экземпляр контроллера
$controller = new $controller($args);
// Действие доступно?
if (!is_callable([$controller, $action])) {
$err = new Error();
$err->error(404);
}
// Выполняем действие
$controller->{$action}();
}
示例4: index
public function index()
{
if (!Registry::get('is_manager')) {
$err = new Error();
$err->error(404);
return;
}
$period = date('Y-m-d', strtotime('-' . Registry::get('days_with_points') . ' days'));
$family = DB::run()->query('select u.id, u.name, t.name task_name, t.daily, t.value from users u
left join tasks t on t.user_id=u.id
where u.family = ' . Registry::get('user')->family . ' and u.id != ' . Registry::get('user')->id . '
order by u.id asc, t.value desc')->fetchAll();
if ($family) {
foreach ($family as $key => $user) {
$fam[$user->id]['name'] = $user->name;
$fam[$user->id]['total_points'] = DB::run()->query('select sum(value) from points where user_id = ' . $user->id)->fetchColumn();
$fam[$user->id]['tasks'][$key]['name'] = $user->task_name;
$fam[$user->id]['tasks'][$key]['value'] = $user->value;
$fam[$user->id]['tasks'][$key]['daily'] = $user->daily;
}
$this->view->family = $fam;
} else {
$this->view->family = false;
}
$this->view->familyPoints = DB::run()->query('select u.id, t.name task_name, p.hold_reason, p.value, p.date from users u
left join points p on p.user_id=u.id
left join tasks t on t.id=p.task_id
where u.family = ' . Registry::get('user')->family . '
and u.id != ' . Registry::get('user')->id . '
and p.date > ' . DB::run()->quote($period . ' 23:59:59') . '
order by u.id')->fetchAll();
$this->view->pageDescription = 'Данный раздел предназначен для просмотра информации по баллам о своей семье';
$this->view->pageTitle = 'Моя семья - ' . Registry::get('site_name');
$this->view->menu = 'family';
$this->view->view('index');
}
示例5: addFamily
public function addFamily()
{
if (Registry::get('user')->role != 'admin') {
$err = new Error();
$err->error(404);
return;
}
$name = $this->getParam('name');
$email = strtolower($this->getParam('email'));
$password = $this->getParam('password');
$familyName = $this->getParam('family');
if (!empty($name) && !empty($email) && !empty($password) && !empty($familyName)) {
$registeredEmail = DB::run()->query('select email from users where email = ' . DB::run()->quote($email))->fetch();
if ($registeredEmail) {
exit(json_encode(['result' => 'fail', 'message' => 'Такой Email/Логин уже зарегистрирован в системе!']));
}
$stmt = DB::run()->prepare('insert into users (family, name, email, password, role, registered_date, updated_at) values (?, ?, ?, ?, ?, ?, ?)');
$stmt2 = DB::run()->prepare('insert into families (name) values (?)');
try {
DB::run()->beginTransaction();
$date = date('Y-m-d H:i:s');
$stmt2->execute([$familyName]);
$familyId = DB::run()->lastInsertId('id');
$stmt->execute([$familyId, $name, $email, Tools::hash($password, Registry::get('hash_salt')), 'manager', $date, $date]);
DB::run()->commit();
exit(json_encode(['result' => 'done', 'message' => 'Новый менеджер и семья успешно добавлены в систему!']));
} catch (PDOException $e) {
DB::run()->rollBack();
exit(json_encode(['result' => 'fail', 'message' => $e->getMessage()]));
}
}
exit(json_encode(['result' => 'fail', 'message' => 'Все поля должны быть заполнены!']));
}