Completed
Branch master (31966b)
by Markus
09:57
created
config.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@
 block discarded – undo
12 12
     require_once 'config_local.php';
13 13
 }
14 14
 
15
-$remote_user = array_key_exists('PHP_AUTH_USER', $_SERVER) ? $_SERVER['PHP_AUTH_USER'] : '';
15
+$remote_user = array_key_exists('PHP_AUTH_USER', $_SERVER)?$_SERVER['PHP_AUTH_USER']:'';
16 16
 // Clean username, only allow a-z, A-Z, 0-9, -_ chars
17
-$remote_user = preg_replace( "/[^a-zA-Z0-9_-]/", "", $remote_user);
17
+$remote_user = preg_replace("/[^a-zA-Z0-9_-]/", "", $remote_user);
18 18
 $user_config_file = 'config_local.' . $remote_user . '.php';
19 19
 if (file_exists(dirname(__FILE__) . '/' . $user_config_file) && (php_sapi_name() !== 'cli')) {
20 20
     require_once $user_config_file;
21 21
 }
22 22
 
23
-if(!is_null($config['cops_basic_authentication']) &&
23
+if (!is_null($config['cops_basic_authentication']) &&
24 24
     is_array($config['cops_basic_authentication']))
25 25
 {
26 26
     if (!isset($_SERVER['PHP_AUTH_USER']) ||
27 27
         (isset($_SERVER['PHP_AUTH_USER']) &&
28
-        ($_SERVER['PHP_AUTH_USER']!=$config['cops_basic_authentication']['username'] ||
28
+        ($_SERVER['PHP_AUTH_USER'] != $config['cops_basic_authentication']['username'] ||
29 29
         $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password'])))
30 30
     {
31 31
         header('WWW-Authenticate: Basic realm="COPS Authentication"');
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,13 +21,11 @@
 block discarded – undo
21 21
 }
22 22
 
23 23
 if(!is_null($config['cops_basic_authentication']) &&
24
-    is_array($config['cops_basic_authentication']))
25
-{
24
+    is_array($config['cops_basic_authentication'])) {
26 25
     if (!isset($_SERVER['PHP_AUTH_USER']) ||
27 26
         (isset($_SERVER['PHP_AUTH_USER']) &&
28 27
         ($_SERVER['PHP_AUTH_USER']!=$config['cops_basic_authentication']['username'] ||
29
-        $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password'])))
30
-    {
28
+        $_SERVER['PHP_AUTH_PW'] != $config['cops_basic_authentication']['password']))) {
31 29
         header('WWW-Authenticate: Basic realm="COPS Authentication"');
32 30
         header('HTTP/1.0 401 Unauthorized');
33 31
         echo 'This site is password protected';
Please login to merge, or discard this patch.
config_default.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * The two first will be displayed in book entries
107 107
      * The other only appear in book detail
108 108
      */
109
-    $config['cops_prefered_format'] = array ("EPUB", "PDF", "AZW3", "AZW", "MOBI", "CBR", "CBZ");
109
+    $config['cops_prefered_format'] = array("EPUB", "PDF", "AZW3", "AZW", "MOBI", "CBR", "CBZ");
110 110
 
111 111
     /*
112 112
      * use URL rewriting for downloading of ebook in HTML catalog
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      *
169 169
      * Example : array ("All" => "", "Unread" => "!Read", "Read" => "Read")
170 170
      */
171
-    $config['cops_books_filter'] = array ();
171
+    $config['cops_books_filter'] = array();
172 172
 
173 173
     /*
174 174
      * Custom Columns to add  as an array containing the lookup names
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      *
179 179
      * Note that for now only the first, second and forth type of custom columns are supported
180 180
      */
181
-    $config['cops_calibre_custom_column'] = array ();
181
+    $config['cops_calibre_custom_column'] = array();
182 182
 
183 183
     /*
184 184
      * Rename .epub to .kepub.epub if downloaded from a Kobo eReader
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      * - rating
257 257
      * - language
258 258
      */
259
-    $config ['cops_ignored_categories'] = array ();
259
+    $config ['cops_ignored_categories'] = array();
260 260
 
261 261
     /*
262 262
      * If you use a Sony eReader or Aldiko you can't download ebooks if your catalog
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @author     Sébastien Lucas <[email protected]>
7 7
  */
8 8
 
9
-    if (!isset($config))
10
-        $config = array();
9
+    if (!isset($config)) {
10
+            $config = array();
11
+    }
11 12
 
12 13
     /*
13 14
      * The directory containing calibre's metadata.db file, with sub-directories
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      *                                           "address.from"  => "[email protected]"
211 211
      *                                           );
212 212
      */
213
-    $config['cops_mail_configuration'] = NULL;
213
+    $config['cops_mail_configuration'] = null;
214 214
 
215 215
     /*
216 216
      * Use filter in HTML catalog
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      * array( "username" => "xxx", "password" => "secret") : Enable PHP password protection
283 283
      * NULL : Disable PHP password protection (You can still use htpasswd)
284 284
      */
285
-    $config['cops_basic_authentication'] = NULL;
285
+    $config['cops_basic_authentication'] = null;
286 286
 
287 287
     /*
288 288
      * Which template is used by default :
Please login to merge, or discard this patch.
checkconfig.php 3 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
     require_once ("config.php");
13 13
     require_once ("base.php");
14 14
 
15
-    header ("Content-Type:text/html; charset=UTF-8");
15
+    header("Content-Type:text/html; charset=UTF-8");
16 16
 
17
-    $err = getURLParam ("err", -1);
18
-    $full = getURLParam ("full");
17
+    $err = getURLParam("err", -1);
18
+    $full = getURLParam("full");
19 19
     $error = NULL;
20 20
     switch ($err) {
21 21
         case 1 :
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     <meta charset="utf-8">
29 29
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
30 30
     <title>COPS Configuration Check</title>
31
-    <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" />
31
+    <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss()) ?>" media="screen" />
32 32
 </head>
33 33
 <body>
34 34
 <div class="container">
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     <div id="content" style="display: none;"></div>
41 41
     <section>
42 42
         <?php
43
-        if (!is_null ($error)) {
43
+        if (!is_null($error)) {
44 44
         ?>
45 45
         <article class="frontpage">
46 46
             <h2>You've been redirected because COPS is not configured properly</h2>
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             <h2>Check if the rendering will be done on client side or server side</h2>
154 154
             <h4>
155 155
             <?php
156
-            if (useServerSideRendering ()) {
156
+            if (useServerSideRendering()) {
157 157
                 echo "Server side rendering";
158 158
             } else {
159 159
                 echo "Client side rendering";
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
         </article>
164 164
 <?php
165 165
 $i = 0;
166
-foreach (Base::getDbList () as $name => $database) {
166
+foreach (Base::getDbList() as $name => $database) {
167 167
 ?>
168 168
         <article class="frontpage">
169 169
             <h2>Check if Calibre database path is not an URL</h2>
170 170
             <h4>
171 171
             <?php
172
-            if (!preg_match ("#^http#", $database)) {
172
+            if (!preg_match("#^http#", $database)) {
173 173
                 echo "OK";
174 174
             } else {
175 175
                 echo "Calibre path has to be local (no URL allowed)";
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
             <h2>Check if Calibre database file exists and is readable</h2>
182 182
             <h4>
183 183
             <?php
184
-            if (is_readable (Base::getDbFileName ($i))) {
184
+            if (is_readable(Base::getDbFileName($i))) {
185 185
                 echo "{$name} OK";
186 186
             } else {
187
-                echo "{$name} File " . Base::getDbFileName ($i) . " not found,
187
+                echo "{$name} File " . Base::getDbFileName($i) . " not found,
188 188
 Please check
189 189
 <ul>
190 190
 <li>Value of \$config['calibre_directory'] in config_local.php</li>
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
             ?>
197 197
             </h4>
198 198
         </article>
199
-    <?php if (is_readable (Base::getDbFileName ($i))) { ?>
199
+    <?php if (is_readable(Base::getDbFileName($i))) { ?>
200 200
         <article class="frontpage">
201 201
             <h2>Check if Calibre database file can be opened with PHP</h2>
202 202
             <h4>
203 203
             <?php
204 204
             try {
205
-                $db = new PDO('sqlite:'. Base::getDbFileName ($i));
205
+                $db = new PDO('sqlite:' . Base::getDbFileName($i));
206 206
                 echo "{$name} OK";
207 207
             } catch (Exception $e) {
208 208
                 echo "{$name} If the file is readable, check your php configuration. Exception detail : " . $e;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             <h4>
216 216
             <?php
217 217
             try {
218
-                $db = new PDO('sqlite:'. Base::getDbFileName ($i));
218
+                $db = new PDO('sqlite:' . Base::getDbFileName($i));
219 219
                 $count = $db->query("select count(*) FROM sqlite_master WHERE type='table' AND name in ('books', 'authors', 'tags', 'series')")->fetchColumn();
220 220
                 if ($count == 4) {
221 221
                     echo "{$name} OK";
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
             <h4>
235 235
             <?php
236 236
             try {
237
-                $db = new PDO('sqlite:'. Base::getDbFileName ($i));
237
+                $db = new PDO('sqlite:' . Base::getDbFileName($i));
238 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 ())
239
+                $result->execute();
240
+                while ($post = $result->fetchObject())
241 241
                 {
242
-                    if (!is_file (Base::getDbDirectory ($i) . $post->fullpath)) {
243
-                        echo "<p>" . Base::getDbDirectory ($i) . $post->fullpath . "</p>";
242
+                    if (!is_file(Base::getDbDirectory($i) . $post->fullpath)) {
243
+                        echo "<p>" . Base::getDbDirectory($i) . $post->fullpath . "</p>";
244 244
                     }
245 245
                 }
246 246
             } catch (Exception $e) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,8 +237,7 @@
 block discarded – undo
237 237
                 $db = new PDO('sqlite:'. Base::getDbFileName ($i));
238 238
                 $result = $db->prepare("select books.path || '/' || data.name || '.' || lower (format) as fullpath from data join books on data.book = books.id");
239 239
                 $result->execute ();
240
-                while ($post = $result->fetchObject ())
241
-                {
240
+                while ($post = $result->fetchObject ()) {
242 241
                     if (!is_file (Base::getDbDirectory ($i) . $post->fullpath)) {
243 242
                         echo "<p>" . Base::getDbDirectory ($i) . $post->fullpath . "</p>";
244 243
                     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
     $err = getURLParam ("err", -1);
18 18
     $full = getURLParam ("full");
19
-    $error = NULL;
19
+    $error = null;
20 20
     switch ($err) {
21 21
         case 1 :
22 22
             $error = "Database error";
Please login to merge, or discard this patch.