<?
function get_action()
{
	if(isset($_GET['act'])){
		$act	=	trim($_GET['act']);
	}else{
		$act	=	'index.frame';
	}	
		

	if(go_to_login($act)){
		$act	=	'login.form';
	}
	$act = explode('.',strtolower($act));
	if(count($act)!=2){
		return false;
	}	
	
	
	$file	=$act[0].'.class';
	if(!is_file(CLASS_DIR . "{$file}.php")){
		return false;
	}
	return array(
		'app'		=>$act[0],
		'fun'		=>	$act[1],		
		'file'	=>	$file,
	);	
}

function get_module_action($is_module)
{
	if(isset($_GET['act'])){
		$act	=	trim($_GET['act']);
	}else{
		$act	=	'index.frame';
	}	
	if(go_to_login($act)){
		$act	=	'login.form';
	}
	
	$act = explode('.',strtolower($act));
	if(count($act)!=2){
		return false;
	}	

	
	$file	=$act[0].'.class';
	if(!is_file(MODULES_DIR .$is_module.'/'. "{$file}.php")){
		return false;
	}
	return array(
		'app'		=>$act[0],
		'fun'		=>	$act[1],		
		'file'	=>	$file,
	);		
}
function go_to_login($act)
{
	if($_SESSION['user']||$act=='login.save_login'||$act=='login.forget_pass'||$act=='login.new_set_pass'||$act=='login.save_new_set_pass'){
		return false;
	}else{
		return true;
	}

}



function create_html_editor($input_name, $input_value = '',$smarty,$height=320,$width='100%')
{
	 require_once(ROOT_PATH.'lib/fckeditor/fckeditor.php');
 	 global $glo_domain_directory;
    $editor = new FCKeditor($input_name);
    $editor->BasePath   = $glo_domain_directory.'lib/fckeditor/';
    $editor->ToolbarSet = 'Normal';
    $editor->Width      = $width;
    $editor->Height     = $height;
    $editor->Value      = $input_value;
    $FCKeditor = $editor->CreateHtml();
	 $smarty->assign('FCKeditor', $FCKeditor);
}

function chart_color($n)
{
	$arr = array('33FF66', 'FF6600', '3399FF', '009966', 'CC3399', 'FFCC33', '6699CC', 'CC3366', '33FF66', 'FF6600', '3399FF');
		if($n > 8){
			$n = $n % 8;
		}
	return $arr[$n];
}


