<?php
defined('IN_HS') or exit('Access Denied');

require_once HS_ROOT.'/include/ftp.class.php';

function fileext_select($name, $fileext = 'html' , $property = '', $fileextarr = array('html','htm','shtml','shtm','php'))
{
	$data = '';
	foreach($fileextarr as $ext)
	{
		$data .= "<option value='$ext' ".($ext == $fileext ? 'selected' : '').">$ext</option>\n";
	}
	return "<select name='$name' id='fileext' $property>\n$data</select>\n";
}

switch($action)
{
	case 'save':

		module_setting($mod, $setting);
	    
		set_config($setconfig);

		if($setting['ishtml'] == 0) 
	    {
			$data = '<html>
					<head>
					<title>hs 2007</title>
					<meta http-equiv="Refresh" content="0;URL=index.php" />
					</head>
					<body>
					</body>
					</html>';
			file_put_contents(HS_ROOT.'/'.$setting['index'].'.'.$setting['fileext'], $data);
			chmod(HS_ROOT.'/'.$setting['index'].'.'.$setting['fileext'], 0777);
		}



		showmessage($LANG['save_setting_success'], $PHP_REFERER);
		break;


	default :
		require HS_ROOT.'/config.inc.php';
		

		@extract(new_htmlspecialchars($CONFIG));
		@extract(new_htmlspecialchars($HS));

		if(!function_exists('ob_gzhandler')) $enablegzip = 0;
		$safe_mode = ini_get('safe_mode');
		if(!function_exists('imagepng') && !function_exists('imagejpeg') && !function_exists('imagegif'))
	    {
			$gd = "<font color='red'>".$LANG['no_gd_support']."</font>";
			$enablegd = 0;
		}
		else
	    {
			$gd = $LANG['support'];
			$enablegd = 1;
		}
        
    include admintpl('setting');
}
?>