From deb0d071bb2cc179818ce8877043a1639ec22b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Tue, 30 Apr 2019 19:13:45 +0200 Subject: [PATCH] change addressing tags by name in query string to addressing by id --- www/_templates/admin_doc_listing.php | 2 +- www/_templates/admin_wrap.php | 2 +- www/_templates/front_doc_overview.php | 2 +- www/_templates/front_wrap.php | 2 +- www/_util/PileDB.php | 2 +- www/admin.php | 4 ++-- www/index.php | 5 ++--- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/www/_templates/admin_doc_listing.php b/www/_templates/admin_doc_listing.php index d79dacb..c1e1f03 100644 --- a/www/_templates/admin_doc_listing.php +++ b/www/_templates/admin_doc_listing.php @@ -10,7 +10,7 @@
- "> + ">

Upload a new document

diff --git a/www/_templates/admin_wrap.php b/www/_templates/admin_wrap.php index 26aadbd..19d7158 100644 --- a/www/_templates/admin_wrap.php +++ b/www/_templates/admin_wrap.php @@ -24,7 +24,7 @@
diff --git a/www/_templates/front_doc_overview.php b/www/_templates/front_doc_overview.php index 83fbf18..5c491ba 100644 --- a/www/_templates/front_doc_overview.php +++ b/www/_templates/front_doc_overview.php @@ -13,7 +13,7 @@

Tags: " . $tag["Name"] . ""; + echo '
  • " . $tag["Name"] . "
  • "; } ?>

    diff --git a/www/_templates/front_wrap.php b/www/_templates/front_wrap.php index 825d21b..6f44c90 100644 --- a/www/_templates/front_wrap.php +++ b/www/_templates/front_wrap.php @@ -25,7 +25,7 @@ 0) { - echo '
  • " . $tag['name'] . " (" . $tag['count'] . ")
  • "; + echo '
  • " . $tag['name'] . " (" . $tag['count'] . ")
  • "; } } ?> diff --git a/www/_util/PileDB.php b/www/_util/PileDB.php index 68d54c4..f91a570 100644 --- a/www/_util/PileDB.php +++ b/www/_util/PileDB.php @@ -51,7 +51,7 @@ class PileDB $tags = []; while ($row = $tags_ret->fetchArray(SQLITE3_NUM)) { array_push($tags, array( - 'href' => $row[0], + 'id' => $row[0], 'name' => $row[1], 'count' => $row[2] )); diff --git a/www/admin.php b/www/admin.php index 86ecde6..39fd4a1 100644 --- a/www/admin.php +++ b/www/admin.php @@ -114,9 +114,9 @@ if (isset($_SESSION['ID'])) { } elseif ($_GET["tag"] == "_") { $docs = $db->listDocs(-1); } else { - $tag = $db->findTag($_GET["tag"]); + $tag = $db->fetchTag($_GET["tag"]); $docs = $db->listDocs($tag["ID"]); - $doc_list_template->tag = $db->fetchTag($tag["ID"]); + $doc_list_template->tag = $tag; } $doc_list_template->docs = $docs; $content = $doc_list_template->render('admin_doc_listing.php'); diff --git a/www/index.php b/www/index.php index 5438248..fafb644 100644 --- a/www/index.php +++ b/www/index.php @@ -21,9 +21,8 @@ if (isset($_GET["item"])) { } elseif ($_GET["tag"] == "_") { $docs = $db->listDocs(-1); } else { - $tagObj = $db->findTag($_GET["tag"]); - $docs = $db->listDocs($tagObj["ID"]); - $tag = $db->fetchTag($tagObj["ID"]); + $tag = $db->fetchTag($_GET["tag"]); + $docs = $db->listDocs($tag["ID"]); $tag["Description"] = $pd->text($tag["Description"]); $doc_list_template->tag = $tag; }