function index() { if (isset($this->args[0]) && $this->args[0] != "index") { system::setParam("page", "layout"); $cacheID = $this->args[0] . "|ARTICLE"; $this->smarty->setCacheID($cacheID); if (isset($_POST["contentID"]) && $_POST["contentID"]) { comments::add(intval($_POST["contentID"])); } $this->smarty->assign("isFav", blog::isFavorite($this->args[0])); if (!$this->smarty->isCached()) { $sqlData = blog::getOnePost($this->args[0], "article")->fetch(); if ($sqlData) { $this->smarty->assign("comments", comments::get(intval($sqlData["contentID"]))); $this->smarty->assign("post", $sqlData); } } } else { $offset = 1; system::setParam("page", "list"); if (isset($this->get["offset"])) { $offset = intval($this->get["offset"]); } $cacheID = "ARTICLES|artoffset_{$offset}"; $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { $allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` WHERE `type`='article'")->fetch(); $this->smarty->assign("posts", news::getPosts(core::pagination($allCount["cnt"], $offset), "article")->fetchAll()); } } }