<?php
@session_start();
@error_reporting(7);
@ini_set('display_errors', true);
@ini_set('html_errors', false);

define('DATALIFEENGINE', true);
define( 'ROOT_DIR', substr( dirname(  __FILE__ ), 0, -12 ) );
define( 'SYSTEM_DIR', ROOT_DIR . '/system' );

require_once SYSTEM_DIR . '/data/config.php';
require_once SYSTEM_DIR . '/classes/mysql.php';
require_once SYSTEM_DIR . '/data/dbconfig.php';
require_once SYSTEM_DIR . '/modules/functions.php';

@header("Content-type: text/html; charset=windows-1251");

$cat_info = $cache->get("category");
if (!$cat_info){
	$cat_info = array ();
	$db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC");
	while ($row = $db->get_row())
		{
		$cat_info[$row['id']] = array ();
		foreach ($row as $key => $value)
			{
			$cat_info[$row['id']][$key] = stripslashes($value);
			}
		}
    $cache->set("category", $cat_info);
	$db->free();
	}

$adon = $_REQUEST['adon'];
$geta = get_sub_cats($adon);

if ($cat_info[$geta]['parentid'] == '0')
	{
	$retng = '<select name="catlist[]"><option value="' . $adon . '">Подкатегорий нет</option></select>';
	}
else
	{
	$retng = CategoryNewsSelectiod($adon);
	}
echo $retng;
?>