Completed
Branch master (31966b)
by Markus
09:57
created
author.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -60,6 +60,9 @@  discard block
 block discarded – undo
60 60
         return self::getEntryArray (self::SQL_AUTHORS_BY_FIRST_LETTER, array ($letter . "%"));
61 61
     }
62 62
 
63
+    /**
64
+     * @param string $query
65
+     */
63 66
     public static function getAuthorsForSearch($query) {
64 67
         return self::getEntryArray (self::SQL_AUTHORS_FOR_SEARCH, array ($query . "%", $query . "%"));
65 68
     }
@@ -68,6 +71,9 @@  discard block
 block discarded – undo
68 71
         return self::getEntryArray (self::SQL_ALL_AUTHORS, array ());
69 72
     }
70 73
 
74
+    /**
75
+     * @param string $query
76
+     */
71 77
     public static function getEntryArray ($query, $params) {
72 78
         return Base::getEntryArrayWithBookNumber ($query, self::AUTHOR_COLUMNS, $params, "Author");
73 79
     }
Please login to merge, or discard this patch.
base.php 2 patches
Doc Comments   +50 added lines patch added patch discarded remove patch
@@ -60,6 +60,9 @@  discard block
 block discarded – undo
60 60
     $_SERVER['REDIRECT_STATUS'] = 404;
61 61
 }
62 62
 
