<?php
if (!defined('DATALIFEENGINE')){
	die ("Hacking attempt!");
}
function dle_cache_timeout($prefix, $cache_id=false, $member_prefix=false){
  global $config, $is_logged, $member_id;
	if ($config['allow_cache'] != "yes") return false;
	if ($is_logged) $end_file = $member_id['user_group']; else $end_file = "0";
	if (!$cache_id) {
		$filename = ENGINE_DIR.'/cache/'.$prefix.'.tmp';
	} else {
		$cache_id = totranslit ($cache_id);
		if ($member_prefix)
			$filename = ENGINE_DIR."/cache/".$prefix."_".$cache_id."_".$end_file.".tmp";
		else
			$filename = ENGINE_DIR."/cache/".$prefix."_".$cache_id.".tmp";
	}
	if (file_exists($filename)){
		$cr_time = filemtime($filename);
		// 86400 - если кэш больше дня, удалить...
		if ((time() - $cr_time) > 86400) {
			@unlink($filename);
			return false;
		}
	}
	return @file_get_contents($filename);
}
$tpl->load_template('num_cat.tpl');
$map1 = dle_cache_timeout("kol_news", $config['skin']);
if(!$map) {
	foreach($cat_info as $val){ 
		if (($val==131) OR ($val==141) OR ($val==161)) {
			$map1 .= "<a href='".$config['http_home_url']."category/".$val['alt_name']."/' class='link'; align='left'; '>{$val['name']}</a>\n"; 
			$cat = intval($val['id']); 
			$row = $db->super_query("SELECT COUNT(*) as count FROM ". PREFIX ."_post WHERE category = '$cat' ORDER BY title ASC"); 
			$map1 .= '('.$row['count'].')<br />';
		}
	}
	create_cache_sm('kol_news', $map1, $config['skin']);
}
$tpl->result['num_cat'] = $map1;
$tpl->clear();
?>