-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
211d0f8
commit ada4d01
Showing
10 changed files
with
170 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Uuid: HIAGvn3L1XPu29XC |
Submodule kirby
updated
56 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title: TEST | ||
|
||
fields: | ||
description: | ||
label: Description | ||
type: textarea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,14 +76,25 @@ function generateRelationsJson() | |
* all config options: https://getkirby.com/docs/reference/system/options | ||
*/ | ||
return [ | ||
// 'debug' => true, | ||
'debug' => false, | ||
'debug' => true, | ||
// 'debug' => false, | ||
'panel' => [ | ||
'install' => true | ||
], | ||
'api' => [ | ||
'basicAuth' => true | ||
], | ||
'email' => [ | ||
'transport' => [ | ||
'type' => 'smtp', | ||
//'host' => 'smtp.company.com', | ||
'host' => 'cp-wc01.per01.ds.network', | ||
'port' => 465, | ||
'security' => true, | ||
'username' => '[email protected]', | ||
'password' => "Dn;in'}47CAd,pk" | ||
] | ||
], | ||
'languages' => true, | ||
'thumbs' => [ | ||
'srcsets' => [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ | |
try { | ||
$kirby->email([ | ||
'template' => 'email', | ||
'from' => 'alexrturner@gmail.com', | ||
'from' => 'info@tonelist.com.au', | ||
'replyTo' => $data['email'], | ||
'to' => '[email protected]', | ||
'subject' => esc($data['name']) . ' (' . esc($data['pronouns']) . ') sent you an accessibility request via the AE website.', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
return function ($kirby, $pages, $page) { | ||
|
||
$alert = null; | ||
|
||
if ($kirby->request()->is('POST') && get('submit')) { | ||
dump($_POST); // check if you get into this if-statement at all | ||
// check the honeypot | ||
if (empty(get('website')) === false) { | ||
go($page->url()); | ||
exit; | ||
} | ||
|
||
$data = [ | ||
'name' => get('name'), | ||
'pronouns' => get('pronouns'), | ||
'email' => get('email'), | ||
'phone' => get('phone'), | ||
'text' => get('text') | ||
]; | ||
|
||
$rules = [ | ||
'name' => [], | ||
'pronouns' => [], | ||
'email' => ['email'], | ||
'phone' => ['phone'], | ||
'text' => ['minLength' => 3, 'maxLength' => 3000], | ||
]; | ||
|
||
$messages = [ | ||
'name' => 'Please enter your name', | ||
'pronouns' => 'Please enter your pronouns', | ||
'email' => 'Please enter a valid email address', | ||
'phone' => 'Please enter a valid phone number', | ||
'text' => 'Please enter your accessibility request' | ||
]; | ||
|
||
// some of the data is invalid | ||
if ($invalid = invalid($data, $rules, $messages)) { | ||
$alert = $invalid; | ||
|
||
// the data is fine, let's send the email | ||
} else { | ||
dump($data); | ||
try { | ||
$kirby->email([ | ||
'template' => 'email', | ||
'from' => '[email protected]', | ||
'replyTo' => $data['email'], | ||
'to' => '[email protected]', | ||
'subject' => esc($data['name']) . ' (' . esc($data['pronouns']) . ') sent you an accessibility request via the AE website.', | ||
'data' => [ | ||
'text' => esc($data['text']), | ||
'sender' => esc($data['name']) | ||
] | ||
|
||
]); | ||
} catch (Exception $error) { | ||
if (option('debug')) : | ||
$alert['error'] = 'The form could not be sent: ' . $error->getMessage(); | ||
else : | ||
$alert['error'] = 'The form could not be sent!'; | ||
endif; | ||
} | ||
|
||
// no exception occurred, let's send a success message | ||
if (empty($alert) === true) { | ||
$success = 'Your message has been sent, thank you. We will get back to you soon!'; | ||
$data = []; | ||
} | ||
} | ||
} | ||
|
||
return [ | ||
'alert' => $alert, | ||
'data' => $data ?? false, | ||
'success' => $success ?? false | ||
]; | ||
}; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php snippet('header') ?> | ||
|
||
<main class="main content-container index"> | ||
|
||
<section id="col1" class="intro" style="max-width: 60ch;"> | ||
<?= kt($page->intro()) ?> | ||
</section> | ||
|
||
<section id="col2" class="description" style="max-width: 60ch;"> | ||
<?= kt($page->description()) ?> | ||
</section> | ||
|
||
<section id="col3" class="form" style="max-width: 60ch;"> | ||
|
||
<?= kt($page->form()) ?> | ||
|
||
<?php if ($success) : ?> | ||
<div class="alert success"> | ||
<p><?= $success ?></p> | ||
</div> | ||
<?php else : ?> | ||
<?php if (isset($alert['error'])) : ?> | ||
<div><?= $alert['error'] ?></div> | ||
<?php endif ?> | ||
<form method="post" action="<?= $page->url() ?>"> | ||
<div class="honeypot" style="position: absolute; left: -9999px;"> | ||
<label for="website">Website <abbr title="required">*</abbr></label> | ||
<input type="url" id="website" name="website" tabindex="-1"> | ||
</div> | ||
<div class="field-group"> | ||
<div class="field half"> | ||
<input type="text" id="name" name="name" value="<?= esc($data['name'] ?? '', 'attr') ?>" placeholder="Name"> | ||
<?= isset($alert['name']) ? '<span class="alert error">' . esc($alert['name']) . '</span>' : '' ?> | ||
</div> | ||
<div class="field half"> | ||
<input type="text" id="pronouns" name="pronouns" value="<?= esc($data['pronouns'] ?? '', 'attr') ?>" placeholder="Pronouns"> | ||
<?= isset($alert['pronouns']) ? '<span class="alert error">' . esc($alert['pronouns']) . '</span>' : '' ?> | ||
</div> | ||
</div> | ||
<div class="field-group"> | ||
<div class="field half"> | ||
<input type="email" id="email" name="email" value="<?= esc($data['email'] ?? '', 'attr') ?>" placeholder="eMail"> | ||
<?= isset($alert['email']) ? '<span class="alert error">' . esc($alert['email']) . '</span>' : '' ?> | ||
</div> | ||
<div class="field half"> | ||
<input type="tel" id="phone" name="phone" value="<?= esc($data['phone'] ?? '', 'attr') ?>" placeholder="Phone"> | ||
<?= isset($alert['phone']) ? '<span class="alert error">' . esc($alert['phone']) . '</span>' : '' ?> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<textarea id="text" name="text" placeholder="Request" required><?= esc($data['text'] ?? '') ?></textarea> | ||
|
||
<?= isset($alert['text']) ? '<span class="alert error">' . esc($alert['text']) . '</span>' : '' ?> | ||
</div> | ||
<div> | ||
<button class="button__link button__submit" type="submit">Get in Touch</button> | ||
<!-- <input type="submit" name="submit" value="Get in Touch"> --> | ||
</div> | ||
</form> | ||
<?php endif ?> | ||
</section> | ||
|
||
</main> | ||
|
||
|
||
<?php snippet('footer') ?> |