<?
function this_channel($channel_id)
{
	if(!(int)$channel_id){
		return false;
	}
	global $glo_channel_res,$tpl_obj,$glo_this_is_here,$glo_this_channel,$glo_channel_home_focus;

	$glo_this_channel		=	$glo_channel_res[$channel_id];
	
	$glo_this_is_here[]	=	array(
			'name'	=>	$glo_channel_res[$channel_id]['channel_name'],
			'url'		=>	$glo_channel_res[$channel_id]['go_to_link'],
	);

	$glo_channel_res[$channel_id]['checked']				=	true;
	$glo_channel_home_focus		=	false;
}

function format_channel_list($channel_res)
{
	$channel_tmp_res		=		array();
	foreach($channel_res as $key=>$val){
		$channel_res[$key]['go_to_link']		=		$val['go_to_link']?get_url($val['go_to_link']):get_url('/channel.php?channel_id='.$val['channel_id'],$val['channel_name']);
		$channel_res[$key]['channel_name']	=		htmlspecialchars($val['channel_name'],ENT_QUOTES);
		$channel_res[$key]['menu']				=		unserialize($val['menu']);
		if($channel_res[$key]['menu']){
			foreach($channel_res[$key]['menu'] as $k=>$v){
				$channel_res[$key]['menu'][$k]['url']		=	get_url($v['url']);
				$channel_res[$key]['menu'][$k]['name']		=	htmlspecialchars($v['name'],ENT_QUOTES);
			}
		}
		$channel_tmp_res[$val['channel_id']]		=		$channel_res[$key];
	}	
	return $channel_tmp_res;
}