63
+/**
64
+ * @param string $name
65
+ */
63 66
 function getURLParam ($name, $default = NULL) {
64 67
     if (!empty ($_GET) && isset($_GET[$name]) && $_GET[$name] != "") {
65 68
         return $_GET[$name];
@@ -95,6 +98,11 @@  discard block
 block discarded – undo
95 98
     return $url . "?v=" . VERSION;
96 99
 }
97 100
 
101
+/**
102
+ * @param string $xml
103
+ *
104
+ * @return string
105
+ */
98 106
 function xml2xhtml($xml) {
99 107
     return preg_replace_callback('#<(\w+)([^>]*)\s*/>#s', create_function('$m', '
100 108
         $xhtml_tags = array("br", "hr", "input", "frame", "img", "area", "link", "col", "base", "basefont", "param");
@@ -308,6 +316,9 @@  discard block
 block discarded – undo
308 316
     return $phrase;
309 317
 }
310 318
 
319
+/**
320
+ * @param string $paramName
321
+ */
311 322
 function addURLParameter($urlParams, $paramName, $paramValue) {
312 323
     if (empty ($urlParams)) {
313 324
         $urlParams = "";
@@ -369,6 +380,9 @@  discard block
 block discarded – undo
369 380
         return $this->href;
370 381
     }
371 382
 
383
+    /**
384
+     * @return string
385
+     */
372 386
     public function getScriptName() {
373 387
         $parts = explode('/', $_SERVER["SCRIPT_NAME"]);
374 388
         return $parts[count($parts) - 1];
@@ -377,6 +391,9 @@  discard block
 block discarded – undo
377 391
 
378 392
 class LinkNavigation extends Link
379 393
 {
394
+    /**
395
+     * @param string $prel
396
+     */
380 397
     public function __construct($phref, $prel = NULL, $ptitle = NULL) {
381 398
         parent::__construct ($phref, Link::OPDS_NAVIGATION_TYPE, $prel, $ptitle);
382 399
         if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
@@ -391,6 +408,9 @@  discard block
 block discarded – undo
391 408
 
392 409
 class LinkFacet extends Link
393 410
 {
411
+    /**
412
+     * @param string $phref
413
+     */
394 414
     public function __construct($phref, $ptitle = NULL, $pfacetGroup = NULL, $pactiveFacet = FALSE) {
395 415
         parent::__construct ($phref, Link::OPDS_PAGING_TYPE, "http://opds-spec.org/facet", $ptitle, $pfacetGroup, $pactiveFacet);
396 416
         if (!is_null (GetUrlParam (DB))) $this->href = addURLParameter ($this->href, DB, GetUrlParam (DB));
@@ -471,6 +491,12 @@  discard block
 block discarded – undo
471 491
 {
472 492
     public $book;
473 493
 
494
+    /**
495
+     * @param string $pid
496
+     * @param string $pcontent
497
+     * @param string $pcontentType
498
+     * @param Book $pbook
499
+     */
474 500
     public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pbook) {
475 501
         parent::__construct ($ptitle, $pid, $pcontent, $pcontentType, $plinkArray);
476 502
         $this->book = $pbook;
@@ -1044,6 +1070,9 @@  discard block
 block discarded – undo
1044 1070
 
1045 1071
 class PageCustomize extends Page
1046 1072
 {
1073
+    /**
1074
+     * @param string $key
1075
+     */
1047 1076
     private function isChecked ($key, $testedValue = 1) {
1048 1077
         $value = getCurrentOption ($key);
1049 1078
         if (is_array ($value)) {
@@ -1058,6 +1087,9 @@  discard block
 block discarded – undo
1058 1087
         return "";
1059 1088
     }
1060 1089
 
1090
+    /**
1091
+     * @param string $key
1092
+     */
1061 1093
     private function isSelected ($key, $value) {
1062 1094
         if (getCurrentOption ($key) == $value) {
1063 1095
             return "selected='selected'";
@@ -1214,6 +1246,9 @@  discard block
 block discarded – undo
1214 1246
         return "";
1215 1247
     }
1216 1248
 
1249
+    /**
1250
+     * @return string
1251
+     */
1217 1252
     public static function getDbDirectory ($database = NULL) {
1218 1253
         global $config;
1219 1254
         if (self::isMultipleDatabaseEnabled ()) {
@@ -1273,10 +1308,18 @@  discard block
 block discarded – undo
1273 1308
         self::$db = NULL;
1274 1309
     }
1275 1310
 
1311
+    /**
1312
+     * @param string $query
1313
+     */
1276 1314
     public static function executeQuerySingle ($query, $database = NULL) {
1277 1315
         return self::getDb ($database)->query($query)->fetchColumn();
1278 1316
     }
1279 1317
 
1318
+    /**
1319
+     * @param string $table
1320
+     * @param string $id
1321
+     * @param string $numberOfString
1322
+     */
1280 1323
     public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) {
1281 1324
         if (!$numberOfString) {
1282 1325
             $numberOfString = $table . ".alphabetical";
@@ -1289,6 +1332,10 @@  discard block
 block discarded – undo
1289 1332
         return $entry;
1290 1333
     }
1291 1334
 
1335
+    /**
1336
+     * @param string $columns
1337
+     * @param string $category
1338
+     */
1292 1339
     public static function getEntryArrayWithBookNumber ($query, $columns, $params, $category) {
1293 1340
         list (, $result) = self::executeQuery ($query, $columns, "", $params, -1);
1294 1341
         $entryArray = array();
@@ -1307,6 +1354,9 @@  discard block
 block discarded – undo
1307 1354
         return $entryArray;
1308 1355
     }
1309 1356
 
1357
+    /**
1358
+     * @param string $filter
1359
+     */
1310 1360
     public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) {
1311 1361
         $totalResult = -1;
1312 1362
 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     // Generate the function for the template
31 31
     $template = new doT ();
32 32
     $dot = $template->template ($page, array ("bookdetail" => $bookdetail,
33
-                                              "header" => $header,
34
-                                              "footer" => $footer,
35
-                                              "main" => $main));
33
+                                                "header" => $header,
34
+                                                "footer" => $footer,
35
+                                                "main" => $main));
36 36
     // If there is a syntax error in the function created
37 37
     // $dot will be equal to FALSE
38 38
     if (!$dot) {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         case LIBXML_ERR_WARNING:
112 112
             $return .= "Warning $error->code: ";
113 113
             break;
114
-         case LIBXML_ERR_ERROR:
114
+            case LIBXML_ERR_ERROR:
115 115
             $return .= "Error $error->code: ";
116 116
             break;
117 117
         case LIBXML_ERR_FATAL:
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
     }
121 121
 
122 122
     $return .= trim($error->message) .
123
-               "\n  Line: $error->line" .
124
-               "\n  Column: $error->column";
123
+                "\n  Line: $error->line" .
124
+                "\n  Column: $error->column";
125 125
 
126 126
     if ($error->file) {
127 127
         $return .= "\n  File: $error->file";
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
         $this->entryArray = array ();
1082 1082
 
1083 1083
         $ignoredBaseArray = array (PageQueryResult::SCOPE_AUTHOR,
1084
-                                   PageQueryResult::SCOPE_TAG,
1085
-                                   PageQueryResult::SCOPE_SERIES,
1086
-                                   PageQueryResult::SCOPE_PUBLISHER,
1087
-                                   PageQueryResult::SCOPE_RATING,
1088
-                                   "language");
1084
+                                    PageQueryResult::SCOPE_TAG,
1085
+                                    PageQueryResult::SCOPE_SERIES,
1086
+                                    PageQueryResult::SCOPE_PUBLISHER,
1087
+                                    PageQueryResult::SCOPE_RATING,
1088
+                                    "language");
1089 1089
 
1090 1090
         $content = "";
1091 1091
         array_push ($this->entryArray, new Entry ("Template", "",
Please login to merge, or discard this patch.
book.php 2 patches
Doc Comments   +13 added lines patch added patch discarded remove patch
@@ -287,6 +287,9 @@  discard block
 block discarded – undo
287 287
         return reset ($reduced);
288 288
     }
289 289
 
290
+    /**
291
+     * @param string $extension
292
+     */
290 293
     public function getFilePath ($extension, $idData = NULL, $relative = false)
291 294
     {
292 295
         if ($extension == "jpg")
@@ -419,6 +422,9 @@  discard block
 block discarded – undo
419 422
             $this->getLinkArray (), $this);
420 423
     }
421 424
 
425
+    /**
426
+     * @param integer $database
427
+     */
422 428
     public static function getBookCount($database = NULL) {
423 429
         return parent::executeQuerySingle ('select count(*) from books', $database);
424 430
     }
@@ -500,6 +506,10 @@  discard block
 block discarded – undo
500 506
         return NULL;
501 507
     }
502 508
 
509
+    /**
510
+     * @param integer $database
511
+     * @param integer $numberPerPage
512
+     */
503 513
     public static function getBooksByQuery($query, $n, $database = NULL, $numberPerPage = NULL) {
504 514
         $i = 0;
505 515
         $critArray = array ();
@@ -544,6 +554,9 @@  discard block
 block discarded – undo
544 554
         return $entryArray;
545 555
     }
546 556
 
557
+    /**
558
+     * @param integer $numberPerPage
559
+     */
547 560
     public static function getBooksByStartingLetter($letter, $n, $database = NULL, $numberPerPage = NULL) {
548 561
         return self::getEntryArray (self::SQL_BOOKS_BY_FIRST_LETTER, array ($letter . "%"), $n, $database, $numberPerPage);
549 562
     }
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -428,15 +428,15 @@
 block discarded – undo
428 428
         $nBooks = parent::executeQuerySingle ('select count(*) from books');
429 429
         $result = array();
430 430
         $entry = new Entry (localize ("allbooks.title"),
431
-                          self::ALL_BOOKS_ID,
432
-                          str_format (localize ("allbooks.alphabetical", $nBooks), $nBooks), "text",
433
-                          array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS)), "", $nBooks);
431
+                            self::ALL_BOOKS_ID,
432
+                            str_format (localize ("allbooks.alphabetical", $nBooks), $nBooks), "text",
433
+                            array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS)), "", $nBooks);
434 434
         array_push ($result, $entry);
435 435
         if ($config['cops_recentbooks_limit'] > 0) {
436 436
             $entry = new Entry (localize ("recent.title"),
437
-                              self::ALL_RECENT_BOOKS_ID,
438
-                              str_format (localize ("recent.list"), $config['cops_recentbooks_limit']), "text",
439
-                              array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RECENT_BOOKS)), "", $config['cops_recentbooks_limit']);
437
+                                self::ALL_RECENT_BOOKS_ID,
438
+                                str_format (localize ("recent.list"), $config['cops_recentbooks_limit']), "text",
439
+                                array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RECENT_BOOKS)), "", $config['cops_recentbooks_limit']);
440 440
             array_push ($result, $entry);
441 441
         }
442 442
         return $result;
Please login to merge, or discard this patch.
data.php 1 patch
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -141,6 +141,9 @@  discard block
 block discarded – undo
141 141
         return new Link ($href, $this->getMimeType (), Link::OPDS_ACQUISITION_TYPE, $title);
142 142
     }
