<?php

addTitle($_locale['entries']);

if (isset($seo[1]) && isnum($seo[1]))
	$blog = new blog(null, $seo[1]);
else
	$blog = new blog();

if (theme_component('entries'))
	include theme_component('entries');
else
{
	if (LOGGEDIN && $user['userLevel'] > 2) echo "<a href='/admin/entry'><p class='phantom'>{locale:new_entry}</p></a>";
	if ($blog->entries)
	{
		while ($data = $blog->entries())
			echo "<article>
					<header>
						<h2><a href='".get_entry_link($data['entrySlug'])."'>".htmlspecialchars($data['entryTitle'])."</a></h2>
						<p class='meta'><time class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</time><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>".get_entry_admin($data)."</p>
					</header>
					<div class='content'>".entry_show_init($data['entryContent'], $data['entrySlug'])."</div>
				</article>\n";
		echo "<p class='paginator'>".(isset($seo[1]) && isnum($seo[1]) ? "<a href='/p/".($seo[1]+1)."'>{locale:next_page}</a><a href='/p/".($seo[1]-1)."'>{locale:prev_page}</a>" : "<a href='/p/2'>{locale:next_page}</a>")."</p>";
	} else
		echo "<h1>{locale:entry_not_found_title}</h1>"
			."<p>{locale:entry_not_found}</p>\n";
}