You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

  1. <?php
  2. function doc_pages($page=null) {
  3. $pages = [
  4. 'signing-in' => 'Signing In',
  5. 'creating-posts' => 'Creating Posts',
  6. 'editor' => 'Rich Editor',
  7. 'note' => 'Creating a Note',
  8. 'bookmark' => 'Creating a Bookmark',
  9. 'favorite' => 'Favoriting a Post',
  10. 'syndication' => 'Syndication',
  11. 'post-status' => 'Post Status',
  12. ];
  13. if($page == null)
  14. return $pages;
  15. else
  16. return $pages[$page];
  17. }
  18. $app->get('/', function($format='html') use($app) {
  19. $res = $app->response();
  20. $params = $app->request()->params();
  21. if (k($params, 'me')) {
  22. $app->redirect('/auth/start?'.http_build_query($params), 302);
  23. }
  24. render('index', array(
  25. 'title' => 'Quill',
  26. 'meta' => '',
  27. 'authorizing' => false,
  28. ));
  29. });
  30. $app->get('/creating-a-token-endpoint', function() use($app) {
  31. $app->redirect('http://indiewebcamp.com/token-endpoint', 301);
  32. });
  33. $app->get('/creating-a-micropub-endpoint', function() use($app) {
  34. render('creating-a-micropub-endpoint', array('title' => 'Creating a Micropub Endpoint', 'authorizing' => false));
  35. });
  36. $app->get('/docs', function() use($app) {
  37. render('docs/index', array(
  38. 'title' => 'Documentation',
  39. 'authorizing' => false,
  40. 'pages' => doc_pages()
  41. ));
  42. });
  43. $app->get('/docs/:page', function($page) use($app) {
  44. if(file_exists('views/docs/'.$page.'.php'))
  45. render('docs/'.$page, array(
  46. 'title' => doc_pages($page).' - Quill Documentation',
  47. 'authorizing' => false
  48. ));
  49. else
  50. $app->notFound();
  51. });
  52. $app->get('/privacy', function() use($app) {
  53. render('privacy', array('title' => 'Quill Privacy Policy', 'authorizing' => false));
  54. });