Ejemplo n.º 1
0
 public function action_index()
 {
     if (!Auth::instance()->logged_in() && isset($_POST['login'])) {
         $user = ORM::factory('User');
         $status = Auth::instance()->login($_POST['username'], $_POST['password'], true);
         if ($status) {
             HTTP::redirect('/');
         }
     }
     if (Auth::instance()->logged_in() && isset($_POST['logout'])) {
         Auth::instance()->logout();
     }
     if (!Auth::instance()->logged_in()) {
         Guestid::factory()->get_id();
     }
     $templateData['title'] = 'Главная.';
     $templateData['description'] = '';
     $template = View::factory('template')->set('templateData', $templateData);
     $content = View::factory("catalog");
     $content->get = $_GET;
     $content->shopArr = Model::factory('Shop')->getShop();
     $root_page = "index";
     $template->root_page = $root_page;
     $template->content = $content;
     $this->response->body($template);
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     if (Auth::instance()->logged_in()) {
         $this->user_id = Auth::instance()->get_user()->id;
     } else {
         $this->user_id = Guestid::factory()->get_id();
     }
     DB::query(Database::UPDATE, "SET time_zone = '+10:00'")->execute();
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     if (Auth::instance()->logged_in()) {
         $this->user_id = Auth::instance()->get_user()->id;
     } else {
         $this->user_id = Guestid::factory()->get_id();
     }
     $this->devLimit = preg_match('/\\.lan/i', $_SERVER['SERVER_NAME']) ? 'limit 0, 6' : '';
     DB::query(Database::UPDATE, "SET time_zone = '+10:00'")->execute();
 }