<?php require_once "awscfg.php"; require_once "db.php"; require_once "utils.php"; $current_url = getFullUrl("atom.php"); $db = new DB($dbServer, $dbName, $dbUser, $dbPassword); $limit = isset($_GET["limit"]) ? $_GET["limit"] : 15; $list = isset($_GET["author"]) ? $db->getBooksByAuthorRSS($_GET["author"], $limit) : $db->getBooks($limit); $last_modified = date(DATE_RFC822, strtotime($list[0]["converted"])); header("Content-Type: application/atom+xml; charset=utf-8"); header("Last-Modified: " . $last_modified); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <feed xmlns=\"http://www.w3.org/2005/Atom\">\n <link rel=\"self\" href=\"{$current_url}\"/> \n "; if (isset($_GET["author"])) { $byauthor = $_GET["author"]; echo "<title>FB2PDF. Новые книги {$byauthor}.</title>"; } else { echo "<title>FB2PDF. Новые книги.</title>"; } echo "<link href=\"http://fb2pdf.com/\"/>\n <id>urn:uuid:60a76c80</id>\n <updated>" . date("Y\\-m\\-d\\TH\\:i\\:s\\Z") . "</updated>\n "; if ($limit > count($list)) { $limit = count($list); } for ($i = 0; $i < $limit; $i++) { $title = $list[$i]["title"]; $author = $list[$i]["author"]; $id = $list[$i]["id"]; $date = formatDateIntoAtom($list[$i]["submitted"]); $key = "book.php?key=" . $list[$i]["storage_key"]; if (!$author) { $author = "Автор неизвестен";
$author = "C_LastName {$i}, FirstName {$i}"; } } $title = "Book title {$i}"; $isbn = $i % 2 == 0 ? "123" : NULL; $db->insertBook("stkey{$i}", $author, $title, $isbn, md5("{$i}"), "p"); } for ($i = 0; $i < $COUNT; $i++) { $status = $i % 2 == 0 ? "r" : "e"; $db->updateBookStatus("stkey{$i}", $status, 3.14); if ($status == "r") { $db->updateBookCounter("stkey{$i}"); } } $db->updateBookCounter("nonexistingkey"); $arr = $db->getBooks($COUNT); print "<br><b>Books:</b><br>"; if (count($arr) == 0) { print "No books!\n"; } else { print_r($arr); } print "<br>"; } $letters = $db->getAuthorsFirstLetters(); print "<br><b>Authors First Letter:</b><br>"; if (count($letters) == 0) { print "No letters!\n"; } else { print_r($letters); print "<br><b>Authors:</b><br>";
<div id="more_books"><a href="library.php"><u>Все книги</u></a></div> <h4>Книги, сконвертированные недавно:</h4> <img src="images/green_px.gif" class="line"/> <?php require_once 'awscfg.php'; require_once 'db.php'; require_once 'utils.php'; global $awsS3Bucket; global $dbServer, $dbName, $dbUser, $dbPassword; // list of new books $MAX_BOOKS = 40; $MAX_ROWS = 20; $MAX_COLS = 2; $db = new DB($dbServer, $dbName, $dbUser, $dbPassword); $list = $db->getBooks($MAX_BOOKS); if ($list) { $count = count($list); for ($col = $MAX_COLS - 1; $col >= 0; $col--) { if ($col == 0) { echo '<div class="left_book">'; } else { echo '<div class="right_book">'; } for ($row = 0; $row < $MAX_ROWS; $row++) { $i = $col * $MAX_ROWS + $row; if ($i < $count) { $author = $list[$i]["author"]; $title = $list[$i]["title"]; $key = $list[$i]["storage_key"]; if (!$author) {