@@ -19,7 +19,7 @@ |
||
19 | 19 | (object) array( |
20 | 20 | 'match' => '/get/portfolioImage.json', |
21 | 21 | 'controller' => 'GetPortfolioImageController'), |
22 | - ); |
|
22 | + ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | } |
@@ -46,16 +46,16 @@ |
||
46 | 46 | 'value' => Request::getPost()); |
47 | 47 | } |
48 | 48 | |
49 | - global $container; |
|
50 | - $sent = $container['mail'] |
|
51 | - ->addTo($container['config']->admin_email) |
|
52 | - ->setSubject('Site Contact') |
|
53 | - ->setPlainMessage( |
|
54 | - 'Name: ' . Request::getPost('name') . "\n" . |
|
55 | - 'Email: ' . Request::getPost('email') . "\n" . |
|
56 | - 'Message: ' . Request::getPost('message') |
|
57 | - ) |
|
58 | - ->send(); |
|
49 | + global $container; |
|
50 | + $sent = $container['mail'] |
|
51 | + ->addTo($container['config']->admin_email) |
|
52 | + ->setSubject('Site Contact') |
|
53 | + ->setPlainMessage( |
|
54 | + 'Name: ' . Request::getPost('name') . "\n" . |
|
55 | + 'Email: ' . Request::getPost('email') . "\n" . |
|
56 | + 'Message: ' . Request::getPost('message') |
|
57 | + ) |
|
58 | + ->send(); |
|
59 | 59 | |
60 | 60 | return array( |
61 | 61 | 'success_message' => "Thank you for your message, " . Request::getPost('name') . "! I'll get back to you as soon as possible."); |
@@ -44,16 +44,16 @@ |
||
44 | 44 | 'value' => Request::getPost()); |
45 | 45 | } |
46 | 46 | |
47 | - global $container; |
|
48 | - $sent = $container['mail'] |
|
49 | - ->addTo($container['config']->admin_email) |
|
50 | - ->setSubject('Portfolio Contact') |
|
51 | - ->setPlainMessage( |
|
52 | - 'Name: ' . Request::getPost('name') . "\n" . |
|
53 | - 'Email: ' . Request::getPost('email') . "\n" . |
|
54 | - 'Message: ' . Request::getPost('message') |
|
55 | - ) |
|
56 | - ->send(); |
|
47 | + global $container; |
|
48 | + $sent = $container['mail'] |
|
49 | + ->addTo($container['config']->admin_email) |
|
50 | + ->setSubject('Portfolio Contact') |
|
51 | + ->setPlainMessage( |
|
52 | + 'Name: ' . Request::getPost('name') . "\n" . |
|
53 | + 'Email: ' . Request::getPost('email') . "\n" . |
|
54 | + 'Message: ' . Request::getPost('message') |
|
55 | + ) |
|
56 | + ->send(); |
|
57 | 57 | |
58 | 58 | return array( |
59 | 59 | 'success_message' => "Thank you for your message, ".Request::getPost('name')."! I'll get back to you as soon as possible."); |
@@ -58,16 +58,16 @@ |
||
58 | 58 | 'values' => $values); |
59 | 59 | } |
60 | 60 | |
61 | - global $container; |
|
62 | - $sent = $container['mail'] |
|
63 | - ->addTo($container['config']->admin_email) |
|
64 | - ->setSubject('Waterfall Site Contact') |
|
65 | - ->setPlainMessage( |
|
66 | - "Name: {$values->name}\n" . |
|
67 | - "Email: {$values->email}\n" . |
|
68 | - "Message: {$values->message}" |
|
69 | - ) |
|
70 | - ->send(); |
|
61 | + global $container; |
|
62 | + $sent = $container['mail'] |
|
63 | + ->addTo($container['config']->admin_email) |
|
64 | + ->setSubject('Waterfall Site Contact') |
|
65 | + ->setPlainMessage( |
|
66 | + "Name: {$values->name}\n" . |
|
67 | + "Email: {$values->email}\n" . |
|
68 | + "Message: {$values->message}" |
|
69 | + ) |
|
70 | + ->send(); |
|
71 | 71 | |
72 | 72 | return (object) array('display' => 'success'); |
73 | 73 | } |
@@ -60,16 +60,16 @@ |
||
60 | 60 | 'values' => $values); |
61 | 61 | } |
62 | 62 | |
63 | - global $container; |
|
64 | - $sent = $container['mail'] |
|
65 | - ->addTo($container['config']->admin_email) |
|
66 | - ->setSubject('Home Page Contact') |
|
67 | - ->setPlainMessage( |
|
68 | - "Name: {$values->name}\n" . |
|
69 | - "Email: {$values->email}\n" . |
|
70 | - "Message: {$values->message}" |
|
71 | - ) |
|
72 | - ->send(); |
|
63 | + global $container; |
|
64 | + $sent = $container['mail'] |
|
65 | + ->addTo($container['config']->admin_email) |
|
66 | + ->setSubject('Home Page Contact') |
|
67 | + ->setPlainMessage( |
|
68 | + "Name: {$values->name}\n" . |
|
69 | + "Email: {$values->email}\n" . |
|
70 | + "Message: {$values->message}" |
|
71 | + ) |
|
72 | + ->send(); |
|
73 | 73 | |
74 | 74 | return (object) array('display' => 'success'); |
75 | 75 | } |
@@ -167,26 +167,26 @@ |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - $site = URLDecode::getSite(); |
|
170 | + $site = URLDecode::getSite(); |
|
171 | 171 | |
172 | - if ($site == 'blog') { |
|
173 | - $subject = "New Comment on Jacob Emerick's Blog"; |
|
174 | - $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
175 | - } else if ($site == 'waterfalls') { |
|
176 | - $subject = "New Comment on Waterfalls of the Keweenaw"; |
|
177 | - $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
178 | - } |
|
172 | + if ($site == 'blog') { |
|
173 | + $subject = "New Comment on Jacob Emerick's Blog"; |
|
174 | + $message = "Hello!\nThere has been a new comment on the post '{$this->page_title}' at Jacob Emerick's Blog. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
175 | + } else if ($site == 'waterfalls') { |
|
176 | + $subject = "New Comment on Waterfalls of the Keweenaw"; |
|
177 | + $message = "Hello!\nThere has been a new comment on the page '{$this->page_title}' at Waterfalls of the Keweenaw. You have chosen to be notified of it - please reply to [email protected] if you would like to be removed from these notifications.\n\nOn " . date('F j, Y g:i a') . ", " . Request::getPost('name') . " commented...\n" . Request::getPost('comment') . "\n\nVisit {$this->full_path}#comments to see and reply to all the comments on this post.\nThank you!"; |
|
178 | + } |
|
179 | 179 | |
180 | - global $container; |
|
180 | + global $container; |
|
181 | 181 | |
182 | 182 | foreach($email_recipient_array as $email_recipient) |
183 | 183 | { |
184 | - $sent = $container['mail'] |
|
185 | - ->addTo($email_recipient['email'], $email_recipient['name']) |
|
186 | - ->addBCC($container['config']->admin_email) |
|
187 | - ->setSubject($subject) |
|
188 | - ->setPlainMessage($message) |
|
189 | - ->send(); |
|
184 | + $sent = $container['mail'] |
|
185 | + ->addTo($email_recipient['email'], $email_recipient['name']) |
|
186 | + ->addBCC($container['config']->admin_email) |
|
187 | + ->setSubject($subject) |
|
188 | + ->setPlainMessage($message) |
|
189 | + ->send(); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | $container['console']->logMemory(null, 'Bootstrapping is done'); |
8 | 8 | |
9 | 9 | $dispatcher = FastRoute\simpleDispatcher(function (FastRoute\RouteCollector $r) { |
10 | - $r->addRoute('GET', '/', 'HomeController'); |
|
11 | - $r->addRoute('GET', '/terms/', 'TermsController'); |
|
12 | - $r->addRoute('GET', '/change-log/', 'ChangelogController'); |
|
13 | - $r->addRoute(['GET', 'POST'], '/contact/', 'ContactController'); |
|
10 | + $r->addRoute('GET', '/', 'HomeController'); |
|
11 | + $r->addRoute('GET', '/terms/', 'TermsController'); |
|
12 | + $r->addRoute('GET', '/change-log/', 'ChangelogController'); |
|
13 | + $r->addRoute(['GET', 'POST'], '/contact/', 'ContactController'); |
|
14 | 14 | }); |
15 | 15 | |
16 | 16 | $httpMethod = $_SERVER['REQUEST_METHOD']; |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | $status = reset($routeInfo); |
20 | 20 | |
21 | 21 | switch ($status) { |
22 | - case FastRoute\Dispatcher::NOT_FOUND: |
|
23 | - $container['logger']->debug('Route not found - 404'); |
|
24 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
25 | - break; |
|
26 | - case FastRoute\Dispatcher::METHOD_NOT_ALLOWED: |
|
27 | - // todo - return allowed routes in header |
|
28 | - $container['logger']->debug('Unallowed method - 405'); |
|
29 | - Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
30 | - break; |
|
31 | - case FastRoute\Dispatcher::FOUND: |
|
32 | - $container['logger']->debug('found!'); |
|
33 | - Loader::loadNew('controller', "{$namespace}/{$routeInfo[1]}")->activate(); |
|
34 | - break; |
|
22 | + case FastRoute\Dispatcher::NOT_FOUND: |
|
23 | + $container['logger']->debug('Route not found - 404'); |
|
24 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
25 | + break; |
|
26 | + case FastRoute\Dispatcher::METHOD_NOT_ALLOWED: |
|
27 | + // todo - return allowed routes in header |
|
28 | + $container['logger']->debug('Unallowed method - 405'); |
|
29 | + Loader::loadNew('controller', '/Error404Controller')->activate(); |
|
30 | + break; |
|
31 | + case FastRoute\Dispatcher::FOUND: |
|
32 | + $container['logger']->debug('found!'); |
|
33 | + Loader::loadNew('controller', "{$namespace}/{$routeInfo[1]}")->activate(); |
|
34 | + break; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $container['console']->logMemory(null, 'Routing is done'); |
@@ -22,28 +22,28 @@ |
||
22 | 22 | |
23 | 23 | // sets up shutdown function to display profiler |
24 | 24 | register_shutdown_function(function () use ($container) { |
25 | - if ( |
|
26 | - !isset($_COOKIE['debugger']) || |
|
27 | - $_COOKIE['debugger'] != 'display' |
|
28 | - ) { |
|
29 | - return; |
|
30 | - } |
|
31 | - |
|
32 | - $dbProfiles = $container['db_connection_locator'] |
|
33 | - ->getRead() |
|
34 | - ->getProfiler() |
|
35 | - ->getProfiles(); |
|
36 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
37 | - return $profile['function'] == 'perform'; |
|
38 | - }); |
|
39 | - $dbProfiles = array_map(function ($profile) { |
|
40 | - return [ |
|
41 | - 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
42 | - 'parameters' => $profile['bind_values'], |
|
43 | - 'time' => $profile['duration'], |
|
44 | - ]; |
|
45 | - }, $dbProfiles); |
|
46 | - $container['profiler']->setProfiledQueries($dbProfiles); |
|
47 | - $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
48 | - $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
25 | + if ( |
|
26 | + !isset($_COOKIE['debugger']) || |
|
27 | + $_COOKIE['debugger'] != 'display' |
|
28 | + ) { |
|
29 | + return; |
|
30 | + } |
|
31 | + |
|
32 | + $dbProfiles = $container['db_connection_locator'] |
|
33 | + ->getRead() |
|
34 | + ->getProfiler() |
|
35 | + ->getProfiles(); |
|
36 | + $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
37 | + return $profile['function'] == 'perform'; |
|
38 | + }); |
|
39 | + $dbProfiles = array_map(function ($profile) { |
|
40 | + return [ |
|
41 | + 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
42 | + 'parameters' => $profile['bind_values'], |
|
43 | + 'time' => $profile['duration'], |
|
44 | + ]; |
|
45 | + }, $dbProfiles); |
|
46 | + $container['profiler']->setProfiledQueries($dbProfiles); |
|
47 | + $container['profiler']->setDisplay(new Particletree\Pqp\Display()); |
|
48 | + $container['profiler']->display($container['db_connection_locator']->getRead()); |
|
49 | 49 | }); |
@@ -13,24 +13,24 @@ discard block |
||
13 | 13 | |
14 | 14 | $blogFeed = Feed::loadRss('http://blog.jacobemerick.com/rss.xml'); |
15 | 15 | foreach ($blogFeed->item as $item) { |
16 | - $datetime = new DateTime($item->pubDate); |
|
17 | - if ($datetime <= $mostRecentBlogDateTime) { |
|
18 | - // break; |
|
19 | - } |
|
20 | - |
|
21 | - $uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid); |
|
22 | - if ($uniqueBlogCheck !== false) { |
|
23 | - continue; |
|
24 | - } |
|
25 | - |
|
26 | - $datetime->setTimezone($container['default_timezone']); |
|
27 | - $metadata = json_decode(json_encode($item), true); |
|
28 | - |
|
29 | - $blogRepository->insertBlog( |
|
30 | - (string) $item->guid, |
|
31 | - $datetime, |
|
32 | - $metadata |
|
33 | - ); |
|
16 | + $datetime = new DateTime($item->pubDate); |
|
17 | + if ($datetime <= $mostRecentBlogDateTime) { |
|
18 | + // break; |
|
19 | + } |
|
20 | + |
|
21 | + $uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid); |
|
22 | + if ($uniqueBlogCheck !== false) { |
|
23 | + continue; |
|
24 | + } |
|
25 | + |
|
26 | + $datetime->setTimezone($container['default_timezone']); |
|
27 | + $metadata = json_decode(json_encode($item), true); |
|
28 | + |
|
29 | + $blogRepository->insertBlog( |
|
30 | + (string) $item->guid, |
|
31 | + $datetime, |
|
32 | + $metadata |
|
33 | + ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $blogCommentRepository = new BlogCommentRepository($container['db_connection_locator']); |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | |
42 | 42 | $commentFeed = Feed::loadRss('http://blog.jacobemerick.com/rss-comments.xml'); |
43 | 43 | foreach ($commentFeed->item as $item) { |
44 | - $datetime = new DateTime($item->pubDate); |
|
45 | - if ($datetime <= $mostRecentBlogCommentDateTime) { |
|
46 | - break; |
|
47 | - } |
|
48 | - |
|
49 | - $uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid); |
|
50 | - if ($uniqueBlogCommentCheck !== false) { |
|
51 | - continue; |
|
52 | - } |
|
53 | - |
|
54 | - $datetime->setTimezone($container['default_timezone']); |
|
55 | - $metadata = json_decode(json_encode($item), true); |
|
56 | - |
|
57 | - $blogCommentRepository->insertBlogComment( |
|
58 | - (string) $item->guid, |
|
59 | - $datetime, |
|
60 | - $metadata |
|
61 | - ); |
|
44 | + $datetime = new DateTime($item->pubDate); |
|
45 | + if ($datetime <= $mostRecentBlogCommentDateTime) { |
|
46 | + break; |
|
47 | + } |
|
48 | + |
|
49 | + $uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid); |
|
50 | + if ($uniqueBlogCommentCheck !== false) { |
|
51 | + continue; |
|
52 | + } |
|
53 | + |
|
54 | + $datetime->setTimezone($container['default_timezone']); |
|
55 | + $metadata = json_decode(json_encode($item), true); |
|
56 | + |
|
57 | + $blogCommentRepository->insertBlogComment( |
|
58 | + (string) $item->guid, |
|
59 | + $datetime, |
|
60 | + $metadata |
|
61 | + ); |
|
62 | 62 | } |