<?php
	include_once("./cms/BlogEntry.class.php");
	include_once("./cms/Blog.class.php");
	$blog = new BlogEntry($_blogID,$_sectionID);
	$cms = new Blog();
	$pages = $cms->getPostPerPage($_blogID);
	
	// checks for permalink
	if (isset($_GET['permalink'])){
		$_permalink = $_GET['permalink'];
		$blog->showEntry($_permalink);			
	}else{		
		// show monthly
		if (isset($_GET['year']))
			$year = $_GET['year'];
		if (isset($_GET['month']))
			$month = $_GET['month'];				
		if ((strcmp($year,'')!='')&&(strcmp($month,'')!=''))
			$blog->showMonthEntries($month,$year);
		else{
			//$blog->showAllEntries();
			$url = $_SERVER['PHP_SELF'].'?blog='.$_blogID.'&section='.$_sectionID;
			if (isset($_GET['from']))
				$from = $_GET['from'];
			else
				$from = 0;
			$blog->showLastEntries($pages ,$url,$from);
		}			
	}
?>