<?php
declare(strict_types = 1);

class_exists('DB') || die;

require_once(__DIR__ . '/classes/GalleryCategory.class.php');
require_once(__DIR__ . '/classes/GalleryItems.class.php');

Template::set('template',
[
	'file' => 'item.tpl.php'
]);

// Informations.
$r = GalleryItems::getInfos();
if ($r < 0)
{
	Gallery::error();
	return;
}
if ($r < 1)
{
	Gallery::notFound();
	return;
}

// Filtres.
Gallery::filters();

// Commentaires.
if (Template::$data['comments'])
{
	require_once(__DIR__ . '/classes/GalleryComments.class.php');
	GalleryComments::addComment();
	GalleryComments::getCommentsItem();
}
?>