コード例 #1
0
ファイル: prod.php プロジェクト: quenti77/easyhq
function errorHandler($number, $message, $file, $line, $vars)
{
    /* GET ERROR */
    $errors = Errors::select('E')->where('message', $message)->andWhere('file', $file)->andWhere('line', $line)->andWhere('DATE(time_catch)', '=', 'CURDATE()', false)->get();
    if (!is_null($vars) && $vars === 3) {
        return;
    }
    if (empty($errors)) {
        $error = Errors::create();
        $error->number = $number;
        $error->message = $message;
        $error->file = $file;
        $error->line = $line;
        $error->time_catch = BaseModel::now();
        $error->save();
    }
}
コード例 #2
0
ファイル: UserController.php プロジェクト: quenti77/easyhq
 public function resend($id)
 {
     $this->checker('update_full_admin');
     $user = Users::select()->where('id', $id)->get();
     if (empty($user)) {
         Router::redirect('home.index');
     }
     $user = $user[0];
     $user->mail_check = sha1($user->user_key . '-----' . time());
     $user->mail_check_at = BaseModel::now();
     $user->save();
     Users::sendMailCheck($user);
     Router::redirect('admin:user.show');
 }
コード例 #3
0
ファイル: UserController.php プロジェクト: quenti77/easyhq
 public function register()
 {
     Users::redirectIf(true);
     $nickname = Helper::post('nickname');
     $password = Helper::post('password');
     $confirm = Helper::post('password_confirm');
     $email = Helper::post('email');
     if (empty($nickname) || empty($password) || empty($confirm) || empty($email)) {
         Session::setFlash('danger', '', Translate::get('error.forms.missing.content'));
         Router::redirect('user.signup');
     }
     $errors = [];
     if (strlen($nickname) < 3 || strlen($nickname) > 40) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (!preg_match('#[a-zA-Z0-9\\_\\.]+#', $nickname)) {
         $errors['username'] = Translate::get('register.error.username');
     }
     if (strlen($password) < 6) {
         $errors['password'] = Translate::get('register.error.password');
     }
     if ($password != $confirm) {
         $errors['password'] = Translate::get('register.error.password_confirm');
     }
     if (!preg_match('/[a-zA-Z0-9\\_\\-\\.]{3,}@[a-zA-Z0-9\\-]{2,}\\.[a-z]{2,6}/', $email)) {
         $errors['email'] = Translate::get('register.error.email');
     }
     if (!empty($errors)) {
         ob_start();
         Translate::getContent('error_fields', ['errors' => $errors]);
         $content = ob_get_clean();
         Session::setFlash('danger', '', $content);
         Router::redirect('user.signup');
     }
     $users = Users::select()->addFields(['id'])->where('nickname', $nickname)->andWhere('mail', $email)->get(0, 1);
     if (!empty($users)) {
         Session::setFlash('danger', '', Translate::get('user.error.register'));
         Router::redirect('user.signup');
     }
     $random = '';
     while ($random == '') {
         $random = Config::randomString(14);
         if (Users::find('user_key', $random)) {
             $random = '';
         }
     }
     $default_group = Groups::find('g_default', 1);
     $user = Users::create();
     $user->id_group = $default_group->id;
     // TODO: Change for default group
     $user->nickname = $nickname;
     $user->password = password_hash($password, PASSWORD_BCRYPT);
     $user->user_key = $random;
     $user->mail = $email;
     $user->mail_check = sha1($user->user_key);
     $user->mail_check_at = BaseModel::now();
     $user->register_at = BaseModel::now();
     $user->connection_at = '0000-00-00 00:00:00';
     $user->save();
     Users::sendMailCheck($user);
     Session::setFlash('success', '', Translate::get('user.success.register'));
     Router::redirect('home.index');
 }
コード例 #4
0
ファイル: Tasks.php プロジェクト: quenti77/easyhq
 public function __construct()
 {
     parent::__construct(BaseModel::MODE_UPDATE);
 }