<?
	if(!defined('CONFIG.INC')) require_once($_SERVER['DOCUMENT_ROOT'] . '/../lib/lib/config.inc');
	require_once($libdir . '/connect.inc');
	$db = DB::connect();
	$res = $db->submitQuery("select distinct publishdir from posts p where p.status='publish' and if(p.type='ent',date(p.created),p.date) <= curdate() order by publishdir desc limit 1");
	if($res && $db->hasRows()){
		$row = $db->getRow();
		$dir = $row['publishdir'];
		header("Location: $dir/");
		exit;
	}
?>