private function init() { $app = JFactory::getApplication(); $category_id = $app->input->get('category_id'); if (!$category_id || !JeproshopValidator::isUnsignedInt($category_id)) { } $this->category = new JeproshopCategoryModelCategory($category_id, $this->context->language->lang_id); $this->context->controller->init(); if (!$this->category->published) { header('HTTP/1.1 4O4 Not Found'); header('Status: 404 Not Found'); } //check if category can be accessible by current customer and return 403 if not if (!$this->category->checkAccess($this->context->customer->customer_id)) { header('HTTP/1.1 403 Forbidden'); header('Status: 403 Forbidden'); $this->errors[] = JText::_('You do not have access to this category.'); $this->customer_access = false; } $this->context->controller->init(); }
/** * Check customer informations and return customer validity * * @since 1.5.0 * @param boolean $with_guest * @return boolean customer validity */ public function isLogged($with_guest = false) { if (!$with_guest && $this->is_guest == 1) { return false; } /* Customer is valid only if it can be load and if object password is the same as database one */ if ($this->logged == 1 && $this->customer_id && JeproshopValidator::isUnsignedInt($this->customer_id) && JeproshopCustomerModelCustomer::checkPassword($this->customer_id, $this->passwd)) { return true; } return false; }
/** * Check if order contains (only) virtual products * * @param boolean $strict If false return true if there are at least one product virtual * @return boolean true if is a virtual order or false * */ public function isVirtual($strict = true) { $products = $this->getProducts(); if (count($products) < 1) { return false; } $virtual = true; foreach ($products as $product) { $pd = JeproshopProductDownloadModelProductDownload::getIdFromProductId((int) $product->product_id); if ($pd && JeproshopValidator::isUnsignedInt($pd) && $product->download_hash && $product->display_filename != '') { if ($strict === false) { return true; } } else { $virtual &= false; } } return $virtual; }
/** * Check employee informations saved into cookie and return employee validity * * @return boolean employee validity */ public function isLoggedBack() { if (!JeproshopCache::isStored('jeproshop_is_logged_back_' . $this->employee_id)) { /* Employee is valid only if it can be load and if cookie password is the same as database one */ JeproshopCache::store('jeproshop_is_logged_back_' . $this->employee_id, $this->employee_id && JeproshopValidator::isUnsignedInt($this->employee_id) && JeproshopEmployeeModelEmployee::checkPassword($this->employee_id, JeproshopContext::getContext()->cookie->passwd) && (!isset(JeproshopContext::getContext()->cookie->remote_addr) || JeproshopContext::getContext()->cookie->remote_addr == ip2long(JeproshopValidator::getRemoteAddr()) || !JeproshopSettingModelSetting::getValue('cookie_check_ip'))); } return JeproshopCache::retrieve('jeproshop_is_logged_back_' . $this->employee_id); }