diff --git a/controllers/controllers.php b/controllers/controllers.php index 844c6eb..409d15e 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -38,25 +38,12 @@ $app->get('/new', function() use($app) { $entry = false; $photo_url = false; - $test_response = ''; - if($user->last_micropub_response) { - try { - if(@json_decode($user->last_micropub_response)) { - $d = json_decode($user->last_micropub_response); - $test_response = $d->response; - } - } catch(Exception $e) { - } - } - $html = render('new-post', array( 'title' => 'New Post', 'micropub_endpoint' => $user->micropub_endpoint, 'token_scope' => $user->token_scope, 'access_token' => $user->access_token, 'response_date' => $user->last_micropub_response_date, - 'syndication_targets' => json_decode($user->syndication_targets, true), - 'test_response' => $test_response, 'location_enabled' => $user->location_enabled )); $app->response()->body($html); @@ -131,7 +118,7 @@ $app->get('/add-to-home', function() use($app) { }); -$app->post('/micropub/post', function() use($app) { +$app->post('/post', function() use($app) { if($user=require_login($app)) { $params = $app->request()->params(); @@ -140,30 +127,30 @@ $app->post('/micropub/post', function() use($app) { return $v !== ''; }); - // Now send to the micropub endpoint - $r = micropub_post($user->micropub_endpoint, $params, $user->micropub_access_token); - $request = $r['request']; - $response = $r['response']; + print_r($params); + - $user->last_micropub_response = json_encode($r); - $user->last_micropub_response_date = date('Y-m-d H:i:s'); + // Now send to the micropub endpoint + // $r = micropub_post($user->micropub_endpoint, $params, $user->micropub_access_token); + // $request = $r['request']; + // $response = $r['response']; // Check the response and look for a "Location" header containing the URL - if($response && preg_match('/Location: (.+)/', $response, $match)) { - $location = $match[1]; - $user->micropub_success = 1; - } else { - $location = false; - } + // if($response && preg_match('/Location: (.+)/', $response, $match)) { + // $location = $match[1]; + // $user->micropub_success = 1; + // } else { + // $location = false; + // } - $user->save(); + // $user->save(); $app->response()->body(json_encode(array( - 'request' => htmlspecialchars($request), - 'response' => htmlspecialchars($response), - 'location' => $location, - 'error' => $r['error'], - 'curlinfo' => $r['curlinfo'] + // 'request' => htmlspecialchars($request), + // 'response' => htmlspecialchars($response), + // 'location' => $location, + // 'error' => $r['error'], + // 'curlinfo' => $r['curlinfo'] ))); } }); diff --git a/lib/helpers.php b/lib/helpers.php index cf751c6..329eba8 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -175,3 +175,31 @@ function relative_time($date) { } return $rel->timeAgo($date); } + +function caffeine_options() { + return array( + 'Coffee', + 'Americano', + 'Latte', + 'Cappuccino', + 'Espresso', + 'Iced Coffee', + 'Iced Americano', + 'Iced Latte', + 'Black Tea', + 'Tea' + ); +} + +function alcohol_options() { + return array( + 'Beer', + 'Cocktail', + 'Mimosa', + 'Champagne', + 'Wine', + 'Sake', + 'Cider' + ); +} + diff --git a/public/css/style.css b/public/css/style.css index 7cb152c..c005a30 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -190,3 +190,15 @@ body { } +.caffeine, .alcohol { + margin-bottom: 10px; + list-style-type: none; + padding-left: 0; + max-width: 240px; +} +.caffeine li, .alcohol li { + margin-bottom: 6px; +} +.caffeine li input, .alcohol li input { + width: 100%; +} diff --git a/views/new-post.php b/views/new-post.php index 01304fb..7ed6bf8 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -1,53 +1,39 @@
= htmlspecialchars($this->test_response) ?>+ +
Clicking "Post" will post this note to your Micropub endpoint. Below is some information about the request that will be made.
+ +me | += session('me') ?> (should be your URL) |
+
scope | += $this->token_scope ?> (should be a space-separated list of permissions including "post") |
+
micropub endpoint | += $this->micropub_endpoint ?> (should be a URL) |
+
access token | +String of length = strlen($this->access_token) ?>= (strlen($this->access_token) > 0) ? (', ending in ' . substr($this->access_token, -7) . ' ') : '' ?> (should be greater than length 0) |
+
= htmlspecialchars($this->test_response) ?>- - -
Clicking "Post" will post this note to your Micropub endpoint. Below is some information about the request that will be made.
- -me | -= session('me') ?> (should be your URL) |
-
scope | -= $this->token_scope ?> (should be a space-separated list of permissions including "post") |
-
micropub endpoint | -= $this->micropub_endpoint ?> (should be a URL) |
-
access token | -String of length = strlen($this->access_token) ?>= (strlen($this->access_token) > 0) ? (', ending in ' . substr($this->access_token, -7) . ' ') : '' ?> (should be greater than length 0) |
-