<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
	function admin_pages_sitemap($module)
	{
		$result=array();
		
		$pages=Db::instance()->selectCol("SELECT path AS ARRAY_KEY, UNIX_TIMESTAMP(date_updated) as date_updated FROM ?_tree t JOIN ?_pages p ON t.tree_id=p.tree_id WHERE t.sitemap=1 AND `show`=1");

		if ($pages)
		foreach($pages as $link=>$date)
		{
			$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(false, false, false, $link);
			
			$result[$link]=array('changefreq'=>$changefreq,'lastmod'=>$lastmod);
		}
		return $result;
	}