143 143
 
144
+    /**
145
+     * @param Book $book
146
+     */
144 147
     public static function getDataByBook ($book) {
145 148
         $out = array ();
146 149
         $result = parent::getDb ()->prepare('select id, format, name
@@ -154,6 +157,9 @@  discard block
 block discarded – undo
154 157
         return $out;
155 158
     }
156 159
 
160
+    /**
161
+     * @param string $urlParam
162
+     */
157 163
     public static function handleThumbnailLink ($urlParam, $height) {
158 164
         global $config;
159 165
 
@@ -173,6 +179,10 @@  discard block
 block discarded – undo
173 179
         return $urlParam;
174 180
     }
175 181
 
182
+    /**
183
+     * @param string $type
184
+     * @param string $filename
185
+     */
176 186
     public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL, $height = NULL)
177 187
     {
178 188
         global $config;
Please login to merge, or discard this patch.
rating.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -36,6 +36,9 @@
 block discarded – undo
36 36
         return self::getEntryArray (self::SQL_ALL_RATINGS, array ());
37 37
     }
38 38
 
39
+    /**
40
+     * @param string $query
41
+     */
39 42
     public static function getEntryArray ($query, $params) {
40 43
         list (, $result) = parent::executeQuery ($query, self::RATING_COLUMNS, "", $params, -1);
41 44
         $entryArray = array();
Please login to merge, or discard this patch.
tag.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -45,6 +45,9 @@
 block discarded – undo
45 45
         return Base::getEntryArrayWithBookNumber (self::SQL_ALL_TAGS, self::TAG_COLUMNS, array (), "Tag");
46 46
     }
