<?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
*/

if (LabConfig::$mcfg['use_comments'])
{
	if (substr($_GET['action'], 0, 8)=='comment_')
	{
		if (is_callable('CommentTools::'.$_GET['action'])) call_user_func('CommentTools::'.$_GET['action']);
		return;
	}
}

Tpl::i()->assign("access_add", access('add'));
Tpl::i()->assign("access_edit", access('edit'));
Tpl::i()->assign("access_delete", access('delete'));
switch (true)
{
	case($_GET['data_type']=='xml'):
		include dirname(__FILE__)."/rss.php";
	break; 
	case($_GET['action']=='add' && access("add")):
		$mode="add";
		include dirname(__FILE__)."/edit_news.php";
		addBreadcrumb("добавление новости", LabCMS::i()->url(false, 'add'));
	break;
	case($_GET['action']=='edit' && access("edit")):
		$mode="edit";
		include dirname(__FILE__)."/edit_news.php";
		addBreadcrumb(($item["news_title"]?$item["news_title"]:$item["news_date"]), LabCMS::i()->url($_GET['var1'], 'item'));
		addBreadcrumb("редактирование новости", LabCMS::i()->url($_GET['var1'], 'edit'));
	break;
	case($_GET['action']=='delete' && access("delete")):
		$mode="delete";
		include dirname(__FILE__)."/edit_news.php";
	break;
	case($_GET['action']=='item'):
		include dirname(__FILE__)."/show.php";
		if ($new) addBreadcrumb(($new["news_title"]?$new["news_title"]:$new["news_date"]), LabCMS::i()->url($new["news_id"], 'item'));
	break;
	default: 
		include dirname(__FILE__)."/news.php";
} 

