| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function __invoke(array $post) { |
||
| 12 | |||
| 13 | # Declare variables |
||
| 14 | |||
| 15 | $name = ''; $email = ''; $message = ''; $captcha = ''; |
||
| 16 | |||
| 17 | # Extract post array |
||
| 18 | |||
| 19 | extract($post); |
||
| 20 | |||
| 21 | # Validate values |
||
| 22 | |||
| 23 | if (false === ($email = Validate::userEmail($email))) return ['email', 'CONTACT_ERROR_EMAIL_INVALID']; |
||
| 24 | |||
| 25 | if (false === Security::checkCaptcha($captcha)) return ['captcha', 'CONTACT_ERROR_CAPTCHA_INCORRECT']; |
||
| 26 | |||
| 27 | # Send mail |
||
| 28 | |||
| 29 | $to = Settings::get('system_email'); $subject = (Settings::get('site_title') . ' | Contact form message'); |
||
| 30 | |||
| 31 | if (!Mailer::send($to, $name, $email, $email, $subject, $message)) return 'CONTACT_ERROR_SEND'; |
||
| 32 | |||
| 33 | # ------------------------ |
||
| 34 | |||
| 35 | return true; |
||
| 36 | } |
||
| 37 | } |
||
| 39 |