@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | require_once dirname(__FILE__) . '/config.php'; |
4 | 4 | require_once dirname(__FILE__) . '/base.php'; |
5 | 5 | |
6 | -function checkConfiguration () { |
|
6 | +function checkConfiguration() { |
|
7 | 7 | global $config; |
8 | 8 | |
9 | - if (is_null ($config['cops_mail_configuration']) || |
|
10 | - !is_array ($config['cops_mail_configuration']) || |
|
9 | + if (is_null($config['cops_mail_configuration']) || |
|
10 | + !is_array($config['cops_mail_configuration']) || |
|
11 | 11 | empty ($config['cops_mail_configuration']["smtp.host"]) || |
12 | 12 | empty ($config['cops_mail_configuration']["address.from"])) { |
13 | 13 | return "NOK. bad configuration."; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | return False; |
16 | 16 | } |
17 | 17 | |
18 | -function checkRequest ($idData, $emailDest) { |
|
18 | +function checkRequest($idData, $emailDest) { |
|
19 | 19 | if (empty ($idData)) { |
20 | 20 | return 'No data sent.'; |
21 | 21 | } |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | |
30 | 30 | global $config; |
31 | 31 | |
32 | -if ($error = checkConfiguration ()) { |
|
32 | +if ($error = checkConfiguration()) { |
|
33 | 33 | echo $error; |
34 | 34 | exit; |
35 | 35 | } |
36 | 36 | |
37 | 37 | $idData = $_REQUEST["data"]; |
38 | 38 | $emailDest = $_REQUEST["email"]; |
39 | -if ($error = checkRequest ($idData, $emailDest)) { |
|
39 | +if ($error = checkRequest($idData, $emailDest)) { |
|
40 | 40 | echo $error; |
41 | 41 | exit; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $book = Book::getBookByDataId($idData); |
45 | -$data = $book->getDataById ($idData); |
|
45 | +$data = $book->getDataById($idData); |
|
46 | 46 | |
47 | -if (filesize ($data->getLocalPath ()) > 10 * 1024 * 1024) { |
|
47 | +if (filesize($data->getLocalPath()) > 10 * 1024 * 1024) { |
|
48 | 48 | echo 'Attachment too big'; |
49 | 49 | exit; |
50 | 50 | } |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $mail->From = $config['cops_mail_configuration']["address.from"]; |
67 | 67 | $mail->FromName = $config['cops_title_default']; |
68 | 68 | |
69 | -foreach (explode (";", $emailDest) as $emailAddress) { |
|
69 | +foreach (explode(";", $emailDest) as $emailAddress) { |
|
70 | 70 | if (empty ($emailAddress)) { continue; } |
71 | 71 | $mail->AddAddress($emailAddress); |
72 | 72 | } |
73 | 73 | |
74 | -$mail->AddAttachment($data->getLocalPath ()); |
|
74 | +$mail->AddAttachment($data->getLocalPath()); |
|
75 | 75 | |
76 | 76 | $mail->IsHTML(true); |
77 | 77 | $mail->CharSet = "UTF-8"; |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | if (!empty ($config['cops_mail_configuration']["subject"])) { |
80 | 80 | $mail->Subject = $config['cops_mail_configuration']["subject"]; |
81 | 81 | } |
82 | -$mail->Subject .= $data->getUpdatedFilename (); |
|
83 | -$mail->Body = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName () . "</h2>" . $book->getComment (); |
|
82 | +$mail->Subject .= $data->getUpdatedFilename(); |
|
83 | +$mail->Body = "<h1>" . $book->title . "</h1><h2>" . $book->getAuthorsName() . "</h2>" . $book->getComment(); |
|
84 | 84 | $mail->AltBody = "Sent by COPS"; |
85 | 85 | |
86 | 86 | if (!$mail->Send()) { |
87 | - echo localize ("mail.messagenotsent"); |
|
87 | + echo localize("mail.messagenotsent"); |
|
88 | 88 | echo 'Mailer Error: ' . $mail->ErrorInfo; |
89 | 89 | exit; |
90 | 90 | } |
91 | 91 | |
92 | -echo localize ("mail.messagesent"); |
|
92 | +echo localize("mail.messagesent"); |
|
93 | 93 |