2017-02-04 22:10:59 +01:00
|
|
|
<?php
|
|
|
|
require '_templates/Template.php';
|
2017-03-07 09:38:47 +01:00
|
|
|
require '_util/PileDB.php';
|
2017-02-04 22:10:59 +01:00
|
|
|
|
2017-03-07 09:38:47 +01:00
|
|
|
$db = new PileDB();
|
|
|
|
session_start();
|
2017-02-04 22:10:59 +01:00
|
|
|
|
|
|
|
if (isset($_GET["item"])) {
|
2017-03-07 09:38:47 +01:00
|
|
|
$doc = $db->fetchDoc($_GET["item"]);
|
2017-02-04 22:10:59 +01:00
|
|
|
|
|
|
|
$doc_template = new Template();
|
|
|
|
$doc_template->doc = $doc;
|
|
|
|
$content = $doc_template->render('front_doc_overview.php');
|
|
|
|
} elseif (isset($_GET["tag"])) {
|
2017-03-07 09:38:47 +01:00
|
|
|
$doc_list_template = new Template();
|
2017-02-04 22:10:59 +01:00
|
|
|
if ($_GET["tag"] == "*"){
|
2017-03-07 09:38:47 +01:00
|
|
|
$docs = $db->listDocs();
|
2017-03-07 21:24:46 +01:00
|
|
|
} elseif ($_GET["tag"] == "_") {
|
|
|
|
$docs = $db->listDocs(-1);
|
2017-02-04 22:10:59 +01:00
|
|
|
} else {
|
2017-03-07 21:24:46 +01:00
|
|
|
$tag = $db->findTag($_GET["tag"]);
|
2017-03-07 09:38:47 +01:00
|
|
|
$docs = $db->listDocs($tag["ID"]);
|
|
|
|
$doc_list_template->tag = $db->fetchTag($tag["ID"]);
|
2017-02-04 22:10:59 +01:00
|
|
|
}
|
|
|
|
$doc_list_template->docs = $docs;
|
|
|
|
$content = $doc_list_template->render('front_doc_listing.php');
|
|
|
|
} else {
|
|
|
|
$intro_template = new Template();
|
|
|
|
$content = $intro_template->render('front_intro.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
$page = new Template();
|
2017-03-07 09:38:47 +01:00
|
|
|
$page->doc_count = $db->getDocCount();
|
2017-03-07 21:20:20 +01:00
|
|
|
$page->none_count = $db->getUntaggedDocCount();
|
2017-03-07 09:38:47 +01:00
|
|
|
$page->tags = $db->getTags();
|
2017-02-04 22:10:59 +01:00
|
|
|
$page->content = $content;
|
2017-03-07 09:38:47 +01:00
|
|
|
$page->logged = isset($_SESSION["ID"]);
|
2017-02-04 22:10:59 +01:00
|
|
|
echo $page->render('front_wrap.php');
|
2017-03-07 09:38:47 +01:00
|
|
|
?>
|