Completed
Push — master ( 2cc4d6...bb97fd )
by Sébastien
03:24
created

epubreader.php (9 issues)

Upgrade to new PHP Analysis Engine

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
This code seems to be duplicated across your project.

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.

Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
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
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

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 (\') and the backslash (\\). Every other character is displayed as is.

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: Single is Value

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.

Loading history...
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