<?php

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((preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images) ? $images[1] : 0));
			headerImage($data['entryHeader']);
			echo "<article class='full'>";
					if (strlen($data['entryTitle']) > 50)
						echo "<header><div><h2>".htmlspecialchars($data['entryTitle'])."</h2></div></header>";

				echo "<div class='content'>".entry_show_all($data['entryContent'])."</div>
					<p class='meta'>
						<a href='".get_entry_link($data['entrySlug'])."' class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</a>
						<a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>
						".get_entry_admin($data)."
				</article>\n";
		}
	}
else
	echo "<h1>{locale:entry_not_found_title}</h1>"
		."<p>{locale:entry_not_found}</p>\n";