<?php 
/*
 *
 * sflog!
 * Copyright (C) 2005 Alberto Sfolcini <a.sfolcini@gmail.com>
 *
 * This file is a part of sflog!.
 *
 * sflog! is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * sflog! is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */
 
  require_once(dirname(__FILE__)."/../../cms/Validator.class.php");
  require_once(dirname(__FILE__)."/../../cms/Blog.class.php");
  require_once(dirname(__FILE__)."/../../cms/Auth.class.php");
  
  // Check for authorizations
  $auth = new Auth();
  if (!$auth->isAuth()){
  	header("Location: login.php");
  	die();
  }
  // ------ end auth's check
  
  $cms = new Blog();

  if (isset($_POST['blogID'])){
  	if (!($_POST['blogID']=='')){
  	  $blogID = $_POST['blogID'];	
	}
  }else{
  	if (isset($_GET['blogID']))
  		$blogID = $_GET['blogID'];
  	else
  		$blogID = "";
  }
  if (isset($_POST['sectionID'])){
  	if (!($_POST['sectionID']=='')){
  	  $sectionID = $_POST['sectionID'];	
	}
  }else{
  	if (isset($_GET['sectionID']))
  		$sectionID = $_GET['sectionID'];
  	else
  		$sectionID = "";
  }
  if (isset($_POST['contentType'])){
		if (!$_POST['contentType']=='')
			$contentType = $_POST['contentType'];
  }else{
  	if (isset($_GET['contentType']))
  		$contentType = $_GET['contentType'];
  	else
  		$contentType = "";
  }
?>	

<b>blog	   ID</b>&nbsp;&nbsp;<?=$blogID?><BR>
<b>section ID</b>&nbsp;&nbsp;<?=$sectionID?><BR>

<FORM name="section" action="<?=$_SERVER['PHP_SELF']?>" method="POST">
	<input type="hidden" name="blogID" value="<?=$blogID?>">
	<input type="hidden" name="sectionID" value="<?=$sectionID?>">
	<table cellspacing="0" cellpaddgin="0" border="0">
		<tr>
			<td><b>Select what type of section's content you wanna insert:</b>&nbsp;</td>
			<td>
				<SELECT name="contentType" onChange="section.submit();">
					<OPTION></OPTION>
					<OPTION value="1" <?if ($contentType==1) print('selected')?>>blog section</OPTION>
					<OPTION value="2" <?if ($contentType==2) print('selected')?>>link</OPTION>
					<OPTION value="3" <?if ($contentType==3) print('selected')?>>banner</OPTION>
					<OPTION value="4" <?if ($contentType==4) print('selected')?>>calendar archive</OPTION>
					<OPTION value="5" <?if ($contentType==5) print('selected')?>>google</OPTION>					
				</SELECT>
			</td>
		</tr>
	</table>
</FORM>

<HR size="-1">

<?php
	if (isset($contentType)){
		switch($contentType){
			case 1: {
				require_once(dirname(__FILE__)."/contentBlog.inc.php");
				break;
			}
			case 2: {
				require_once(dirname(__FILE__)."/contentLink.inc.php");
				break;
			}
		}
	}
	
	
?>

<a href="manage.php?blogID=<?=$blogID?>">back</a>