<?php

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

require("../../include/header.php");

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

<!--body start-->
	<?php
	
	require_once(VI_ROOT."/class/setting.php");	
	
	//模块ID
	$appid = GetQuery("appid");
	
	//配置地址
	$self = VI_ROOT.$VICACHE["sys.module"][$appid]["config"];
	
	if( $appid && file_exists( $self ) && require( $self ) ){
	
		//模块配置
		$app = $Modules[$appid];
	
		//检查权限
		checker_func( "sys-setting-".$app["model"] );
		
		$_GalSet = new Setting(VI_ROOT.'module/'.$appid.'/setting.php' , VI_ROOT.'module/'.$appid.'/setting.xml' , $appid);
		
		if( $_GET["action"]=="update" && !empty($_POST) ){
			if($_GalSet->save('POST')){		
					
				//写入日志
				event_insert($mysql,$func,time(),time());
				
				echo '<div id="state">成功修改模块配置，新配置将立即生效</div>';
				
			}else{
				
				echo "<div id='state' class='failure'>保存模块配置失败！请检查 veryide/module/".$appid."/ 目录有允许写权限</div>";
				
			}
			
		}
		
		$form = $_GalSet->transform();
		
	}
	
    ?>
    
	<div id="box">
		<form method="post" action="?appid=<?php echo $appid;?>&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();?>