public function dashboard()
 {
     $user = Models\User::getCurrent();
     if ($user instanceof Models\User) {
         $this->slim->render('dashboard/dashboard.phtml', array());
     } else {
         $this->slim->redirect("/");
     }
 }
 public function logout()
 {
     $user = Models\User::getCurrent();
     if ($user instanceof Models\User) {
         TigerApp::log("Logout for {$user->username}");
     }
     Session::dispose('user');
     $this->slim->response()->redirect("/login");
 }
 public function index()
 {
     $user = Models\User::getCurrent();
     $this->slim->log->debug("Index page accessed from {$this->slim->request()->getIp()}");
     if ($user instanceof Models\User) {
         $this->slim->response()->redirect("/dashboard");
     } else {
         $this->slim->render('home/home.phtml', array());
     }
 }
 public function doUpload()
 {
     Models\User::checkLoggedIn();
     $user = Models\User::getCurrent();
     if ($user instanceof Models\User) {
         $imageService = new ImageService();
         $imageService->uploadImage($user, $_FILES['file']);
     } else {
         $this->slim->notFound();
     }
 }
 public function save($automatic_reload = true)
 {
     $currentUser = User::getCurrent();
     // Set the created date & user
     if (!$this->created) {
         $this->created = date("Y-m-d H:i:s");
         if ($currentUser instanceof User) {
             $this->created_user_id = $currentUser->user_id;
         }
     }
     // Set the Updated date & user
     $this->updated = date("Y-m-d H:i:s");
     if ($currentUser instanceof User) {
         $this->updated_user_id = $currentUser->user_id;
     }
     return parent::save($automatic_reload);
 }