Пример #1
0
 public static function index($lang)
 {
     if (isset($lang)) {
         Controller::setLanguage($lang);
     }
     $data = array('horay' => 'Horraayyy!!!', 'form' => '', 'table' => self::_table_user());
     return Controller::view('home/v_index', $data);
     //        return Controller::markdown('home/README');
 }
Пример #2
0
 public function __construct($action, $args)
 {
     $this->categories_m = new \models\Categories();
     $this->categories = $this->categories_m->getCategories();
     $this->category_ids = $this->categories_m->getCategoriesIds();
     $this->products_m = new \models\Products();
     $this->d_product = $this->products_m->getDayProduct();
     parent::__construct($action, $args);
 }
Пример #3
0
 public function __construct($action = null, $args = null)
 {
     $this->categories_m = new Categories();
     $this->categories = $this->categories_m->getCategories();
     $this->products_m = new Products();
     $this->category_ids = $this->categories_m->getCategoriesIds();
     $this->slider = $this->products_m->getSliderProducts();
     $this->d_product = $this->products_m->getDayProduct();
     parent::__construct($action, $args);
 }
Пример #4
0
 public function __construct()
 {
     parent::__construct();
     $this->http = new Http();
     $this->categories_m = new \models\Categories();
     $this->categories = $this->categories_m->getCategories();
     $this->category_ids = $this->categories_m->getCategoriesIds();
     $this->products_m = new \models\Products();
     $this->d_product = $this->products_m->getDayProduct();
     $this->check();
 }
Пример #5
0
 public function __construct()
 {
     parent::__construct();
     $id = Register::get('id');
     if (!empty($id)) {
         $user = new User($id);
         $user->setLastVisit();
         $user->writeData(true);
         $this->logout();
     }
     $this->logout();
 }
Пример #6
0
 public function __construct()
 {
     parent::__construct();
     if (Session::isSession('user')) {
         $user = new User();
         $user->findByName(Session::getData('user'));
         $authlevel = $user->getAuthlevel();
         $this->view->addAuthlevel($authlevel);
         $this->view->addLogged(1);
     } else {
         $this->view->addLogged(0);
     }
 }
Пример #7
0
 public function __construct($action, $args)
 {
     $this->categories_m = new \models\Categories();
     $this->categories = $this->categories_m->getCategories();
     $this->category_ids = $this->categories_m->getCategoriesIds();
     $this->products_m = new \models\Products();
     $this->d_product = $this->products_m->getDayProduct();
     $id = \lib\Register::get('id');
     if (!empty($id)) {
         $this->user_m = new \models\User($id);
         $this->user_m->LoadData($id);
     } else {
         Location::To(URL . 'home');
     }
     parent::__construct($action, $args);
 }
Пример #8
0
    public function __construct()
    {
        if (\Lib\LoginVal::isLogged()) {
            Location::To(URL . 'user');
        }
        parent::__construct();
        $http = new Http();
        $this->categories_m = new \models\Categories();
        $this->categories = $this->categories_m->getCategories();
        $this->products_m = new \models\Products();
        $this->d_product = $this->products_m->getDayProduct();
        $this->category_ids = $this->categories_m->getCategoriesIds();
        if (!$http->isActive('login')) {
            $this->render('register', array('categories' => $this->categories, 'd_product' => $this->d_product, 'ids' => $this->category_ids));
        } else {
            $passVal = new \lib\PassVal("Nieprawidłowe hasło", "Hasła nie są takie same.", 5, 15);
            $validator = new Validator(array('login' => new \lib\LoginVal("Podana nazwa użytkownika jest zajęta.", "Nieprawidłowa nazaw użytkownika.", 5, 15), 'email' => new \lib\EmailVal("Nieprawidłowy email."), 'password' => $passVal, 'password_2' => $passVal, 'accept' => new \lib\CheckBoxVal("Nie zaznaczono pola z akceptacją regulaminu.")));
            if ($validator->validate($http->post())) {
                $this->register($http->post());
                $user = new \models\User($this->id);
                $date = $user->getRegistrationDate();
                $subject = 'Aktywacja Konta';
                $message = 'W celu aktywowania Konta kliknij 
						<a href="' . URL . 'activation/activate?id=' . $this->id . '&register=' . $date . '">Tutaj</a>';
                $altmessage = 'W celu aktywacji konta odwiedź podany adres:' . URL . 'activation/activate?id=' . $id . '&register=' . $date;
                $email = new Email();
                if ($email->send($http->post('email'), $subject, $message, $altmessage)) {
                    Location::To(URL . 'success/success/Sprawdź email w celu aktywacji konta.');
                } else {
                    Location::To(URL . 'error');
                }
            } else {
                $this->errors = $validator->getErrors();
                $this->render('register', array('categories' => $this->categories, 'd_product' => $this->d_product, 'ids' => $this->category_ids, 'errors' => $this->errors));
            }
        }
    }
Пример #9
0
 /**
  * Combine css into one file.
  */
 public function combineCss()
 {
     Controller::combine($this->caches_folder . $this->combined_css_filename, $this->css_folder . '*.css');
 }
Пример #10
0
 public function __construct($action, $args)
 {
     $this->http = new Http();
     parent::__construct($action, $args);
 }
 public function __construct(AdminManager $manager)
 {
     parent::__construct($manager);
     $this->setTotalPages();
 }
Пример #12
0
 public static function index()
 {
     return Controller::view('home/v_notfound');
 }
Пример #13
0
 public function __construct()
 {
     parent::__construct();
 }
Пример #14
0
 public function __construct($action, $args)
 {
     parent::__construct($action, $args);
 }
Пример #15
0
    if (file_exists(ROOT . $classFile . '.php')) {
        require ROOT . $classFile . '.php';
    } else {
        throw new Exception("{$classFile} not found");
    }
}
try {
    $dbh = new PDO($dsn, $user, $password);
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    Registry::set('dbh', $dbh);
    Router::resolve($url);
    $_controller = Router::$_controller;
    $_action = Router::$_action;
    $_controller = '\\Controller\\' . ucfirst($_controller) . "Controller";
    $_action .= "Action";
    $_controller = new $_controller();
    if (method_exists($_controller, $_action)) {
        $content = $_controller->{$_action}();
    } else {
        throw new Exception("{$_action} not found");
    }
} catch (PDOException $e) {
    $to = $for_pdo_exception['email'];
    $subject = $for_pdo_exception['subject'];
    $message = $e->getMessage();
    mail($to, $subject, $message);
    $content = Controller::renderError(500, 'Server error');
} catch (Exception $e) {
    $content = Controller::renderError($e->getCode(), $e->getMessage());
}
echo $content;