diff --git a/www/data/images/book_img/mol_front.png b/www/data/images/book_img/mol_front.png new file mode 100644 index 0000000..1f477e4 Binary files /dev/null and b/www/data/images/book_img/mol_front.png differ diff --git a/www/data/images/book_img/mol_full.png b/www/data/images/book_img/mol_full.png new file mode 100644 index 0000000..160f25a Binary files /dev/null and b/www/data/images/book_img/mol_full.png differ diff --git a/www/data/images/book_img/mol_img1.jpg b/www/data/images/book_img/mol_img1.jpg new file mode 100644 index 0000000..718d29d Binary files /dev/null and b/www/data/images/book_img/mol_img1.jpg differ diff --git a/www/data/images/book_img/mol_img2.jpg b/www/data/images/book_img/mol_img2.jpg new file mode 100644 index 0000000..ca65130 Binary files /dev/null and b/www/data/images/book_img/mol_img2.jpg differ diff --git a/www/data/images/book_img/mol_img3.jpg b/www/data/images/book_img/mol_img3.jpg new file mode 100644 index 0000000..ef8cb31 Binary files /dev/null and b/www/data/images/book_img/mol_img3.jpg differ diff --git a/www/data/images/book_img/mol_img4.jpg b/www/data/images/book_img/mol_img4.jpg new file mode 100644 index 0000000..5e6274a Binary files /dev/null and b/www/data/images/book_img/mol_img4.jpg differ diff --git a/www/data/images/book_img/mol_img5.jpg b/www/data/images/book_img/mol_img5.jpg new file mode 100644 index 0000000..3136c7c Binary files /dev/null and b/www/data/images/book_img/mol_img5.jpg differ diff --git a/www/internals/books.php b/www/internals/books.php index f6ee97a..6e8602a 100644 --- a/www/internals/books.php +++ b/www/internals/books.php @@ -26,6 +26,8 @@ class Books $a['extraimages_paths'] []= __DIR__ . '/../data/images/book_img/' . $a['id'] . '_img' . $i . '.jpg'; } + $a['book_count'] = is_array($a['pdf']) ? count($a['pdf']) : 1; + return $a; } @@ -61,6 +63,16 @@ class Books { if (!file_exists($eipath)) return ['result'=>'err', 'message' => 'Extra-Image not found ' . $prog['title_short']]; } + + if ($prog['book_count'] <= 0) return ['result'=>'err', 'message' => 'BookCount must be greater than zero ' . $prog['title_short']]; + + if ($prog['book_count'] > 1 && !is_array($prog['pdf'])) return ['result'=>'err', 'message' => 'Attribute [pdf] must be an array ' . $prog['title_short']]; + if ($prog['book_count'] > 1 && count($prog['pdf']) !== $prog['book_count']) return ['result'=>'err', 'message' => 'Attribute [pdf] must be the correct size ' . $prog['title_short']]; + if ($prog['book_count'] === 1 && !is_string($prog['pdf'])) return ['result'=>'err', 'message' => 'Attribute [pdf] must be an string ' . $prog['title_short']]; + + if ($prog['book_count'] > 1 && !is_array($prog['pages'])) return ['result'=>'err', 'message' => 'Attribute [pages] must be an array ' . $prog['title_short']]; + if ($prog['book_count'] > 1 && count($prog['pages']) !== $prog['book_count']) return ['result'=>'err', 'message' => 'Attribute [pages] must be the correct size ' . $prog['title_short']]; + if ($prog['book_count'] === 1 && !is_string($prog['pages'])) return ['result'=>'err', 'message' => 'Attribute [pages] must be an string ' . $prog['title_short']]; } if ($warn != null) return $warn; diff --git a/www/pages/books_view.php b/www/pages/books_view.php index 26f02ba..4df3087 100644 --- a/www/pages/books_view.php +++ b/www/pages/books_view.php @@ -39,7 +39,21 @@ if ($book === NULL) httpError(404, 'Book not found');