diff --git a/controllers/auth.php b/controllers/auth.php index 6fd78e4..f405d86 100644 --- a/controllers/auth.php +++ b/controllers/auth.php @@ -5,7 +5,7 @@ function buildRedirectURI() { } function clientID() { - return Config::$base_url; + return trim(Config::$base_url, '/'); // remove trailing slash from client_id } function build_url($parsed_url) { diff --git a/controllers/controllers.php b/controllers/controllers.php index d7014d0..96916f6 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -146,10 +146,13 @@ $app->post('/post', function() use($app) { if(k($params, 'drank')) { $entry->content = $params['drank']; - } elseif(k($params, 'custom_caffeine')) { - $entry->content = $params['custom_caffeine']; - } elseif(k($params, 'custom_alcohol')) { - $entry->content = $params['custom_alcohol']; + $type = 'drink'; + } elseif(k($params, 'custom_drank')) { + $entry->content = $params['custom_drank']; + $type = 'drink'; + } elseif(k($params, 'custom_ate')) { + $entry->content = $params['custom_ate']; + $type = 'eat'; } $entry->save(); @@ -159,7 +162,8 @@ $app->post('/post', function() use($app) { if($user->micropub_endpoint) { $mp_request = array( 'h' => 'entry', - 'content' => $entry->content, + 'p3k-food' => $entry->content, + 'p3k-type' => $type, 'location' => k($params, 'location') ); @@ -175,6 +179,8 @@ $app->post('/post', function() use($app) { $user->micropub_success = 1; $entry->micropub_success = 1; $entry->canonical_url = $url; + } else { + $entry->micropub_success = 0; } $entry->save(); diff --git a/public/css/style.css b/public/css/style.css index 7dee754..1e93a30 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -190,16 +190,16 @@ body { } -.caffeine, .alcohol { +.entry-buttons { margin-bottom: 10px; list-style-type: none; padding-left: 0; max-width: 240px; } -.caffeine li, .alcohol li { +.entry-buttons li { margin-bottom: 6px; } -.caffeine li input, .alcohol li input { +.entry-buttons li input { width: 100%; } diff --git a/views/new-post.php b/views/new-post.php index 1484986..0c4ece0 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -4,33 +4,42 @@