<?php
if(!defined( 'R_P')) die("access die");
if($_POST['myFormAc'] == 'update'){
	$temp = $_POST['data'];
	qdb::query("delete from ".TABLEPRE."pic_setting where channelid = '{$channelid}' ");
	$index = 0;
	foreach($temp as $val){
		$param = array();
		$param['channelid'] = $channelid;
		$param['w'] = intval($val['w']);
		$param['h'] = intval($val['h']);
		$param['type'] = intval($val['type']);
		$param['name'] = trim($val['name']);
		if($param['w']< 1 || $param['h'] < 1 || !$param['name']) continue;
		$index++;
		$param['id'] = $index;
		qdb::query(qbase::createSql(TABLEPRE.'pic_setting', $param, 'insert'));
	}

	$file = C_P . "/config/pic_mod_set.php";
	if(is_file($file)){
		@unlink($file);
		clearstatcache();
	}
	$data = getPicModCache(0);
	$s = var_export($data, true);
	qbase::writetofile($file, "<?php\n \$pic_mod_set = {$s}; \n?>");
	qbase::showmsg("²Ù×÷³É¹¦", "default", "module.php?mod=pic&channelid={$channelid}&action=set");
}
$data = getPicModCache($channelid);
include qbase::template($path . 'pic/set');
?>
