jekyll-theme-consulting 0.10.0 → 0.10.5
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/{_includes/contact_server_script.php → _layouts/contact.html} +35 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cde8f473a218c3cdae16d8de6a9463bd447f8bbee274a64d4d303184e2db9e5f
|
4
|
+
data.tar.gz: ecb4e5237a23ccdbb48c36bb438a0db885802bd148db2dd33fe4d5ab53f64f8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 695bcbe2c8a7e2b0817ce6d4bd3eddfd822ec4ac38cd9e50dff562ddfd09c0f92f561a1fc5cdaba0fdd6b5f0b4281f862d2b7e8331c3b6f37478016f4353644e
|
7
|
+
data.tar.gz: 33bfd5fde84d1318ebd6af9f0cb5e43801a030f396327bd2651eec613885a9841b27f8e3803e960bfdff53ed32d84529cbb425a95b9d7a7ce8e89a19f7340163
|
@@ -1,26 +1,38 @@
|
|
1
|
+
---
|
2
|
+
permalink: /contact.php
|
3
|
+
mail:
|
4
|
+
subject:
|
5
|
+
intro:
|
6
|
+
---
|
7
|
+
{%- capture mail-intro -%}You received a message on <a href="{{ site.url }}">your website</a>.{%- endcapture -%}
|
1
8
|
<?php
|
2
9
|
|
3
|
-
$
|
10
|
+
$contact_name = $contact_email = $contact_message = $token = $contact_ip = "";
|
4
11
|
|
5
12
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
6
13
|
if (has_required_data($_POST)) {
|
7
|
-
$
|
14
|
+
$contact_name = filter_var(
|
8
15
|
$_POST["name"],
|
9
16
|
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
10
|
-
$
|
17
|
+
$contact_email = filter_var(
|
11
18
|
$_POST["email"],
|
12
19
|
FILTER_SANITIZE_EMAIL);
|
13
|
-
$
|
20
|
+
$contact_message = filter_var(
|
14
21
|
$_POST["message"],
|
15
22
|
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
16
23
|
$token = filter_var(
|
17
24
|
$_POST["token"],
|
18
25
|
FILTER_SANITIZE_URL);
|
26
|
+
if (filter_var(
|
27
|
+
$_SERVER['REMOTE_ADDR'],
|
28
|
+
FILTER_VALIDATE_IP)) {
|
29
|
+
$contact_ip = $_SERVER['REMOTE_ADDR'];
|
30
|
+
}
|
19
31
|
|
20
|
-
if is_recaptcha_valid($token) {
|
21
|
-
send_mail($
|
32
|
+
if (is_recaptcha_valid($token)) {
|
33
|
+
send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
|
22
34
|
} else {
|
23
|
-
send_mail($
|
35
|
+
send_mail($contact_name, $contact_email, "Tried to contact you, but his recaptcha is not valid.", $contact_ip);
|
24
36
|
}
|
25
37
|
}
|
26
38
|
}
|
@@ -36,8 +48,7 @@ function has_required_data($request) {
|
|
36
48
|
!empty($request['name'])
|
37
49
|
&& !empty($request['email'])
|
38
50
|
&& !empty($request['message'])
|
39
|
-
&& !empty($request['token']))
|
40
|
-
);
|
51
|
+
&& !empty($request['token'])));
|
41
52
|
}
|
42
53
|
|
43
54
|
function is_recaptcha_valid($token) {
|
@@ -47,9 +58,7 @@ function is_recaptcha_valid($token) {
|
|
47
58
|
'http' => array(
|
48
59
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
49
60
|
'method' => 'POST',
|
50
|
-
'content' => http_build_query($data)
|
51
|
-
)
|
52
|
-
);
|
61
|
+
'content' => http_build_query($data)));
|
53
62
|
$context = stream_context_create($options);
|
54
63
|
$result = json_decode(file_get_contents($validation_url, false, $context));
|
55
64
|
|
@@ -59,12 +68,22 @@ function is_recaptcha_valid($token) {
|
|
59
68
|
&& $result->success);
|
60
69
|
}
|
61
70
|
|
62
|
-
function send_mail ($name, $email, $message) {
|
71
|
+
function send_mail ($name, $email, $message, $ip) {
|
63
72
|
return mail(
|
64
73
|
"{{ site.email }}",
|
65
|
-
"{{
|
66
|
-
|
67
|
-
"
|
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"));
|
68
86
|
}
|
69
87
|
|
70
88
|
?>
|
89
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-consulting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moodule
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- _includes/contact.html
|
80
80
|
- _includes/contact_client_script.html
|
81
81
|
- _includes/contact_form.html
|
82
|
-
- _includes/contact_server_script.php
|
83
82
|
- _includes/date.html
|
84
83
|
- _includes/fact.html
|
85
84
|
- _includes/feature.html
|
@@ -99,6 +98,7 @@ files:
|
|
99
98
|
- _includes/toggle.html
|
100
99
|
- _includes/waves/bottom.html
|
101
100
|
- _includes/waves/top.html
|
101
|
+
- _layouts/contact.html
|
102
102
|
- _layouts/default.html
|
103
103
|
- _layouts/home.html
|
104
104
|
- _layouts/index.html
|