<?php require_once 'process.php'; require_once 'utils.php'; if (!isset($_GET["key"])) { httpResponseCode("400 Bad Request", "Missing parameter \"key\""); die; } $key = $_GET["key"]; $format = $_GET["format"]; $bs = new BookStatus(); try { $bs->checkOriginal($key); $status = $bs->checkConverted($key, $format); // generate response json header('Content-type: application/json'); $response = "{\n 'status' : '{$status}',\n 'source' : '{$bs->fbFile}',\n 'converted' : '{$bs->convFile}',\n 'log' : '{$bs->logFile}'\n }"; echo $response; } catch (Exception $e) { error_log("FB2PDF ERROR. Status: " . $e->getMessage()); httpResponseCode("400 Bad Request", $e->getMessage()); }
<input type="hidden" name="format" value=""/> <?php echo "<h3 class='left'><a href='books.php?author={$author}' style='color:black'>{$author}</a> \"{$title}\"</h3><br/><br/>"; echo "<p>Загрузить книгу в формате:<br/>"; echo "[<a href='{$bs->fbFile}'>оригинал (fb2)</a>]<br/>"; if ($formats) { $count = count($formats); for ($i = 0; $i < $count; $i++) { $format = $formats[$i]["id"]; $formatTitle = $formats[$i]["title"]; $formatFileType = $formats[$i]["file_type"]; $formatContentType = $formats[$i]["content_type"]; $storageStatus = BookStatus::STATUS_ERROR; $formatStatus = $cb->checkConverted($key, $format); if ($formatStatus == ConvertBook::DB_BOOK_CONVERTED) { $storageStatus = $bs->checkConverted($key, $format, $formatFileType, $formatContentType); } if ($storageStatus == BookStatus::STATUS_SUCCESS) { echo "[<a href='{$bs->convFile}'>{$formatTitle} ({$formatFileType})</a>]<br/>"; } else { echo "[<a href='javascript:convertBook(\"{$key}\", {$format})'>{$formatTitle} ({$formatFileType})</a>]<br/>"; } } } echo "<p><a href='books.php?author={$author}' style='color:black'>Другие книги автора</a></p>"; echo "<p>"; $book_link = getFullUrl("book.php") . "?key=" . urlencode($key); $book_path = "/book/" . $key; $book_title = $author . " '" . $title . "'"; echo "<div class=\"js-kit-rating\" title=\"{$book_title}\" permalink=\"{$book_link}\" path=\"{$book_path}\"></div>"; echo "<div class=\"js-kit-comments\" permalink=\"{$book_link}\" path=\"{$book_path}\"></div>";