jekyll-theme-consulting 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/contact.html +26 -17
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf4b346828d9745cd0d92091c845db875f04036618372d32d58c29e025422ad9
4
- data.tar.gz: 411b6948e3a4c218b4a579dd8c8376722ebf51a330fdbb2add99a2947001c54d
3
+ metadata.gz: '0267749ef77dd82f236dd948e2aa7414eeda519ca5c13f54546e06d9933681be'
4
+ data.tar.gz: b84c63d4fef729187874985609a8866131caa3d927fdfdb97677c68f2f5c965c
5
5
  SHA512:
6
- metadata.gz: a475fcc6994e78e1fd36047ffa70c4640ca5f8f179f0520ffa441ef7a21fcb037f88574517788bacd3f1a52aa1f35055a81aa86dc3fb43ba475a42fe9250c293
7
- data.tar.gz: e702de5b269e20bd6d0150c3df6e449aba94a3a328b68af822bf0278e5e3e6b85436d819a76977e195c011a68fd75f37ec62dce32acb90be8466967d1c070e7d
6
+ metadata.gz: 376739a8d52226d30c647ffe07b3343fb813047493a37c7150ac8c20e5212bcc99282820dc97b01ce701545af31c59e587bb9feca106e76f167219af08f3fd56
7
+ data.tar.gz: 1afd669eb76697a58b947c15a69b2e433600cd1fa088337850fd6cbddac90f841f5bdcfe54bd71c7e4e9673142cd469f2d84ce14aec4e9041fb04883979055de
@@ -1,20 +1,23 @@
1
1
  ---
2
2
  permalink: /contact.php
3
- subject: Contact request
3
+ mail:
4
+ subject:
5
+ intro:
4
6
  ---
7
+ {%- capture mail-intro -%}You received a message on <a href="{{ site.url }}">your website</a>.{%- endcapture -%}
5
8
  <?php
6
9
 
7
- $name = $email = $message = $token = $ip = "";
10
+ $contact_name = $contact_email = $contact_message = $token = $contact_ip = "";
8
11
 
9
12
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
10
13
  if (has_required_data($_POST)) {
11
- $name = filter_var(
14
+ $contact_name = filter_var(
12
15
  $_POST["name"],
13
16
  FILTER_SANITIZE_FULL_SPECIAL_CHARS);
14
- $email = filter_var(
17
+ $contact_email = filter_var(
15
18
  $_POST["email"],
16
19
  FILTER_SANITIZE_EMAIL);
17
- $message = filter_var(
20
+ $contact_message = filter_var(
18
21
  $_POST["message"],
19
22
  FILTER_SANITIZE_FULL_SPECIAL_CHARS);
20
23
  $token = filter_var(
@@ -23,13 +26,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
23
26
  if (filter_var(
24
27
  $_SERVER['REMOTE_ADDR'],
25
28
  FILTER_VALIDATE_IP)) {
26
- $ip = $_SERVER['REMOTE_ADDR'];
29
+ $contact_ip = $_SERVER['REMOTE_ADDR'];
27
30
  }
28
31
 
29
32
  if (is_recaptcha_valid($token)) {
30
- send_mail($name, $email, $message);
33
+ send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
31
34
  } else {
32
- send_mail($name, $email, "Got a fishy request from ".$ip);
35
+ send_mail($contact_name, $contact_email, "Tried to contact you, but his recaptcha is not valid.", $contact_ip);
33
36
  }
34
37
  }
35
38
  }
@@ -45,8 +48,7 @@ function has_required_data($request) {
45
48
  !empty($request['name'])
46
49
  && !empty($request['email'])
47
50
  && !empty($request['message'])
48
- && !empty($request['token']))
49
- );
51
+ && !empty($request['token'])));
50
52
  }
51
53
 
52
54
  function is_recaptcha_valid($token) {
@@ -56,9 +58,7 @@ function is_recaptcha_valid($token) {
56
58
  'http' => array(
57
59
  'header' => "Content-type: application/x-www-form-urlencoded\r\n",
58
60
  'method' => 'POST',
59
- 'content' => http_build_query($data)
60
- )
61
- );
61
+ 'content' => http_build_query($data)));
62
62
  $context = stream_context_create($options);
63
63
  $result = json_decode(file_get_contents($validation_url, false, $context));
64
64
 
@@ -68,12 +68,21 @@ function is_recaptcha_valid($token) {
68
68
  && $result->success);
69
69
  }
70
70
 
71
- function send_mail ($name, $email, $message) {
71
+ function send_mail ($name, $email, $message, $ip) {
72
72
  return mail(
73
73
  "{{ site.email }}",
74
- "{{ page.subject | default: 'Contact request' }}",
75
- $message."\r\n\nFrom: ".$name." @ ".$ip,
76
- "From: ".$name." <".$email.">\r\nMIME-Version: 1.0\r\nContent-type: text/html\r\n");
74
+ "{{ page.mail.subject | default: 'Contact request' }}",
75
+ (
76
+ "{{ page.mail.intro | default: mail-intro }}<br>\r\n"
77
+ ."Ip: ".$ip."<br>\r\n"
78
+ ."Name: ".$name."<br>\r\n"
79
+ ."Email: ".$email."<br>\r\n"
80
+ ."Message: ".$message."<br>\r\n"),
81
+ (
82
+ "From: ".$name
83
+ ." <".$email.">\r\n"
84
+ ."MIME-Version: 1.0\r\n"
85
+ ."Content-type: text/html\r\n"));
77
86
  }
78
87
 
79
88
  ?>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-consulting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moodule