jekyll-theme-consulting 0.10.3 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_layouts/contact.html +26 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0267749ef77dd82f236dd948e2aa7414eeda519ca5c13f54546e06d9933681be'
|
4
|
+
data.tar.gz: b84c63d4fef729187874985609a8866131caa3d927fdfdb97677c68f2f5c965c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 376739a8d52226d30c647ffe07b3343fb813047493a37c7150ac8c20e5212bcc99282820dc97b01ce701545af31c59e587bb9feca106e76f167219af08f3fd56
|
7
|
+
data.tar.gz: 1afd669eb76697a58b947c15a69b2e433600cd1fa088337850fd6cbddac90f841f5bdcfe54bd71c7e4e9673142cd469f2d84ce14aec4e9041fb04883979055de
|
data/_layouts/contact.html
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
---
|
2
2
|
permalink: /contact.php
|
3
|
-
|
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
|
-
$
|
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
|
-
$
|
14
|
+
$contact_name = filter_var(
|
12
15
|
$_POST["name"],
|
13
16
|
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
14
|
-
$
|
17
|
+
$contact_email = filter_var(
|
15
18
|
$_POST["email"],
|
16
19
|
FILTER_SANITIZE_EMAIL);
|
17
|
-
$
|
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
|
-
$
|
29
|
+
$contact_ip = $_SERVER['REMOTE_ADDR'];
|
27
30
|
}
|
28
31
|
|
29
32
|
if (is_recaptcha_valid($token)) {
|
30
|
-
send_mail($
|
33
|
+
send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
|
31
34
|
} else {
|
32
|
-
send_mail($
|
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
|
-
|
76
|
-
|
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
|
?>
|