Browse Source

add note about the "p3k-food" parameter. fix undefined $url variable error.

pull/10/head
Aaron Parecki 9 years ago
parent
commit
0046e24f6d
2 changed files with 11 additions and 2 deletions
  1. +7
    -2
      controllers/controllers.php
  2. +4
    -0
      views/new-post.php

+ 7
- 2
controllers/controllers.php View File

@ -182,6 +182,7 @@ $app->post('/post', function() use($app) {
$entry->save(); $entry->save();
// Send to the micropub endpoint if one is defined, and store the result // Send to the micropub endpoint if one is defined, and store the result
$url = false;
if($user->micropub_endpoint) { if($user->micropub_endpoint) {
$mp_request = array( $mp_request = array(
@ -208,11 +209,15 @@ $app->post('/post', function() use($app) {
} }
$entry->save(); $entry->save();
}
if($url) {
$app->redirect($url);
} else { } else {
// TODO: Redirect to an error page or show an error on the teacup post page
$url = Config::$base_url . $user->url . '/' . $entry->id; $url = Config::$base_url . $user->url . '/' . $entry->id;
$app->redirect($url);
} }
$app->redirect($url);
} }
}); });

+ 4
- 0
views/new-post.php View File

@ -74,6 +74,10 @@
<td>access token</td> <td>access token</td>
<td>String of length <b><?= strlen($this->access_token) ?></b><?= (strlen($this->access_token) > 0) ? (', ending in <code>' . substr($this->access_token, -7) . '</code>') : '' ?> (should be greater than length 0)</td> <td>String of length <b><?= strlen($this->access_token) ?></b><?= (strlen($this->access_token) > 0) ? (', ending in <code>' . substr($this->access_token, -7) . '</code>') : '' ?> (should be greater than length 0)</td>
</tr> </tr>
<tr>
<td>p3k-food</td>
<td>The button you tap (or your custom text) will be sent to your Micropub endpoint in a field named <code>p3k-food</code></td>
</tr>
</table> </table>
</div> </div>

Loading…
Cancel
Save