$this->output->send($this->tmpl->result()); } private function selectBook($bookId) { $result = mysql_query('select id, author, title, year, price, isbn,' . ' description, auth_key, mail from books where id="' . $bookId . '"'); if (mysql_num_rows($result) != 1) { $this->tmpl->addSubtemplate('messageNotFound'); $this->output->sendNotFound($this->tmpl->result()); exit; } return Book::fromMySql($result); } } $output = new Output(); if (!isset($_GET['id'])) { $output->sendNotFound(); exit; } $page = new bookPage((int) $_GET['id'], $output); /* checks mail sending, no returning on success */ $page->sendMailIfRequested(); $page->showBook(); if (isset($_GET['key'])) { $page->showAdminElements($_GET['key']); } else { $page->showNormalElements(); } $page->send(); ?>