<?php
	error_reporting(E_USER_ERROR);
	/**
	 * Gets blogID to show:
	 * 1. check if are there more then 0 blogs
	 * 2. if ok, check the GET var
	 * 3. if not ok, set the first blogID
	 * 4. if ok, check if blogID exists
	 * 5. if ok, load it
	 * 6. if not ok, get the first blogID
	 */
	require_once("./cms/Blog.class.php");
	require_once("./cms/Auth.class.php");
	$blogMgt = new Blog();
	$auth = new Auth();
	if ($blogMgt->getBlogsCount()>0){
		if (strcasecmp(trim(isset($_GET['blog'])),"")==0){
			$_blogID = $blogMgt->getFirstVisible();
		}else{
			$_blogID = $_GET['blog'];
		}				
	} else {
		if ($auth->isAuth())
			$_blogID = 'admin';
		else
			$_blogID = '';
	}
	
	/**
	 * Gets sectionID
	 */
	 require_once("./cms/SectionBlog.class.php");
	 $sec = new SectionBlog($_blogID);	 
	 if (isset($_GET['section']))
	 	$_sectionID = $_GET['section'];
	 else
	 	$_sectionID = $sec->getFirst();
	 	
	/**
	 * Get PhotoBlogID
	 */
	 if (isset($_GET['photoblog']))
	 	$_photoBlogID = stripslashes($_GET['photoblog']);
	 else
	 	$_photoBlogID = '';
?>