These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
||
2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> |
||
3 | <?php |
||
4 | /** |
||
5 | * COPS (Calibre OPDS PHP Server) epub reader |
||
6 | * |
||
7 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
8 | * @author Sébastien Lucas <[email protected]> |
||
9 | */ |
||
10 | |||
11 | require_once 'config.php'; |
||
12 | require_once 'base.php'; |
||
13 | |||
14 | header('Content-Type: text/html;charset=utf-8'); |
||
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> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
resources/monocle/scripts/monocore.js does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
33 | <script type="text/javascript" src="<?php echo getUrlWithVersion("resources/monocle/scripts/monoctrl.js") ?>"></script> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
resources/monocle/scripts/monoctrl.js does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
34 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monocore.css") ?>" media="screen" /> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
resources/monocle/styles/monocore.css does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
35 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("resources/monocle/styles/monoctrl.css") ?>" media="screen" /> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
resources/monocle/styles/monoctrl.css does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
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 ())) . '];'; ?> |
||
0 ignored issues
–
show
|
|||
41 | }, |
||
42 | getContents: function() { |
||
43 | <?php echo 'return [' . implode(', ', array_map(function($content) { return "{title: '" . addslashes($content['title']) . "', src: '". $content['src'] . "'}"; }, $book->contents())) . '];'; ?> |
||
0 ignored issues
–
show
|
|||
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> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
styles/cops-monocle.js does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
58 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion("styles/cops-monocle.css") ?>" media="screen" /> |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
styles/cops-monocle.css does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
59 | </head> |
||
60 | <body> |
||
61 | <div id="readerBg"> |
||
62 | <div class="board"></div> |
||
63 | <div class="jacket"></div> |
||
64 | <div class="dummyPage"></div> |
||
65 | <div class="dummyPage"></div> |
||
66 | <div class="dummyPage"></div> |
||
67 | <div class="dummyPage"></div> |
||
68 | <div class="dummyPage"></div> |
||
69 | </div> |
||
70 | <div id="readerCntr"> |
||
71 | <div id="reader"></div> |
||
72 | </div> |
||
73 | </body> |
||
74 | </html> |
||
75 |
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.