<?php

/*
*	Copyright VeryIDE,2007-2010
*	http://www.veryide.com/
*
*	$Id: veryide.setting.php,v2 19:47 2008-2-21 Lay $
*/

require '../../include/loader.php';

html_start("系统设置 - VeryIDE");
?>

<!--body start-->
    
	<script type="text/javascript">
	//if( top.Mo.store.model == "modern" ){
		Mo("#wrapper").attr({"class":"snugly"});
	//}
	</script>
    
	<?php
		
	//服务器扩展检测
	//System :: check_class('XSLTProcessor');
	
	require_once("../../class/setting.php");

	//检查权限
	$func = "sys-setting-system";
	System :: check_func( $func, false );
	
	$do = getgpc('do');
	
	if( !$do ){
		ob_end_clean();
		header("location:?do=global");
		exit;
	}
	
	$active = array('global','attach','mail');
	
	if( in_array( $do , $active ) ){
		
		$_GalSet = new Setting(VI_ROOT.'config/'.$do.'.php' , VI_ROOT.'config/'.$do.'.xml' , $do);
		
		if( $_GET["action"]=="update" && !empty($_POST) ){
			if($_GalSet->save('POST')){		
				
				//连接数据库
				System :: connect();
					
				//写入日志
				System :: insert_event($func,time(),time());
				
				//关闭数据库
				System :: connect();
				
				echo '<div id="state">成功修改系统配置：'.$do.'</div>';
				
			}else{
				
				echo "<div id='state' class='failure'>保存系统配置失败！请检查 ./config/".$do.".php 是否有读写权限</div>";
				
			}
			
		}elseif( $_GalSet -> writable() == FALSE ){
			echo "<div id='state' class='failure'>请检查 ./config/".$do.".php 是否有读写权限</div>";	
		}
		
		$form = $_GalSet->transform();
		
	}
	
    ?>
	<div id="box">
		<form method="post" action="?do=<?php echo $do;?>&action=update" mode="edit" verify="true">
        
        <table cellpadding="0" cellspacing="0" class="form">
        
		<?php
	
		echo $form;
		
        ?>
        <tr class="nobr">
            <td><strong></strong></td>
            <td>
                <input type="submit" name="" value="保存配置" class="submit" />
            </td>				
        </tr>
            
		</table>
		  
		</form>
	</div>


<!--body end-->

<?php html_close();?>