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.

28 lines
696 B

  1. <?php
  2. require '/var/www-php/Adafruit-Feed-Mangler/app.rc.php';
  3. $app = new \Slim\Slim;
  4. $app->config('debug', false);
  5. $app->error(function (\Exception $e) use ($app) {
  6. print "something broke";
  7. });
  8. $app->get('/', function () use ($app) {
  9. $term = 'adafruit';
  10. if ($app->request->get('search')) {
  11. $term = $app->request->get('search');
  12. }
  13. if ($app->request->get('type') === 'json') {
  14. $app->response->headers->set('Content-Type', 'application/json');
  15. print \Adafruit\FeedMangler\Mangler::getSearchJson($term);
  16. } else {
  17. $app->response->headers->set('Content-Type', 'application/atom+xml');
  18. print \Adafruit\FeedMangler\Atom::searchResults($term);
  19. }
  20. });
  21. $app->run();