public function getPage(string $file, int $directoryId = 0, string $cabin = '') : array { if (empty($cabin)) { $cabin = $this->cabin; } if ($directoryId > 0) { $page = $this->db->row("SELECT\n *\n FROM\n airship_custom_page\n WHERE\n active\n AND cabin = ?\n AND directory = ?\n AND url = ?\n ", $cabin, $directoryId, $file); } else { // No directory? Only look for when it's null then! $page = $this->db->row("SELECT\n *\n FROM\n airship_custom_page\n WHERE\n active\n AND cabin = ?\n AND directory IS NULL\n AND url = ?\n ", $cabin, $file); } if (empty($page)) { throw new CustomPageNotFoundException(); } return $page; }
/** * Serve a file * * @param string $file * @param int $directoryId * @return bool */ protected function serveFile(string $file, int $directoryId) : bool { $page = $this->pages->getPage($file, $directoryId); if (!empty($page)) { return $this->serveLatestVersion($page); } return false; }