public function complete() { $http = new Http(); $id = $http->get('id'); $rand = $http->get('rand'); $email = $http->get('email'); if ($http->isActive('change')) { $id = $http->post('id'); $rand = $http->post('rand'); $email = $http->post('email'); } if (!empty($id) && !empty($rand) && $email) { $pass = new \models\PasswordRecovery($email); if ($pass->checkUserToChange($id, $rand)) { if ($http->isActive('change')) { $pass_1 = $http->post('password'); $pass_2 = $http->post('password_2'); $passVal = new \lib\PassVal("Nieprawidłowe hasło", "Hasła nie są takie same.", 5, 15); $validator = new \lib\Validator(array('password' => $passVal, 'password_2' => $passVal)); if ($validator->validate($http->post())) { $user = new Users($id); $user->setPassword($pass_1); $user->writeData(true); $pass->deleteUserToChange($id); $message = 'Twoje hało zostalo zmienione .'; Location::To(URL . 'success/success/' . $message); } else { $this->errors = $validator->getErrors(); $this->render('changepassword', array('categories' => $this->categories, 'd_product' => $this->d_product, 'id' => $id, 'rand' => $rand, 'email' => $email, 'errors' => $this->errors)); } } $this->render('changepassword', array('categories' => $this->categories, 'd_product' => $this->d_product, 'id' => $id, 'rand' => $rand, 'email' => $email)); } else { Location::To(URL . 'error'); } } else { Location::To(URL . 'error'); } }
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 . '®ister=' . $date . '">Tutaj</a>'; $altmessage = 'W celu aktywacji konta odwiedź podany adres:' . URL . 'activation/activate?id=' . $id . '®ister=' . $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)); } } }
public function deleteShippingMethod() { $http = new Http(); if ($http->isActive('id')) { $shipping_m = new Shippment($http->post('id')); $shipping_m->delete(); echo 1; return ''; } echo 0; }
public function delete() { $http = new Http(); if ($http->isActive('yes')) { $this->eraseUser(); } if ($http->isActive('no')) { Location::To(URL . 'user/profile'); } $this->render('delete', array('categories' => $this->categories, 'd_product' => $this->d_product, 'ids' => $this->category_ids)); }
protected function productlist($arg = null) { $tab = $this->checkArg($arg); $http = new Http(); if ($http->isActive('sub_cat')) { $arg[2] = $http->get('sub_cat'); $arg[3] = $http->get('sort'); Location::To(URL . 'product/productlist/' . $arg[0] . '/' . $arg[1] . '/' . $arg[2] . '/' . $arg[3] . '/0'); } $pagination = $this->sort($arg); $pag = $pagination['pagination']; $sub_categories_m = new SubCategories(); $sub_cats = $sub_categories_m->getSubCategories(); $sub_cats_array = array(); if (!empty($sub_cats)) { foreach ($sub_cats as $key => $c) { $sub_cats_array[$key]['name'] = $c->getSubCategoryName(); $sub_cats_array[$key]['id'] = $c->getSubCategoryId(); } } $products = $pagination['products']; $next = $pag->next(); $prev = $pag->prev(); $this->render('products', array('categories' => $this->categories, 'products' => $products, 'ids' => $this->category_ids, 'slider' => $this->slider, 'd_product' => $this->d_product, 'next' => $next, 'prev' => $prev, 'action' => $this->action, 'promo' => true, 'sub_categories' => $sub_cats_array, 'category' => $arg[1], 'sub_category' => $arg[2], 'order' => $arg[3], 'page' => $arg[4], 'tab' => $tab)); }