create-berna-stencil 1.0.7 → 1.0.9
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.
- package/.eleventy.js +3 -1
- package/_tools/res/templates.json +2 -2
- package/bin/create.js +1 -1
- package/package.json +5 -5
- package/src/.htaccess +18 -0
- package/src/api/.htaccess +12 -0
- package/src/api/composer.json +6 -0
- package/src/api/composer.lock +574 -0
- package/src/api/endpoints/protected/secret.php +16 -0
- package/src/api/endpoints/protected/send-mail.php +75 -0
- package/src/api/endpoints/public/ping.php +16 -0
- package/src/api/index.php +95 -0
- package/src/api/init.php +43 -0
- package/src/api/modules/Response.php +37 -0
- package/src/api/vendor/autoload.php +22 -0
- package/src/api/vendor/composer/ClassLoader.php +579 -0
- package/src/api/vendor/composer/InstalledVersions.php +396 -0
- package/src/api/vendor/composer/LICENSE +21 -0
- package/src/api/vendor/composer/autoload_classmap.php +15 -0
- package/src/api/vendor/composer/autoload_files.php +12 -0
- package/src/api/vendor/composer/autoload_namespaces.php +9 -0
- package/src/api/vendor/composer/autoload_psr4.php +16 -0
- package/src/api/vendor/composer/autoload_real.php +50 -0
- package/src/api/vendor/composer/autoload_static.php +86 -0
- package/src/api/vendor/composer/installed.json +582 -0
- package/src/api/vendor/composer/installed.php +86 -0
- package/src/api/vendor/composer/platform_check.php +25 -0
- package/src/data/site.json +53 -53
- package/src/js/pages/404.js +2 -2
- package/src/js/pages/anotherPage.js +2 -2
- package/src/js/pages/homepage.js +2 -2
- package/src/scss/pages/404.scss +1 -0
- package/src/api/configExample.php +0 -28
- package/src/api/sendEmail.php +0 -131
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
// platform_check.php @generated by Composer
|
|
4
|
+
|
|
5
|
+
$issues = array();
|
|
6
|
+
|
|
7
|
+
if (!(PHP_VERSION_ID >= 70205)) {
|
|
8
|
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if ($issues) {
|
|
12
|
+
if (!headers_sent()) {
|
|
13
|
+
header('HTTP/1.1 500 Internal Server Error');
|
|
14
|
+
}
|
|
15
|
+
if (!ini_get('display_errors')) {
|
|
16
|
+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
|
17
|
+
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
|
18
|
+
} elseif (!headers_sent()) {
|
|
19
|
+
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw new \RuntimeException(
|
|
23
|
+
'Composer detected issues in your platform: ' . implode(' ', $issues)
|
|
24
|
+
);
|
|
25
|
+
}
|
package/src/data/site.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"site_name": "Site name",
|
|
3
|
-
"title": "Site title",
|
|
4
|
-
"description": "Site description",
|
|
5
|
-
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
-
"domain": "yoursite.com",
|
|
7
|
-
"url": "https://yoursite.com",
|
|
8
|
-
"lang": "en",
|
|
9
|
-
"author": "Name and surname",
|
|
10
|
-
"data_bs_theme": "dark",
|
|
11
|
-
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
-
"logo": "/assets/brand/logo.svg",
|
|
13
|
-
"copyright": {
|
|
14
|
-
"year": "2026",
|
|
15
|
-
"text": "Copyright text"
|
|
16
|
-
},
|
|
17
|
-
"legal": {
|
|
18
|
-
"privacy": "",
|
|
19
|
-
"cookie": "",
|
|
20
|
-
"cookieControls": "",
|
|
21
|
-
"terms": ""
|
|
22
|
-
},
|
|
23
|
-
"pages": {
|
|
24
|
-
"404": {
|
|
25
|
-
"seo": {
|
|
26
|
-
"title": "404 - Not found"
|
|
27
|
-
},
|
|
28
|
-
"cdn": {
|
|
29
|
-
"css": [],
|
|
30
|
-
"js": []
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"homepage": {
|
|
34
|
-
"seo": {
|
|
35
|
-
"title": "Homepage",
|
|
36
|
-
"description": "Description"
|
|
37
|
-
},
|
|
38
|
-
"cdn": {
|
|
39
|
-
"css": [],
|
|
40
|
-
"js": []
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"anotherPage": {
|
|
44
|
-
"seo": {
|
|
45
|
-
"title": "Another Page",
|
|
46
|
-
"description": "description"
|
|
47
|
-
},
|
|
48
|
-
"cdn": {
|
|
49
|
-
"css": [],
|
|
50
|
-
"js": []
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"site_name": "Site name",
|
|
3
|
+
"title": "Site title",
|
|
4
|
+
"description": "Site description",
|
|
5
|
+
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
+
"domain": "yoursite.com",
|
|
7
|
+
"url": "https://yoursite.com",
|
|
8
|
+
"lang": "en",
|
|
9
|
+
"author": "Name and surname",
|
|
10
|
+
"data_bs_theme": "dark",
|
|
11
|
+
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
+
"logo": "/assets/brand/logo.svg",
|
|
13
|
+
"copyright": {
|
|
14
|
+
"year": "2026",
|
|
15
|
+
"text": "Copyright text"
|
|
16
|
+
},
|
|
17
|
+
"legal": {
|
|
18
|
+
"privacy": "",
|
|
19
|
+
"cookie": "",
|
|
20
|
+
"cookieControls": "",
|
|
21
|
+
"terms": ""
|
|
22
|
+
},
|
|
23
|
+
"pages": {
|
|
24
|
+
"404": {
|
|
25
|
+
"seo": {
|
|
26
|
+
"title": "404 - Not found"
|
|
27
|
+
},
|
|
28
|
+
"cdn": {
|
|
29
|
+
"css": [],
|
|
30
|
+
"js": []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"homepage": {
|
|
34
|
+
"seo": {
|
|
35
|
+
"title": "Homepage",
|
|
36
|
+
"description": "Description"
|
|
37
|
+
},
|
|
38
|
+
"cdn": {
|
|
39
|
+
"css": [],
|
|
40
|
+
"js": []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"anotherPage": {
|
|
44
|
+
"seo": {
|
|
45
|
+
"title": "Another Page",
|
|
46
|
+
"description": "description"
|
|
47
|
+
},
|
|
48
|
+
"cdn": {
|
|
49
|
+
"css": [],
|
|
50
|
+
"js": []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
}
|
package/src/js/pages/404.js
CHANGED
|
@@ -9,8 +9,8 @@ import { initLangSwitcher } from '../modules/langSwitcher.js';
|
|
|
9
9
|
import { showNotification } from '../modules/notification.js';
|
|
10
10
|
|
|
11
11
|
// Uncomment to enable optional modules (call inside DOMContentLoaded)
|
|
12
|
-
// import { initTextAreaAutoExpand } from '../modules/textAreaAutoExpand.js';
|
|
13
|
-
// import { initNormalizePhoneNumber } from '../modules/normalizePhoneNumber.js';
|
|
12
|
+
// import { initTextAreaAutoExpand } from '../modules/forms/textAreaAutoExpand.js';
|
|
13
|
+
// import { initNormalizePhoneNumber } from '../modules/forms/normalizePhoneNumber.js';
|
|
14
14
|
|
|
15
15
|
//==========================
|
|
16
16
|
// "404" PAGE CUSTOM JAVASCRIPT
|
|
@@ -9,8 +9,8 @@ import { initLangSwitcher } from '../modules/langSwitcher.js';
|
|
|
9
9
|
import { showNotification } from '../modules/notification.js';
|
|
10
10
|
|
|
11
11
|
// Uncomment to enable optional modules (call inside DOMContentLoaded)
|
|
12
|
-
// import { initTextAreaAutoExpand } from '../modules/textAreaAutoExpand.js';
|
|
13
|
-
// import { initNormalizePhoneNumber } from '../modules/normalizePhoneNumber.js';
|
|
12
|
+
// import { initTextAreaAutoExpand } from '../modules/forms/textAreaAutoExpand.js';
|
|
13
|
+
// import { initNormalizePhoneNumber } from '../modules/forms/normalizePhoneNumber.js';
|
|
14
14
|
|
|
15
15
|
//==========================
|
|
16
16
|
// "another-page" PAGE CUSTOM JAVASCRIPT
|
package/src/js/pages/homepage.js
CHANGED
|
@@ -10,8 +10,8 @@ import { initLangSwitcher } from '../modules/langSwitcher.js';
|
|
|
10
10
|
import { showNotification } from '../modules/notification.js';
|
|
11
11
|
|
|
12
12
|
// Uncomment to enable optional modules (call inside DOMContentLoaded)
|
|
13
|
-
// import { initTextAreaAutoExpand } from '../modules/textAreaAutoExpand.js';
|
|
14
|
-
// import { initNormalizePhoneNumber } from '../modules/normalizePhoneNumber.js';
|
|
13
|
+
// import { initTextAreaAutoExpand } from '../modules/forms/textAreaAutoExpand.js';
|
|
14
|
+
// import { initNormalizePhoneNumber } from '../modules/forms/normalizePhoneNumber.js';
|
|
15
15
|
|
|
16
16
|
//==========================
|
|
17
17
|
// "homepage" PAGE CUSTOM JAVASCRIPT
|
package/src/scss/pages/404.scss
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
// IMPORTANT!
|
|
4
|
-
// You should fill this file with your data and rename it to config.php
|
|
5
|
-
|
|
6
|
-
// SMTP Configuration
|
|
7
|
-
|
|
8
|
-
// Email address you want to send from (must be configured with the SMTP provider)
|
|
9
|
-
define('MAIL_USERNAME', 'youremail@gmail.com');
|
|
10
|
-
|
|
11
|
-
// Password for the above email address (or an app-specific password if using Gmail with 2FA)
|
|
12
|
-
define('MAIL_PASSWORD', 'password');
|
|
13
|
-
|
|
14
|
-
// SMPT server host (e.g., smtp.gmail.com for Gmail)
|
|
15
|
-
define('MAIL_HOST', 'smtp.gmail.com');
|
|
16
|
-
|
|
17
|
-
// SMPT port (587 for TLS, 465 for SSL)
|
|
18
|
-
define('MAIL_PORT', 587);
|
|
19
|
-
|
|
20
|
-
// Email address you want to send to (you can use the same as MAIL_USERNAME if you want to send to yourself)
|
|
21
|
-
define('MAIL_TO_ADDRESS', 'youremail@gmail.com');
|
|
22
|
-
|
|
23
|
-
// From: name that will appear in the recipient's inbox
|
|
24
|
-
define('MAIL_FROM_NAME', 'Your website');
|
|
25
|
-
|
|
26
|
-
// To: name that will appear in the recipient's inbox
|
|
27
|
-
define('MAIL_TO_NAME', 'Receiver');
|
|
28
|
-
?>
|
package/src/api/sendEmail.php
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
//==========================
|
|
4
|
-
// SECURITY: METHOD CHECK
|
|
5
|
-
//==========================
|
|
6
|
-
|
|
7
|
-
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
8
|
-
http_response_code(405);
|
|
9
|
-
echo 'Method not allowed (PHP RESPONSE)';
|
|
10
|
-
exit;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//==========================
|
|
15
|
-
// SECURITY: ORIGIN CHECK
|
|
16
|
-
//==========================
|
|
17
|
-
|
|
18
|
-
// Do not forget to add a ,
|
|
19
|
-
$allowedDomains = [
|
|
20
|
-
'www.yourorigin.com',
|
|
21
|
-
// 'www.anotherorigin.com',
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
|
25
|
-
$referer = $_SERVER['HTTP_REFERER'] ?? '';
|
|
26
|
-
|
|
27
|
-
$host = parse_url($origin ?: $referer, PHP_URL_HOST);
|
|
28
|
-
|
|
29
|
-
if (!$host || !in_array($host, $allowedDomains)) {
|
|
30
|
-
http_response_code(403);
|
|
31
|
-
echo 'Forbidden origin (PHP RESPONSE)';
|
|
32
|
-
exit;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//==========================
|
|
37
|
-
// DEPENDENCIES
|
|
38
|
-
//==========================
|
|
39
|
-
|
|
40
|
-
use PHPMailer\PHPMailer;
|
|
41
|
-
use PHPMailer\Exception;
|
|
42
|
-
|
|
43
|
-
require __DIR__ . '/vendor/autoload.php';
|
|
44
|
-
require __DIR__ . '/config.php';
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//==========================
|
|
48
|
-
// SANITIZATION FUNCTIONS
|
|
49
|
-
//==========================
|
|
50
|
-
|
|
51
|
-
function clean($value) {
|
|
52
|
-
return htmlspecialchars(trim($value ?? ''), ENT_QUOTES, 'UTF-8');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function safeNum($value) {
|
|
56
|
-
return filter_var($value ?? '', FILTER_SANITIZE_NUMBER_INT);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//==========================
|
|
61
|
-
// POST VARIABLES
|
|
62
|
-
//==========================
|
|
63
|
-
|
|
64
|
-
// If the variable name exists, it will be concatenated in the body of the mail
|
|
65
|
-
// If it does not exist, it doesn't matter
|
|
66
|
-
|
|
67
|
-
$formType = clean($_POST['formType'] ?? '');
|
|
68
|
-
|
|
69
|
-
$name = clean($_POST['name'] ?? '');
|
|
70
|
-
$phoneNumber = safeNum($_POST['phoneNumber'] ?? '');
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//==========================
|
|
74
|
-
// MAIL SETUP
|
|
75
|
-
//==========================
|
|
76
|
-
|
|
77
|
-
$mail = new PHPMailer(true);
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
$mail->isSMTP();
|
|
81
|
-
$mail->Host = MAIL_HOST;
|
|
82
|
-
$mail->SMTPAuth = true;
|
|
83
|
-
$mail->Username = MAIL_USERNAME;
|
|
84
|
-
$mail->Password = MAIL_PASSWORD;
|
|
85
|
-
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
|
86
|
-
$mail->Port = MAIL_PORT;
|
|
87
|
-
$mail->CharSet = 'UTF-8';
|
|
88
|
-
$mail->Encoding = 'base64';
|
|
89
|
-
|
|
90
|
-
$mail->setFrom(MAIL_USERNAME, MAIL_FROM_NAME);
|
|
91
|
-
$mail->addAddress(MAIL_TO_ADDRESS, MAIL_TO_NAME);
|
|
92
|
-
|
|
93
|
-
$mail->isHTML(true);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//==========================
|
|
97
|
-
// MAIL BODY
|
|
98
|
-
//==========================
|
|
99
|
-
|
|
100
|
-
$body = "";
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
//==========================
|
|
104
|
-
// DATA CHECKS AND CONCATENATION
|
|
105
|
-
//==========================
|
|
106
|
-
|
|
107
|
-
if (!empty($name)) {
|
|
108
|
-
$body .= "<p><strong>Name:</strong> {$name}</p>";
|
|
109
|
-
}
|
|
110
|
-
if (!empty($phoneNumber)) {
|
|
111
|
-
$body .= "<p><strong>Phone Number:</strong> {$phoneNumber}</p>";
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
//==========================
|
|
115
|
-
// MAIL CONTENT
|
|
116
|
-
//==========================
|
|
117
|
-
|
|
118
|
-
$mail->Subject = "New form submission ({$formType})";
|
|
119
|
-
|
|
120
|
-
$mail->Body = $body;
|
|
121
|
-
$mail->AltBody = strip_tags(str_replace('<br>', "\n", $body));
|
|
122
|
-
|
|
123
|
-
$mail->send();
|
|
124
|
-
|
|
125
|
-
http_response_code(200);
|
|
126
|
-
echo "success";
|
|
127
|
-
|
|
128
|
-
} catch (Exception $e) {
|
|
129
|
-
http_response_code(500);
|
|
130
|
-
echo "{$mail->ErrorInfo}";
|
|
131
|
-
}
|