<?php
$configfile = MUDDER_PLUGINDIR.'bcastr/config.php';
if(!check_submit('pluginssubmit')) {
    require_once $configfile;
} else {
    $config = html_special_chars_ex($config);
    if(!$config) {
        cpmsg('为定义参数，请返回修改。');
    } else {
        $configdata = "\$config= '".add_cs_lashes($config)."';";
		if($fp = @fopen($configfile, 'wb')) {
            @fwrite($fp, "<?php\r\n//Modoer cache file\r\n//Created on ".date('Y-m-d H:i:s', $timestamp)."\r\n\r\n!defined('IN_MUDDER') && exit('Access Denied');\r\n\r\n".$configdata."\r\n\r\n?>");
			@fclose($fp);
			@chmod($cachefile, 0777);
            
            $jsfile = MUDDER_PLUGINDIR.'bcastr/bcastr.js';
            $fp = @fopen($jsfile, 'r');
            $filecontent = @fread($fp, @filesize($jsfile));
            @fclose($fp);
            $filecontent = preg_replace("/^(var swf_config = )\".*?\";/is", "\\1\"{$config}\";", $filecontent);
            $fp = @fopen($jsfile, 'w');
            @fwrite($fp, trim($filecontent));
            @fclose($fp);

            cpmsg('参数保存完毕。','admincp.php?action=bcastrconfig');
		} else {
			echo 'Can not write to config cache files, please check directory ./plugins/bcastr/ .';
			exit;
		}
    }
}
?>
<div id="body">
<div class="space">
    <div class="subtitle">操作提示</div>
    <table class="maintable" border="0" cellspacing="0" cellpadding="0">
    <tr><td style="letter-spacing:1px;">默认参数字符串<br />0xffffff:文字颜色|2:文字位置|0xff6600:文字背景颜色|60:文字背景透明度|0xffffff:按键文字颜色|0xff6600:按键默认颜色|0x000033:按键当前颜色|8:自动播放时间(秒)|2:图片过渡效果|1:是否显示按钮|_blank:打开窗口<br />
    </td></tr>
    </table>
</div>
<form method="post" action="admincp.php?action=<?=$action?>&">
    <input type="hidden" name="classsort" value="1" />
    <div class="space">
        <div class="subtitle">参数设置</div>
        <table class="maintable" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="50%" class="altbg1"><strong>参数设置</strong>具体参数设置内容，看上方的操作提示</td>
                <td width="50%"><input type="text" name="config" class="txtbox_log" value="<?=$config?>" /></td>
            </tr>
        </table>
        <br /><center><input type="submit" name="pluginssubmit" value=" 提交 " class="btn" /></center>
    </div>
</form>
</div>