public function __construct($boot) { parent::__construct($boot); if (!CurrentUser::loggedIn()) { $this->authFailed(); } }
public function __construct($boot) { parent::__construct($boot); if (!(CurrentUser::loggedIn() && CurrentUser::isAuthLevel(Access::VENDOR))) { $this->redirect(''); } }
public function minimalLayout() { if (0 && CurrentUser::loggedIn()) { $ui_array = array('page', 'vendor_id', 'id'); $this->loadUIVars('ui_blog', $ui_array); } else { $page = $this->filterInt('page'); $vendor_id = $this->filterInt('vendor_id'); $category_id = $this->filterInt('id'); } if (!isset($_GET['page']) || $_GET['page'] == '') { $_GET['page'] = 1; } // vendor lock if (isset($this->vendor_lock)) { $_GET['vendor_id'] = $this->vendor_lock; } $this->assign('top_cats', ProductsLayout::getTopCats()); if (!isset($_GET['vendor_id'])) { $_GET['vendor_id'] = 0; } else { $_GET['vendor_id'] = (int) $_GET['vendor_id']; } $p = Model::load('ProductItem'); $status = '(' . \Empathy\ELib\Storage\ProductItemStatus::AVAILABLE . ', ' . \Empathy\ELib\Storage\ProductItemStatus::SOLD_OUT . ')'; $sql = ' WHERE status IN' . $status; if ($_GET['vendor_id'] > 0) { $sql .= ' AND vendor_id = ' . $_GET['vendor_id']; } if (isset($_GET['id']) && $_GET['id'] > 0) { $cats = array(); switch ($_GET['id']) { case 1: $cats = array(3, 7, 4, 5, 6); break; case 2: $cats = array(8); break; default: break; } $sql .= ' AND category_id IN' . $p->buildUnionString($cats); } $sql .= ' AND vendor_verified = 1'; $sql .= ' ORDER BY id DESC'; if ($_GET['page'] < 1) { $_GET['page'] = 1; } $per_page = 8; $products = $p->getAllCustomPaginate(Model::getTable('ProductItem'), $sql, $_GET['page'], $per_page); $p_nav = $p->getPaginatePages(Model::getTable('ProductItem'), $sql, $_GET['page'], $per_page); $this->pages = $p_nav; $this->assign('products', $products); $this->assign('p_nav', $p_nav); $this->assign('vendor_id', $_GET['vendor_id']); if (isset($_GET['id'])) { $this->assign('category_id', $_GET['id']); } }