<?php

if (!isset($seo[1])) redirect();

$blog = new blog($seo[1]);

if (theme_component('entry'))
	include theme_component('entry');
else
	if ($blog->entries)
		while ($data = $blog->entry())
		{
			addTitle($data['entryTitle']);

			if ($data['entryHidden']) echo "<p>{locale:hidden_content}</p>";

			if ($data['entryPIN'] && get_pin() != $data['entryPIN'])
				echo "<p>{locale:pin_protected_content}</p>
				<form action='".get_entry_link($data['entrySlug'])."' method='post' name='entry-pin-input'>
					<input type='text' name='read_entry_pin' placeholder='{locale:entry_pin}' />
					<button type='submit'>{locale:unlock}</button>
				</form>";
			else
			{
				addDescription(entry_show_init($data['entryContent'], $data['entrySlug']));
				addImage($data['entryHeader']);
				headerImage($data['entryHeader']);
				echo "<article class='full' itemscope itemtype='http://schema.org/Article'>
						<h2 itemprop='name'>".htmlspecialchars($data['entryTitle'])."</h2>
						<div class='hidden' itemprop='headline'>".htmlspecialchars($data['entryTitle'])."</div>
						".($data['entryHeader'] ? "<img class='hidden' itemprop='image' src='$data[entryHeader]' alt='Header image'/>" : null)."
						<div class='content' itemprop='articleBody'>".entry_show_all($data['entryContent'])."</div>
						<p class='meta'><time class='date' title='{locale:published_on}' itemprop='datePublished' content='".date('Y-m-d', $data['entryPublished'])."'>".show_date($data['entryPublished'])."</time><span itemprop='author' itemscope itemtype='http://schema.org/Person'><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}' itemprop='url'><span itemprop='name'>$data[publicName]</span></a></span>".get_entry_admin($data)."</p>
					</article>\n";
			}
		}
	else
		echo "<h1>{locale:entry_not_found_title}</h1>"
			."<p>{locale:entry_not_found}</p>\n";