Dodanie sposobu na pobieranie książek, dodanie wyświetlania linków do pobranych plików, dodanie katalogu books do ignore.
This commit is contained in:
19
index.php
19
index.php
@@ -13,12 +13,25 @@ $result = $stmt->execute();
|
||||
echo '<pre>';
|
||||
|
||||
echo '<table style="width: 100%">';
|
||||
print('<tr> <th>id</th><th>nid</th><th>Title</th><th>Category</th><th>Publish date</th><th>Pages</th><th>Votes</th><th>Rating</th> </tr>');
|
||||
print('<tr> <th>id</th><th>nid</th><th>Title</th><th>Category</th><th>Publish date</th><th>Pages</th><th>Votes</th><th>Rating</th> <th>Pdf</th> <th>Epub</th> <th>Mobi</th> <th>Code</th> </tr>');
|
||||
while ($resultArray = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
// print_r($resultArray);
|
||||
|
||||
printf('<tr> <td>%d</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%.1f</td> </tr>',
|
||||
$resultArray['id'], $resultArray['nid'], $resultArray['title'], $resultArray['category'], $resultArray['datepublished'], $resultArray['numberofpages'], $resultArray['reviewCount'], $resultArray['ratingValue']);
|
||||
$pdfUrl = 'books/' . $resultArray['nid'] . '/' . $resultArray['nid'] . '.pdf';
|
||||
$epubUrl = 'books/' . $resultArray['nid'] . '/' . $resultArray['nid'] . '.epub';
|
||||
$mobiUrl = 'books/' . $resultArray['nid'] . '/' . $resultArray['nid'] . '.mobi';
|
||||
$codeUrl = '';
|
||||
if (preg_match('#\d+#', $resultArray['code'], $found)) {
|
||||
$codeId = $found[0];
|
||||
$codeUrl = 'books/' . $codeId . '/' . $codeId . '.zip';
|
||||
}
|
||||
printf('<tr> <td>%d</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%.1f</td> <td>%s</td><td>%s</td><td>%s</td><td>%s</td> </tr>',
|
||||
$resultArray['id'], $resultArray['nid'], $resultArray['title'], $resultArray['category'], $resultArray['datepublished'], $resultArray['numberofpages'], $resultArray['reviewCount'], $resultArray['ratingValue'],
|
||||
is_file($pdfUrl) ? "<a href='{$pdfUrl}'>pdf</a>" : (strlen($resultArray['pdf']) ? 'nie pobrano' : ''),
|
||||
is_file($epubUrl) ? "<a href='{$epubUrl}'>epub</a>" : (strlen($resultArray['epub']) ? 'nie pobrano' : ''),
|
||||
is_file($mobiUrl) ? "<a href='{$mobiUrl}'>mobi</a>" : (strlen($resultArray['mobi']) ? 'nie pobrano' : ''),
|
||||
is_file($codeUrl) ? "<a href='{$codeUrl}'>zip</a>" : (strlen($resultArray['code']) ? 'nie pobrano' : '')
|
||||
);
|
||||
if ($resultArray) {
|
||||
$x = $resultArray;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user