<?php

/**
 * @package eggblog
 * @author eggblog.net, tenfourzero@users.sourceforge.net
 * @version $Id: global.php,v 4.0.0RC1 2007/12/03 10:26:12 tenfourzero Exp $
 * @copyright Copyright (c) 2005, http://www.eggblog.net
 * @license http://www.gnu.org/licenses/gpl.html GNU Lesser General Public License
 */

/**
 * require lib files
 */
require_once "_lib/global.php";

if(empty($_GET['i'])) $_GET['i']=1;
else settype($_GET['i'],"integer");
if(!empty($_GET['topic'])) settype($_GET['topic'],"integer");
if(!empty($_POST['text'])) $_POST['text']=htmlentities(strip_tags($_POST['text']),ENT_QUOTES);
if(!empty($_POST['title'])) $_POST['title']=htmlentities(strip_tags($_POST['title']),ENT_QUOTES);
if($config['forums']!=1) header("Location: index.php");
eb_pre();
if(!empty($_GET['topic'])) {
	if(!empty($_POST['text'])) eb_topic_post($_GET['topic'],$_POST['text']);
	else {
		eb_head(eb_topic_title($_GET['topic']));
		echo eb_topic($_GET['topic']);
	}
}
elseif(isset($_GET['newtopic'])) {
	if(!empty($_POST['text'])) eb_topic_new_post($_POST['title'],$_POST['text']);
	else {
		eb_head('');
		echo eb_topic_new();
	}
}
else {
	eb_head('');
	echo eb_forum(10,$_GET['i']);
}
eb_foot();
?>