47 47
 
48
+    /**
49
+     * @param integer $numberPerPage
50
+     */
48 51
     public static function getAllTagsByQuery($query, $n, $database = NULL, $numberPerPage = NULL) {
49 52
         $columns  = "tags.id as id, tags.name as name, (select count(*) from books_tags_link where tags.id = tag) as count";
50 53
         $sql = 'select {0} from tags where upper (tags.name) like ? {1} order by tags.name';
Please login to merge, or discard this patch.
transliteration.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
 /**
164 164
  * Replaces a Unicode character using the transliteration database.
165 165
  *
166
- * @param $ord
166
+ * @param integer $ord
167 167
  *   An ordinal Unicode character code.
168 168
  * @param $unknown
169 169
  *   Replacement string for characters that do not have a suitable ASCII
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -26,56 +26,56 @@  discard block
 block discarded – undo
26 26
  *   Transliterated text.
27 27
  */
28 28
 function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) {
29
-  // ASCII is always valid NFC! If we're only ever given plain ASCII, we can
30
-  // avoid the overhead of initializing the decomposition tables by skipping
31
-  // out early.
32
-  if (!preg_match('/[\x80-\xff]/', $string)) {
29
+    // ASCII is always valid NFC! If we're only ever given plain ASCII, we can
30
+    // avoid the overhead of initializing the decomposition tables by skipping
31
+    // out early.
32
+    if (!preg_match('/[\x80-\xff]/', $string)) {
33 33
     return $string;
34
-  }
34
+    }
35 35
 
36
-  static $tail_bytes;
36
+    static $tail_bytes;
37 37
 
38
-  if (!isset($tail_bytes)) {
38
+    if (!isset($tail_bytes)) {
39 39
     // Each UTF-8 head byte is followed by a certain number of tail bytes.
40 40
     $tail_bytes = array();
41 41
     for ($n = 0; $n < 256; $n++) {
42
-      if ($n < 0xc0) {
42
+        if ($n < 0xc0) {
43 43
         $remaining = 0;
44
-      }
45
-      elseif ($n < 0xe0) {
44
+        }
45
+        elseif ($n < 0xe0) {
46 46
         $remaining = 1;
47
-      }
48
-      elseif ($n < 0xf0) {
47
+        }
48
+        elseif ($n < 0xf0) {
49 49
         $remaining = 2;
50
-      }
51
-      elseif ($n < 0xf8) {
50
+        }
51
+        elseif ($n < 0xf8) {
52 52
         $remaining = 3;
53
-      }
54
-      elseif ($n < 0xfc) {
53
+        }
54
+        elseif ($n < 0xfc) {
55 55
         $remaining = 4;
56
-      }
57
-      elseif ($n < 0xfe) {
56
+        }
57
+        elseif ($n < 0xfe) {
58 58
         $remaining = 5;
59
-      }
60
-      else {
59
+        }
60
+        else {
61 61
         $remaining = 0;
62
-      }
63
-      $tail_bytes[chr($n)] = $remaining;
62
+        }
63
+        $tail_bytes[chr($n)] = $remaining;
64
+    }
64 65
     }
65
-  }
66 66
 
67
-  // Chop the text into pure-ASCII and non-ASCII areas; large ASCII parts can
68
-  // be handled much more quickly. Don't chop up Unicode areas for punctuation,
69
-  // though, that wastes energy.
70
-  preg_match_all('/[\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*/', $string, $matches);
67
+    // Chop the text into pure-ASCII and non-ASCII areas; large ASCII parts can
68
+    // be handled much more quickly. Don't chop up Unicode areas for punctuation,
69
+    // though, that wastes energy.
70
+    preg_match_all('/[\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*/', $string, $matches);
71 71
 
72
-  $result = '';
73
-  foreach ($matches[0] as $str) {
72
+    $result = '';
73
+    foreach ($matches[0] as $str) {
74 74
     if ($str[0] < "\x80") {
75
-      // ASCII chunk: guaranteed to be valid UTF-8 and in normal form C, so
76
-      // skip over it.
77
-      $result .= $str;
78
-      continue;
75
+        // ASCII chunk: guaranteed to be valid UTF-8 and in normal form C, so
76
+        // skip over it.
77
+        $result .= $str;
78
+        continue;
79 79
     }
80 80
 
81 81
     // We'll have to examine the chunk byte by byte to ensure that it consists
@@ -91,73 +91,73 @@  discard block
 block discarded – undo
91 91
     $len = $chunk + 1;
92 92
 
93 93
     for ($i = -1; --$len; ) {
94
-      $c = $str[++$i];
95
-      if ($remaining = $tail_bytes[$c]) {
94
+        $c = $str[++$i];
95
+        if ($remaining = $tail_bytes[$c]) {
96 96
         // UTF-8 head byte!
97 97
         $sequence = $head = $c;
98 98
         do {
99
-          // Look for the defined number of tail bytes...
100
-          if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") {
99
+            // Look for the defined number of tail bytes...
100
+            if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") {
101 101
             // Legal tail bytes are nice.
102 102
             $sequence .= $c;
103
-          }
104
-          else {
103
+            }
104
+            else {
105 105
             if ($len == 0) {
106
-              // Premature end of string! Drop a replacement character into
107
-              // output to represent the invalid UTF-8 sequence.
108
-              $result .= $unknown;
109
-              break 2;
106
+                // Premature end of string! Drop a replacement character into
107
+                // output to represent the invalid UTF-8 sequence.
108
+                $result .= $unknown;
109
+                break 2;
110 110
             }
111 111
             else {
112
-              // Illegal tail byte; abandon the sequence.
113
-              $result .= $unknown;
114
-              // Back up and reprocess this byte; it may itself be a legal
115
-              // ASCII or UTF-8 sequence head.
116
-              --$i;
117
-              ++$len;
118
-              continue 2;
112
+                // Illegal tail byte; abandon the sequence.
113
+                $result .= $unknown;
114
+                // Back up and reprocess this byte; it may itself be a legal
115
+                // ASCII or UTF-8 sequence head.
116
+                --$i;
117
+                ++$len;
118
+                continue 2;
119
+            }
119 120
             }
120
-          }
121 121
         } while (--$remaining);
122 122
 
123 123
         $n = ord($head);
124 124
         if ($n <= 0xdf) {
125
-          $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128);
125
+            $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128);
126 126
         }
127 127
         elseif ($n <= 0xef) {
128
-          $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128);
128
+            $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128);
129 129
         }
