<?
	function guest_sitemap($module)
	{
		$result=array();
		
		$link=Db::instance()->selectCell("SELECT path FROM ?_tree t JOIN ?_includes i ON t.tree_id=i.tree_id WHERE module_id=? LIMIT 1", $module['module_id']);
		
		$result[$link]=array('changefreq'=>'hourly','lastmod'=>time());
		
		$posts=Db::instance()->selectCol("SELECT UNIX_TIMESTAMP(`date`) as `date` FROM ?_guest ORDER BY `date`");
		
		include LAB_PATH_DATA.'/configs/-1_'.$module['module_id'].'.conf';
		
		if ($posts)
		for($i=1;$i<(count($posts)-1);$i+=$config['guestbook_posts_at_page'])
		{
			$date=$posts[$i]; 
			$changefreq='always';
			if($date<time()-3600) $changefreq='hourly';
			if($date<time()-3600*24) $changefreq='daily';
			if($date<time()-3600*24*7) $changefreq='weekly';
			if($date<time()-3600*24*30) $changefreq='monthly';
			if($date<time()-3600*24*365) $changefreq='yearly';
			
			$lastmod=date("Y-m-d", $date);
			
			$loc=LabCMS::instance()->url(ceil($i/$config['guestbook_posts_at_page']), false, false, $link);
			
			$result[$loc]=array('changefreq'=>$changefreq,'lastmod'=>$lastmod);
		}
		return $result;
	}