destroy();
}
//$template_content = & new PMDTemplate(PMDROOT .'/template/' . $config['template'] . '/index.tpl','index.tpl'.$_SERVER['REQUEST_URI']);
$template_content = & new PMDTemplate(PMDROOT .'/template/' . $config['template'] . '/index.tpl');
$template_content->set('yes',$homepage);
$template_content->set('lang',$lang);
$template_content->set('mod_rewrite',$config['mod_rewrite']);
$template_content->set('search_display_all',$config['search_display_all']);
/****** CHECK FOR A SPECIFIC CATEGORY BEING SET ************/
if (!isset($_GET['id']) AND $_GET['id'] == '') {
$path = array();
$show_banner=$config['show_banner_index'];
$_GET['id'] = 1;
} else {
if($config['mod_rewrite'] == 'YES') {
$categories = explode('/',$_GET['id']);
$category_part = array();
foreach($categories as $key=>$value) {
if(sizeof($category_part) > 0) {
$lft_rgt_sql = "AND left_>".$category_part['left_']." AND right_<".$category_part['right_'];
}
$category_part = $db->GetRow("SELECT id, left_, right_ FROM ".T_CATEGORY." WHERE friendly_url=? $lft_rgt_sql AND level=?",array($value,$key+1));
}
//$path = $category_tree->getPathByFriendlyURL($categories[(count($categories)-1)]);
$_GET['id'] = $category_part['id'];
}
$path = $category_tree->getPath($_GET['id']);
$path_count = count($path);
if($path_count < 1) {
header('HTTP/1.1 410 Gone');
header('Location: '.BASE_URL);
exit();
}
$category_tree->addHit($_GET['id'],$_SERVER['REMOTE_ADDR']);
if(!($template_content->is_cached())) {
$show_banner = $config['show_banner_cats'];
//$path = $category_tree->getPath($_GET['id']);
//$category_url_string = getPlainTextString($path,'/',true);
$page_title = getCategoryPathDisplay($path,$lang['category'],'|',true,'status_line');
$incomingline = ''.$lang['home'].' | '.$page_title;
$cat_info = $path[($path_count-1)];
if($cat_info['description'] != '' AND $config['show_category_description'] == 'YES') {
$cat_info['description'] = unHTML($cat_info['description'].'
');
} else {
$cat_info['description'] = '';
}
if($config['show_category_title'] != 'YES') {
$cat_info['title'] == '';
}
$template_content->set('cat_info',$cat_info);
}
}
if(!($template_content->is_cached())) {
if($config['show_indexes'] == 'NO' AND $config['cat_empty_hidden'] == 'NO') {
$get_category_count = false;
} else {
$get_category_count = true;
}
if ($config['show_subs_number'] > 0) {
$categories=$category_tree->getCategoryPlusImmediateChildren($_GET['id'], 2, $get_category_count);
} else {
$categories=$category_tree->getCategoryPlusImmediateChildren($_GET['id'], 1, $get_category_count);
}
$first_level_count = 0;
$first_level_count_reference = $categories[0]['level'];
for ($i=0;$i 0 OR $config['cat_empty_hidden'] != 'YES')) {
$first_level_count++;
}
// If we never get the listing counts for categories, make it 1 for all categories so they all display normally. Then if clicked we give a no listings message. (speed improvement)
if(!$get_category_count) {
$categories[$i]['count'] = 1;
}
}
$j = 0;
$category_table = '