private function sanitize() { $this->user = GWF_Session::getUser(); if (false !== ($error = GWF_LinksValidator::mayAddLink($this->module, $this->user))) { return GWF_HTML::error('Links', $error); } return false; }
private function sanitize() { $this->user = GWF_Session::getUser(); $links = GDO::table('GWF_Links'); $this->by = Common::getGet('by', self::DEFAULT_BY); $this->dir = Common::getGet('dir', self::DEFAULT_DIR); // if ($this->by === false && $this->dir === false) // { // $this->by = self::DEFAULT_BY; // $this->dir = self::DEFAULT_DIR; // $this->orderby = self::DEFAULT_ORDERBY; // } // else // { $this->orderby = $links->getMultiOrderby($this->by, $this->dir); // } $this->tag = GWF_LinksTag::getWhitelistedTag(Common::getGet('tag'), ''); $this->lpp = $this->module->cfgLinksPerPage(); $this->nLinks = $links->countLinks($this->module, $this->user, $this->tag, false); $this->nPages = GWF_PageMenu::getPagecount($this->lpp, $this->nLinks); $this->page = Common::clamp(Common::getGet('page', 1), 1, $this->nPages); $this->from = GWF_PageMenu::getFrom($this->page, $this->lpp); if ($this->tag === '') { $this->sortURL = GWF_WEB_ROOT . 'links/by/%BY%/%DIR%/page-1'; $href = GWF_WEB_ROOT . 'links/by/' . $this->by . '/' . $this->dir . '/page-%PAGE%'; } else { $this->sortURL = GWF_WEB_ROOT . 'links/' . $this->tag . '/by/%BY%/%DIR%/page-1'; $href = GWF_WEB_ROOT . 'links/' . Common::urlencodeSEO($this->tag) . '/by/' . $this->by . '/' . $this->dir . '/page-%PAGE%'; } // var_dump($this->tag); // $unread_query = $this->module->getUnreadQuery($this->user); $tag_query = $links->getTagQuery($this->tag); // var_dump($tag_query); if ($this->module->cfgShowPermitted()) { $conditions = "({$tag_query})"; } else { $perm_query = $this->module->getPermQuery($this->user); $mod_query = $links->getModQuery($this->user); $member_query = $links->getMemberQuery($this->user); $private_query = $links->getPrivateQuery($this->user); $conditions = "({$perm_query}) AND ({$tag_query}) AND ({$mod_query}) AND ({$member_query}) AND ({$private_query})"; # AND (NOT $unread_query))"; } // var_dump($conditions); if (false === ($this->links = $links->selectObjects('*', $conditions, $this->orderby, $this->lpp, $this->from))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $this->pagemenu = GWF_PageMenu::display($this->page, $this->nPages, $href); $this->add_link_text = GWF_LinksValidator::mayAddLink($this->module, $this->user); $this->hrefAdd = $this->add_link_text === false ? $this->module->getMethodURL('Add', '&tag=' . $this->tag) : false; // $this->newLinks = $links->select("(($perm_query) AND ($unread_query) AND ($mod_query) AND ($member_query) AND ($tag_query))", 'link_date ASC'); return false; }