130 130
         elseif ($n <= 0xf7) {
131
-          $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128);
131
+            $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128);
132 132
         }
133 133
         elseif ($n <= 0xfb) {
134
-          $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128);
134
+            $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128);
135 135
         }
136 136
         elseif ($n <= 0xfd) {
137
-          $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128);
137
+            $ord = ($n - 252) * 1073741824 + (ord($sequence[1]) - 128) * 16777216 + (ord($sequence[2]) - 128) * 262144 + (ord($sequence[3]) - 128) * 4096 + (ord($sequence[4]) - 128) * 64 + (ord($sequence[5]) - 128);
138 138
         }
139 139
         $result .= _transliteration_replace($ord, $unknown, $source_langcode);
140 140
         $head = '';
141
-      }
142
-      elseif ($c < "\x80") {
141
+        }
142
+        elseif ($c < "\x80") {
143 143
         // ASCII byte.
144 144
         $result .= $c;
145 145
         $head = '';
146
-      }
147
-      elseif ($c < "\xc0") {
146
+        }
147
+        elseif ($c < "\xc0") {
148 148
         // Illegal tail bytes.
149 149
         if ($head == '') {
150
-          $result .= $unknown;
150
+            $result .= $unknown;
151
+        }
151 152
         }
152
-      }
153
-      else {
153
+        else {
154 154
         // Miscellaneous freaks.
155 155
         $result .= $unknown;
156 156
         $head = '';
157
-      }
157
+        }
158 158
     }
