Пример #1
0
 /**
  * Display login form and do login
  */
 public function action_login()
 {
     switch ($this->request->method()) {
         default:
         case 'GET':
             $view = View::factory('session/login');
             $referrer = Session::instance()->get_once('login_referrer');
             $view->set('referrer', $referrer);
             $this->response->body($view);
             break;
         case 'POST':
             $post = $this->request->post();
             $success = Auth::instance()->login($post['email'], $post['password']);
             if ($success) {
                 if ($post['referrer'] != '') {
                     $this->redirect($post['referrer']);
                 } else {
                     $this->redirect('');
                 }
             } else {
                 Lasku::flash("Invalid email/password.", Lasku::FLASH_ERROR);
                 $view = View::factory('session/login');
                 $view->set('referrer', $post['referrer']);
                 $this->response->body($view);
             }
             break;
     }
 }
Пример #2
0
 /**
  * Get/set skin name
  * 
  * If the skin doesn't exist, the default base skin will be used.
  * 
  * @param string $skin Skin name. If not specified, it will act as getter.
  *    To use default base skin, set FALSE here.
  * @return string Skin name. FALSE if using default.
  */
 public static function skin_name($skin = NULL)
 {
     // Getter
     if ($skin === NULL) {
         if (Skin::$_skin === NULL) {
             $skin = Lasku::get_config('skin');
             if (trim($skin) == '' or !is_dir(DOCROOT . "skins/{$skin}")) {
                 Skin::$_skin = FALSE;
             } else {
                 Skin::$_skin = $skin;
             }
         }
     } else {
         if (trim($skin) == '' or !is_dir(DOCROOT . "skin/{$skin}")) {
             Skin::$_skin = FALSE;
             Lasku::set_config('skin', '');
         } else {
             Skin::$_skin = $skin;
             Lasku::set_config('skin', $skin);
         }
     }
     return Skin::$_skin;
 }
Пример #3
0
 /**
  * Delete a client
  * 
  * /client/delete/<id>
  */
 public function action_delete()
 {
     $client = Model::factory('Client');
     $id = $this->request->param('id');
     if (!$client->exists($id)) {
         throw HTTP_Exception::factory(404, 'File not found!');
     }
     $data = $client->load($id, array('name'));
     $rs = $client->delete($id);
     if ($rs) {
         Lasku::flash("Client {$data['name']} is deleted.");
         $this->redirect($this->request->referrer());
     } else {
         Lasku::flash("Error when deleting {$data['nanem']}.", Lasku::FLASH_ERROR);
         $this->redirect($this->request->referrer());
     }
 }
Пример #4
0
<?php

/**
 * Header part of the base template.
 * This file comes as a pair with footer.php.
 */
$browser_names = array('Mozilla Firefox', 'Google Chrome', 'Safari');
$flash = Lasku::flash();
if ($flash != NULL) {
    $flash_class = 'info';
    if (($flash['flags'] & Lasku::FLASH_INFO) == Lasku::FLASH_INFO) {
        $flash_class = 'info';
    }
    if (($flash['flags'] & Lasku::FLASH_WARNING) == Lasku::FLASH_WARNING) {
        $flash_class = 'warning';
    }
    if (($flash['flags'] & Lasku::FLASH_ERROR) == Lasku::FLASH_ERROR) {
        $flash_class = 'error';
    }
}
?>
<noscript>
	<div class="ScreenModalDialog"><div class="wrapper"><div class="inner-wrapper">
		<h1>Have a cup of coffee.</h1>
		<p>
			We're sorry, but JavaScript is required to run this application correctly.
			Please enable JavaScript on your web browser first and try again.
		</p>
	</div></div></div>
</noscript>