@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if ($post = $result->fetchObject()) { |
58 | 58 | return new CustomColumn($id, $post->name, $this); |
59 | 59 | } |
60 | - return NULL; |
|
60 | + return null; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | protected function getAllCustomValuesFromDatabase() |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($post = $result->fetchObject()) { |
93 | 93 | return new CustomColumn($post->id, $post->name . " [" . $post->extra . "]", $this); |
94 | 94 | } |
95 | - return new CustomColumn(NULL, "", $this); |
|
95 | + return new CustomColumn(null, "", $this); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function isSearchable() |
@@ -78,9 +78,9 @@ |
||
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"); |
@@ -2,11 +2,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -2,7 +2,8 @@ discard block |
||
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 |
||
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 |
||
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']; |
@@ -11,7 +11,7 @@ discard block |
||
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 |
||
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; } |
@@ -72,11 +72,11 @@ |
||
72 | 72 | try { |
73 | 73 | $data = getComponentContent($book, $component, $add); |
74 | 74 | |
75 | - $expires = 60*60*24*14; |
|
75 | + $expires = 60 * 60 * 24 * 14; |
|
76 | 76 | header('Pragma: public'); |
77 | - header('Cache-Control: maxage='.$expires); |
|
78 | - header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); |
|
79 | - header ('Content-Type: ' . $book->componentContentType($component)); |
|
77 | + header('Cache-Control: maxage=' . $expires); |
|
78 | + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT'); |
|
79 | + header('Content-Type: ' . $book->componentContentType($component)); |
|
80 | 80 | echo $data; |
81 | 81 | } catch (Exception $e) { |
82 | 82 | error_log($e); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | -$idData = getURLParam('data', NULL); |
|
54 | +$idData = getURLParam('data', null); |
|
55 | 55 | $add = 'data=' . $idData . '&'; |
56 | 56 | if (!is_null(GetUrlParam(DB))) { |
57 | 57 | $add .= DB . '=' . GetUrlParam(DB) . '&'; |
@@ -12,20 +12,20 @@ |
||
12 | 12 | require_once dirname(__FILE__) . '/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 dirname(__FILE__) . '/' . $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"'); |
@@ -21,13 +21,11 @@ |
||
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'; |
@@ -237,8 +237,7 @@ |
||
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 | } |
@@ -16,7 +16,7 @@ |
||
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'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | <meta charset="utf-8"> |
27 | 27 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
28 | 28 | <title>COPS Configuration Check</title> |
29 | - <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss ()) ?>" media="screen" /> |
|
29 | + <link rel="stylesheet" type="text/css" href="<?php echo getUrlWithVersion(getCurrentCss()) ?>" media="screen" /> |
|
30 | 30 | </head> |
31 | 31 | <body> |
32 | 32 | <div class="container"> |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | <h2>Check if the rendering will be done on client side or server side</h2> |
152 | 152 | <h4> |
153 | 153 | <?php |
154 | - if (useServerSideRendering ()) { |
|
154 | + if (useServerSideRendering()) { |
|
155 | 155 | echo 'Server side rendering'; |
156 | 156 | } else { |
157 | 157 | echo 'Client side rendering'; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | <h2>Check if Calibre database path is not an URL</h2> |
168 | 168 | <h4> |
169 | 169 | <?php |
170 | - if (!preg_match ('#^http#', $database)) { |
|
170 | + if (!preg_match('#^http#', $database)) { |
|
171 | 171 | echo $name . ' OK'; |
172 | 172 | } else { |
173 | 173 | echo $name . 'Calibre path has to be local (no URL allowed)'; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | <h4> |
201 | 201 | <?php |
202 | 202 | try { |
203 | - $db = new PDO('sqlite:'. Base::getDbFileName($i)); |
|
203 | + $db = new PDO('sqlite:' . Base::getDbFileName($i)); |
|
204 | 204 | echo $name . ' OK'; |
205 | 205 | } catch (Exception $e) { |
206 | 206 | echo $name . ' If the file is readable, check your php configuration. Exception detail : ' . $e; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | <h4> |
214 | 214 | <?php |
215 | 215 | try { |
216 | - $db = new PDO('sqlite:'. Base::getDbFileName($i)); |
|
216 | + $db = new PDO('sqlite:' . Base::getDbFileName($i)); |
|
217 | 217 | $count = $db->query('select count(*) FROM sqlite_master WHERE type="table" AND name in ("books", "authors", "tags", "series")')->fetchColumn(); |
218 | 218 | if ($count == 4) { |
219 | 219 | echo $name . ' OK'; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $result->execute(); |
238 | 238 | while ($post = $result->fetchObject()) |
239 | 239 | { |
240 | - if (!is_file (Base::getDbDirectory($i) . $post->fullpath)) { |
|
240 | + if (!is_file(Base::getDbDirectory($i) . $post->fullpath)) { |
|
241 | 241 | echo '<p>' . Base::getDbDirectory($i) . $post->fullpath . '</p>'; |
242 | 242 | } |
243 | 243 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllLanguages extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("languages.title"); |
14 | 14 | $this->entryArray = Language::getAllLanguages(); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllLanguages extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("languages.title"); |
14 | 14 | $this->entryArray = Language::getAllLanguages(); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllLanguages extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("languages.title"); |
14 | 14 | $this->entryArray = Language::getAllLanguages(); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | class PageAllLanguages extends Page |
10 | 10 | { |
11 | - public function InitializeContent () |
|
11 | + public function InitializeContent() |
|
12 | 12 | { |
13 | 13 | $this->title = localize("languages.title"); |
14 | 14 | $this->entryArray = Language::getAllLanguages(); |