159
-  }
160
-  return $result;
159
+    }
160
+    return $result;
161 161
 }
162 162
 
163 163
 /**
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
  *   ASCII replacement character.
177 177
  */
178 178
 function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) {
179
-  static $map = array();
179
+    static $map = array();
180 180
 
181
-  //GL: set language later
182
-  /*
181
+    //GL: set language later
182
+    /*
183 183
   if (!isset($langcode)) {
184 184
     global $language;
185 185
     $langcode = $language->language;
186 186
   }
187 187
   */
188 188
 
189
-  $bank = $ord >> 8;
189
+    $bank = $ord >> 8;
190 190
 
191
-  if (!isset($map[$bank][$langcode])) {
191
+    if (!isset($map[$bank][$langcode])) {
192 192
     $file = './resources/transliteration-data/' . sprintf('x%02x', $bank) . '.php';  
193 193
     if (file_exists($file)) {
194
-      include $file;
195
-      if ($langcode != 'en' && isset($variant[$langcode])) {
194
+        include $file;
195
+        if ($langcode != 'en' && isset($variant[$langcode])) {
196 196
         // Merge in language specific mappings.
197 197
         $map[$bank][$langcode] = $variant[$langcode] + $base;
198
-      }
199
-      else {
198
+        }
199
+        else {
200 200
         $map[$bank][$langcode] = $base;
201
-      }
201
+        }
202 202
     }
203 203
     else {
204
-      $map[$bank][$langcode] = array();
204
+        $map[$bank][$langcode] = array();
205
+    }
205 206
     }
206
-  }
207 207
 
208
-  $ord = $ord & 255;
208
+    $ord = $ord & 255;
209 209
 
210
-  return isset($map[$bank][$langcode][$ord]) ? $map[$bank][$langcode][$ord] : $unknown;
210
+    return isset($map[$bank][$langcode][$ord]) ? $map[$bank][$langcode][$ord] : $unknown;
211 211
 }
