Completed
Push — master ( 3facbb...d7e1eb )
by Markus
04:20
created
transliteration.php 5 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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     // Counting down is faster. I'm *so* sorry.
91 91
     $len = $chunk + 1;
92 92
 
93
-    for ($i = -1; --$len; ) {
93
+    for ($i = -1; --$len;) {
94 94
       $c = $str[++$i];
95 95
       if ($remaining = $tail_bytes[$c]) {
96 96
         // UTF-8 head byte!
@@ -207,5 +207,5 @@  discard block
 block discarded – undo
207 207
 
208 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.
Braces   +21 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
  * @return
26 26
  *   Transliterated text.
27 27
  */
28
-function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) {
28
+function _transliteration_process($string, $unknown = '?', $source_langcode = NULL)
29
+{
29 30
   // ASCII is always valid NFC! If we're only ever given plain ASCII, we can
30 31
   // avoid the overhead of initializing the decomposition tables by skipping
31 32
   // out early.
@@ -41,23 +42,17 @@  discard block
 block discarded – undo
41 42
     for ($n = 0; $n < 256; $n++) {
42 43
       if ($n < 0xc0) {
43 44
         $remaining = 0;
44
-      }
45
-      elseif ($n < 0xe0) {
45
+      } elseif ($n < 0xe0) {
46 46
         $remaining = 1;
47
-      }
48
-      elseif ($n < 0xf0) {
47
+      } elseif ($n < 0xf0) {
49 48
         $remaining = 2;
50
-      }
51
-      elseif ($n < 0xf8) {
49
+      } elseif ($n < 0xf8) {
52 50
         $remaining = 3;
53
-      }
54
-      elseif ($n < 0xfc) {
51
+      } elseif ($n < 0xfc) {
55 52
         $remaining = 4;
56
-      }
57
-      elseif ($n < 0xfe) {
53
+      } elseif ($n < 0xfe) {
58 54
         $remaining = 5;
59
-      }
60
-      else {
55
+      } else {
61 56
         $remaining = 0;
62 57
       }
63 58
       $tail_bytes[chr($n)] = $remaining;
@@ -100,15 +95,13 @@  discard block
 block discarded – undo
100 95
           if (--$len && ($c = $str[++$i]) >= "\x80" && $c < "\xc0") {
101 96
             // Legal tail bytes are nice.
102 97
             $sequence .= $c;
103
-          }
104
-          else {
98
+          } else {
105 99
             if ($len == 0) {
106 100
               // Premature end of string! Drop a replacement character into
107 101
               // output to represent the invalid UTF-8 sequence.
108 102
               $result .= $unknown;
109 103
               break 2;
110
-            }
111
-            else {
104
+            } else {
112 105
               // Illegal tail byte; abandon the sequence.
113 106
               $result .= $unknown;
114 107
               // Back up and reprocess this byte; it may itself be a legal
@@ -123,34 +116,27 @@  discard block
 block discarded – undo
123 116
         $n = ord($head);
124 117
         if ($n <= 0xdf) {
125 118
           $ord = ($n - 192) * 64 + (ord($sequence[1]) - 128);
126
-        }
127
-        elseif ($n <= 0xef) {
119
+        } elseif ($n <= 0xef) {
128 120
           $ord = ($n - 224) * 4096 + (ord($sequence[1]) - 128) * 64 + (ord($sequence[2]) - 128);
129
-        }
130
-        elseif ($n <= 0xf7) {
121
+        } elseif ($n <= 0xf7) {
131 122
           $ord = ($n - 240) * 262144 + (ord($sequence[1]) - 128) * 4096 + (ord($sequence[2]) - 128) * 64 + (ord($sequence[3]) - 128);
132
-        }
133
-        elseif ($n <= 0xfb) {
123
+        } elseif ($n <= 0xfb) {
134 124
           $ord = ($n - 248) * 16777216 + (ord($sequence[1]) - 128) * 262144 + (ord($sequence[2]) - 128) * 4096 + (ord($sequence[3]) - 128) * 64 + (ord($sequence[4]) - 128);
135
-        }
136
-        elseif ($n <= 0xfd) {
125
+        } elseif ($n <= 0xfd) {
137 126
           $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 127
         }
139 128
         $result .= _transliteration_replace($ord, $unknown, $source_langcode);
140 129
         $head = '';
141
-      }
142
-      elseif ($c < "\x80") {
130
+      } elseif ($c < "\x80") {
143 131
         // ASCII byte.
144 132
         $result .= $c;
145 133
         $head = '';
146
-      }
147
-      elseif ($c < "\xc0") {
134
+      } elseif ($c < "\xc0") {
148 135
         // Illegal tail bytes.
149 136
         if ($head == '') {
150 137
           $result .= $unknown;
151 138
         }
152
-      }
153
-      else {
139
+      } else {
154 140
         // Miscellaneous freaks.
155 141
         $result .= $unknown;
156 142
         $head = '';
@@ -175,7 +161,8 @@  discard block
 block discarded – undo
175 161
  * @return
176 162
  *   ASCII replacement character.
177 163
  */
178
-function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) {
164
+function _transliteration_replace($ord, $unknown = '?', $langcode = NULL)
165
+{
179 166
   static $map = array();
180 167
 
181 168
   //GL: set language later
@@ -195,12 +182,10 @@  discard block
 block discarded – undo
195 182
       if ($langcode != 'en' && isset($variant[$langcode])) {
196 183
         // Merge in language specific mappings.
197 184
         $map[$bank][$langcode] = $variant[$langcode] + $base;
198
-      }
199
-      else {
185
+      } else {
200 186
         $map[$bank][$langcode] = $base;
201 187
       }
202
-    }
203
-    else {
188
+    } else {
204 189
       $map[$bank][$langcode] = array();
205 190
     }
206 191
   }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  * @return
26 26
  *   Transliterated text.
27 27
  */
28
-function _transliteration_process($string, $unknown = '?', $source_langcode = NULL) {
28
+function _transliteration_process($string, $unknown = '?', $source_langcode = null) {
29 29
   // ASCII is always valid NFC! If we're only ever given plain ASCII, we can
30 30
   // avoid the overhead of initializing the decomposition tables by skipping
31 31
   // out early.
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
  * @return
176 176
  *   ASCII replacement character.
177 177
  */
178
-function _transliteration_replace($ord, $unknown = '?', $langcode = NULL) {
178
+function _transliteration_replace($ord, $unknown = '?', $langcode = null) {
179 179
   static $map = array();
180 180
 
181 181
   //GL: set language later
Please login to merge, or discard this patch.
sendtomail.php 4 patches
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.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@  discard block
 block discarded – undo
2 2
 
3 3
 require_once ("config.php");
4 4
 
5
-function checkConfiguration () {
5
+function checkConfiguration() {
6 6
     global $config;
7 7
 
8
-    if (is_null ($config['cops_mail_configuration']) ||
9
-        !is_array ($config['cops_mail_configuration']) ||
8
+    if (is_null($config['cops_mail_configuration']) ||
9
+        !is_array($config['cops_mail_configuration']) ||
10 10
         empty ($config['cops_mail_configuration']["smtp.host"]) ||
11 11
         empty ($config['cops_mail_configuration']["address.from"])) {
12 12
         return "NOK. bad configuration.";
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     return False;
15 15
 }
16 16
 
17
-function checkRequest ($idData, $emailDest) {
17
+function checkRequest($idData, $emailDest) {
18 18
     if (empty ($idData)) {
19 19
         return 'No data sent.';
20 20
     }
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 
29 29
 global $config;
30 30
 
31
-if ($error = checkConfiguration ()) {
31
+if ($error = checkConfiguration()) {
32 32
     echo $error;
33 33
     exit;
34 34
 }
35 35
 
36 36
 $idData = $_REQUEST["data"];
37 37
 $emailDest = $_REQUEST["email"];
38
-if ($error = checkRequest ($idData, $emailDest)) {
38
+if ($error = checkRequest($idData, $emailDest)) {
39 39
     echo $error;
40 40
     exit;
41 41
 }
42 42
 
43 43
 $book = Book::getBookByDataId($idData);
44
-$data = $book->getDataById ($idData);
44
+$data = $book->getDataById($idData);
45 45
 
46
-if (filesize ($data->getLocalPath ()) > 10 * 1024 * 1024) {
46
+if (filesize($data->getLocalPath()) > 10 * 1024 * 1024) {
47 47
     echo 'Attachment too big';
48 48
     exit;
49 49
 }
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
 $mail->From = $config['cops_mail_configuration']["address.from"];
66 66
 $mail->FromName = $config['cops_title_default'];
67 67
 
68
-foreach (explode (";", $emailDest) as $emailAddress) {
68
+foreach (explode(";", $emailDest) as $emailAddress) {
69 69
     if (empty ($emailAddress)) { continue; }
70 70
     $mail->AddAddress($emailAddress);
71 71
 }
72 72
 
73
-$mail->AddAttachment($data->getLocalPath ());
73
+$mail->AddAttachment($data->getLocalPath());
74 74
 
75 75
 $mail->IsHTML(true);
76
-$mail->Subject = 'Sent by COPS : ' . $data->getUpdatedFilename ();
77
-$mail->Body    = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName () . "</h2>" . $book->getComment ();
76
+$mail->Subject = 'Sent by COPS : ' . $data->getUpdatedFilename();
77
+$mail->Body    = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName() . "</h2>" . $book->getComment();
78 78
 $mail->AltBody = "Sent by COPS";
79 79
 
80 80
 if (!$mail->Send()) {
81
-   echo localize ("mail.messagenotsent");
81
+   echo localize("mail.messagenotsent");
82 82
    echo 'Mailer Error: ' . $mail->ErrorInfo;
83 83
    exit;
84 84
 }
85 85
 
86
-echo localize ("mail.messagesent");
86
+echo localize("mail.messagesent");
87 87
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 require_once ("config.php");
4 4
 
5
-function checkConfiguration () {
5
+function checkConfiguration ()
6
+{
6 7
     global $config;
7 8
 
8 9
     if (is_null ($config['cops_mail_configuration']) ||
@@ -14,7 +15,8 @@  discard block
 block discarded – undo
14 15
     return False;
15 16
 }
16 17
 
17
-function checkRequest ($idData, $emailDest) {
18
+function checkRequest ($idData, $emailDest)
19
+{
18 20
     if (empty ($idData)) {
19 21
         return 'No data sent.';
20 22
     }
@@ -58,9 +60,15 @@  discard block
 block discarded – undo
58 60
     $mail->Port = 465;
59 61
 }
60 62
 $mail->SMTPAuth = !empty ($config['cops_mail_configuration']["smtp.username"]);
61
-if (!empty ($config['cops_mail_configuration']["smtp.username"])) $mail->Username = $config['cops_mail_configuration']["smtp.username"];
62
-if (!empty ($config['cops_mail_configuration']["smtp.password"])) $mail->Password = $config['cops_mail_configuration']["smtp.password"];
63
-if (!empty ($config['cops_mail_configuration']["smtp.secure"])) $mail->SMTPSecure = $config['cops_mail_configuration']["smtp.secure"];
63
+if (!empty ($config['cops_mail_configuration']["smtp.username"])) {
64
+    $mail->Username = $config['cops_mail_configuration']["smtp.username"];
65
+}
66
+if (!empty ($config['cops_mail_configuration']["smtp.password"])) {
67
+    $mail->Password = $config['cops_mail_configuration']["smtp.password"];
68
+}
69
+if (!empty ($config['cops_mail_configuration']["smtp.secure"])) {
70
+    $mail->SMTPSecure = $config['cops_mail_configuration']["smtp.secure"];
71
+}
64 72
 
65 73
 $mail->From = $config['cops_mail_configuration']["address.from"];
66 74
 $mail->FromName = $config['cops_title_default'];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
         empty ($config['cops_mail_configuration']["address.from"])) {
12 12
         return "NOK. bad configuration.";
13 13
     }
14
-    return False;
14
+    return false;
15 15
 }
16 16
 
17 17
 function checkRequest ($idData, $emailDest) {
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     if (empty ($emailDest)) {
22 22
         return 'No email sent.';
23 23
     }
24
-    return False;
24
+    return false;
25 25
 }
26 26
 
27 27
 if (php_sapi_name() === 'cli') { return; }
Please login to merge, or discard this patch.
epubfs.php 3 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,70 +9,70 @@
 block discarded – undo
9 9
 require_once ("config.php");
10 10
 require_once ("base.php");
11 11
 
12
-function getComponentContent ($book, $component, $add) {
13
-    $data = $book->component ($component);
12
+function getComponentContent($book, $component, $add) {
13
+    $data = $book->component($component);
14 14
 
15
-    $callback = function ($m) use ($book, $component, $add) {
15
+    $callback = function($m) use ($book, $component, $add) {
16 16
         $method = $m[1];
17 17
         $path = $m[2];
18 18
         $end = "";
19
-        if (preg_match ("/^src\s*:/", $method)) {
19
+        if (preg_match("/^src\s*:/", $method)) {
20 20
             $end = ")";
21 21
         }
22
-        if (preg_match ("/^#/", $path)) {
22
+        if (preg_match("/^#/", $path)) {
23 23
             return "{$method}'{$path}'{$end}";
24 24
         }
25 25
         $hash = "";
26
-        if (preg_match ("/^(.+)#(.+)$/", $path, $matches)) {
26
+        if (preg_match("/^(.+)#(.+)$/", $path, $matches)) {
27 27
             $path = $matches [1];
28 28
             $hash = "#" . $matches [2];
29 29
         }
30
-        $comp = $book->getComponentName ($component, $path);
30
+        $comp = $book->getComponentName($component, $path);
31 31
         if (!$comp) return "{$method}'#'{$end}";
32 32
         $out = "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}";
33 33
         if ($end) {
34 34
             return $out;
35 35
         }
36
-        return str_replace ("&", "&amp;", $out);
36
+        return str_replace("&", "&amp;", $out);
37 37
     };
38 38
 
39
-    $data = preg_replace_callback ("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
40
-    $data = preg_replace_callback ("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
41
-    $data = preg_replace_callback ("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
42
-    $data = preg_replace_callback ("/(src\s*:\s*url\()(.*?)\)/", $callback, $data);
39
+    $data = preg_replace_callback("/(src=)[\"']([^:]*?)[\"']/", $callback, $data);
40
+    $data = preg_replace_callback("/(href=)[\"']([^:]*?)[\"']/", $callback, $data);
41
+    $data = preg_replace_callback("/(\@import\s+)[\"'](.*?)[\"'];/", $callback, $data);
42
+    $data = preg_replace_callback("/(src\s*:\s*url\()(.*?)\)/", $callback, $data);
43 43
 
44 44
     return $data;
45 45
 }
46 46
 
47 47
 if (php_sapi_name() === 'cli') { return; }
48 48
 
49
-$idData = getURLParam ("data", NULL);
49
+$idData = getURLParam("data", NULL);
50 50
 $add = "data=$idData&";
51
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
51
+if (!is_null(GetUrlParam(DB))) $add .= DB . "=" . GetUrlParam(DB) . "&";
52 52
 $myBook = Book::getBookByDataId($idData);
53 53
 
54
-$book = new EPub ($myBook->getFilePath ("EPUB", $idData));
54
+$book = new EPub($myBook->getFilePath("EPUB", $idData));
55 55
 
56
-$book->initSpineComponent ();
56
+$book->initSpineComponent();
57 57
 
58 58
 if (!isset ($_GET["comp"])) {
59
-    notFound ();
59
+    notFound();
60 60
     return;
61 61
 }
62 62
 
63 63
 $component = $_GET["comp"];
64 64
 
65 65
 try {
66
-    $data = getComponentContent ($book, $component, $add);
66
+    $data = getComponentContent($book, $component, $add);
67 67
 
68
-    $expires = 60*60*24*14;
68
+    $expires = 60 * 60 * 24 * 14;
69 69
     header("Pragma: public");
70
-    header("Cache-Control: maxage=".$expires);
71
-    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
72
-    header ("Content-Type: " . $book->componentContentType($component));
70
+    header("Cache-Control: maxage=" . $expires);
71
+    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
72
+    header("Content-Type: " . $book->componentContentType($component));
73 73
     echo $data;
74 74
 }
75 75
 catch (Exception $e) {
76
-    error_log ($e);
77
-    notFound ();
76
+    error_log($e);
77
+    notFound();
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,8 @@  discard block
 block discarded – undo
9 9
 require_once ("config.php");
10 10
 require_once ("base.php");
11 11
 
12
-function getComponentContent ($book, $component, $add) {
12
+function getComponentContent ($book, $component, $add)
13
+{
13 14
     $data = $book->component ($component);
14 15
 
15 16
     $callback = function ($m) use ($book, $component, $add) {
@@ -28,7 +29,9 @@  discard block
 block discarded – undo
28 29
             $hash = "#" . $matches [2];
29 30
         }
30 31
         $comp = $book->getComponentName ($component, $path);
31
-        if (!$comp) return "{$method}'#'{$end}";
32
+        if (!$comp) {
33
+            return "{$method}'#'{$end}";
34
+        }
32 35
         $out = "{$method}'epubfs.php?{$add}comp={$comp}{$hash}'{$end}";
33 36
         if ($end) {
34 37
             return $out;
@@ -48,7 +51,9 @@  discard block
 block discarded – undo
48 51
 
49 52
 $idData = getURLParam ("data", NULL);
50 53
 $add = "data=$idData&";
51
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
54
+if (!is_null (GetUrlParam (DB))) {
55
+    $add .= DB . "=" . GetUrlParam (DB) . "&";
56
+}
52 57
 $myBook = Book::getBookByDataId($idData);
53 58
 
54 59
 $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
@@ -71,8 +76,7 @@  discard block
 block discarded – undo
71 76
     header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
72 77
     header ("Content-Type: " . $book->componentContentType($component));
73 78
     echo $data;
74
-}
75
-catch (Exception $e) {
79
+} catch (Exception $e) {
76 80
     error_log ($e);
77 81
     notFound ();
78 82
 }
79 83
\ No newline at end of file
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 header ("Content-Type: text/html;charset=utf-8");
15 15
 
16
-$idData = getURLParam ("data", NULL);
16
+$idData = getURLParam ("data", null);
17 17
 $add = "data=$idData&";
18 18
 if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
19 19
 $myBook = Book::getBookByDataId($idData);
Please login to merge, or discard this patch.
epubreader.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 require_once ("config.php");
12 12
 require_once ("base.php");
13 13
 
14
-header ("Content-Type: text/html;charset=utf-8");
14
+header("Content-Type: text/html;charset=utf-8");
15 15
 
16
-$idData = getURLParam ("data", NULL);
16
+$idData = getURLParam("data", NULL);
17 17
 $add = "data=$idData&";
18
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
18
+if (!is_null(GetUrlParam(DB))) $add .= DB . "=" . GetUrlParam(DB) . "&";
19 19
 $myBook = Book::getBookByDataId($idData);
20 20
 
21
-$book = new EPub ($myBook->getFilePath ("EPUB", $idData));
22
-$book->initSpineComponent ();
21
+$book = new EPub($myBook->getFilePath("EPUB", $idData));
22
+$book->initSpineComponent();
23 23
 
24 24
 ?>
25 25
 <head>
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
         Monocle.DEBUG = true;
36 36
         var bookData = {
37 37
           getComponents: function () {
38
-            <?php echo "return [" . implode (", ", array_map (function ($comp) { return "'" . $comp . "'"; }, $book->components ())) . "];"; ?>
38
+            <?php echo "return [" . implode(", ", array_map(function($comp) { return "'" . $comp . "'"; }, $book->components())) . "];"; ?>
39 39
           },
40 40
           getContents: function () {
41
-            <?php echo "return [" . implode (", ", array_map (function ($content) { return "{title: '" . addslashes($content["title"]) . "', src: '". $content["src"] . "'}"; }, $book->contents ())) . "];"; ?>
41
+            <?php echo "return [" . implode(", ", array_map(function($content) { return "{title: '" . addslashes($content["title"]) . "', src: '" . $content["src"] . "'}"; }, $book->contents())) . "];"; ?>
42 42
           },
43 43
           getComponent: function (componentId) {
44 44
             return { url: "epubfs.php?<?php echo $add ?>comp="  + componentId };
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@
 block discarded – undo
15 15
 
16 16
 $idData = getURLParam ("data", NULL);
17 17
 $add = "data=$idData&";
18
-if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
18
+if (!is_null (GetUrlParam (DB))) {
19
+    $add .= DB . "=" . GetUrlParam (DB) . "&";
20
+}
19 21
 $myBook = Book::getBookByDataId($idData);
20 22
 
21 23
 $book = new EPub ($myBook->getFilePath ("EPUB", $idData));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 header ("Content-Type: text/html;charset=utf-8");
15 15
 
16
-$idData = getURLParam ("data", NULL);
16
+$idData = getURLParam ("data", null);
17 17
 $add = "data=$idData&";
18 18
 if (!is_null (GetUrlParam (DB))) $add .= DB . "=" . GetUrlParam (DB) . "&";
19 19
 $myBook = Book::getBookByDataId($idData);
Please login to merge, or discard this patch.
feed.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
     require_once ("config.php");
11 11
     require_once ("base.php");
12 12
 
13
-    header ("Content-Type:application/xml");
14
-    $page = getURLParam ("page", Base::PAGE_INDEX);
15
-    $query = getURLParam ("query");
16
-    $n = getURLParam ("n", "1");
13
+    header("Content-Type:application/xml");
14
+    $page = getURLParam("page", Base::PAGE_INDEX);
15
+    $query = getURLParam("query");
16
+    $n = getURLParam("n", "1");
17 17
     if ($query)
18 18
         $page = Base::PAGE_OPENSEARCH_QUERY;
19
-    $qid = getURLParam ("id");
19
+    $qid = getURLParam("id");
20 20
 
21 21
     if ($config ['cops_fetch_protect'] == "1") {
22 22
         session_start();
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
         }
26 26
     }
27 27
 
28
-    $OPDSRender = new OPDSRenderer ();
28
+    $OPDSRender = new OPDSRenderer();
29 29
 
30 30
     switch ($page) {
31 31
         case Base::PAGE_OPENSEARCH :
32
-            echo $OPDSRender->getOpenSearch ();
32
+            echo $OPDSRender->getOpenSearch();
33 33
             return;
34 34
         default:
35
-            $currentPage = Page::getPage ($page, $qid, $query, $n);
36
-            $currentPage->InitializeContent ();
37
-            echo $OPDSRender->render ($currentPage);
35
+            $currentPage = Page::getPage($page, $qid, $query, $n);
36
+            $currentPage->InitializeContent();
37
+            echo $OPDSRender->render($currentPage);
38 38
             return;
39 39
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
     $page = getURLParam ("page", Base::PAGE_INDEX);
15 15
     $query = getURLParam ("query");
16 16
     $n = getURLParam ("n", "1");
17
-    if ($query)
18
-        $page = Base::PAGE_OPENSEARCH_QUERY;
17
+    if ($query) {
18
+            $page = Base::PAGE_OPENSEARCH_QUERY;
19
+    }
19 20
     $qid = getURLParam ("id");
20 21
 
21 22
     if ($config ['cops_fetch_protect'] == "1") {
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@
 block discarded – undo
37 37
     header ("Content-Type:text/html;charset=utf-8");
38 38
 
39 39
     $data = array("title"                 => $config['cops_title_default'],
40
-                  "version"               => VERSION,
41
-                  "opds_url"              => $config['cops_full_url'] . "feed.php",
42
-                  "customHeader"          => "",
43
-                  "template"              => getCurrentTemplate (),
44
-                  "server_side_rendering" => useServerSideRendering (),
45
-                  "current_css"           => getCurrentCss (),
46
-                  "favico"                => $config['cops_icon'],
47
-                  "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
40
+                    "version"               => VERSION,
41
+                    "opds_url"              => $config['cops_full_url'] . "feed.php",
42
+                    "customHeader"          => "",
43
+                    "template"              => getCurrentTemplate (),
44
+                    "server_side_rendering" => useServerSideRendering (),
45
+                    "current_css"           => getCurrentCss (),
46
+                    "favico"                => $config['cops_icon'],
47
+                    "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
48 48
     if (preg_match("/Kindle/", $_SERVER['HTTP_USER_AGENT'])) {
49 49
         $data ["customHeader"] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>';
50 50
     }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
         exit ();
17 17
     }
18 18
 
19
-    $page = getURLParam ("page", Base::PAGE_INDEX);
20
-    $query = getURLParam ("query");
21
-    $qid = getURLParam ("id");
22
-    $n = getURLParam ("n", "1");
23
-    $database = GetUrlParam (DB);
19
+    $page = getURLParam("page", Base::PAGE_INDEX);
20
+    $query = getURLParam("query");
21
+    $qid = getURLParam("id");
22
+    $n = getURLParam("n", "1");
23
+    $database = GetUrlParam(DB);
24 24
 
25 25
 
26 26
     // Access the database ASAP to be sure it's readable, redirect if that's not the case.
27 27
     // It has to be done before any header is sent.
28
-    Base::checkDatabaseAvailability ();
28
+    Base::checkDatabaseAvailability();
29 29
 
30 30
     if ($config ['cops_fetch_protect'] == "1") {
31 31
         session_start();
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
         }
35 35
     }
36 36
 
37
-    header ("Content-Type:text/html;charset=utf-8");
37
+    header("Content-Type:text/html;charset=utf-8");
38 38
 
39 39
     $data = array("title"                 => $config['cops_title_default'],
40 40
                   "version"               => VERSION,
41 41
                   "opds_url"              => $config['cops_full_url'] . "feed.php",
42 42
                   "customHeader"          => "",
43
-                  "template"              => getCurrentTemplate (),
44
-                  "server_side_rendering" => useServerSideRendering (),
45
-                  "current_css"           => getCurrentCss (),
43
+                  "template"              => getCurrentTemplate(),
44
+                  "server_side_rendering" => useServerSideRendering(),
45
+                  "current_css"           => getCurrentCss(),
46 46
                   "favico"                => $config['cops_icon'],
47
-                  "getjson_url"           => "getJSON.php?" . addURLParameter (getQueryString (), "complete", 1));
47
+                  "getjson_url"           => "getJSON.php?" . addURLParameter(getQueryString(), "complete", 1));
48 48
     if (preg_match("/Kindle/", $_SERVER['HTTP_USER_AGENT'])) {
49 49
         $data ["customHeader"] = '<style media="screen" type="text/css"> html { font-size: 75%; -webkit-text-size-adjust: 75%; -ms-text-size-adjust: 75%; }</style>';
50 50
     }
51
-    $headcontent = file_get_contents('templates/' . getCurrentTemplate () . '/file.html');
52
-    $template = new doT ();
53
-    $dot = $template->template ($headcontent, NULL);
54
-    echo ($dot ($data));
51
+    $headcontent = file_get_contents('templates/' . getCurrentTemplate() . '/file.html');
52
+    $template = new doT();
53
+    $dot = $template->template($headcontent, NULL);
54
+    echo ($dot($data));
55 55
 ?><body>
56 56
 <?php
57
-if (useServerSideRendering ()) {
57
+if (useServerSideRendering()) {
58 58
     // Get the data
59 59
     require_once ("JSON_renderer.php");
60
-    $data = JSONRenderer::getJson (true);
60
+    $data = JSONRenderer::getJson(true);
61 61
 
62
-    echo serverSideRender ($data);
62
+    echo serverSideRender($data);
63 63
 }
64 64
 ?>
65 65
 </body>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     }
51 51
     $headcontent = file_get_contents('templates/' . getCurrentTemplate () . '/file.html');
52 52
     $template = new doT ();
53
-    $dot = $template->template ($headcontent, NULL);
53
+    $dot = $template->template ($headcontent, null);
54 54
     echo ($dot ($data));
55 55
 ?><body>
56 56
 <?php
Please login to merge, or discard this patch.
getJSON.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
9 9
 
10 10
     require_once ("config.php");
11 11
 
12
-    header ("Content-Type:application/json;charset=utf-8");
12
+    header("Content-Type:application/json;charset=utf-8");
13 13
 
14 14
 
15
-    echo json_encode (JSONRenderer::getJson ());
15
+    echo json_encode(JSONRenderer::getJson());
16 16
 
Please login to merge, or discard this patch.
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.