This repository was archived by the owner on Aug 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.php
More file actions
195 lines (160 loc) · 7.92 KB
/
contact.php
File metadata and controls
195 lines (160 loc) · 7.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
/**
* Contact Page - Reach out and touch someone.
*
* @package ChristopherL.com
* @copyright 2016-2018 ChristopherL (https://github.com/christopherldotcom)
* @license http://www.gnu.org/licenses/gpl-2.0.html
*/
// Load Site Configuration
require_once('include/config.inc.php');
require_once('include/functions.inc.php');
// Load Smarty Library and Plugin
require_once('include/libs/smarty/Smarty.class.php');
// Instantiate Smarty Class then build page if not cached
$smarty = new Smarty();
$cache_id = 'contact';
if (!$smarty->isCached('base.tpl', $cache_id)) {
smarty_scaffolding($smarty, $config);
// Create Meta & Page Settings
$smarty->assign('page_title', 'Infrequently Responding to Email, Since 1999 :: ChristopherL');
$smarty->assign('page_desc', "There's no shortage of ways to contact ChristopherL. Except on Facebook. Don't bother with that.");
$smarty->assign('page_url', '/contact');
$smarty->assign('active_nav', 'contact');
$smarty->assign('hero_image', complete_url('/img/heros/contact.jpg', 1));
// Social Images
$smarty->assign('image_facebook', '/img/social/contact.jpg');
$smarty->assign('image_twitter', '/img/social/contact.jpg');
// recaptcha elements
$captcha_challenge = $captcha_scripts = '';
if ($config['recaptcha_active'] && $config['recaptcha_site_key'] && $config['recaptcha_secret_key']) {
$captcha_challenge = '<div id="g-recaptcha" class="g-recaptcha" data-sitekey="' . $config['recaptcha_site_key'] . '"></div>';
$captcha_scripts = '<script src="https://www.google.com/recaptcha/api.js"></script>';
}
$contact_javascript = <<<HTML
<script>
(function($){
/*
* Handle contact us form submissions
*/
$('#contact_christopherl').parsley()
.on('form:submit', function(event) {
event.preventDefault;
// hide any errors, and feedback, from earlier attempts
$('#contact_christopherl *').each(function(){
$(this).removeClass('error');
});
$('#feedback').hide();
// package it up and send to the server
$.ajax({
url: 'ajax.php',
cache: false,
method: 'post',
dataType: 'json',
data: { 'method':'contact', 'data':$('#contact_christopherl').serializeArray() },
})
.done(function(data) {
// handle success response, reset form and recaptcha
$('#contact_christopherl').trigger('reset');
if (typeof grecaptcha !== 'undefined') {
grecaptcha.reset();
}
// update feedback
$('#feedback').show();
$('#feedback').removeClass('incomplete');
$('#feedback').text(data.msg.toString());
// track it using our global listener
$(document).trigger('ga_track', [{type:"form_submit",identifier: data.msg.toString()}]);
// hide feedback after 10 seconds
setTimeout(function(){
$('#feedback').hide();
}, 10000);
})
.fail(function(data) {
// handle error response
$('#feedback').show();
$('#feedback').addClass('incomplete');
$('#feedback').text(data.responseJSON.msg.toString());
$('#' + data.responseJSON.field.toString()).addClass('error');
// track it using our global listener
$(document).trigger('ga_track', [{type:"form_submit",identifier: data.responseJSON.msg.toString()}]);
});
});
}(jQuery));
</script>
HTML;
$smarty->assign('head_extras', '');
$smarty->assign('body_header_extras', '');
$smarty->assign('body_footer_extras', smarty_content($captcha_scripts . $contact_javascript));
$footer_cta = newsletter_subscribe();
// Page Content
$content = <<<HTML
<section>
<div class="the-outer-limits">
<h1>Connect <span class="hidden-phone">with Christopherl</span></h1>
<aside class="contact">
<h3>Our Digits</h3>
<a href="tel:14242424711">(424) 242-4711</a>
<span>Yes, this number is real. And it's awesome.<br>It's real awesome.</span>
</aside>
<p>
It's a small world. The human race is more interconnected now than at any point in our history.
Even still, connecting with people can be difficult. Should you like to contact us we've rounded
up all your options into one easy-to-use list.
</p>
<h2>Social Profiles</h2>
<p>
You can find ChristopherL on
<a href="https://github.com/chrislarrycarl" target="_blank">GitHub</a>,
<a href="https://www.linkedin.com/in/chriscarlevato" target="_blank">LinkedIn</a>,
<a href="https://www.flickr.com/photos/chrislarrycarl" target="_blank">Flickr</a>,
<a href="https://profiles.wordpress.org/chrislarrycarl" target="_blank">WordPress</a>,
<a href="https://keybase.io/chrislarrycarl" target="_blank">Keybase</a>,
<a href="https://twitter.com/chrislarrycarl" target="_blank">Twitter</a>,
<a href="https://plus.google.com/100207846325253267928" target="_blank">Google+</a>, and
<a href="https://setiathome.berkeley.edu/show_user.php?userid=166402" target="_blank">Seti@Home</a>.
</p>
<h2>Good Old Email</h2>
<p>
But email isn't a secure medium you say?
</p>
<p>
And you don't care this is an https slack webhook and not an actual email form?
</p>
<p>
OK. Calm down Alan Westin, if it makes you feel better here's <a href="download/christopherl_public_key.asc">our public key</a>.
<br>
<sub><i>(sha 256 checksum: 92ee978f9ba0d032c63e265bf4265ab5e47872e84dc469fabaa0361bbede2325)</i></sub>
</p>
<form name="contact_christopherl" id="contact_christopherl" data-parsley-trigger="change" onsubmit="return false;">
<fieldset>
<label for="fullname">Name</label>
<input class="form-control" id="fullname" name="fullname" type="text" required="required">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" required="required" type="email">
<label for="message">What's on your mind?</label>
<textarea class="form-control" name="message" id="message" required="required"></textarea>
{$captcha_challenge}
<input id="submit" type="submit" name="submit" value="Go Button" title="Smash the Go Button to Send">
</fieldset>
</form>
<div id="feedback" class="hidden">This is a feedback message</div>
</div>
</section>
<section class="highlight logos">
<div class="the-outer-limits container row">
<h3>What About Facebook?</h3>
<p>
Yeah. Sure. If you're into <a href="https://www.facebook.com/chrislarrycarl" target="_blank" data-event="highlight-ribbon">that sort of thing</a>.
</p>
</div>
</section>
{$footer_cta}
HTML;
$smarty->assign('content', smarty_content($content));
// Smoosh it all down, this will make viewing the page source a pain for people
// but will save literally 10 of milliseconds in page download time.
smarty_smoosh();
}
// Output the page
$smarty->display('base.tpl', $cache_id);