示例#1
0
 public function post()
 {
     $f3 = \Base::instance();
     //        $f3->reroute('/beta');
     // Exit immediately if public registrations are disabled
     if (!DbConfig::getOpt('openRegister')) {
         $f3->error(400);
         return;
     }
     if ($f3->get('POST.register-password') != $f3->get('POST.register-password-verify')) {
         $f3->set('errors', ['Password verify must match the first password.']);
     } else {
         $user = User::createUser(array('name' => $f3->get("POST.register-name"), 'username' => $f3->get("POST.register-username"), 'email' => $f3->get("POST.register-email"), 'password' => $f3->get("POST.register-password")));
         // Data missing
         if ($user == false) {
             $f3->set('errors', ['Some information has not been entered correctly or is not long enough.']);
         } elseif (is_array($user)) {
             $f3->set('errors', $user);
         } else {
             $f3->set('SESSION.id', $user->id);
             $f3->set('tplData', ['name' => $f3->get("POST.register-username")]);
             SendingAPI::send(['mailTo' => $f3->get("POST.register-email"), 'mailSubject' => 'Thank you for registering on SquareMS !', 'mailContents' => ['html' => \Template::instance()->render('mails/register.html'), 'text' => "Thank you for registering on SquareMS ! \n" . "You can access your account now on https://squarems.net/ ! \n\n" . "Please do not respond to this email, it is sent by an automated system."]]);
             $f3->reroute("/dashboard");
             return;
         }
     }
     $f3->set('css', array('/static/css/auth.css'));
     $f3->set('target', 'auth/register.html');
     $this->_render('base.html');
 }
示例#2
0
 public function globalnote()
 {
     $f3 = \Base::instance();
     $this->_requireLogin();
     $this->_requireRank('admin');
     $db = $f3->get('db.instance');
     // Some side-bar stats
     $result = $db->exec('SELECT count(*) AS `count` FROM users');
     $f3->set('users_count', $result[0]['count']);
     $result = $db->exec('SELECT count(*) AS `count` FROM support_tickets');
     $f3->set('tickets_count', $result[0]['count']);
     // Global note
     $f3->set('global_note', DbConfig::getOpt('adminNote'));
     $f3->set('target', 'dashboard/admin/global_note.html');
     $this->_render('base.html');
 }