Please login to merge, or discard this patch.
sendtomail.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@
 block discarded – undo
78 78
 $mail->AltBody = "Sent by COPS";
79 79
 
80 80
 if (!$mail->Send()) {
81
-   echo localize ("mail.messagenotsent");
82
-   echo 'Mailer Error: ' . $mail->ErrorInfo;
83
-   exit;
81
+    echo localize ("mail.messagenotsent");
82
+    echo 'Mailer Error: ' . $mail->ErrorInfo;
83
+    exit;
84 84
 }
85 85
 
86 86
 echo localize ("mail.messagesent");
Please login to merge, or discard this patch.
JSON_renderer.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
         }
47 47
 
48 48
         return array ("id" => $book->id,
49
-                      "hasCover" => $book->hasCover,
50
-                      "preferedData" => $preferedData,
51
-                      "rating" => $book->getRating (),
52
-                      "publisherName" => $pn,
53
-                      "publisherurl" => $pu,
54
-                      "pubDate" => $book->getPubDate (),
55
-                      "languagesName" => $book->getLanguages (),
56
-                      "authorsName" => $book->getAuthorsName (),
57
-                      "tagsName" => $book->getTagsName (),
58
-                      "seriesName" => $sn,
59
-                      "seriesIndex" => $book->seriesIndex,
60
-                      "seriesCompleteName" => $scn,
61
-                      "seriesurl" => $su);
49
+                        "hasCover" => $book->hasCover,
50
+                        "preferedData" => $preferedData,
51
+                        "rating" => $book->getRating (),
52
+                        "publisherName" => $pn,
53
+                        "publisherurl" => $pu,
54
+                        "pubDate" => $book->getPubDate (),
55
+                        "languagesName" => $book->getLanguages (),
56
+                        "authorsName" => $book->getAuthorsName (),
57
+                        "tagsName" => $book->getTagsName (),
58
+                        "seriesName" => $sn,
59
+                        "seriesIndex" => $book->seriesIndex,
60
+                        "seriesCompleteName" => $scn,
61
+                        "seriesurl" => $su);
62 62
     }
63 63
 
