diff options
| author | David T. Sadler <davidtsadler@googlemail.com> | 2021-09-18 12:20:59 +0100 |
|---|---|---|
| committer | David T. Sadler <davidtsadler@googlemail.com> | 2021-09-18 12:20:59 +0100 |
| commit | 2b15ee9eae6a98fba871b4c587cdd8cfc1b1b48a (patch) | |
| tree | e3ceb3a87c11b925f0df0088da82427f793b2e14 /public | |
| parent | 3431dc10bc8c9925dcda272855de379321d832b2 (diff) | |
Beginning of rewrite
Diffstat (limited to 'public')
| -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/>"; +} |
