mbirth /
cops
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <!DOCTYPE html> |
||
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
||
| 3 | <?php |
||
| 4 | /** |
||
| 5 | * COPS (Calibre OPDS PHP Server) Configuration check |
||
| 6 | * |
||
| 7 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
||
| 8 | * @author Sébastien Lucas <[email protected]> |
||
| 9 | * |
||
| 10 | */ |
||
| 11 | |||
| 12 | require_once ("config.php"); |
||
|
0 ignored issues
–
show
|
|||
| 13 | require_once ("base.php"); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
base.php 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. Loading history...
|
|||
| 14 | |||
| 15 | header ("Content-Type:text/html; charset=UTF-8"); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Content-Type:text/html; charset=UTF-8 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. Loading history...
|
|||
| 16 | |||
| 17 | $err = getURLParam ("err", -1); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
err 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. Loading history...
|
|||
| 18 | $full = getURLParam ("full"); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
full 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. Loading history...
|
|||
| 19 | $error = NULL; |
||
| 20 | switch ($err) { |
||
| 21 | case 1 : |
||
|
0 ignored issues
–
show
There must be no space before the colon in a CASE statement
As per the PSR-2 coding standard, there must not be a space in front of the colon in case statements. switch ($selector) {
case "A": //right
doSomething();
break;
case "B" : //wrong
doSomethingElse();
break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. Loading history...
|
|||
| 22 | $error = "Database error"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Database error 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. Loading history...
|
|||
| 23 | break; |
||
| 24 | } |
||
| 25 | |||
| 26 | ?> |
||
| 27 | <head> |
||
| 28 | <meta charset="utf-8"> |
||
| 29 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||
| 30 | <title>COPS Configuration Check</title> |
||
| 31 | <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" /> |
||
| 32 | </head> |
||
| 33 | <body> |
||
| 34 | <div class="container"> |
||
| 35 | <header> |
||
| 36 | <div class="headcenter"> |
||
| 37 | <h1>COPS Configuration Check</h1> |
||
| 38 | </div> |
||
| 39 | </header> |
||
| 40 | <div id="content" style="display: none;"></div> |
||
| 41 | <section> |
||
| 42 | <?php |
||
| 43 | if (!is_null ($error)) { |
||
| 44 | ?> |
||
| 45 | <article class="frontpage"> |
||
| 46 | <h2>You've been redirected because COPS is not configured properly</h2> |
||
| 47 | <h4><?php echo $error ?></h4> |
||
| 48 | </article> |
||
| 49 | <?php |
||
| 50 | } |
||
| 51 | ?> |
||
| 52 | <article class="frontpage"> |
||
| 53 | <h2>Check if PHP version is correct</h2> |
||
| 54 | <h4> |
||
| 55 | <?php |
||
| 56 | if (defined('PHP_VERSION_ID')) { |
||
| 57 | if (PHP_VERSION_ID >= 50300) { |
||
| 58 | echo "OK (" . PHP_VERSION . ")"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK ( 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. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
) 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. Loading history...
|
|||
| 59 | } else { |
||
| 60 | echo "Please install PHP >= 5.3 (" . PHP_VERSION . ")"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Please install PHP >= 5.3 ( 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. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
) 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. Loading history...
|
|||
| 61 | } |
||
| 62 | } else { |
||
| 63 | echo "Please install PHP >= 5.3"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Please install PHP >= 5.3 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. Loading history...
|
|||
| 64 | } |
||
| 65 | ?> |
||
| 66 | </h4> |
||
| 67 | </article> |
||
| 68 | <article class="frontpage"> |
||
| 69 | <h2>Check if GD is properly installed and loaded</h2> |
||
| 70 | <h4> |
||
| 71 | <?php |
||
| 72 | if (extension_loaded('gd') && function_exists('gd_info')) { |
||
| 73 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 74 | } else { |
||
| 75 | echo "Please install the php5-gd extension and make sure it's enabled"; |
||
| 76 | } |
||
| 77 | ?> |
||
| 78 | </h4> |
||
| 79 | </article> |
||
| 80 | <article class="frontpage"> |
||
| 81 | <h2>Check if Sqlite is properly installed and loaded</h2> |
||
| 82 | <h4> |
||
| 83 | <?php |
||
| 84 | if (extension_loaded('pdo_sqlite')) { |
||
| 85 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 86 | } else { |
||
| 87 | echo "Please install the php5-sqlite extension and make sure it's enabled"; |
||
| 88 | } |
||
| 89 | ?> |
||
| 90 | </h4> |
||
| 91 | </article> |
||
| 92 | <article class="frontpage"> |
||
| 93 | <h2>Check if libxml is properly installed and loaded</h2> |
||
| 94 | <h4> |
||
| 95 | <?php |
||
| 96 | if (extension_loaded('libxml')) { |
||
| 97 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 98 | } else { |
||
| 99 | echo "Please make sure libxml is enabled"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Please make sure libxml is enabled 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. Loading history...
|
|||
| 100 | } |
||
| 101 | ?> |
||
| 102 | </h4> |
||
| 103 | </article> |
||
| 104 | <article class="frontpage"> |
||
| 105 | <h2>Check if Json is properly installed and loaded</h2> |
||
| 106 | <h4> |
||
| 107 | <?php |
||
| 108 | if (extension_loaded('json')) { |
||
| 109 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 110 | } else { |
||
| 111 | echo "Please install the php5-json extension and make sure it's enabled"; |
||
| 112 | } |
||
| 113 | ?> |
||
| 114 | </h4> |
||
| 115 | </article> |
||
| 116 | <article class="frontpage"> |
||
| 117 | <h2>Check if mbstring is properly installed and loaded</h2> |
||
| 118 | <h4> |
||
| 119 | <?php |
||
| 120 | if (extension_loaded('mbstring')) { |
||
| 121 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 122 | } else { |
||
| 123 | echo "Please install the php5-mbstring extension and make sure it's enabled"; |
||
| 124 | } |
||
| 125 | ?> |
||
| 126 | </h4> |
||
| 127 | </article> |
||
| 128 | <article class="frontpage"> |
||
| 129 | <h2>Check if intl is properly installed and loaded</h2> |
||
| 130 | <h4> |
||
| 131 | <?php |
||
| 132 | if (extension_loaded('intl')) { |
||
| 133 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 134 | } else { |
||
| 135 | echo "Please install the php5-intl extension and make sure it's enabled"; |
||
| 136 | } |
||
| 137 | ?> |
||
| 138 | </h4> |
||
| 139 | </article> |
||
| 140 | <article class="frontpage"> |
||
| 141 | <h2>Check if Normalizer class is properly installed and loaded</h2> |
||
| 142 | <h4> |
||
| 143 | <?php |
||
| 144 | if (class_exists("Normalizer", $autoload = false)) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Normalizer 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. Loading history...
|
|||
| 145 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 146 | } else { |
||
| 147 | echo "Please make sure intl is enabled in your php.ini"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Please make sure intl is enabled in your php.ini 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. Loading history...
|
|||
| 148 | } |
||
| 149 | ?> |
||
| 150 | </h4> |
||
| 151 | </article> |
||
| 152 | <article class="frontpage"> |
||
| 153 | <h2>Check if the rendering will be done on client side or server side</h2> |
||
| 154 | <h4> |
||
| 155 | <?php |
||
| 156 | if (useServerSideRendering ()) { |
||
| 157 | echo "Server side rendering"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Server side rendering 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. Loading history...
|
|||
| 158 | } else { |
||
| 159 | echo "Client side rendering"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Client side rendering 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. Loading history...
|
|||
| 160 | } |
||
| 161 | ?> |
||
| 162 | </h4> |
||
| 163 | </article> |
||
| 164 | <?php |
||
| 165 | $i = 0; |
||
| 166 | foreach (Base::getDbList () as $name => $database) { |
||
| 167 | ?> |
||
| 168 | <article class="frontpage"> |
||
| 169 | <h2>Check if Calibre database path is not an URL</h2> |
||
| 170 | <h4> |
||
| 171 | <?php |
||
| 172 | if (!preg_match ("#^http#", $database)) { |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
#^http# 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. Loading history...
|
|||
| 173 | echo "OK"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
OK 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. Loading history...
|
|||
| 174 | } else { |
||
| 175 | echo "Calibre path has to be local (no URL allowed)"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Calibre path has to be local (no URL allowed) 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. Loading history...
|
|||
| 176 | } |
||
| 177 | ?> |
||
| 178 | </h4> |
||
| 179 | </article> |
||
| 180 | <article class="frontpage"> |
||
| 181 | <h2>Check if Calibre database file exists and is readable</h2> |
||
| 182 | <h4> |
||
| 183 | <?php |
||
| 184 | if (is_readable (Base::getDbFileName ($i))) { |
||
| 185 | echo "{$name} OK"; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 186 | } else { |
||
| 187 | echo "{$name} File " . Base::getDbFileName ($i) . " not found, |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 188 | Please check |
||
| 189 | <ul> |
||
| 190 | <li>Value of \$config['calibre_directory'] in config_local.php</li> |
||
| 191 | <li>Value of <a href='http://php.net/manual/en/ini.core.php#ini.open-basedir'>open_basedir</a> in your php.ini</li> |
||
| 192 | <li>The access rights of the Calibre Database</li> |
||
| 193 | <li>Synology users please read <a href='https://github.com/seblucas/cops/wiki/Howto---Synology'>this</a></li> |
||
| 194 | </ul>"; |
||
| 195 | } |
||
| 196 | ?> |
||
| 197 | </h4> |
||
| 198 | </article> |
||
| 199 | <?php if (is_readable (Base::getDbFileName ($i))) { ?> |
||
| 200 | <article class="frontpage"> |
||
| 201 | <h2>Check if Calibre database file can be opened with PHP</h2> |
||
| 202 | <h4> |
||
| 203 | <?php |
||
| 204 | try { |
||
| 205 | $db = new PDO('sqlite:'. Base::getDbFileName ($i)); |
||
| 206 | echo "{$name} OK"; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 207 | } catch (Exception $e) { |
||
| 208 | echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 209 | } |
||
| 210 | ?> |
||
| 211 | </h4> |
||
| 212 | </article> |
||
| 213 | <article class="frontpage"> |
||
| 214 | <h2>Check if Calibre database file contains at least some of the needed tables</h2> |
||
| 215 | <h4> |
||
| 216 | <?php |
||
| 217 | try { |
||
| 218 | $db = new PDO('sqlite:'. Base::getDbFileName ($i)); |
||
| 219 | $count = $db->query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn(); |
||
| 220 | if ($count == 4) { |
||
| 221 | echo "{$name} OK"; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 222 | } else { |
||
| 223 | echo "{$name} Not all Calibre tables were found. Are you sure you're using the correct database."; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 224 | } |
||
| 225 | } catch (Exception $e) { |
||
| 226 | echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 227 | } |
||
| 228 | ?> |
||
| 229 | </h4> |
||
| 230 | </article> |
||
| 231 | <?php if ($full) { ?> |
||
| 232 | <article class="frontpage"> |
||
| 233 | <h2>Check if all Calibre books are found</h2> |
||
| 234 | <h4> |
||
| 235 | <?php |
||
| 236 | try { |
||
| 237 | $db = new PDO('sqlite:'. Base::getDbFileName ($i)); |
||
| 238 | $result = $db->prepare("select books.path || '/' || data.name || '.' || lower (format) as fullpath from data join books on data.book = books.id"); |
||
| 239 | $result->execute (); |
||
| 240 | while ($post = $result->fetchObject ()) |
||
| 241 | { |
||
| 242 | if (!is_file (Base::getDbDirectory ($i) . $post->fullpath)) { |
||
| 243 | echo "<p>" . Base::getDbDirectory ($i) . $post->fullpath . "</p>"; |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
<p> 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. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
</p> 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. Loading history...
|
|||
| 244 | } |
||
| 245 | } |
||
| 246 | } catch (Exception $e) { |
||
| 247 | echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e; |
||
|
0 ignored issues
–
show
As per coding-style, please use concatenation or
sprintf for the variable $name instead of interpolation.
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings. // Instead of
$x = "foo $bar $baz";
// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
|
|||
| 248 | } |
||
| 249 | ?> |
||
| 250 | </h4> |
||
| 251 | </article> |
||
| 252 | <?php } ?> |
||
| 253 | <?php } ?> |
||
| 254 | <?php $i++; } ?> |
||
| 255 | </section> |
||
| 256 | <footer></footer> |
||
| 257 | </div> |
||
| 258 | </body> |
||
| 259 | </html> |
||
| 260 |
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.
will print an indented:
Single is ValueIf 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.