diff options
Diffstat (limited to 'public/index.php')
| -rw-r--r-- | public/index.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..df80ef3 --- /dev/null +++ b/public/index.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +use DTS\BookmarkRepository; + +require_once(__DIR__.'/../autoload.php'); + +$config = require_once(__DIR__.'/../config.php'); + +$sort = $_GET['sort'] ?? null; + +$tag = $_GET['tag'] ?? null; + +$bookmarks = new BookmarkRepository($config['path_to_repository']); + +$bookmarks->load(); + +if ($tag !== null) { + $bookmarks->filter($tag); +} + +$bookmarks->sort($sort === 'asc'); + +foreach ($bookmarks as $bookmark) { + echo $bookmark->url.' '.$bookmark->addedAt."<br/>"; +} |
