These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | header('Content-Type: text/html;charset=utf-8'); |
||
3 | ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
||
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> |
||
5 | <?php |
||
6 | /** |
||
7 | * COPS (Calibre OPDS PHP Server) epub reader |
||
8 | * |
||
9 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
10 | * @author Sébastien Lucas <[email protected]> |
||
11 | */ |
||
12 | |||
13 | require_once 'config.php'; |
||
14 | require_once 'base.php'; |
||
15 | |||
16 | $idData = getURLParam('data', NULL); |
||
17 | $add = 'data=' . $idData . '&'; |
||
18 | View Code Duplication | if (!is_null (GetUrlParam (DB))) { |
|
0 ignored issues
–
show
|
|||
19 | $add .= DB . '=' . GetUrlParam (DB) . '&'; |
||
20 | } |
||
21 | $myBook = Book::getBookByDataId($idData); |
||
22 | |||
23 | $book = new EPub($myBook->getFilePath('EPUB', $idData)); |
||
24 | $book->initSpineComponent(); |
||
25 | |||
26 | ?> |
||
27 | <head> |
||
28 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
||
29 | <meta http-equiv="imagetoolbar" content="no" /> |
||
30 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> |
||
31 | <title>COPS's Epub Reader</title> |
||
32 | <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monocore.js") ?>"></script> |
||
33 | <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monoctrl.js") ?>"></script> |
||
34 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monocore.css") ?>" media="screen" /> |
||
35 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monoctrl.css") ?>" media="screen" /> |
||
36 | <script type="text/javascript"> |
||
37 | Monocle.DEBUG = true; |
||
38 | var bookData = { |
||
39 | getComponents: function() { |
||
40 | <?php echo 'return [' . implode(', ', array_map(function($comp) { return "'" . $comp . "'"; }, $book->components ())) . '];'; ?> |
||
41 | }, |
||
42 | getContents: function() { |
||
43 | <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '". $content['src'] . "'}"; }, $book->contents())) . '];'; ?> |
||
44 | }, |
||
45 | getComponent: function (componentId) { |
||
46 | return { url: "epubfs.php?<?php echo $add ?>comp=" + componentId }; |
||
47 | }, |
||
48 | getMetaData: function(key) { |
||
49 | return { |
||
50 | title: "<?php echo $myBook->title ?>", |
||
51 | creator: "Inventive Labs" |
||
52 | }[key]; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | </script> |
||
57 | <script type="text/javascript" src="<?php echo getUrlWithVersion("styles/cops-monocle.js") ?>"></script> |
||
58 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("styles/cops-monocle.css") ?>" media="screen" /> |
||
59 | <link rel="icon" type="image/x-icon" href="favicon.ico" /> |
||
60 | </head> |
||
61 | <body> |
||
62 | <div id="readerBg"> |
||
63 | <div class="board"></div> |
||
64 | <div class="jacket"></div> |
||
65 | <div class="dummyPage"></div> |
||
66 | <div class="dummyPage"></div> |
||
67 | <div class="dummyPage"></div> |
||
68 | <div class="dummyPage"></div> |
||
69 | <div class="dummyPage"></div> |
||
70 | </div> |
||
71 | <div id="readerCntr"> |
||
72 | <div id="reader"></div> |
||
73 | </div> |
||
74 | </body> |
||
75 | </html> |
||
76 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.