$recent = getBook('3', 'status', '5'); if (!empty($recent['book'][0]['id'])) { foreach ($recent['book'] as $book) { echo "<a class='homecover' href='books/book.php?id=" . $book['id'] . "'>"; //change this line when Books 7 live echo "<img class='homecover' src='" . $book['image'][0]['uri'] . "' alt='" . $book['title'] . "' />"; echo "</a>"; } //end ForEach recent } ?> </section> <section id="trek"> <a href="books/star-trek.php"><img src="http://s3.shastrix.co.uk/gfx2014/trekbooks.png" alt="Jim's Star Trek Books" /></a> <?php $recent = getBook('1', 'tag', '5'); if (!empty($recent['book'][0]['id'])) { foreach ($recent['book'] as $book) { echo "<a class='homecover' href='books/book.php?id=" . $book['id'] . "'>"; //change this line when Books 7 live echo "<img class='homecover' src='" . $book['image'][0]['uri'] . "' alt='" . $book['title'] . "' />"; echo "</a>"; } //end ForEach recent } ?> </section> <section id="comics"> <a href="comics/"><img src="http://s3.shastrix.co.uk/gfx2014/comics.png" alt="Comics" /></a> <a href="shing/" class="homecover"><img class="homecover" src="http://s3.shastrix.co.uk/gfx/shing.gif" alt="S.H.I.N.G." /></a> <a href="thefan/" class="homecover"><img class="homecover" src="http://s3.shastrix.co.uk/gfx/thefan.png" alt="The FAN" /></a>
$firstrecent = 0; } include "includes/reviewedbook.php"; } } //end ForEach recent ?> </section> <?php } //end if recents ?> </section> <!-- Top books --> <?php $topbooks = getBook(1, 'tag', 7, 'stars'); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Top books</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3") { ?> <li> <?php echo getStars($book['review'][0]['stars']); ?> <a href="book.php?id=<?php echo $book['id'];
function deleteBook($id) { global $conn, $data; $book = getBook($id); $picture_url = $book["cover_picture"]; unlink("../" . $picture_url); $query = "DELETE FROM books WHERE id = '{$id}'"; $stmt = $conn->prepare($query); $stmt->execute(); }
$firstrecent = 0; } include "includes/reviewedbook.php"; } } //end ForEach recent ?> </section> <?php } //end if recents ?> </section> <!-- Top books --> <?php $topbooks = getBook($id, 'year', 7, 'stars'); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Top books</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3") { ?> <li> <?php echo getStars($book['review'][0]['stars']); include "includes/soonbook.php"; ?> </li>
$firstother = 0; } include "includes/otherbook.php"; } } //end ForEach others ?> </section> <?php } //end if others ?> </section> <!-- Top books --> <?php $topbooks = getBook($id, 'author', 7, 'stars'); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Top books</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3") { ?> <li> <?php echo getStars($book['review'][0]['stars']); include "includes/soonbook.php"; ?> </li>
<section class="recentlyread"> <?php foreach ($recent['book'] as $book) { include "includes/forthcomingbook.php"; } //end ForEach recent ?> </section> <?php } //end if recents ?> </section> <!-- Top books --> <?php $topbooks = getBook($id, 'tag', 7); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Recent reviews</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3") { ?> <li> <?php echo getStars($book['review'][0]['stars']); ?> <a href="book.php?id=<?php echo $book['id'];
<link rel="stylesheet" type="text/css" href="/books/styles.css"> <link rel="icon" href="http://s3.shastrix.co.uk/favicon.ico" type="image/x-icon"> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="scripts.js"></script> </head> <body> <div id="wrapper"> <header> <h1>Shastrix Books</h1> <?php include "menu.php"; ?> </header> <!-- Recently Read --> <?php $recent = getBook('3', 'status', '7'); if (!empty($recent['book'][0]['id'])) { ?> <section class="recentlyread"> <h1>Recently reviewed</h1> <?php foreach ($recent['book'] as $book) { include "includes/reviewedbook.php"; } //end ForEach recent ?> <section class="showmore"> <a href="archive.php?id=<?php echo date('Y'); ?> ">Show more</a>
</p> <span itemprop="reviewBody"><?php echo $book['review'][0]['content']; ?> </span> </section> <?php } ?> </article> </section> </section> <!-- Top books --> <?php //more by this author? related authors? similar? recent? top? $topbooks = getBook($book['author'][0]['id'], 'author', 7, 'stars'); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>More books</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3" && $book['id'] != $id) { ?> <li> <?php echo getStars($book['review'][0]['stars']); include "includes/soonbook.php"; ?> </li>
function getBibleHTML($refString) { // -- Check if we've already cached this request -- // Get the filename of where the cached file would be. // The filename is the MD5 hash of the request string, so // that the filename won't be too long, as it easily can be. $filename = dirname(__FILE__) . "/cached/" . md5($refString) . ".cache"; // If the file exists, just return its contents, and we're done here. if (file_exists($filename)) { return file_get_contents($filename, FILE_USE_INCLUDE_PATH); } // ---------- No cache ---------- // Holds an array of passages that can be added to // before the final string is created. $passages = array(); // Split at each reference $refs = explode(";", $refString); // Parse each reference foreach ($refs as $ref) { // Kill any side spaces $ref = trim($ref); // Check that this meets the basic requirements of a reference // It must have a space (for between the book and the number(s)) // It also can't have more than two colons, but it can have that // many (for a cross chapter range) or fewer. if (strpos($ref, ' ') === false || substr_count($ref, ':') > 2) { // If it doesn't match the basic requirements, then make a bad reference. array_push($passages, makeBadRef($ref)); // Any time we make a bad ref, we need to call continue // to ensure that we go to the next reference, or we might // get a double instance of it. continue; } // Find where the first digit in the string is: this is where the // reference chapter starts. We need to start at the second character // as the first one may be a number for something like 2 John. $pos = 1; for (; $pos < strlen($ref); ++$pos) { // If the character at this position is a number if (ctype_digit($ref[$pos])) { // Break out of the loop break; } } // If our position is the length of the reference // Then we didn't find a number if ($pos == strlen($ref)) { // So make a bad reference and continue array_push($passages, makeBadRef($ref)); continue; } else { // If we did get a valid position, then // The first bit is the book name $bookStr = trim(substr($ref, 0, $pos)); // And the rest is the chapter/verse stuff that we'll break up next // We also don't want any spaces for that, so remove them. $refNumsStr = str_replace(' ', '', substr($ref, $pos)); } // Scenario 1-2: No colon, thus we want the full chapter(s) (e.g. John 1 or Acts 2-4); if (strpos($refNumsStr, ':') === false) { // Scenario 2: We have a dash, so we want a chapter range if (strpos($refNumsStr, '-') !== false) { // Get the chapter numbers into different variables list($chapStr, $chapStr2) = explode('-', $refNumsStr); } else { // Put that number into the common variable between scenario 1 and 2. $chapStr = $refNumsStr; } // Set this to null so we know we're not on a scenario 4 $verseStr = null; } else { // Scenario 4: There are two colons, so we want a cross chapter range (e.g. Joshua 1:8-2:4) if (substr_count($refNumsStr, ':') == 2) { // If there's no dash, then it's a bad reference if (strpos($refNumsStr, '-') === false) { array_push($passages, makeBadRef($ref)); continue; } // Place each side into temporary variables list($ref1, $ref2) = explode('-', $refNumsStr); // Get the first chapter and verse list($chapStr, $verseStr) = explode(':', $ref1); // Get the second chapter and verse list($chapStr2, $verseStr2) = explode(':', $ref2); } else { // Get the chapter and verse into the shared variable name list($chapStr, $verseStr) = explode(':', $refNumsStr); } } // Get a Book object from the book string $book = getBook($bookStr); // If the book we were given has a negative index, then // we have a bad book, so make a bad reference if ($book->getID() < 0) { array_push($passages, makeBadRef($ref)); continue; } // Check that the chapter is an integer, and if there is a second chapter, // that it also is an integer. If either fail, then make a bad reference. if (!ctype_digit($chapStr) || isset($chapStr2) && !ctype_digit($chapStr2)) { array_push($passages, makeBadRef($ref)); continue; } // Ditto, but for the verses if ($verseStr != null && isset($verseStr2) && (!ctype_digit($verseStr) || !ctype_digit($verseStr2))) { array_push($passages, makeBadRef($ref)); continue; } else { if (isset($verseStr2)) { // Set verses to be an array with the two verses that we want between (inclusive) $verses = array($verseStr, $verseStr2); } else { // Scenario 1 and 2 will have $verseStr be null, whereas 3 // indicates that we need to get all the verse numbers. // We can't just do an array with this one, as it could be // Genesis 1:1,3,5,7,9, so we need each individual number $verses = $verseStr != null ? getVerseNums($verseStr) : array(); } } // Get the HTML for this passage. // The @ will suppress any warnings if $chapStr2 isn't set $passageHTML = makePassageHTML($book, $chapStr, @$chapStr2, $verses); // unset $chapStr2 so it has to be set again to be valid (or weird things happen) unset($chapStr2); // If we were returned an empty string, then make a bad reference if ($passageHTML == '') { array_push($passages, makeBadRef($ref)); // Still doing this, even though it's at the end. Safe over sorry. continue; } else { // Otherwise, add the HTML to the passages array array_push($passages, $passageHTML); } } // This is what we will return. First add in // The number of references we're giving back $retVal = makePassageCount(count($passages)) . "\n"; // Then add each passage separated by a line break foreach ($passages as $passage) { $retVal .= $passage . "\n"; } // If the directory where we cache things doesn't exist yet, make it if (!is_dir(dirname($filename))) { mkdir(dirname($filename), 0755, true); } // Write the cached result so we don't have to parse this one again $file = fopen($filename, 'w'); fwrite($file, $retVal); // Return the HTML return $retVal; }
<?php if ($_GET) { $id = get("id"); $book = getBook($id); $relatedBooks = getRelatedBooks($id); } ?> <div class="row"> <ol class="breadcrumb"> <li><a href="<?php echo URL; ?> ">Home</a></li> <li><a href="<?php echo URL . '?view=detail&id=' . $book["id"]; ?> ">Book Details</a></li> <li class="active"><?php echo $book["title"]; ?> </li> </ol> </div> <div class="row" > <h3>Book Details: <?php echo $book["title"]; ?> </h3>
<?php if (!defined("IN_RULE")) { die("Oops"); } $title = 'EditBook'; getBook($pdo); $authors = getAuthorList($author_id, $pdo); if (isset($_POST['editbook'])) { $message = editbook($bid, $OkDomains, $pdo); } function editbook($bid, $okdomains, $dblink) { $authorid = filter_input(INPUT_POST, 'authorid', FILTER_SANITIZE_NUMBER_INT); $name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_SPECIAL_CHARS); $dateto = filter::date($_POST['dateto']); $preview = filter::allowedURL($_POST['preview'], $okdomains); if ($authorid == FALSE) { $message = "Не выбран автор."; } if ($name == FALSE) { $message = "Не указано название книги."; } if ($dateto == FALSE) { $message = "Не указана дата издания."; } if ($preview == FALSE) { $message = "Укажите полный путь к превью (с http://)."; } if ($authorid != FALSE && $name != FALSE && $dateto != FALSE && $preview != FALSE) { if ($stm = $dblink->prepare("SELECT COUNT(id) AS cnt FROM authors WHERE id=?")) {
// the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; $reserve = getResData($offset, $rowsperpage); foreach ($reserve as $i => $value) { $lin = 'payment.php?number=' . $value['invoice_number']; $link = 'reservation.php?order=' . $value['cust_id']; $update = 'updatereservation.php?order=' . $value['order_id']; $voucher = 'voucher.php?number=' . $value['cust_id']; $add = 'newroom.php?customer=' . $value['cust_id']; ?> <tr class="table-content" ><td><a href="<?php echo $add; ?> ">Add Room</a></td> <td><?php $room = getBook($value['order_id']); $qry = "select room_no from room_reservation where order_id=" . $value['order_id']; $dt = getData($qry); echo count($dt); ?> </td> <td><?php echo $value['cust_name']; ?> </td> <td><?php echo $value['phone_no']; ?> </td> <td><?php echo date_format(date_create($value['arrival_date']), "Y-m-d");
$firstother = 0; } include "includes/otherbook.php"; } } //end ForEach others ?> </section> <?php } //end if others ?> </section> <!-- Top books --> <?php $topbooks = getBook($id, 'genre', 7, 'stars'); if (!empty($topbooks['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Top books</h1> <ol> <?php foreach ($topbooks['book'] as $book) { if ($book['status'][0]['id'] == "3") { ?> <li> <?php echo getStars($book['review'][0]['stars']); include "includes/soonbook.php"; ?> </li>
?> "> </a> </section> <?php } else { if (sh_access('books', 9, $mysqli)) { //ie there's no book reading now, and I'm signed in $showreadnow = 1; } } //end if there is a reading now ?> <!-- Reading Soon --> <?php $readingsoon = getBook('1', 'status'); if (!empty($readingsoon['book'][0]['id'])) { ?> <section class="readingsoon"> <h1>Reading soon</h1> <ol> <?php foreach ($readingsoon['book'] as $book) { include "includes/soonbook.php"; } ?> </ol> </section> <?php } //end if reading soon
$out['date'] = $row['date']; $out['date_create'] = $row['date_create']; $out['date_update'] = $row['date_update']; return $out; } function getAuthorById($author_id, $dblink) { if ($stm = $dblink->prepare("SELECT firstname, lastname FROM authors WHERE id=?")) { $stm->execute(array($author_id)); $row = $stm->fetch(); $stm = NULL; $author = $row['firstname'] . " " . $row['lastname']; } return $author; } $book = getBook($bid, $pdo); ?> <?php if (!empty($message)) { ?> <div class="alert alert-warning"><?php echo $message; ?> </div><?php } ?> <div class="col-md-4"> <div class="modal-body next"> <img draggable="false" title="Фантомы" src="<?php