64 64
     public static function getFullBookContentArray ($book) {
@@ -125,44 +125,44 @@  discard block
 block discarded – undo
125 125
         $out = $in;
126 126
 
127 127
         $out ["c"] = array ("version" => VERSION, "i18n" => array (
128
-                           "coverAlt" => localize("i18n.coversection"),
129
-                           "authorsTitle" => localize("authors.title"),
130
-                           "bookwordTitle" => localize("bookword.title"),
131
-                           "tagsTitle" => localize("tags.title"),
132
-                           "seriesTitle" => localize("series.title"),
133
-                           "customizeTitle" => localize ("customize.title"),
134
-                           "aboutTitle" => localize ("about.title"),
135
-                           "previousAlt" => localize ("paging.previous.alternate"),
136
-                           "nextAlt" => localize ("paging.next.alternate"),
137
-                           "searchAlt" => localize ("search.alternate"),
138
-                           "sortAlt" => localize ("sort.alternate"),
139
-                           "homeAlt" => localize ("home.alternate"),
140
-                           "cogAlt" => localize ("cog.alternate"),
141
-                           "permalinkAlt" => localize ("permalink.alternate"),
142
-                           "publisherName" => localize("publisher.name"),
143
-                           "pubdateTitle" => localize("pubdate.title"),
144
-                           "languagesTitle" => localize("language.title"),
145
-                           "contentTitle" => localize("content.summary"),
146
-                           "sortorderAsc" => localize("search.sortorder.asc"),
147
-                           "sortorderDesc" => localize("search.sortorder.desc"),
148
-                           "customizeEmail" => localize("customize.email")),
149
-                       "url" => array (
150
-                           "detailUrl" => "index.php?page=13&id={0}&db={1}",
151
-                           "coverUrl" => "fetch.php?id={0}&db={1}",
152
-                           "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
-                       "config" => array (
154
-                           "use_fancyapps" => $config ["cops_use_fancyapps"],
155
-                           "max_item_per_page" => $config['cops_max_item_per_page'],
156
-                           "kindleHack"        => "",
157
-                           "server_side_rendering" => useServerSideRendering (),
158
-                           "html_tag_filter" => $config['cops_html_tag_filter']));
128
+                            "coverAlt" => localize("i18n.coversection"),
129
+                            "authorsTitle" => localize("authors.title"),
130
+                            "bookwordTitle" => localize("bookword.title"),
131
+                            "tagsTitle" => localize("tags.title"),
132
+                            "seriesTitle" => localize("series.title"),
133
+                            "customizeTitle" => localize ("customize.title"),
134
+                            "aboutTitle" => localize ("about.title"),
135
+                            "previousAlt" => localize ("paging.previous.alternate"),
136
+                            "nextAlt" => localize ("paging.next.alternate"),
137
+                            "searchAlt" => localize ("search.alternate"),
138
+                            "sortAlt" => localize ("sort.alternate"),
139
+                            "homeAlt" => localize ("home.alternate"),
140
+                            "cogAlt" => localize ("cog.alternate"),
141
+                            "permalinkAlt" => localize ("permalink.alternate"),
142
+                            "publisherName" => localize("publisher.name"),
143
+                            "pubdateTitle" => localize("pubdate.title"),
144
+                            "languagesTitle" => localize("language.title"),
145
+                            "contentTitle" => localize("content.summary"),
146
+                            "sortorderAsc" => localize("search.sortorder.asc"),
147
+                            "sortorderDesc" => localize("search.sortorder.desc"),
148
+                            "customizeEmail" => localize("customize.email")),
149
+                        "url" => array (
150
+                            "detailUrl" => "index.php?page=13&id={0}&db={1}",
151
+                            "coverUrl" => "fetch.php?id={0}&db={1}",
152
+                            "thumbnailUrl" => "fetch.php?height=" . $config['cops_html_thumbnail_height'] . "&id={0}&db={1}"),
153
+                        "config" => array (
154
+                            "use_fancyapps" => $config ["cops_use_fancyapps"],
155
+                            "max_item_per_page" => $config['cops_max_item_per_page'],
156
+                            "kindleHack"        => "",
157
+                            "server_side_rendering" => useServerSideRendering (),
158
+                            "html_tag_filter" => $config['cops_html_tag_filter']));
159 159
         if ($config['cops_thumbnail_handling'] == "1") {
160 160
             $out ["c"]["url"]["thumbnailUrl"] = $out ["c"]["url"]["coverUrl"];
161 161
         } else if (!empty ($config['cops_thumbnail_handling'])) {
162 162
             $out ["c"]["url"]["thumbnailUrl"] = $config['cops_thumbnail_handling'];
163 163
         }
164 164
         if (preg_match("/./", $_SERVER['HTTP_USER_AGENT'])) {
165
-          $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
165
+            $out ["c"]["config"]["kindleHack"] = 'style="text-decoration: none !important;"';
166 166
         }
167 167
         return $out;
168 168
     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         }
222 222
         if (!is_null (getURLParam ("complete")) || $complete) {
223 223
             $out = self::addCompleteArray ($out);
224
-       }
224
+        }
225 225
 
226 226
         $out ["containsBook"] = 0;
227 227
         if ($currentPage->containsBook ()) {
Please login to merge, or discard this patch.