books_view
This commit is contained in:
@@ -52,6 +52,7 @@ function httpError($errorcode, $message)
|
||||
function destructiveUrlEncode($str) {
|
||||
$str = str_replace(' ', '_', $str);
|
||||
$str = str_replace('+', '_', $str);
|
||||
$str = str_replace(':', '_', $str);
|
||||
$str = str_replace('.', '', $str);
|
||||
return urlencode($str);
|
||||
}
|
||||
|
||||
@@ -6,16 +6,25 @@ class Books
|
||||
{
|
||||
public static function readSingle($a)
|
||||
{
|
||||
$a['imgfront_url'] = '/data/images/book_img/' . $a['id'] . '_front.png';
|
||||
$a['imgfront_path'] = __DIR__ . '/../data/images/book_img/' . $a['id'] . '_front.png';
|
||||
$a['imgfront_url'] = '/data/images/book_img/' . $a['id'] . '_front.png';
|
||||
$a['imgfront_path'] = __DIR__ . '/../data/images/book_img/' . $a['id'] . '_front.png';
|
||||
|
||||
$a['imgfull_url'] = '/data/images/book_img/' . $a['id'] . '_full.png';
|
||||
$a['imgfull_path'] = __DIR__ . '/../data/images/book_img/' . $a['id'] . '_full.png';
|
||||
$a['imgfull_url'] = '/data/images/book_img/' . $a['id'] . '_full.png';
|
||||
$a['imgfull_path'] = __DIR__ . '/../data/images/book_img/' . $a['id'] . '_full.png';
|
||||
|
||||
$a['preview_url'] = '/data/dynamic/bookprev_' . $a['id'] . '.png';
|
||||
$a['preview_path'] = __DIR__ . '/../data/dynamic/bookprev_' . $a['id'] . '.png';
|
||||
$a['preview_url'] = '/data/dynamic/bookprev_' . $a['id'] . '.png';
|
||||
$a['preview_path'] = __DIR__ . '/../data/dynamic/bookprev_' . $a['id'] . '.png';
|
||||
|
||||
$a['url'] = '/books/view/' . $a['id'];
|
||||
$a['url'] = '/books/view/' . $a['id'] . '/' . destructiveUrlEncode($a['title']);
|
||||
|
||||
$a['extraimages_urls'] = [];
|
||||
$a['extraimages_paths'] = [];
|
||||
|
||||
for ($i=1; $i <= $a['imagecount']; $i++)
|
||||
{
|
||||
$a['extraimages_urls'] []= '/data/images/book_img/' . $a['id'] . '_img' . $i . '.jpg';
|
||||
$a['extraimages_paths'] []= __DIR__ . '/../data/images/book_img/' . $a['id'] . '_img' . $i . '.jpg';
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
@@ -70,4 +79,12 @@ class Books
|
||||
|
||||
smart_resize_image($src , null, 200, 0, true, $dst, 100);
|
||||
}
|
||||
|
||||
public static function getBook($id)
|
||||
{
|
||||
foreach (self::listAll() as $book) {
|
||||
if ($book['id'] == $id) return $book;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user